@uploadcare/file-uploader 1.4.1-alpha.0 → 1.4.1-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.
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +14 -5
- package/package.json +1 -1
- package/web/file-uploader.iife.min.js +1 -1
- package/web/file-uploader.min.js +1 -1
- package/web/uc-file-uploader-inline.min.js +1 -1
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.min.js +1 -1
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
"use strict";var UC=(()=>{var fe=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Kn=Object.getOwnPropertyNames;var Zn=Object.getPrototypeOf,Yn=Object.prototype.hasOwnProperty;var Jn=Reflect.get;var Qn=(s,e,t)=>e in s?fe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e)=>fe(s,"name",{value:e,configurable:!0});var tl=(s,e)=>{for(var t in e)fe(s,t,{get:e[t],enumerable:!0})},el=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Kn(e))!Yn.call(s,r)&&r!==t&&fe(s,r,{get:()=>e[r],enumerable:!(i=qn(e,r))||i.enumerable});return s};var il=s=>el(fe({},"__esModule",{value:!0}),s);var h=(s,e,t)=>(Qn(s,typeof e!="symbol"?e+"":e,t),t);var j=(s,e,t)=>Jn(Zn(s),t,e);var Wc={};tl(Wc,{ActivityBlock:()=>_,ActivityHeader:()=>Ji,BaseComponent:()=>$t,Block:()=>y,BtnUi:()=>ae,CameraSource:()=>ze,CloudImageEditor:()=>es,CloudImageEditorActivity:()=>Zi,CloudImageEditorBlock:()=>ct,Config:()=>dn,Copyright:()=>Qi,CropFrame:()=>je,Data:()=>T,DropArea:()=>ee,EditorCropButtonControl:()=>oe,EditorFilterControl:()=>Ft,EditorImageCropper:()=>qe,EditorImageFader:()=>qi,EditorOperationControl:()=>ne,EditorScroller:()=>Ke,EditorSlider:()=>Ge,EditorToolbar:()=>Ze,ExternalSource:()=>ti,FileItem:()=>re,FileUploaderInline:()=>si,FileUploaderMinimal:()=>ii,FileUploaderRegular:()=>ue,FormInput:()=>Yi,Icon:()=>Kt,Img:()=>Bi,LineLoaderUi:()=>Ye,Modal:()=>Fe,PACKAGE_NAME:()=>Lt,PACKAGE_VERSION:()=>Ut,PresenceToggle:()=>Je,ProgressBar:()=>Ve,ProgressBarCommon:()=>Be,Select:()=>ei,SimpleBtn:()=>Jt,SliderUi:()=>Qe,SolutionBlock:()=>rt,SourceBtn:()=>ie,SourceList:()=>Vi,StartFrom:()=>Pe,UID:()=>kt,UploadCtxProvider:()=>Ln,UploadList:()=>De,UploaderBlock:()=>S,UrlSource:()=>Ne,defineComponents:()=>is,defineLocale:()=>Ls,loadFileUploaderFrom:()=>Wn,toKebabCase:()=>Xt});var sl=Object.defineProperty,rl=l((s,e,t)=>e in s?sl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp"),os=l((s,e,t)=>(rl(s,typeof e!="symbol"?e+"":e,t),t),"__publicField");function ol(s){let e=l(t=>{var i;for(let r in t)((i=t[r])==null?void 0:i.constructor)===Object&&(t[r]=e(t[r]));return{...t}},"clone");return e(s)}l(ol,"cloneObj");var ge,T=(ge=class{constructor(e){e.constructor===Object?this.store=ol(e):(this._storeIsProxy=!0,this.store=e),this.callbackMap=Object.create(null)}static warn(e,t){console.warn(`Symbiote Data: cannot ${e}. Prop name: `+t)}read(e){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(T.warn("read",e),null):this.store[e]}has(e){return this._storeIsProxy?this.store[e]!==void 0:this.store.hasOwnProperty(e)}add(e,t,i=!1){!i&&Object.keys(this.store).includes(e)||(this.store[e]=t,this.notify(e))}pub(e,t){if(!this._storeIsProxy&&!this.store.hasOwnProperty(e)){T.warn("publish",e);return}this.store[e]=t,this.notify(e)}multiPub(e){for(let t in e)this.pub(t,e[t])}notify(e){this.callbackMap[e]&&this.callbackMap[e].forEach(t=>{t(this.store[e])})}sub(e,t,i=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(T.warn("subscribe",e),null):(this.callbackMap[e]||(this.callbackMap[e]=new Set),this.callbackMap[e].add(t),i&&t(this.store[e]),{remove:()=>{this.callbackMap[e].delete(t),this.callbackMap[e].size||delete this.callbackMap[e]},callback:t})}static registerCtx(e,t=Symbol()){let i=T.globalStore.get(t);return i?console.warn('State: context UID "'+t+'" already in use'):(i=new T(e),T.globalStore.set(t,i)),i}static deleteCtx(e){T.globalStore.delete(e)}static getCtx(e,t=!0){return T.globalStore.get(e)||(t&&console.warn('State: wrong context UID - "'+e+'"'),null)}},l(ge,"Data"),ge);T.globalStore=new Map;var E=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),Xr="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",nl=Xr.length-1,be,kt=(be=class{static generate(e="XXXXXXXXX-XXX"){let t="";for(let i=0;i<e.length;i++)t+=e[i]==="-"?e[i]:Xr.charAt(Math.random()*nl);return t}},l(be,"UID"),be);function qr(s,e,t){let i=!0,r,o=e.split(".");return o.forEach((n,a)=>{a<o.length-1?s=s[n]:r=n}),s?s[r]=t:i=!1,i}l(qr,"setNestedProp");function ll(s){return s.split("-").map((e,t)=>e&&t?e[0].toUpperCase()+e.slice(1):e).join("").split("_").map((e,t)=>e&&t?e.toUpperCase():e).join("")}l(ll,"kebabToCamel");function al(s,e){[...s.querySelectorAll(`[${E.REPEAT_ATTR}]`)].forEach(t=>{var n;let i=t.getAttribute(E.REPEAT_ITEM_TAG_ATTR),r;if(i&&(r=window.customElements.get(i)),!r){r=(n=class extends e.BaseComponent{constructor(){super(),i||(this.style.display="contents")}},l(n,"itemClass"),n);let a=t.innerHTML;r.template=a,r.reg(i)}for(;t.firstChild;)t.firstChild.remove();let o=t.getAttribute(E.REPEAT_ATTR);e.sub(o,a=>{if(!a){for(;t.firstChild;)t.firstChild.remove();return}let c=[...t.children],u,p=l(d=>{d.forEach((m,g)=>{if(c[g])if(c[g].set$)setTimeout(()=>{c[g].set$(m)});else for(let b in m)c[g][b]=m[b];else{u||(u=new DocumentFragment);let b=new r;Object.assign(b.init$,m),u.appendChild(b)}}),u&&t.appendChild(u);let f=c.slice(d.length,c.length);for(let m of f)m.remove()},"fillItems");if(a.constructor===Array)p(a);else if(a.constructor===Object){let d=[];for(let f in a){let m=a[f];Object.defineProperty(m,"_KEY_",{value:f,enumerable:!0}),d.push(m)}p(d)}else console.warn("Symbiote repeat data type error:"),console.log(a)}),t.removeAttribute(E.REPEAT_ATTR),t.removeAttribute(E.REPEAT_ITEM_TAG_ATTR)})}l(al,"repeatProcessor");var Gr="__default__";function cl(s,e){if(e.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let i={};t.forEach(r=>{let o=r.getAttribute("name")||Gr;i[o]={slot:r,fr:document.createDocumentFragment()}}),e.initChildren.forEach(r=>{var o;let n=Gr;r instanceof Element&&r.hasAttribute("slot")&&(n=r.getAttribute("slot"),r.removeAttribute("slot")),(o=i[n])==null||o.fr.appendChild(r)}),Object.values(i).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(o,r.slot)}else r.slot.remove()})}l(cl,"slotProcessor");function ul(s,e){[...s.querySelectorAll(`[${E.EL_REF_ATTR}]`)].forEach(t=>{let i=t.getAttribute(E.EL_REF_ATTR);e.ref[i]=t,t.removeAttribute(E.EL_REF_ATTR)})}l(ul,"refProcessor");function hl(s,e){[...s.querySelectorAll(`[${E.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(E.BIND_ATTR).split(";");[...t.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let n=ll(o.name.replace("-",""));r.push(n+":"+o.value),t.removeAttribute(o.name)}}),r.forEach(o=>{if(!o)return;let n=o.split(":").map(p=>p.trim()),a=n[0],c;a.indexOf(E.ATTR_BIND_PRFX)===0&&(c=!0,a=a.replace(E.ATTR_BIND_PRFX,""));let u=n[1].split(",").map(p=>p.trim());for(let p of u){let d;p.startsWith("!!")?(d="double",p=p.replace("!!","")):p.startsWith("!")&&(d="single",p=p.replace("!","")),e.sub(p,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):qr(t,a,f)||(t[E.SET_LATER_KEY]||(t[E.SET_LATER_KEY]=Object.create(null)),t[E.SET_LATER_KEY][a]=f)})}}),t.removeAttribute(E.BIND_ATTR)})}l(hl,"domSetProcessor");var ri="{{",me="}}",dl="skip-text";function pl(s){let e,t=[],i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var o;return!((o=r.parentElement)!=null&&o.hasAttribute(dl))&&r.textContent.includes(ri)&&r.textContent.includes(me)&&1}});for(;e=i.nextNode();)t.push(e);return t}l(pl,"getTextNodesWithTokens");var fl=l(function(s,e){pl(s).forEach(i=>{let r=[],o;for(;i.textContent.includes(me);)i.textContent.startsWith(ri)?(o=i.textContent.indexOf(me)+me.length,i.splitText(o),r.push(i)):(o=i.textContent.indexOf(ri),i.splitText(o)),i=i.nextSibling;r.forEach(n=>{let a=n.textContent.replace(ri,"").replace(me,"");n.textContent="",e.sub(a,c=>{n.textContent=c})})})},"txtNodesProcessor"),ml=[al,cl,ul,hl,fl],oi="'",Nt='"',gl=/\\([0-9a-fA-F]{1,6} ?)/g;function bl(s){return(s[0]===Nt||s[0]===oi)&&(s[s.length-1]===Nt||s[s.length-1]===oi)}l(bl,"hasLeadingTrailingQuotes");function _l(s){return(s[0]===Nt||s[0]===oi)&&(s=s.slice(1)),(s[s.length-1]===Nt||s[s.length-1]===oi)&&(s=s.slice(0,-1)),s}l(_l,"trimQuotes");function yl(s){let e="",t="";for(var i=0;i<s.length;i++){let r=s[i+1];s[i]==="\\"&&r==='"'?(e+='\\"',i++):s[i]==='"'&&t!=="\\"?e+='\\"':e+=s[i],t=s[i]}return e}l(yl,"escapeQuotes");function vl(s){let e=s;bl(s)&&(e=_l(e),e=e.replace(gl,(t,i)=>String.fromCodePoint(parseInt(i.trim(),16))),e=e.replaceAll(`\\
|
|
27
27
|
`,"\\n"),e=yl(e),e=Nt+e+Nt);try{return JSON.parse(e)}catch{throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${s}`)}}l(vl,"parseCssPropertyValue");var Wr=0,Dt=null,dt=null,_e,yt=(_e=class extends HTMLElement{constructor(){super(),os(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=this.__boundCssProps)==null||e.forEach(t=>{let i=this.getCssData(this.__extractCssName(t),!0);i!==null&&this.$[t]!==i&&(this.$[t]=i)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return yt}initCallback(){}__initCallback(){var e;this.__initialized||(this.__initialized=!0,(e=this.initCallback)==null||e.call(this))}render(e,t=this.renderShadow){let i;if((t||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(E.USE_TPL);if(o){let n=this.getRootNode(),a=(n==null?void 0:n.querySelector(o))||document.querySelector(o);a?e=a.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(e||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(e==null?void 0:e.constructor)===DocumentFragment)i=e;else if((e==null?void 0:e.constructor)===String){let o=document.createElement("template");o.innerHTML=e,i=o.content.cloneNode(!0)}else this.constructor.__tpl&&(i=this.constructor.__tpl.content.cloneNode(!0));for(let o of this.tplProcessors)o(i,this)}let r=l(()=>{i&&(t&&this.shadowRoot.appendChild(i)||this.appendChild(i)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){t=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=r,this.shadowRoot.prepend(o)}else r()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=kt.generate(),this.style.setProperty(E.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(E.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=t,t}get localCtx(){return this.__localCtx||(this.__localCtx=T.registerCtx({},this)),this.__localCtx}get nodeCtx(){return T.getCtx(this.ctxName,!1)||T.registerCtx({},this.ctxName)}static __parseProp(e,t){let i,r;if(e.startsWith(E.EXT_DATA_CTX_PRFX))i=t.nodeCtx,r=e.replace(E.EXT_DATA_CTX_PRFX,"");else if(e.includes(E.NAMED_DATA_CTX_SPLTR)){let o=e.split(E.NAMED_DATA_CTX_SPLTR);i=T.getCtx(o[0]),r=o[1]}else i=t.localCtx,r=e;return{ctx:i,name:r}}sub(e,t,i=!0){let r=l(n=>{this.isConnected&&t(n)},"subCb"),o=yt.__parseProp(e,this);o.ctx.has(o.name)?this.allSubs.add(o.ctx.sub(o.name,r,i)):window.setTimeout(()=>{this.allSubs.add(o.ctx.sub(o.name,r,i))})}notify(e){let t=yt.__parseProp(e,this);t.ctx.notify(t.name)}has(e){let t=yt.__parseProp(e,this);return t.ctx.has(t.name)}add(e,t,i=!1){let r=yt.__parseProp(e,this);r.ctx.add(r.name,t,i)}add$(e,t=!1){for(let i in e)this.add(i,e[i],t)}get $(){if(!this.__stateProxy){let e=Object.create(null);this.__stateProxy=new Proxy(e,{set:(t,i,r)=>{let o=yt.__parseProp(i,this);return o.ctx.pub(o.name,r),!0},get:(t,i)=>{let r=yt.__parseProp(i,this);return r.ctx.read(r.name)}})}return this.__stateProxy}set$(e,t=!1){for(let i in e){let r=e[i];t||![String,Number,Boolean].includes(r==null?void 0:r.constructor)?this.$[i]=r:this.$[i]!==r&&(this.$[i]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(E.CTX_OWNER_ATTR)&&this.getAttribute(E.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let e=this.constructor.__attrDesc;if(e)for(let t of Object.values(e))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(E.EXT_DATA_CTX_PRFX))this.nodeCtx.add(t.replace(E.EXT_DATA_CTX_PRFX,""),this.init$[t],this.__ctxOwner);else if(t.includes(E.NAMED_DATA_CTX_SPLTR)){let i=t.split(E.NAMED_DATA_CTX_SPLTR),r=i[0].trim(),o=i[1].trim();if(r&&o){let n=T.getCtx(r,!1);n||(n=T.registerCtx({},r)),n.add(o,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);this.__dataCtxInitialized=!0}connectedCallback(){var e;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let t=(e=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:e.trim();if(t&&this.style.setProperty(E.CSS_CTX_PROP,`'${t}'`),this.__initDataCtx(),this[E.SET_LATER_KEY]){for(let i in this[E.SET_LATER_KEY])qr(this,i,this[E.SET_LATER_KEY][i]);delete this[E.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let i of ml)this.addTemplateProcessor(i);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let i=this.getRootNode();if(!i)return;if(i==null?void 0:i.querySelector(`link[${E.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let o=this.constructor.__rootStylesLink.cloneNode(!0);o.setAttribute(E.ROOT_STYLE_ATTR_NAME,this.constructor.is),o.onload=()=>{this.render()},i.nodeType===Node.DOCUMENT_NODE?i.head.appendChild(o):i.prepend(o)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);for(let e of this.tplProcessors)this.tplProcessors.delete(e);dt==null||dt.delete(this.updateCssData),dt!=null&&dt.size||(Dt==null||Dt.disconnect(),Dt=null,dt=null)},100)))}static reg(e,t=!1){e||(Wr++,e=`${E.AUTO_TAG_PRFX}-${Wr}`),this.__tag=e;let i=window.customElements.get(e);if(i){!t&&i!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
|
|
28
28
|
`));return}window.customElements.define(e,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=Object.keys(e),this.__attrDesc=e}attributeChangedCallback(e,t,i){var r;if(t===i)return;let o=(r=this.constructor.__attrDesc)==null?void 0:r[e];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[e]=i}getCssData(e,t=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(e)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(e).trim();try{this.__cssDataCache[e]=vl(i)}catch{!t&&console.warn(`CSS Data error: ${e}`),this.__cssDataCache[e]=null}}return this.__cssDataCache[e]}__extractCssName(e){return e.split("--").map((t,i)=>i===0?"":t).join("--")}__initStyleAttrObserver(){dt||(dt=new Set),dt.add(this.updateCssData),Dt||(Dt=new MutationObserver(e=>{e[0].type==="attributes"&&dt.forEach(t=>{t()})}),Dt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(e,t=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(e);let i=this.getCssData(this.__extractCssName(e),!0);i===null&&(i=t),this.add(e,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(e,t,i){let r="__"+e;this[r]=this[e],Object.defineProperty(this,e,{set:o=>{this[r]=o,i?window.setTimeout(()=>{t==null||t(o)}):t==null||t(o)},get:()=>this[r]}),this[e]=this[r]}static set shadowStyles(e){let t=new Blob([e],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(t)}static set rootStyles(e){if(!this.__rootStylesLink){let t=new Blob([e],{type:"text/css"}),i=URL.createObjectURL(t),r=document.createElement("link");r.href=i,r.rel="stylesheet",this.__rootStylesLink=r}}},l(_e,"_BaseComponent"),_e),$t=yt;os($t,"template");var ye,rs=(ye=class{static _print(e){console.warn(e)}static setDefaultTitle(e){this.defaultTitle=e}static setRoutingMap(e){Object.assign(this.appMap,e);for(let t in this.appMap)!this.defaultRoute&&this.appMap[t].default===!0?this.defaultRoute=t:!this.errorRoute&&this.appMap[t].error===!0&&(this.errorRoute=t)}static set routingEventName(e){this.__routingEventName=e}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let e={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))e.route=i.replace("?","");else if(i.includes("=")){let r=i.split("=");e.options[r[0]]=decodeURI(r[1])}else e.options[i]=!0}),e}static notify(){let e=this.readAddressBar(),t=this.appMap[e.route];if(t&&t.title&&(document.title=t.title),e.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!t&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t){this._print(`Route "${e.route}" not found...`);return}let i=new CustomEvent(rs.routingEventName,{detail:{route:e.route,options:Object.assign(t||{},e.options)}});window.dispatchEvent(i)}static reflect(e,t={}){let i=this.appMap[e];if(!i){this._print("Wrong route: "+e);return}let r="?"+e;for(let n in t)t[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${t[n]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,r),document.title=o}static applyRoute(e,t={}){this.reflect(e,t),this.notify()}static setSeparator(e){this._separator=e}static get separator(){return this._separator||"&"}static createRouterData(e,t){this.setRoutingMap(t);let i=T.registerCtx({route:null,options:null,title:null},e);return window.addEventListener(this.routingEventName,r=>{var o;i.multiPub({route:r.detail.route,options:r.detail.options,title:((o=r.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),rs.notify(),this.initPopstateListener(),i}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},l(ye,"AppRouter"),ye);rs.appMap=Object.create(null);function ns(s,e){for(let t in e)t.includes("-")?s.style.setProperty(t,e[t]):s.style[t]=e[t]}l(ns,"applyStyles");function wl(s,e){for(let t in e)e[t].constructor===Boolean?e[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,e[t])}l(wl,"applyAttributes");function ls(s={tag:"div"}){let e=document.createElement(s.tag);if(s.attributes&&wl(e,s.attributes),s.styles&&ns(e,s.styles),s.properties)for(let t in s.properties)e[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(e)}),s.children&&s.children.forEach(t=>{let i=ls(t);e.appendChild(i)}),e}l(ls,"create");var Kr="idb-store-ready",xl="symbiote-db",Cl="symbiote-idb-update_",ve,Al=(ve=class{_notifyWhenReady(e=null){window.dispatchEvent(new CustomEvent(Kr,{detail:{dbName:this.name,storeName:this.storeName,event:e}}))}get _updEventName(){return Cl+this.name}_getUpdateEvent(e){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:e}})}_notifySubscribers(e){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,e),window.dispatchEvent(this._getUpdateEvent(e))}constructor(e,t){this.name=e,this.storeName=t,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=i=>{this.db=i.target.result,this.objStore=this.db.createObjectStore(t,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=i=>{this.db=i.target.result,this._notifyWhenReady(i)},this.request.onerror=i=>{console.error(i)},this._subscriptionsMap={},this._updateHandler=i=>{i.key===this.name&&this._subscriptionsMap[i.newValue]&&this._subscriptionsMap[i.newValue].forEach(async o=>{o(await this.read(i.newValue))})},this._localUpdateHandler=i=>{this._updateHandler(i.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(e){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(e);return new Promise((r,o)=>{i.onsuccess=n=>{var a;(a=n.target.result)!=null&&a._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${e}"`))},i.onerror=n=>{o(n)}})}write(e,t,i=!1){let r={_key:e,_value:t},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((a,c)=>{n.onsuccess=u=>{i||this._notifySubscribers(e),a(u.target.result)},n.onerror=u=>{c(u)}})}delete(e,t=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(e);return new Promise((o,n)=>{r.onsuccess=a=>{t||this._notifySubscribers(e),o(a)},r.onerror=a=>{n(a)}})}getAll(){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,r)=>{t.onsuccess=o=>{let n=o.target.result;i(n.map(a=>a._value))},t.onerror=o=>{r(o)}})}subscribe(e,t){this._subscriptionsMap[e]||(this._subscriptionsMap[e]=new Set);let i=this._subscriptionsMap[e];return i.add(t),{remove:()=>{i.delete(t),i.size||delete this._subscriptionsMap[e]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Zr.clear(this.name)}},l(ve,"DbInstance"),ve),we,Zr=(we=class{static get readyEventName(){return Kr}static open(e=xl,t="store"){let i=e+"/"+t;return this._reg[i]||(this._reg[i]=new Al(e,t)),this._reg[i]}static clear(e){window.indexedDB.deleteDatabase(e);for(let t in this._reg)t.split("/")[0]===e&&delete this._reg[t]}},l(we,"IDB"),we);os(Zr,"_reg",Object.create(null));var Yr=l(s=>{if(typeof s!="string"||!s)return"";let e=s.trim();return e.startsWith("-/")?e=e.slice(2):e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,e.length-1)),e},"normalizeCdnOperation"),ni=l((...s)=>s.filter(e=>typeof e=="string"&&e).map(e=>Yr(e)).join("/-/"),"joinCdnOperations"),D=l((...s)=>{let e=ni(...s);return e?`-/${e}/`:""},"createCdnUrlModifiers");function li(s){let e=new URL(s),t=e.pathname+e.search+e.hash,i=t.lastIndexOf("http"),r=t.lastIndexOf("/"),o="";return i>=0?o=t.slice(i):r>=0&&(o=t.slice(r+1)),o}l(li,"extractFilename");function ai(s){let e=new URL(s),{pathname:t}=e,i=t.indexOf("/"),r=t.indexOf("/",i+1);return t.substring(i+1,r)}l(ai,"extractUuid");function as(s){let e=Qr(s),t=new URL(e),i=t.pathname.indexOf("/-/");return i===-1?"":t.pathname.substring(i).slice(1)}l(as,"extractCdnUrlModifiers");function Jr(s){return as(s).split("/-/").filter(Boolean).map(t=>Yr(t))}l(Jr,"extractOperations");function Qr(s){let e=new URL(s),t=li(s),i=to(t)?eo(t).pathname:t;return e.pathname=e.pathname.replace(i,""),e.search="",e.hash="",e.toString()}l(Qr,"trimFilename");function to(s){return s.startsWith("http")}l(to,"isFileUrl");function eo(s){let e=new URL(s);return{pathname:e.origin+e.pathname||"",search:e.search||"",hash:e.hash||""}}l(eo,"splitFileUrl");var U=l((s,e,t)=>{let i=new URL(Qr(s));if(t=t||li(s),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),to(t)){let r=eo(t);i.pathname=i.pathname+(e||"")+(r.pathname||""),i.search=r.search,i.hash=r.hash}else i.pathname=i.pathname+(e||"")+(t||"");return i.toString()},"createCdnUrl"),vt=l((s,e)=>{let t=new URL(s);return t.pathname=e+"/",t.toString()},"createOriginalUrl");var N=l((s,e=",")=>s.trim().split(e).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var q=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),so=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function El(s,e){if(typeof e=="number"){let t=e;return q[s]!==t?`${s}/${t}`:""}if(typeof e=="boolean"){let t=e;return q[s]!==t?`${s}`:""}if(s==="filter"&&e){let{name:t,amount:i}=e;return q.filter===i?"":`${s}/${t}/${i}`}if(s==="crop"&&e){let{dimensions:t,coords:i}=e;return`${s}/${t.join("x")}/${i.join(",")}`}return""}l(El,"transformationToStr");function wt(s){return ni(...so.filter(e=>typeof s[e]!="undefined"&&s[e]!==null).map(e=>{let t=s[e];return El(e,t)}).filter(e=>!!e))}l(wt,"transformationsToOperations");var ci=ni("format/auto","progressive/yes"),pt=l(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),io=l(()=>!0,"asBoolean"),Tl=l(([s,e])=>({name:s,amount:typeof e!="undefined"?Number(e):100}),"asFilter"),Sl=l(([s,e])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(e))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:N(s,"x").map(Number),coords:N(e).map(Number)}},"asCrop"),kl=Object.freeze({enhance:pt,brightness:pt,exposure:pt,gamma:pt,contrast:pt,saturation:pt,vibrance:pt,warmth:pt,filter:Tl,mirror:io,flip:io,rotate:pt,crop:Sl});function ro(s){let e={};for(let t of s){let[i,...r]=t.split("/");if(!so.includes(i))continue;let o=i,n=kl[o];try{let a=n(r);e[o]=a}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
-
`))}}return e}l(ro,"operationsToTransformations");var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),H=[O.CROP,O.TUNING,O.FILTERS],oo=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],no=["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"],lo=["rotate","mirror","flip"],st=Object.freeze({brightness:{zero:q.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:q.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:q.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:q.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:q.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:q.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:q.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:q.enhance,range:[0,100],keypointsNumber:1},filter:{zero:q.filter,range:[0,100],keypointsNumber:1}});var ao=l(s=>s?s.split(",").map(e=>e.trim()):[],"deserealizeCsv"),zt=l(s=>s?s.join(","):"","serializeCsv");var $l="https://ucarecdn.com",Il="https://upload.uploadcare.com",Ol="https://social.uploadcare.com",Q={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:zt(H),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:$l,baseUrl:Il,socialBaseUrl:Ol,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var $=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),cs=class cs{constructor(e){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=e}bindTarget(e){this._targets.add(e)}unbindTarget(e){this._targets.delete(e)}_dispatch(e,t){var i;for(let r of this._targets)r.dispatchEvent(new CustomEvent(e,{detail:t}));(i=this._debugPrint)==null||i.call(this,()=>{let r=t&&typeof t=="object"?{...t}:t;return[`event "${e}"`,r]})}emit(e,t,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let r=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(e,typeof t=="function"?t():t),this._timeoutStore.delete(e)},r);this._timeoutStore.set(e,o)}};l(cs,"EventEmitter");var ui=cs;function L(s,e){let t,i=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),e)},"debounced");return i.cancel=()=>{clearTimeout(t)},i}l(L,"debounce");var co="--uploadcare-blocks-window-height",xe=class xe{static registerClient(e){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(e)}static unregisterClient(e){this.clientsRegistry.delete(e),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(co)}};l(xe,"WindowHeightTracker"),h(xe,"clientsRegistry",new Set),h(xe,"flush",L(()=>{document.documentElement.style.setProperty(co,`${window.innerHeight}px`)},100));var Ce=xe;var uo=l(s=>{var i;let e=new Intl.Locale(s),t="ltr";return typeof e.getTextInfo=="function"&&e.getTextInfo().direction?t=e.getTextInfo().direction:"textInfo"in e&&((i=e.textInfo)!=null&&i.direction)&&(t=e.textInfo.direction),t},"getLocaleDirection");var hi=l((s,e)=>new Intl.PluralRules(s).select(e),"getPluralForm");var Ll=l(s=>s,"DEFAULT_TRANSFORMER"),us="{{",po="}}",ho="plural:";function Ae(s,e,t={}){var n;let{openToken:i=us,closeToken:r=po,transform:o=Ll}=t;for(let a in e){let c=(n=e[a])==null?void 0:n.toString();s=s.replaceAll(i+a+r,typeof c=="string"?o(c):c)}return s}l(Ae,"applyTemplateData");function fo(s){let e=[],t=s.indexOf(us);for(;t!==-1;){let i=s.indexOf(po,t),r=s.substring(t+2,i);if(r.startsWith(ho)){let o=s.substring(t+2,i).replace(ho,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));e.push({variable:r,pluralKey:n,countVariable:a})}t=s.indexOf(us,i)}return e}l(fo,"getPluralObjects");var mo=l(({element:s,attribute:e,onSuccess:t,onTimeout:i,timeout:r=300})=>{let o=s.getAttribute(e);if(o!==null){t(o);return}let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[e]});let a=setTimeout(()=>{n.disconnect(),i()},r),c=l(u=>{let p=s.getAttribute(e);u.type==="attributes"&&u.attributeName===e&&p!==null&&(clearTimeout(a),n.disconnect(),t(p))},"handleMutation")},"waitForAttribute");function go(s){return Object.prototype.toString.call(s)==="[object Object]"}l(go,"isObject");var Ul=/\W|_/g;function Ml(s){return s.split(Ul).map((e,t)=>e.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+e.slice(1)).join("")}l(Ml,"camelizeString");function bo(s,{ignoreKeys:e}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>gt(t,{ignoreKeys:e})):s}l(bo,"camelizeArrayItems");function gt(s,{ignoreKeys:e}={ignoreKeys:[]}){if(Array.isArray(s))return bo(s,{ignoreKeys:e});if(!go(s))return s;let t={};for(let i of Object.keys(s)){let r=s[i];if(e.includes(i)){t[i]=r;continue}go(r)?r=gt(r,{ignoreKeys:e}):Array.isArray(r)&&(r=bo(r,{ignoreKeys:e})),t[Ml(i)]=r}return t}l(gt,"camelizeKeys");var Pl=l(s=>new Promise(e=>setTimeout(e,s)),"delay");function bs({libraryName:s,libraryVersion:e,userAgent:t,publicKey:i="",integration:r=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:i,libraryName:s,libraryVersion:e,languageName:o,integration:r});let n=[s,e,i].filter(Boolean).join("/"),a=[o,r].filter(Boolean).join("; ");return`${n} (${a})`}l(bs,"getUserAgent$1");var Rl={factor:2,time:100};function Fl(s,e=Rl){let t=0;function i(r){let o=Math.round(e.time*e.factor**t);return r({attempt:t,retry:l(a=>Pl(a!=null?a:o).then(()=>(t+=1,i(r))),"retry")})}return l(i,"runAttempt"),i(s)}l(Fl,"retrier");var Cs=class Cs extends Error{};l(Cs,"UploadcareError");var Ee=Cs,pi=class pi extends Ee{constructor(t){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,pi.prototype),this.originalProgressEvent=t}};l(pi,"NetworkError");var Bt=pi,gi=l((s,e)=>{s&&(s.aborted?Promise.resolve().then(e):s.addEventListener("abort",()=>e(),{once:!0}))},"onCancel"),fi=class fi extends Ee{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,fi.prototype)}};l(fi,"CancelError");var xt=fi,Dl=500,yo=l(({check:s,interval:e=Dl,timeout:t,signal:i})=>new Promise((r,o)=>{let n,a;gi(i,()=>{n&&clearTimeout(n),o(new xt("Poll cancelled"))}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new xt("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(i)).then(u=>{u?(a&&clearTimeout(a),r(u)):n=setTimeout(c,e)}).catch(u=>{a&&clearTimeout(a),o(u)})}catch(u){a&&clearTimeout(a),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),k={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},bi="application/octet-stream",vo="original",Ct=l(({method:s,url:e,data:t,headers:i={},signal:r,onProgress:o})=>new Promise((n,a)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,e,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",gi(r,()=>{p=!0,c.abort(),a(new xt)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:e,data:t,headers:i||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let x=w.split(": "),v=x.shift(),C=x.join(": ");v&&typeof v!="undefined"&&(m[v]=C)});let g=c.response,b=c.status;n({request:d,data:g,headers:m,status:b})}},c.onerror=d=>{p||a(new Bt(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),t?c.send(t):c.send()}),"request");function Nl(s,...e){return s}l(Nl,"identity");var zl=l(({name:s})=>s?[s]:[],"getFileOptions"),Bl=Nl,Vl=l(()=>new FormData,"getFormData"),wo=l(s=>!1,"isBuffer"),_i=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),yi=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),vi=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),Vt=l(s=>_i(s)||yi(s)||wo()||vi(s),"isFileData"),jl=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Hl=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),Gl=l(s=>!!s&&typeof s=="object"&&"data"in s&&Vt(s.data),"isFileValue");function xo(s,e,t){if(Array.isArray(t))for(let i of t)xo(s,`${e}[]`,i);else if(Gl(t)){let{name:i,contentType:r}=t,o=Bl(t.data,i,r!=null?r:bi),n=zl({name:i,contentType:r});s.push([e,o,...n])}else if(Hl(t))for(let[i,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${e}[${i}]`,String(r)]);else jl(t)&&t&&s.push([e,t.toString()])}l(xo,"collectParams");function Wl(s){let e=[];for(let[t,i]of Object.entries(s))xo(e,t,i);return e}l(Wl,"getFormDataParams");function wi(s){let e=Vl(),t=Wl(s);for(let i of t){let[r,o,...n]=i;e.append(r,o,...n)}return e}l(wi,"buildFormData");var mi=class mi extends Ee{constructor(t,i,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=t,this.code=i,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,mi.prototype)}};l(mi,"UploadError");var z=mi,Xl=l(s=>{let e=new URLSearchParams;for(let[t,i]of Object.entries(s))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(r=>{var o;return(o=r[1])!=null?o:!1}).forEach(r=>e.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(i)?i.forEach(r=>{e.append(`${t}[]`,r)}):typeof i=="string"&&i?e.set(t,i):typeof i=="number"&&e.set(t,i.toString());return e.toString()},"buildSearchParams"),ft=l((s,e,t)=>{let i=new URL(s);return i.pathname=(i.pathname+e).replace("//","/"),t&&(i.search=Xl(t)),i.toString()},"getUrl"),ql="6.14.1",Kl="UploadcareUploadClient",Zl=ql;function It(s){return bs({libraryName:Kl,libraryVersion:Zl,...s})}l(It,"getUserAgent");var Yl="RequestThrottledError",_o=15e3,Jl=1e3;function Ql(s){let{headers:e}=s||{};if(!e||typeof e["retry-after"]!="string")return _o;let t=parseInt(e["retry-after"],10);return Number.isFinite(t)?t*1e3:_o}l(Ql,"getTimeoutFromThrottledRequest");function At(s,e){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:i}=e;return Fl(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===Yl&&r<t)return o(Ql(n));if(n instanceof Bt&&r<i)return o((r+1)*Jl);throw n}))}l(At,"retryIfFailed");var Co=l(s=>{let e="";return(_i(s)||yi(s)||vi(s))&&(e=s.type),e||bi},"getContentType"),Ao=l(s=>{let e="";return yi(s)&&s.name?e=s.name:_i(s)||wo()?e="":vi(s)&&s.name&&(e=s.name),e||vo},"getFileName");function _s(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(_s,"getStoreValue");function ta(s,{publicKey:e,fileName:t,contentType:i,baseURL:r=k.baseURL,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",url:ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:wi({signature:o,expire:n,file:{data:s,name:t||Ao(s),contentType:i||Co(s)},UPLOADCARE_PUB_KEY:e,UPLOADCARE_STORE:_s(a),source:p,metadata:b}),signal:c,onProgress:u}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ta,"base");var ps;(function(s){s.Token="token",s.FileInfo="file_info"})(ps||(ps={}));function ea(s,{publicKey:e,baseURL:t=k.baseURL,store:i,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:e,source_url:s,store:_s(i),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:c,source:u,metadata:b}),signal:p}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ea,"fromUrl");var G;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(G||(G={}));var ia=l(s=>"status"in s&&s.status===G.Error,"isErrorResponse");function sa(s,{publicKey:e,baseURL:t=k.baseURL,signal:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}={}){return At(()=>Ct({method:"GET",headers:e?{"X-UC-User-Agent":It({publicKey:e,integration:r,userAgent:o})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:i}).then(({data:c,headers:u,request:p})=>{let d=gt(JSON.parse(c));if("error"in d&&!ia(d))throw new z(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}l(sa,"fromUrlStatus");function ra(s,{publicKey:e,baseURL:t=k.baseURL,jsonpCallback:i,secureSignature:r,secureExpire:o,signal:n,source:a,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:c,userAgent:u})},url:ft(t,"/group/",{jsonerrors:1}),data:wi({files:s,callback:i,pub_key:e,signature:r,expire:o,source:a}),signal:n}).then(({data:f,headers:m,request:g})=>{let b=gt(JSON.parse(f));if("error"in b)throw new z(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}l(ra,"group");function Eo(s,{publicKey:e,baseURL:t=k.baseURL,signal:i,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"GET",headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},url:ft(t,"/info/",{jsonerrors:1,pub_key:e,file_id:s,source:r}),signal:i}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Eo,"info");function oa(s,{publicKey:e,contentType:t,fileName:i,multipartChunkSize:r=k.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",url:ft(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:wi({filename:i||vo,size:s,content_type:t||bi,part_size:r,UPLOADCARE_STORE:_s(c),UPLOADCARE_PUB_KEY:e,signature:n,expire:a,source:p,metadata:b}),signal:u}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C.parts=Object.keys(C.parts).map(M=>C.parts[Number(M)]),C}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}l(oa,"multipartStart");function na(s,e,{contentType:t,signal:i,onProgress:r,retryThrottledRequestMaxTimes:o=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"PUT",url:e,data:s,onProgress:r,signal:i,headers:{"Content-Type":t||bi}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}l(na,"multipartUpload");function la(s,{publicKey:e,baseURL:t=k.baseURL,source:i="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},data:wi({uuid:s,UPLOADCARE_PUB_KEY:e,source:i}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(la,"multipartComplete");function ys(s,{publicKey:e,baseURL:t,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:c,onProgress:u}){return yo({check:p=>Eo(s,{publicKey:e,baseURL:t,signal:p,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}l(ys,"isReadyPoll");function aa(s){return"defaultEffects"in s}l(aa,"isGroupFileInfo");var As=class As{constructor(e,{baseCDN:t=k.baseCDN,fileName:i}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:o}=e,n=ft(t,`${r}/`),a=o?ft(`https://${o}.s3.amazonaws.com/`,`${r}/${e.filename}`):null;this.uuid=r,this.name=i||e.filename,this.size=e.size,this.isStored=e.isStored,this.isImage=e.isImage,this.mimeType=e.mimeType,this.cdnUrl=n,this.originalFilename=e.originalFilename,this.imageInfo=e.imageInfo,this.videoInfo=e.videoInfo,this.contentInfo=e.contentInfo,this.metadata=e.metadata||null,this.s3Bucket=o||null,this.s3Url=a,aa(e)&&(this.defaultEffects=e.defaultEffects)}};l(As,"UploadcareFile");var mt=As,ca=l((s,{publicKey:e,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,contentType:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>ta(s,{publicKey:e,fileName:t,contentType:a,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:x})=>ys(x,{publicKey:e,baseURL:i,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(x=>new mt(x,{baseCDN:b})),"uploadDirect"),ua=l((s,{publicKey:e,fileName:t,baseURL:i,signal:r,onProgress:o,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Eo(s,{publicKey:e,baseURL:i,signal:r,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new mt(f,{baseCDN:d,fileName:t})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),ha=l((s,{signal:e}={})=>{let t=null,i=null,r=s.map(()=>new AbortController),o=l(n=>()=>{i=n,r.forEach((a,c)=>c!==n&&a.abort())},"createStopRaceCallback");return gi(e,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,a)=>{let c=o(a);return Promise.resolve().then(()=>n({stopRace:c,signal:r[a].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(i===null)throw t;return n[i]})},"race"),da=window.WebSocket,Es=class Es{constructor(){h(this,"events",Object.create({}))}emit(e,t){var i;(i=this.events[e])==null||i.forEach(r=>r(t))}on(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}off(e,t){t?this.events[e]=this.events[e].filter(i=>i!==t):this.events[e]=[]}};l(Es,"Events");var fs=Es,pa=l((s,e)=>s==="success"?{status:G.Success,...e}:s==="progress"?{status:G.Progress,...e}:{status:G.Error,...e},"response"),Ts=class Ts{constructor(e,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new fs);h(this,"disconnectTimeoutId",null);this.key=e,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let e=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new da(e),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let i=JSON.parse(t.data.toString());switch(i.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(i.channel,pa(i.event,JSON.parse(i.data)))}})}}disconnect(){let e=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{e()},this.disconnectTime):e()}send(e,t){var r;let i=JSON.stringify({event:e,data:t});(r=this.ws)==null||r.send(i)}subscribe(e,t){this.subscribers+=1,this.connect();let i=`task-status-${e}`,r={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(e){this.subscribers-=1;let t=`task-status-${e}`,i={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(e){return this.emmitter.on("error",e),()=>this.emmitter.off("error",e)}};l(Ts,"Pusher");var ms=Ts,hs=null,vs=l(s=>{if(!hs){let e=typeof window=="undefined"?0:3e4;hs=new ms(s,e)}return hs},"getPusher"),fa=l(s=>{vs(s).connect()},"preconnect");function ma({token:s,publicKey:e,baseURL:t,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:c}){return yo({check:u=>sa(s,{publicKey:e,baseURL:t,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case G.Error:return new z(p.error,p.errorCode);case G.Waiting:return!1;case G.Unknown:return new z(`Token "${s}" was not found.`);case G.Progress:return a&&(p.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:p.done/p.total})),!1;case G.Success:return a&&a({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}l(ma,"pollStrategy");var ga=l(({token:s,pusherKey:e,signal:t,onProgress:i})=>new Promise((r,o)=>{let n=vs(e),a=n.onError(o),c=l(()=>{a(),n.unsubscribe(s)},"destroy");gi(t,()=>{c(),o(new xt("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case G.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case G.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),r(u);break}case G.Error:c(),o(new z(u.msg,u.error_code))}})}),"pushStrategy"),ba=l((s,{publicKey:e,fileName:t,baseURL:i,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=k.pusherKey,metadata:x})=>Promise.resolve(fa(w)).then(()=>ea(s,{publicKey:e,fileName:t,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:x})).catch(v=>{let C=vs(w);return C==null||C.disconnect(),Promise.reject(v)}).then(v=>v.type===ps.FileInfo?v:ha([({signal:C})=>ma({token:v.token,publicKey:e,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:C}),({signal:C})=>ga({token:v.token,pusherKey:w,signal:C,onProgress:d})],{signal:p})).then(v=>{if(v instanceof z)throw v;return v}).then(v=>ys(v.uuid,{publicKey:e,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:p})).then(v=>new mt(v,{baseCDN:r})),"uploadFromUrl"),ds=new WeakMap,_a=l(async s=>{if(ds.has(s))return ds.get(s);let e=await fetch(s.uri).then(t=>t.blob());return ds.set(s,e),e},"getBlobFromReactNativeAsset"),To=l(async s=>{if(yi(s)||_i(s))return s.size;if(vi(s))return(await _a(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),ya=l((s,e=k.multipartMinFileSize)=>s>=e,"isMultipart"),So=l(s=>{let e="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(e);return!Vt(s)&&t.test(s)},"isUuid"),ws=l(s=>{let e="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(e);return!Vt(s)&&t.test(s)},"isUrl"),va=l((s,e)=>new Promise((t,i)=>{let r=[],o=!1,n=e.length,a=[...e],c=l(()=>{let u=e.length-a.length,p=a.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():t(r))}).catch(d=>{o=!0,i(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),wa=l((s,e,t,i)=>{let r=i*e,o=Math.min(r+i,t);return s.slice(r,o)},"sliceChunk"),xa=l(async(s,e,t)=>i=>wa(s,i,e,t),"prepareChunks"),Ca=l((s,e,{publicKey:t,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>na(s,e,{publicKey:t,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),Aa=l(async(s,{publicKey:e,fileName:t,fileSize:i,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=k.multipartChunkSize,maxConcurrentRequests:x=k.maxConcurrentRequests,baseCDN:v,metadata:C})=>{let M=i!=null?i:await To(s),K,et=l((P,V)=>{if(!u)return;K||(K=Array(P).fill(0));let J=l(it=>it.reduce((ht,ss)=>ht+ss,0),"sum");return it=>{it.isComputable&&(K[V]=it.value,u({isComputable:!0,value:J(K)/P}))}},"createProgressHandler");return b||(b=Co(s)),oa(M,{publicKey:e,contentType:b,fileName:t||Ao(s),baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:C}).then(async({uuid:P,parts:V})=>{let J=await xa(s,M,w);return Promise.all([P,va(x,V.map((it,ht)=>()=>Ca(J(ht),it,{publicKey:e,contentType:b,onProgress:et(V.length,ht),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([P])=>la(P,{publicKey:e,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(P=>P.isReady?P:ys(P.uuid,{publicKey:e,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(P=>new mt(P,{baseCDN:v}))},"uploadMultipart");async function xs(s,{publicKey:e,fileName:t,baseURL:i=k.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:x,baseCDN:v=k.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:M,pusherKey:K,metadata:et}){if(Vt(s)){let P=await To(s);return ya(P,b)?Aa(s,{publicKey:e,contentType:g,multipartChunkSize:w,fileSize:P,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:et}):ca(s,{publicKey:e,fileName:t,contentType:g,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:et})}if(ws(s))return ba(s,{publicKey:e,fileName:t,baseURL:i,baseCDN:v,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:M,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:K,metadata:et});if(So(s))return ua(s,{publicKey:e,fileName:t,baseURL:i,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${s}" is not supported`)}l(xs,"uploadFile");var Ss=class Ss{constructor(e,{baseCDN:t=k.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=e.id,this.filesCount=e.filesCount;let i=e.files.filter(Boolean);this.totalSize=Object.values(i).reduce((r,o)=>r+o.size,0),this.isStored=!!e.datetimeStored,this.isImage=!!Object.values(i).filter(r=>r.isImage).length,this.cdnUrl=e.cdnUrl,this.files=i.map(r=>new mt(r,{baseCDN:t})),this.createdAt=e.datetimeCreated,this.storedAt=e.datetimeStored}};l(Ss,"UploadcareGroup");var gs=Ss,Ea=l(s=>{for(let e of s)if(!Vt(e))return!1;return!0},"isFileDataArray"),Ta=l(s=>{for(let e of s)if(!So(e))return!1;return!0},"isUuidArray"),Sa=l(s=>{for(let e of s)if(!ws(e))return!1;return!0},"isUrlArray");function ko(s,{publicKey:e,fileName:t,baseURL:i=k.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=k.multipartChunkSize,baseCDN:w=k.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v,jsonpCallback:C}){if(!Ea(s)&&!Sa(s)&&!Ta(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let M,K=!0,et=s.length,P=l((V,J)=>{if(!c)return;M||(M=Array(V).fill(0));let it=l(ht=>ht.reduce((ss,Xn)=>ss+Xn)/V,"normalize");return ht=>{if(!ht.isComputable||!K){K=!1,c({isComputable:!1});return}M[J]=ht.value,c({isComputable:!0,value:it(M)})}},"createProgressHandler");return Promise.all(s.map((V,J)=>Vt(V)||ws(V)?xs(V,{publicKey:e,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:P(et,J),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v}).then(it=>it.uuid):V)).then(V=>ra(V,{publicKey:e,baseURL:i,jsonpCallback:C,secureSignature:r,secureExpire:o,signal:a,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(J=>new gs(J,{baseCDN:w})).then(J=>(c&&c({isComputable:!0,value:1}),J)))}l(ko,"uploadFileGroup");var ks=class ks{constructor(e){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=e}_run(){let e=this._concurrency-this._running;for(let t=0;t<e;t++){let i=this._pending.shift();if(!i)return;let r=this._resolvers.get(i),o=this._rejectors.get(i);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(n=>r(n)).catch(n=>o(n))}}add(e){return new Promise((t,i)=>{this._resolvers.set(e,t),this._rejectors.set(e,i),this._pending.push(e),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(e){this._concurrency=e,this._run()}get concurrency(){return this._concurrency}};l(ks,"Queue");var di=ks;var $s=l(()=>({}),"blockCtx"),Is=l(s=>({...$s(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),xi=l(s=>({...Is(s),"*commonProgress":0,"*uploadList":[],"*focusedEntry":null,"*uploadQueue":new di(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var Te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"Selected:","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error ocurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit button","file-item-remove-button":"Remove button"};var Ci=new Map,Os=new Map,$o=l((s,e)=>{Ci.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Ci.set(s,{...Te,...e})},"defineLocaleSync"),ka=l((s,e)=>{Os.set(s,e)},"defineLocaleAsync"),Ls=l((s,e)=>{typeof e=="function"?ka(s,e):$o(s,e)},"defineLocale"),Io=l(async s=>{if(!Ci.has(s)){if(!Os.has(s))throw new Error(`Locale ${s} is not defined`);let t=await Os.get(s)();$o(s,t)}return Ci.get(s)},"resolveLocaleDefinition");Ls("en",Te);var bt=l(s=>`*l10n/${s}`,"localeStateKey"),$a="en",Us=class Us{constructor(e){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=e;for(let[t,i]of Object.entries(Te))this._blockInstance.add(bt(t),i,!1);setTimeout(()=>{e.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let i=await Io(t);if(t!==$a&&this._localeName!==t)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,a]of Object.entries(i)){let c=r==null?void 0:r[n];this._blockInstance.add(bt(n),c!=null?c:a,!0);for(let u of this._callbacks)u()}}),e.subConfigValue("localeDefinitionOverride",t=>{var r;if(!t)return;let i=t[this._localeName];if(i)for(let[o,n]of Object.entries(i)){(r=this._blockInstance)==null||r.add(bt(o),n,!0);for(let a of this._callbacks)a()}})})}onLocaleChange(e){let t=L(e,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(e,t,i){var o,n,a;e.$[t]=i(),this._boundBlocks.has(e)||this._boundBlocks.set(e,new Map),(n=(o=this._boundBlocks.get(e))==null?void 0:o.get(t))==null||n();let r=this.onLocaleChange(()=>{e.$[t]=i()});(a=this._boundBlocks.get(e))==null||a.set(t,r)}destroyL10nBindings(e){let t=this._boundBlocks.get(e);if(t){for(let i of t.values())i();this._boundBlocks.delete(e)}}destroy(){this._callbacks.clear()}};l(Us,"LocaleManager");var Ai=Us;function Oo(s,e){[...s.querySelectorAll("[l10n]")].forEach(t=>{let i=t.getAttribute("l10n");if(!i)return;let r="textContent",o=!1;if(i.includes(":")){let c=i.split(":");r=c[0],i=c[1],r.startsWith("@")&&(r=r.slice(1),o=!0)}let n=i;e.has(n)&&e.sub(n,c=>{if(!c)return;e.l10nProcessorSubs.has(n)||e.l10nProcessorSubs.set(n,new Set);let u=e.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),e.allSubs.delete(f)});let p=bt(c).replace("*","");e.nodeCtx.has(p)||e.nodeCtx.add(p,c);let d=e.nodeCtx.sub(p,()=>{t[r]=e.l10n(c)});u==null||u.add(d),e.allSubs.add(d),t.removeAttribute("l10n")});let a=bt(i);e.has(a)||e.add(a,""),e.sub(a,()=>{i=i,o?t.setAttribute(r,e.l10n(i)):t[r]=e.l10n(i)}),t.removeAttribute("l10n")})}l(Oo,"l10nProcessor");var W=l(s=>`*cfg/${s}`,"sharedConfigKey");var Ia={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Se(s,e){e.tabIndex=0,e.focus(),s.tabIndex=-1}l(Se,"focus");function Ms(s){let e=s.role||s.type||s.tagName;if(!e)return null;let t=Ia[e.toLowerCase()];if(!t)return null;for(let i of t){let r=s.closest(`[role=${i}]`);if(r)return r}}l(Ms,"findGroupNodeByEventTarget");function Ps(s,e){return e.role==="toolbar"?Oa(e):e.querySelectorAll(`[role=${s.role}]`)}l(Ps,"getItems");function Oa(s){return[...s.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}l(Oa,"getToolbarItems");function La(s){let e=s.getAttribute("aria-orientation");if(e==="vertical")return!1;if(e==="horizontal")return!0;let t=s.role;return t==="menubar"||t==="tablist"||t==="toolbar"}l(La,"isHorizontalOrientation");function Lo(s){return e=>{let t=!1,i=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=Ms(d.target);if(!f){a();return}let m=Ps(d.target,f),g=Array.from(m).indexOf(d.target),b="ArrowDown",w="ArrowUp";if(La(f)&&(e.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),d.key===b)d.preventDefault(),Se(d.target,m[g+1]||m[0]);else if(d.key===w)d.preventDefault(),Se(d.target,m[g-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),Se(d.target,m[0]);else if(d.key==="End")d.preventDefault(),Se(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let x=Date.now();x-r<=i?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=x;let v=Array.from(m).find(C=>{var M,K,et;return(et=(K=(M=C.textContent)==null?void 0:M.trim())==null?void 0:K.toLowerCase())==null?void 0:et.startsWith(o)});v&&(d.preventDefault(),Se(d.target,v))}}l(n,"keyDown");function a(){t=!1,e.removeEventListener("keydown",n)}l(a,"stop");function c(d){let f=Ms(d.target);if(f){t||(t=!0,e.addEventListener("keydown",n));let m=Ps(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1)}else t&&a()}l(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===e.document)&&a()}l(u,"focusOut");function p(d){let f=Ms(d.target);if(f){let m=Ps(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return l(p,"click"),e.addEventListener("click",p),e.addEventListener("focusin",c),e.addEventListener("focusout",u),()=>{a(),e.removeEventListener("click",p),e.removeEventListener("focusin",c),e.removeEventListener("focusout",u)}}}l(Lo,"focusGroupKeyUX");function Uo(){return s=>{let e,t;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){e=o.target,e.setAttribute("aria-hidden","false"),t=e.hidden,t&&(e.hidden=!1);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0)}}l(i,"jump");function r(o){e&&e.contains(o.target)&&(!o.relatedTarget||!e.contains(o.relatedTarget))&&(o.target.tabIndex=-1,e.setAttribute("aria-hidden","true"),t&&(e.hidden=!0),e=null)}return l(r,"focusOut"),s.addEventListener("keyuxJump",i),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",i),s.removeEventListener("focusout",r)}}}l(Uo,"hiddenKeyUX");function Mo(){return s=>{let e=[];function t(u){let p=s.document.activeElement;p&&p!==s.document.body&&e.push(new WeakRef(p)),u.focus({focusVisible:!0})}l(t,"focus");function i(){let u=e.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():i()}l(i,"back");let r=0,o;function n(u){clearInterval(o);let p=u.getAttribute("aria-controls");p&&(o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(p);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:!0})),t(f))}},50))}l(n,"jump");function a(u){u.clientX===0&&u.clientY===0&&n(u.target)}l(a,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&i()}return l(c,"keyDown"),s.addEventListener("click",a),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",a),s.removeEventListener("keydown",c)}}}l(Mo,"jumpKeyUX");function Po(s){let e,t=s.split(" ");function i(){e&&e.classList.remove(...t)}l(i,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(i(),o.target.classList.add(...t),e=o.target)}return l(r,"click"),o=>(o.addEventListener("keyup",i),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",i),o.removeEventListener("click",r)})}l(Po,"pressKeyUX");function Ro(s,e){let t=e.map(i=>i(s));return()=>{t.forEach(i=>i())}}l(Ro,"startKeyUX");var Fs=class Fs{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(e,t){let i=l(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&t(r)},"wrappedListener");this._listeners.set(t,i),window.addEventListener(e,i)}removeEventListener(e,t){let i=this._listeners.get(t);i&&window.removeEventListener(e,i),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(e){this._scope.push(e)}destroy(){this._scope=[],this._listeners.forEach((e,t)=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",e),this._listeners.delete(t)})}};l(Fs,"ScopedMinimalWindow");var Rs=Fs,Ds=class Ds{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new Rs,this._destroyKeyUX=Ro(this._scopedWindow,[Lo(),Po("is-pressed"),Mo(),Uo()])}registerBlock(e){this._scopedWindow.registerScope(e)}destroy(){var e;(e=this._destroyKeyUX)==null||e.call(this),this._scopedWindow.destroy()}};l(Ds,"A11y");var Ei=Ds;var Ua="uc-",ke=class ke extends $t{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",$s());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Oo)}l10n(t,i={}){if(!t)return"";let r=this.$[bt(t)]||t,o=fo(r);for(let a of o)i[a.variable]=this.pluralize(a.pluralKey,Number(i[a.countVariable]));return Ae(r,i)}pluralize(t,i){let r=this.l10n("locale-id")||"en",o=hi(r,i);return this.l10n(`${t}__${o}`)}bindL10n(t,i){var r;(r=this.localeManager)==null||r.bindL10n(this,t,i)}emit(t,i,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,i,r)}hasBlockInCtx(t){for(let i of this.blocksRegistry)if(t(i))return!0;return!1}setOrAddState(t,i){this.add$({[t]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?mo({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),Ce.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Ce.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new ui(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ai(this)),this.has("*a11y")||this.add("*a11y",new Ei),this.sub(bt("locale-id"),i=>{let r=uo(i);this.style.direction=r==="ltr"?"":r})}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var i;let t=this.blocksRegistry;t==null||t.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;T.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:ai(t),cdnUrlModifiers:as(t),fileName:li(t)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),t}return this.cfg.secureDeliveryProxy?Ae(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:i=>window.encodeURIComponent(i)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(i,r,o)=>{if(typeof r!="string")return!1;let n=W(r);return this.has(n)||this.add(n,Q[r]),this.$[n]=o,!0},get:(i,r)=>{let o=W(r);return this.has(o)||this.add(o,Q[r]),this.$[W(r)]}})}return this.__cfgProxy}subConfigValue(t,i){let r=W(t);this.has(r)||this.add(r,Q[t]),this.sub(r,i)}debugPrint(...t){if(!this.cfg.debug)return;let i=t;if(typeof(t==null?void 0:t[0])=="function"){let r=t[0];i=r()}console.log(`[${this.ctxName}]`,...i)}static reg(t){if(!t){super.reg();return}t.startsWith(Ua)&&super.reg(t)}};l(ke,"Block"),h(ke,"StateConsumerScope",null),h(ke,"styleAttrs",[]);var y=ke;var Fo="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='apuc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#apuc-icon-id__a)'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#asuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#asuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#asuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#asuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#asuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#asuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#asuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ti=class Ti extends y{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",xi(this));h(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=Fo+t+"<slot></slot>"}static get template(){return this._template}};l(Ti,"SolutionBlock"),h(Ti,"styleAttrs",["uc-wgt-common"]);var rt=Ti;var Do="active",$e="___ACTIVITY_IS_ACTIVE___",ot=class ot extends y{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Is(this));h(this,"_debouncedHistoryFlush",L(this._historyFlush.bind(this),10))}_deactivate(){var i;let t=ot._activityCallbacks.get(this);this[$e]=!1,this.removeAttribute(Do),(i=t==null?void 0:t.deactivateCallback)==null||i.call(t)}_activate(){var i;let t=ot._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[$e]=!0,this.setAttribute(Do,""),(i=t==null?void 0:t.activateCallback)==null||i.call(t),this._debouncedHistoryFlush(),this.emit($.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[$e]?this._deactivate():this.activityType===t&&!this[$e]&&this._activate(),t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_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&&ot._activityCallbacks.has(this)}get isActivityActive(){return this[$e]}get couldOpenActivity(){return!0}registerActivity(t,i={}){let{onActivate:r,onDeactivate:o}=i;ot._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ot._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof ot&&r.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var i;let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(a=>a.activityType===r);o=(i=n==null?void 0:n.couldOpenActivity)!=null?i:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}};l(ot,"ActivityBlock"),h(ot,"_activityCallbacks",new Map);var _=ot;_.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Ie=33.333333333333336,A=1,Ns=24,No=6;function Ot(s,e){for(let t in e)s.setAttributeNS(null,t,e[t].toString())}l(Ot,"setSvgNodeAttrs");function Z(s,e={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Ot(t,e),t}l(Z,"createSvgNode");function zo(s,e,t){let{x:i,y:r,width:o,height:n}=s,a=e.includes("w")?0:1,c=e.includes("n")?0:1,u=[-1,1][a],p=[-1,1][c],d=[i+a*o+1.5*u,r+c*n+1.5*p-24*t*p],f=[i+a*o+1.5*u,r+c*n+1.5*p],m=[i+a*o-24*t*u+1.5*u,r+c*n+1.5*p];return{d:`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,center:f}}l(zo,"cornerPath");function Bo(s,e,t){let{x:i,y:r,width:o,height:n}=s,a=["n","s"].includes(e)?.5:{w:0,e:1}[e],c=["w","e"].includes(e)?.5:{n:0,s:1}[e],u=[-1,1][a],p=[-1,1][c],d,f;["n","s"].includes(e)?(d=[i+a*o-34*t/2,r+c*n+1.5*p],f=[i+a*o+34*t/2,r+c*n+1.5*p]):(d=[i+a*o+1.5*u,r+c*n-34*t/2],f=[i+a*o+1.5*u,r+c*n+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]}`,g=[f[0]-(f[0]-d[0])/2,f[1]-(f[1]-d[1])/2];return{d:m,center:g}}l(Bo,"sidePath");function Vo(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Vo,"thumbCursor");function jo({rect:s,delta:[e,t],imageBox:i}){return Ht({...s,x:s.x+e,y:s.y+t},i)}l(jo,"moveRect");function Ht(s,e){let{x:t}=s,{y:i}=s;return s.x<e.x?t=e.x:s.x+s.width>e.x+e.width&&(t=e.x+e.width-s.width),s.y<e.y?i=e.y:s.y+s.height>e.y+e.height&&(i=e.y+e.height-s.height),{...s,x:t,y:i}}l(Ht,"constraintRect");function Ma({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[,r]=e,{y:o,width:n,height:a}=s;o+=r,a-=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o<=i.y&&(o=i.y,a=s.y+s.height-o,t&&(n=a*t,c=s.x+s.width/2-n/2)),c<=i.x&&(c=i.x,o=s.y+s.height-a),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,t&&(a=n/t),o=s.y+s.height-a),a<A&&(a=A,t&&(n=a*t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),n<A&&(n=A,t&&(a=n/t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:c,y:o,width:n,height:a}}l(Ma,"resizeNorth");function Pa({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r]=e,{x:o,width:n,height:a}=s;o+=r,n-=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o<=i.x&&(o=i.x,n=s.x+s.width-o,t&&(a=n/t,c=s.y+s.height/2-a/2)),c<=i.y&&(c=i.y,o=s.x+s.width-n),c+a>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-a),a=i.y+i.height-c,t&&(n=a*t),o=s.x+s.width-n),a<A&&(a=A,t&&(n=a*t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),n<A&&(n=A,t&&(a=n/t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:a}}l(Pa,"resizeWest");function Ra({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[,r]=e,{y:o,width:n,height:a}=s;a+=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o+a>=i.y+i.height&&(a=i.y+i.height-o,t&&(n=a*t),c=s.x+s.width/2-n/2),c<=i.x&&(c=i.x,o=s.y),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,t&&(a=n/t),o=s.y),a<A&&(a=A,t&&(n=a*t),c=s.x+s.width/2-n/2),n<A&&(n=A,t&&(a=n/t),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:a}}l(Ra,"resizeSouth");function Fa({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r]=e,{x:o,width:n,height:a}=s;n+=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o+n>=i.x+i.width&&(n=i.x+i.width-o,t&&(a=n/t),c=s.y+s.height/2-a/2),c<=i.y&&(c=i.y,o=s.x),c+a>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-a),a=i.y+i.height-c,t&&(n=a*t),o=s.x),a<A&&(a=A,t&&(n=a*t),c=s.y+s.height/2-a/2),n<A&&(n=A,t&&(a=n/t),c=s.y+s.height/2-a/2),{x:o,y:c,width:n,height:a}}l(Fa,"resizeEast");function Da({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),a+o<i.y&&(o=i.y-a),n+=r,c-=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=i.y&&(u=u-(i.y-a),c=u*t,n=s.x+s.width-c,a=i.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/t,n=i.x,a=s.y+s.height-u)),u<A&&(u=A,t&&(c=u*t),n=s.x+s.width-c,a=s.y+s.height-u),c<A&&(c=A,t&&(u=c/t),n=s.x+s.width-c,a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(Da,"resizeNorthWest");function Na({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),a+o<i.y&&(o=i.y-a),c+=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=i.y&&(u=u-(i.y-a),c=u*t,n=s.x,a=i.y)):t&&(r=u*t-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/t,n=i.x+i.width-c,a=s.y+s.height-u)),u<A&&(u=A,t&&(c=u*t),a=s.y+s.height-u),c<A&&(c=A,t&&(u=c/t),a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(Na,"resizeNorthEast");function za({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),a+u+o>i.y+i.height&&(o=i.y+i.height-a-u),n+=r,c-=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=i.y+i.height&&(u=i.y+i.height-a,c=u*t,n=s.x+s.width-c,a=i.y+i.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/t,n=i.x,a=s.y)),u<A&&(u=A,t&&(c=u*t),n=s.x+s.width-c),c<A&&(c=A,t&&(u=c/t),n=s.x+s.width-c),{x:n,y:a,width:c,height:u}}l(za,"resizeSouthWest");function Ba({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),a+u+o>i.y+i.height&&(o=i.y+i.height-a-u),c+=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=i.y+i.height&&(u=i.y+i.height-a,c=u*t,n=s.x,a=i.y+i.height-u)):t&&(r=u*t-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/t,n=i.x+i.width-c,a=s.y)),u<A&&(u=A,t&&(c=u*t)),c<A&&(c=A,t&&(u=c/t)),{x:n,y:a,width:c,height:u}}l(Ba,"resizeSouthEast");function Ho({direction:s,...e}){switch(s){case"n":return Ma(e);case"w":return Pa(e);case"s":return Ra(e);case"e":return Fa(e);case"nw":return Da(e);case"ne":return Na(e);case"sw":return za(e);case"se":return Ba(e);default:return e.rect}}l(Ho,"resizeRect");function Go(s,[e,t]){return s.x<=e&&e<=s.x+s.width&&s.y<=t&&t<=s.y+s.height}l(Go,"rectContainsPoint");function Wo(s,e){return s.x>=e.x&&s.y>=e.y&&s.x+s.width<=e.x+e.width&&s.y+s.height<=e.y+e.height}l(Wo,"isRectInsideRect");function Xo(s,e){return Math.abs(s.width/s.height-e)<.1}l(Xo,"isRectMatchesAspectRatio");function Gt({width:s,height:e},t){let i=t/90%2!==0;return{width:i?e:s,height:i?s:e}}l(Gt,"rotateSize");function qo(s,e,t){let i=s/e,r,o;i>t?(r=Math.round(e*t),o=e):(r=s,o=Math.round(s/t));let n=Math.round((s-r)/2),a=Math.round((e-o)/2);return n+r>s&&(r=s-n),a+o>e&&(o=e-a),{x:n,y:a,width:r,height:o}}l(qo,"calculateMaxCenteredCropFrame");function Wt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(Wt,"roundRect");function Et(s,e,t){return Math.min(Math.max(s,e),t)}l(Et,"clamp");var ki=l(s=>{if(!s)return[];let[e,t]=s.split(":").map(Number);if(!Number.isFinite(e)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:e,height:t}]},"parseCropPreset");var Lt="blocks",Ut="1.4.0";function Ko(s){return bs({...s,libraryName:Lt,libraryVersion:Ut})}l(Ko,"customUserAgent");var Zo=l(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Yo=l((s,{threshold:e})=>{let{secureExpire:t}=s,i=Zo(Date.now()),r=Number(t),o=Zo(e);return i+o>=r},"isSecureTokenExpired");var zs=class zs{constructor(e){h(this,"_block");h(this,"_secureToken",null);this._block=e}_debugPrint(...e){this._block.debugPrint("[secure-uploads]",...e)}async getSecureToken(){let{secureSignature:e,secureExpire:t,secureUploadsSignatureResolver:i}=this._block.cfg;if((e||t)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Yo(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let r=await i();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this._debugPrint("Secure signature resolved:",r),this._debugPrint("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this._secureToken=r):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r)}}return this._secureToken}return e&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:e,secureExpire:t}),{secureSignature:e,secureExpire:t}):null}};l(zs,"SecureUploadsManager");var $i=zs;var Jo="[Typed State] Wrong property name: ",Va="[Typed State] Wrong property type: ",Bs=class Bs{constructor(e,t){this.__typedSchema=e,this.__ctxId=t||kt.generate(),this.__schema=Object.keys(e).reduce((i,r)=>(i[r]=e[r].value,i),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(e,t){if(!this.__typedSchema.hasOwnProperty(e)){console.warn(Jo+e);return}let i=this.__typedSchema[e];if((t==null?void 0:t.constructor)===i.type||t instanceof i.type||i.nullable&&t===null){this.__data.pub(e,t);return}console.warn(Va+e)}setMultipleValues(e){for(let t in e)this.setValue(t,e[t])}getValue(e){if(!this.__typedSchema.hasOwnProperty(e)){console.warn(Jo+e);return}return this.__data.read(e)}subscribe(e,t){return this.__data.sub(e,t)}remove(){T.deleteCtx(this.__ctxId)}};l(Bs,"TypedData");var Ii=Bs;var Vs=class Vs{constructor(e){this.__typedSchema=e.typedSchema,this.__ctxId=e.ctxName||kt.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=e.watchList||[],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;let t=Object.create(null);this.__notifyObservers=(i,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[i]||(t[i]=new Set),t[i].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let e=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],e,t)})}observeCollection(e){return this.__collectionObservers.add(e),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(e)}}unobserveCollection(e){var t;(t=this.__collectionObservers)==null||t.delete(e)}add(e){let t=new Ii(this.__typedSchema);for(let i in e)t.setValue(i,e[i]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(i=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(i,()=>{this.__notifyObservers(i,t.uid)}))}),t.uid}read(e){return this.__data.read(e)}readProp(e,t){return this.read(e).getValue(t)}publishProp(e,t,i){this.read(e).setValue(t,i)}remove(e){this.__removed.add(this.__data.read(e)),this.__items.delete(e),this.notify(),this.__data.pub(e,null),delete this.__subsMap[e]}clearAll(){this.__items.forEach(e=>{this.remove(e)})}observeProperties(e){return this.__propertyObservers.add(e),()=>{this.unobserveProperties(e)}}unobserveProperties(e){var t;(t=this.__propertyObservers)==null||t.delete(e)}findItems(e){let t=[];return this.__items.forEach(i=>{let r=this.read(i);e(r)&&t.push(i)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let e in this.__subsMap)this.__subsMap[e].forEach(t=>{t.remove()}),delete this.__subsMap[e]}};l(Vs,"TypedCollection");var Oi=Vs;var X=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Oe=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Li=l(s=>s?s.filter(e=>typeof e=="string").map(e=>N(e)).flat():[],"mergeFileTypes"),js=l((s,e)=>e.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),Qo=l((s,e)=>e.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),tn=l(s=>{let e=s==null?void 0:s.type;return e?js(e,Oe):!1},"fileIsImage");var ja=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ha=new RegExp(`^/?(${ja.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),en=l(({url:s,cdnBase:e})=>{let t=new URL(e),i=new URL(s);if(t.host!==i.host)return null;let[,r,o,n]=Ha.exec(i.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var sn=l(s=>{let e=new Map;return(...t)=>{let i=JSON.stringify(t);if(e.has(i))return e.get(i);let r=s(...t);return e.set(i,r),r}},"memoize");var rn=new Set;function on(s){rn.has(s)||(rn.add(s),console.warn(s))}l(on,"warnOnce");function Ga(s){let e=!1;return setTimeout(()=>{e=!0},0),l(i=>(...r)=>(e&&on(s),i(...r)),"withAssert")}l(Ga,"createAsyncAssertWrapper");function nn(s){let e={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(r=>r.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>t.allEntries.filter(r=>r.status==="success"),failedEntries:()=>t.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>t.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>t.allEntries.filter(r=>r.status==="idle")},t={},i=Ga("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[r,o]of Object.entries(e)){let n=r,c=sn(i(o));Object.defineProperty(t,n,{get:c,enumerable:!0})}return t}l(nn,"buildOutputCollectionState");var Hs=class Hs{constructor(e){h(this,"_ctx");h(this,"addFileFromUrl",l((e,{silent:t,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:e,fileName:i!=null?i:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",l((e,{silent:t,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({uuid:e,fileName:i!=null?i:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",l((e,{silent:t,fileName:i,source:r}={})=>{var a;let o=en({url:e,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:e,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(a=i!=null?i:o.filename)!=null?a:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",l((e,{silent:t,fileName:i,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:e,isImage:tn(e),mimeType:e.type,fileName:i!=null?i:e.name,fileSize:e.size,silent:t!=null?t:!1,source:r!=null?r:X.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",l(e=>{if(!this._uploadCollection.read(e))throw new Error(`File with internalId ${e} not found`);this._uploadCollection.remove(e)},"removeFileByInternalId"));h(this,"uploadAll",l(()=>{let e=this._uploadCollection.items().filter(t=>{let i=this._uploadCollection.read(t);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});e.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(e),this._ctx.emit($.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",l((e={})=>{var r;let t=zt(Li([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?Oe:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("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.");let i=document.createElement("input");i.type="file",i.multiple=this.cfg.multiple,e.captureCamera?(i.capture=this.cfg.cameraCapture,i.accept="image/*"):i.accept=t,i.addEventListener("change",()=>{[...i.files].forEach(o=>this.addFileFromObject(o,{source:e.captureCamera?X.CAMERA:X.LOCAL})),this._ctx.$["*currentActivity"]=_.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),i.value=""},{once:!0}),i.dispatchEvent(new MouseEvent("click"))},"openSystemDialog"));h(this,"getOutputItem",l(e=>{var n,a,c,u,p,d,f,m,g,b;let t=T.getCtx(e).store,i=t.fileInfo,r=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(a=(n=i==null?void 0:i.uuid)!=null?n:t.uuid)!=null?a:null,internalId:e,name:(c=i==null?void 0:i.originalFilename)!=null?c:t.fileName,size:(u=i==null?void 0:i.size)!=null?u:t.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:t.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(m=(f=t.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:i!=null?i:null,metadata:(b=(g=t.metadata)!=null?g:i==null?void 0:i.metadata)!=null?b:null,isSuccess:r==="success",isUploading:r==="uploading",isFailed:r==="failed",isRemoved:r==="removed",errors:t.errors,status:r}},"getOutputItem"));h(this,"getOutputCollectionState",l(()=>nn(this._ctx),"getOutputCollectionState"));h(this,"initFlow",l((e=!1)=>{var t;if(this._uploadCollection.size>0&&!e)this._ctx.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let i=this._sourceList[0];if(i==="local"){this._ctx.$["*currentActivity"]=_.activities.UPLOAD_LIST,this.openSystemDialog();return}let r=this._ctx.$["*blocksRegistry"],o=l(a=>"type"in a&&a.type===i,"isSourceBtn"),n=[...r].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":_.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)},"initFlow"));h(this,"doneFlow",l(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)},"doneFlow"));h(this,"setCurrentActivity",l((e,t={})=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===e)){this._ctx.set$({"*currentActivityParams":t,"*currentActivity":e});return}console.warn(`Activity type "${e}" not found in the context`)},"setCurrentActivity"));h(this,"setModalState",l(e=>{if(e&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",e)},"setModalState"));this._ctx=e}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let e=[];return this.cfg.sourceList&&(e=N(this.cfg.sourceList)),e}};l(Hs,"UploaderPublicApi");var Ui=Hs;var Gs=l((s,e)=>{let t=e.cfg.imgOnly,i=s.isImage;if(!(!t||i)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:e.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Ws=l((s,e)=>{let t=e.cfg.imgOnly,i=e.cfg.accept,r=Li([...t?Oe:[],i]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let a=js(o,r),c=Qo(n,r);if(!a&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:e.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var lt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Le=l(s=>Math.ceil(s*100)/100,"round"),ln=l((s,e=Mt.AUTO)=>{let t=e===Mt.AUTO;if(e===Mt.BYTE||t&&s<lt**1){let i=hi("en-US",s),r={one:"byte",other:"bytes"}[i];return`${s} ${r}`}return e===Mt.KB||t&&s<lt**2?`${Le(s/lt**1)} KB`:e===Mt.MB||t&&s<lt**3?`${Le(s/lt**2)} MB`:e===Mt.GB||t&&s<lt**4?`${Le(s/lt**3)} GB`:e===Mt.TB||t&&s<lt**5?`${Le(s/lt**4)} TB`:`${Le(s/lt**5)} PB`},"prettyBytes");var Xs=l((s,e)=>{let t=e.cfg.maxLocalFileSizeBytes,i=s.size;if(t&&i&&i>t)return{type:"FILE_SIZE_EXCEEDED",message:e.l10n("files-max-size-limit-error",{maxFileSize:ln(t)}),payload:{entry:s}}},"validateMaxSizeLimit");var qs=l((s,e)=>{let{internalId:t}=s,i=e._uploadCollection.read(t),r=i==null?void 0:i.getValue("uploadError");if(!r)return;if(r instanceof z)return{type:"UPLOAD_ERROR",message:r.message,payload:{entry:s,error:r}};if(r instanceof Bt)return{type:"NETWORK_ERROR",message:r.message,payload:{entry:s,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:s,error:o}}},"validateUploadError");var Ks=l((s,e)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:e.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Zs=l((s,e)=>{let t=s.totalCount,i=e.cfg.multiple?e.cfg.multipleMin:0,r=e.cfg.multiple?e.cfg.multipleMax:1;if(i&&t<i)return{type:"TOO_FEW_FILES",message:e.l10n("files-count-limit-error-too-few",{min:i,max:r,total:t}),payload:{total:t,min:i,max:r}};if(r&&t>r)return{type:"TOO_MANY_FILES",message:e.l10n("files-count-limit-error-too-many",{min:i,max:r,total:t}),payload:{total:t,min:i,max:r}}},"validateMultiple");var Mi={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Ys=class Ys{constructor(e){h(this,"_blockInstance");h(this,"_fileValidators",[Gs,Ws,Xs,qs]);h(this,"_collectionValidators",[Zs,Ks]);this._blockInstance=e,this._uploadCollection=this._blockInstance.uploadCollection;let t=l(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(e){let t=e!=null?e:this._uploadCollection.items();for(let i of t){let r=this._uploadCollection.read(i);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let e=this._blockInstance.api.getOutputCollectionState(),t=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=i(e,this._blockInstance.api);if(!r)continue;r&&(t.push(r),r.message||console.warn(Mi.message))}catch(r){console.warn(Mi.collection,r)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit($.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(e){let t=this._blockInstance.api.getOutputItem(e.uid),i=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(t,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Mi.message))}catch(o){console.warn(Mi.file,o)}e.setValue("errors",i)}_addCustomTypeToValidators(e){return e.map(t=>(...i)=>{let r=t(...i);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};l(Ys,"ValidationManager");var Pi=Ys;var an=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:mt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var Ri=class Ri extends _{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",xi(this));h(this,"_flushOutputItems",L(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));h(this,"_handleCollectionUpdate",l((t,i,r)=>{var o;(i.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of i)n.getValue("silent")||this.emit($.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of r)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit($.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",l(t=>{this._flushOutputItems();let i=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let a of t.errors){let{errors:c}=T.getCtx(a).store;c.length>0&&(this.emit($.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit($.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(a=>!!a.getValue("fileInfo")),n=i.findItems(a=>a.getValue("errors").length>0);i.size>0&&n.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit($.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var a;return!!((a=this.uploadCollection.read(n))!=null&&a.getValue("cdnUrl"))}).forEach(n=>{this.emit($.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",l(()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");t+=a});let o=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit($.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof Ri?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new Oi({typedSchema:an,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new Ui(this)),this.has("*validationManager")||this.add("*validationManager",new Pi(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,i;(t=this._unobserveCollectionProperties)==null||t.call(this),(i=this._unobserveCollection)==null||i.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new $i(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let i=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await ko(r,{...i,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit($.GROUP_CREATED,a),this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=a}setInitialCrop(){let t=ki(this.cfg.cropPreset);if(t){let[i]=t,r=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of r){let n=o.getValue("fileInfo"),{width:a,height:c}=n.imageInfo,u=i.width/i.height,p=qo(a,c,u),d=D(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:U(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===_.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=o,this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let r=this.api.getOutputItem(t);return await i(r)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ko,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,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.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};l(Ri,"UploaderBlock");var S=Ri;S.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});S.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...S.extSrcList});var Xt=l(s=>{var e;return(e=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:e.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var R=l(s=>String(s),"asString"),tt=l(s=>{let e=Number(s);if(Number.isNaN(e))throw new Error(`Invalid number: "${s}"`);return e},"asNumber"),I=l(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),Wa=l(s=>s==="auto"?s:I(s),"asStore"),Xa=l(s=>{let e=R(s);if(e!=="user"&&e!=="environment"&&e!=="")throw new Error(`Invalid "cameraCapture" value: "${e}"`);return e},"asCameraCapture"),qa=l(s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Ka=l(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),Js=l(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),cn=l(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),Za={pubkey:R,multiple:I,multipleMin:tt,multipleMax:tt,confirmUpload:I,imgOnly:I,accept:R,externalSourcesPreferredTypes:R,store:Wa,cameraMirror:I,cameraCapture:Xa,sourceList:R,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:I,useLocalImageEditor:I,useCloudImageEditor:I,cloudImageEditorTabs:R,removeCopyright:I,cropPreset:R,imageShrink:R,modalScrollLock:I,modalBackdropStrokes:I,sourceListWrap:I,remoteTabSessionKey:R,cdnCname:R,baseUrl:R,socialBaseUrl:R,secureSignature:R,secureExpire:R,secureDeliveryProxy:R,retryThrottledRequestMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:I,saveUrlForRecurrentUploads:I,groupOutput:I,userAgentIntegration:R,debug:I,localeName:R,metadata:qa,secureUploadsExpireThreshold:tt,localeDefinitionOverride:Ka,secureUploadsSignatureResolver:Js,secureDeliveryProxyUrlResolver:Js,iconHrefResolver:Js,fileValidators:cn,collectionValidators:cn},un=l((s,e)=>{if(!(typeof e=="undefined"||e===null))try{return Za[s](e)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),Q[s]}},"normalizeConfigValue");var Qs=[...new Set(["debug",...Object.keys(Q)])],Ya=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],Ja=l(s=>Ya.includes(s),"isComplexKey"),qt=Qs.filter(s=>!Ja(s)),Qa={...Object.fromEntries(qt.map(s=>[Xt(s),s])),...Object.fromEntries(qt.map(s=>[s.toLowerCase(),s]))},tc={...Object.fromEntries(qt.map(s=>[Xt(s),W(s)])),...Object.fromEntries(qt.map(s=>[s.toLowerCase(),W(s)]))},hn=l(s=>"__"+s,"getLocalPropName"),tr=class tr extends y{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Q).map(([t,i])=>[W(t),i]))}}_flushValueToAttribute(t,i){if(qt.includes(t)){let r=[...new Set([Xt(t),t.toLowerCase()])];for(let o of r)typeof i=="undefined"||i===null?this.removeAttribute(o):this.getAttribute(o)!==i.toString()&&this.setAttribute(o,i.toString())}}_flushValueToState(t,i){this.$[W(t)]!==i&&(typeof i=="undefined"||i===null?this.$[W(t)]=Q[t]:this.$[W(t)]=i)}_setValue(t,i){let r=this,o=un(t,i),n=hn(t);r[n]!==o&&(this._assertSameValueDifferentReference(t,r[n],o),r[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let i=this,r=hn(t);return i[r]}_assertSameValueDifferentReference(t,i,r){this.cfg.debug&&r!==i&&typeof r=="object"&&typeof i=="object"&&JSON.stringify(r)===JSON.stringify(i)&&(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:`,i),console.warn(`[uc-config] "${t}" new value:`,r))}initCallback(){var i;super.initCallback();let t=this;for(let r of qt)this.sub(W(r),o=>{this._setValue(r,o)},!1);for(let r of Qs){let o=(i=t[r])!=null?i:this.$[W(r)];o!==Q[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(t,i,r){if(i===r)return;let o=this,n=Qa[t];o[n]=r}};l(tr,"ConfigClass");var Ue=tr;Ue.bindAttributes(tc);for(let s of Qs)Ue.prototype[s]=void 0;var dn=Ue;var er=class er extends y{constructor(){super(),this.init$={...this.init$,name:"",href:"",title:""}}initCallback(){super.initCallback(),this.sub("name",e=>{if(!e)return;let t=`#uc-icon-${e}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let r=i(e);t=r!=null?r:t}this.$.href=t})})}};l(er,"Icon");var Kt=er;Kt.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><title>{{title}}</title><use set="@href: href;"></use></svg>`;Kt.bindAttributes({name:"name",title:"title"});var pn=l(s=>[...new Set(s)],"uniqueArray");var fn=l(s=>Object.entries(s).filter(([e,t])=>t!==void 0&&t!=="").map(([e,t])=>e==="cdn-operations"||e==="analytics"?t:`${e}/${t}`),"parseObjectToString");var ec="https://ucarecdn.com",Me=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ec},"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 Zt="--uc-img-",ir="unresolved";var sr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),rr=3e3,or=5e3,nr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var gn=Object.create(null),mn;for(let s in Me)gn[Zt+s]=((mn=Me[s])==null?void 0:mn.default)||"";var lr=class lr extends $t{constructor(){super(...arguments);h(this,"cssInit$",gn)}$$(t){return this.$[Zt+t]}set$$(t){for(let i in t)this.$[Zt+i]=t[i]}sub$$(t,i){this.sub(Zt+t,r=>{r===null||r===""||i(r)})}analyticsParams(){return`-/@clib/${Lt}/${Ut}/uc-img/`}initAttributes(t){[...this.attributes].forEach(i=>{Me[i.name]||t.setAttribute(i.name,i.value)})}initIntersection(t,i){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(i(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Me)}attributeChangedCallback(t,i,r){window.setTimeout(()=>{this.$[Zt+t]=r})}};l(lr,"ImgConfig");var Fi=lr;var ar=class ar extends Fi{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!sr&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let i=t.match(/\d+/)[0],r=t.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>or&&this.hasFormatJPG)return or+r;if(Number(o)>rr&&!this.hasFormatJPG)return rr+r}return t}_getCdnModifiers(t,i){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return D(...fn(r))}_getUrlBase(t="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(sr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(t,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return U(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(U(vt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(U(vt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(U(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(U(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Ae(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,i=1,r=!0){let o=t.getBoundingClientRect(),n=i*Math.round(o.width),a=r?"":i*Math.round(o.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(t){let i=l(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)t.addEventListener(o,i)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:nr.PREVIEW,img:this._imgPreview}:{type:nr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=N(this.$$("breakpoints"));return pn(t.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let r=`image-set(${[...i].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{t.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:i,srcset:r}){i&&(t.src=i),r&&(t.srcset=r)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:i,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(ir,""),r.addEventListener("load",()=>{r.removeAttribute(ir),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:t,srcset:i})})}async renderImage(){var t,i;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var r;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};l(ar,"ImgBase");var zi=ar;var cr=class cr extends zi{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",e=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=e?"lazy":"eager")})}};l(cr,"Img");var Bi=cr;var Yt=class Yt extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=I(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};l(Yt,"SimpleBtn"),h(Yt,"styleAttrs",[...j(Yt,Yt,"styleAttrs"),"uc-simple-btn"]);var Jt=Yt;Jt.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;Jt.bindAttributes({dropzone:null});var ur=class ur extends _{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(ur,"StartFrom");var Pe=ur;Pe.template='<div class="uc-content"><slot></slot></div>';function ic(s){return new Promise(e=>{typeof window.FileReader!="function"&&e(!1);try{let t=new FileReader;t.onerror=()=>{e(!0)};let i=l(r=>{r.type!=="loadend"&&t.abort(),e(!1)},"onLoad");t.onloadend=i,t.onprogress=i,t.readAsDataURL(s)}catch{e(!1)}})}l(ic,"checkIsDirectory");function sc(s,e){return new Promise(t=>{let i=0,r=[],o=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(i++,a.file(c=>{i--;let u=new File([c],c.name,{type:c.type||e});r.push({type:"file",file:u,fullPath:a.fullPath}),i===0&&t(r)})):a.isDirectory&&n(a.createReader())},"readEntry"),n=l(a=>{i++,a.readEntries(c=>{i--;for(let u of c)o(u);i===0&&t(r)})},"readReaderContent");o(s)})}l(sc,"readEntryContentAsync");function bn(s){let e=[],t=[];for(let i=0;i<s.items.length;i++){let r=s.items[i];if(r)if(r.kind==="file"){let o=r.type;if(typeof r.webkitGetAsEntry=="function"||typeof r.getAsEntry=="function"){let a=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();t.push(sc(a,o).then(c=>{c&&e.push(...c)}));continue}let n=r.getAsFile();n&&t.push(ic(n).then(a=>{a||e.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(o=>{r.getAsString(n=>{e.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>e)}l(bn,"getDropItems");var B={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},_n=["focus"],rc=100,hr=new Map;function oc(s,e){let t=Math.max(Math.min(s[0],e.x+e.width),e.x),i=Math.max(Math.min(s[1],e.y+e.height),e.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-i)*(s[1]-i))}l(oc,"distance");function dr(s){let e=0,t=document.body,i=new Set,r=l(g=>i.add(g),"handleSwitch"),o=B.INACTIVE,n=l(g=>{s.shouldIgnore()&&g!==B.INACTIVE||(o!==g&&i.forEach(b=>b(g)),o=g)},"setState"),a=l(()=>e>0,"isDragging");r(g=>s.onChange(g));let c=l(()=>{e=0,n(B.INACTIVE)},"onResetEvent"),u=l(()=>{e+=1,o===B.INACTIVE&&n(B.ACTIVE)},"onDragEnter"),p=l(()=>{e-=1,a()||n(B.INACTIVE)},"onDragLeave"),d=l(g=>{g.preventDefault(),e=0,n(B.INACTIVE)},"onDrop"),f=l(g=>{if(s.shouldIgnore())return;a()||(e+=1);let b=[g.x,g.y],w=s.element.getBoundingClientRect(),x=Math.floor(oc(b,w)),v=x<rc,C=g.composedPath().includes(s.element);hr.set(s.element,x);let M=Math.min(...hr.values())===x;C&&M?(g.preventDefault(),n(B.OVER)):n(v&&M?B.NEAR:B.ACTIVE)},"onDragOver"),m=l(async g=>{if(s.shouldIgnore())return;g.preventDefault();let b=await bn(g.dataTransfer);s.onItems(b),n(B.INACTIVE)},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),s.element.addEventListener("drop",m),_n.forEach(g=>{window.addEventListener(g,c)}),()=>{hr.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",m),_n.forEach(g=>{window.removeEventListener(g,c)})}}l(dr,"addDropzone");var yn="uc-drop-area",Qt=`${yn}/registry`,te=class te extends S{constructor(){super(),this.init$={...this.init$,state:B.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[Qt]:null}}isActive(){if(!this.$.isEnabled)return!1;let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,i=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return t&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[Qt]||(this.$[Qt]=new Set),this.$[Qt].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!I(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:I(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:I(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:I(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=dr({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:X.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:X.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let e=this.ref["content-wrapper"];e&&(this._destroyContentWrapperDropzone=dr({element:e,onChange:t=>{var r;let i=(r=Object.entries(B).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();i&&e.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let i=(r=Object.entries(B).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",t=>{let i=N(t);this.$.isEnabled=i.includes(S.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[Qt]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let e=this.cfg.multiple,t=this.cfg.multipleMax,i=this.uploadCollection.size;return!(e&&t&&i>=t||!e&&i>0)}destroyCallback(){var t,i;super.destroyCallback();let e=this.$[Qt];e&&(e.delete(this),e.size===0&&T.deleteCtx(yn)),(t=this._destroyDropzone)==null||t.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};l(te,"DropArea"),h(te,"styleAttrs",[...j(te,te,"styleAttrs"),"uc-drop-area"]);var ee=te;ee.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;ee.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var nc="src-type-",pr=class pr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:S.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:S.sourceTypes.URL,activity:_.activities.URL,textKey:"from-url"}),this.registerType({type:S.sourceTypes.CAMERA,activity:_.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:_.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(S.extSrcList))this.registerType({type:t,activity:_.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:i,activate:r,activityParams:o={}}=t;(r?r():!!i)&&this.set$({"*currentActivityParams":o,"*currentActivity":i})}applyType(t){let i=this._registeredTypes[t];if(!i){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:o=t}=i;this.$["src-type"]=`${nc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};l(pr,"SourceBtn");var ie=pr;ie.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;ie.bindAttributes({type:null});var fr=class fr extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{let t=N(e),i="";t.forEach(r=>{i+=`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};l(fr,"SourceList");var Vi=fr;var Hi=l(()=>{let s=[];return{stack:s,promiseReadJpegChunks:l(t=>new Promise((i,r)=>{let o=2,n=l((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result))}),d.addEventListener("error",f=>{r(`Reader error: ${f}`)}),d.readAsArrayBuffer(u)},"readToView"),a=l(()=>n(t.slice(o,o+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=l(()=>{let u=o;return n(t.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){i(!0);return}let f=p.getUint16(2)-2;return n(t.slice(o,o+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:m}),a()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),a()})}),"promiseReadJpegChunks")}},"readJpegChunks"),lc=l(async s=>{let e=[],{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s),i.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&e.push(o)}),e},"getIccProfile"),wn=l(async(s,e,t)=>{{let i=[],r=[],{promiseReadJpegChunks:o,stack:n}=Hi();await o(s),n.forEach(u=>{if(u.marker===e)return i.push(u.startPos),r.push(u.length)});let a=[s.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+e),p.setUint16(2,u.byteLength+2),a.push(p.buffer),a.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&a.push(s.slice(c,i[u])),c=i[u]+r[u]+4;return a.push(s.slice(c,s.size)),new Blob(a,{type:s.type})}},"replaceJpegChunk"),ac=226,xn=l((s,e)=>wn(s,ac,e.map(t=>t.buffer)),"replaceIccProfile"),cc=l(async s=>{try{return await xn(s,[])}catch(e){throw new Error(`Failed to strip ICC profile: ${e}`)}},"stripIccProfile"),uc=l((s,e,t)=>new Promise((i,r)=>{let o=l(n=>{if(!n){r("Failed to convert canvas to blob");return}i(n)},"callback");s.toBlob(o,e,t),s.width=s.height=1}),"canvasToBlob"),Re=l(()=>{let s=document.createElement("canvas"),e=s.getContext("2d");return{canvas:s,ctx:e}},"createCanvas"),hc=l(s=>{let{ctx:t,canvas:i}=Re();i.width=i.height=50,t.drawImage(s,0,0,50,50);let r=t.getImageData(0,0,50,50).data;i.width=i.height=1;for(let o=3;o<r.length;o+=4)if(r[o]<254)return!0;return!1},"hasTransparency"),dc=l(async s=>{let e=null,{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s),i.forEach(({marker:r,view:o})=>{if(!e&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){e=o;return}}),e},"getExif"),pc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ji,fc=l(()=>new Promise(s=>{if(ji!==void 0)s(ji);else{let e=new Image;e.addEventListener("load",()=>{ji=e.naturalWidth<e.naturalHeight,e.src="//:0",s(ji)}),e.src=pc}}),"isBrowserApplyExifOrientation"),mc=l((s,e)=>{let t,i,r,o;if(!s||s.byteLength<14||s.getUint32(0)!==1165519206||s.getUint16(4)!==0)return;if(s.getUint16(6)===18761)i=!0;else if(s.getUint16(6)===19789)i=!1;else return;if(s.getUint16(8,i)!==42)return;r=8+s.getUint32(10,i);let n=s.getUint16(r-2,i);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(s.byteLength<r+10)return;s.getUint16(r,i)===274&&e(r+8,i),r+=12}},"findExifOrientation"),gc=l((s,e)=>{mc(s,(t,i)=>s.setUint16(t,e,i))},"setExifOrientation"),bc=l(async(s,e,t)=>(t&&gc(e,1),wn(s,225,[e.buffer])),"replaceExif"),_c=l((s,e)=>new Promise((t,i)=>{e&&(s.src=e),s.complete?t(s):(s.addEventListener("load",()=>{t(s)}),s.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),yc=l(s=>_c(new Image,s),"imageLoader"),vc=[1,3],wc=[192,193,194,195,197,198,199,201,202,203,205,206,207],vn={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},xc=l(async s=>{let e=!1,{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s).then(()=>(i.forEach(({marker:r,view:o})=>{if(!e&&wc.indexOf(r)>=0){let n=o.getUint8(5);vc.indexOf(n)<0&&(e=!0)}}),e)).catch(()=>e)},"shouldSkipShrink"),Cn=l((s,e)=>{let t={};return(...i)=>{let r=e(i,t);return r in t?t[r]:t[r]=s(...i)}},"memoize"),An=l((s,e)=>{let[t]=s,i=Object.keys(e).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<i.length;r++){let o=i[r],n=!!e[o];if(o>t&&n||o<t&&!n)return o}return t},"memoKeySerializer"),Tt={R:55,G:110,B:165,A:255},Cc=`rgba(${Tt.R}, ${Tt.G}, ${Tt.B}, ${Tt.A/255})`,En=l((s,e)=>{try{let t=[s-1,e-1,1,1],{canvas:i,ctx:r}=Re();i.width=1,i.height=1;let{canvas:o,ctx:n}=Re();o.width=s,o.height=e,n&&(n.fillStyle=Cc,n.fillRect(...t),r.drawImage(o,s-1,e-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,c=!1;return a&&(c=a[0]===Tt.R&&a[1]===Tt.G&&a[2]===Tt.B&&a[3]===Tt.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${e}.`),!1}},"canvasTest");function Tn(s){return(...e)=>new Promise(t=>{setTimeout(()=>{let i=s(...e);t(i)},0)})}l(Tn,"wrapAsync");var Ac=Tn(Cn(En,An)),Ec=Tn(Cn(En,An)),Sn=l(async(s,e)=>{let t=vn.squareSide.find(n=>n*n>=s*e),i=vn.dimension.find(n=>n>=s&&n>=e);if(!t||!i)throw new Error("Not supported");let[r,o]=await Promise.all([Ac(t,t),Ec(i,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),kn=l(async(s,e,t)=>{try{let{ctx:i,canvas:r}=Re();return r.width=e,r.height=t,i.imageSmoothingQuality="high",i.drawImage(s,0,0,e,t),s instanceof HTMLImageElement&&(s.src="//:0"),s instanceof HTMLCanvasElement&&(s.width=s.height=1),r}catch(i){throw new Error("Canvas resize error",{cause:i})}},"canvasResize"),Tc=l(({img:s,targetW:e,targetH:t})=>kn(s,e,t),"native"),Sc=l(function({sourceW:s,targetW:e,targetH:t,step:i}){let r=[],o=e,n=t;do r.push([o,n]),o=Math.round(o/i),n=Math.round(n/i);while(o<s*i);return r.reverse()},"calcShrinkSteps"),kc=l(({img:s,sourceW:e,targetW:t,targetH:i,step:r})=>Sc({sourceW:e,targetW:t,targetH:i,step:r}).reduce((n,[a,c])=>n.then(u=>Sn(a,c).then(()=>kn(u,a,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),$c=l(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Ic=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),mr=.71,Oc=l((s,e)=>{if(s.width*mr*s.height*mr<e.size)throw new Error("Not required");let t=s.width,i=s.height,r=t/i,o=Math.floor(Math.sqrt(e.size*r)),n=Math.floor(e.size/Math.sqrt(e.size*r));return Sn(o,n).then(()=>{let{ctx:a}=Re();return"imageSmoothingQuality"in a&&!$c()&&!Ic?Tc({img:s,targetW:o,targetH:n}):kc({img:s,sourceW:t,targetW:o,targetH:n,step:mr})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),$n=l(async(s,e)=>{try{if(await xc(s))throw new Error("Should skipped");let i=await Promise.allSettled([dc(s),fc(),lc(s)]),o=!i.some(b=>b.status==="rejected"),[n,a,c]=i,u=await cc(s).catch(()=>s),p=await yc(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Oc(p,e),f="image/jpeg",m=(e==null?void 0:e.quality)||.8;!o&&hc(d)&&(f="image/png",m=void 0);let g=await uc(d,f,m);if(o&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await bc(g,b,w)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await xn(g,c.value)),g}catch(t){let i;throw t instanceof Error&&(i=t.message),typeof t=="string"&&(i=t),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:t})}},"shrinkFile");function Lc(s){let e=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(e)}l(Lc,"createSvgBlobUrl");function gr(s="hsl(209, 21%, 65%)",e=32,t=32){return Lc(`<svg width="${e}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${s}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}l(gr,"fileCssBg");function In(s,e=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),i=t.getContext("2d"),r=new Image,o=new Promise((n,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=e,t.height=e*c):(t.height=e,t.width=e/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,t.width,t.height),i.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){a();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),o}l(In,"generateThumb");var Uc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,On=l(s=>{let e=Uc.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!e.length)return!1;let t=e[1]*e[2],i=16384*16384;return t>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${e[1]}x${e[2]} (${Math.ceil(t/1e3/100)/10}MP).`),!1):{quality:e[3]?e[3]/100:void 0,size:t}},"parseShrink");var Y=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3)}),se=class se extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",L(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",L(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:Y.IDLE,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===_.activities.DETAILS)?this.$["*currentActivity"]=_.activities.DETAILS:this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[i]=t;this._isIntersecting=i.isIntersecting,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),i.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,i=Y.IDLE;t.getValue("errors").length>0?i=Y.FAILED:t.getValue("isUploading")?i=Y.UPLOADING:t.getValue("fileInfo")&&(i=Y.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(U(vt(this.cfg.cdnCname,this._entry.getValue("uuid")),D(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((i=t.getValue("file"))!=null&&i.type.includes("image"))try{let r=await In(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",gr(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",gr(r))}}_subEntry(t,i){let r=this._entry.subscribe(t,o=>{this.isConnected&&i(o)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=i,i&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=i.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{se.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),se.activeInstances.add(this)}_handleState(t){var i,r,o,n;t===Y.FAILED?this.$.badgeIcon="badge-error":t===Y.FINISHED&&(this.$.badgeIcon="badge-success"),t===Y.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===Y.FAILED,isUploading:t===Y.UPLOADING,isFinished:t===Y.FINISHED,progressVisible:t===Y.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((i=this._entry)==null?void 0:i.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message})}destroyCallback(){super.destroyCallback(),se.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return On(this.cfg.imageShrink)}_processShrink(t){return $n(t,this._settingsOfShrink())}async upload(){var r,o,n,a,c;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let u=new AbortController;t.setValue("abortController",u);let p=l(async()=>{let f=t.getValue("file");f&&this.cfg.imageShrink&&(f=await this._processShrink(f).catch(()=>f));let m=f||t.getValue("externalUrl")||t.getValue("uuid"),b={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:w=>{if(w.isComputable){let x=w.value*100;t.setValue("uploadProgress",x)}},signal:u.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",m,b),xs(m,b)},"uploadTask"),d=await this.$["*uploadQueue"].add(p);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(n=(o=(r=d.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:d.mimeType,uuid:d.uuid,cdnUrl:(a=t.getValue("cdnUrl"))!=null?a:d.cdnUrl,cdnUrlModifiers:(c=t.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(u){u instanceof xt&&u.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:u}),t===this._entry&&this._debouncedCalculateState()}}}};l(se,"FileItem");var re=se;re.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div class="uc-file-name-wrapper"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;re.activeInstances=new Set;var Pt=class Pt extends y{constructor(){super();h(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",l(t=>{this._mouseDownTarget=t.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",l(t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};l(Pt,"Modal"),h(Pt,"styleAttrs",[...j(Pt,Pt,"styleAttrs"),"uc-modal"]),h(Pt,"StateConsumerScope","modal");var Fe=Pt;Fe.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Gi=l((s,e)=>{let t,i,r,o=l((...n)=>{t?(clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=e&&(s(...n),r=Date.now())},Math.max(e-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),o},"throttle");var br=class br extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",_.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",Gi(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit($.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit($.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),i={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=i.failed===0&&t.errors.length===0,c=!1,u=!1,p=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&r)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!t.group:!0;p=i.total===i.succeed&&r&&a&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:i.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(t){let i=l(r=>{let o=t[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return t.uploading>0?i("uploading"):t.failed>0?i("failed"):t.succeed>0?i("succeed"):i("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let i=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};l(br,"UploadList");var De=br;De.template=`<uc-activity-header><span class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var _r=class _r extends S{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:X.URL_TAB}),this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let i=t.target.value;this.set$({importDisabled:!i})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(_r,"UrlSource");var Ne=_r;Ne.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var yr=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var vr=class vr extends S{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:yr(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",l(()=>{yr()&&this._subscribePermissions(),this._capture()},"_onActivate"));h(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));h(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_setPermissionsState",L(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let i=await navigator.mediaDevices.getUserMedia(t);i.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=i,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.error("Failed to capture camera",i)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),i=`camera-${t}.jpeg`,r="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],i,{lastModified:t,type:r});this.api.addFileFromObject(n,{source:X.CAMERA}),this.set$({"*currentActivity":_.activities.UPLOAD_LIST})},r)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",i=>{this.$.videoTransformCss=i?"scaleX(-1)":null});try{let r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));r.length>1&&(this.$.cameraSelectOptions=r,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=r[0])==null?void 0:t.value}catch{}}};l(vr,"CameraSource");var ze=vr;ze.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" set="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var wr=class wr extends S{constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};l(wr,"UploadCtxProviderClass");var Wi=wr;Wi.EventType=$;var Ln=Wi;var xr=class xr extends S{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};l(xr,"ProgressBarCommon");var Be=xr;Be.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var Cr=class Cr extends y{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let i=this._value;if(this._value=t,t===0&&i>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};l(Cr,"ProgressBar");var Ve=Cr;Ve.template='<div ref="line" class="uc-progress"></div>';var at="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Un(...s){return s.reduce((e,t)=>{if(typeof t=="string")return e[t]=!0,e;for(let i of Object.keys(t))e[i]=t[i];return e},{})}l(Un,"normalize");function F(...s){let e=Un(...s);return Object.keys(e).reduce((t,i)=>(e[i]&&t.push(i),t),[]).join(" ")}l(F,"classNames");function Mn(s,...e){let t=Un(...e);for(let i of Object.keys(t))s.classList.toggle(i,t[i])}l(Mn,"applyClassNames");var Pn=l(s=>{if(!s)return H;let e=ao(s).filter(t=>H.includes(t));return e.length===0?H:e},"parseTabs");function Rn(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":H,"*tabId":O.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:at,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:zt(H),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let e=s.querySelectorAll("img");for(let t of e){let i=t.src;t.src=at,t.src=i}s.$["*networkProblems"]=!1},"*on.apply":e=>{if(!e)return;let t=s.$["*originalUrl"],i=D(wt(e),"preview"),r=U(t,i),o={originalUrl:t,cdnUrlModifiers:i,cdnUrl:r,transformations:e};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(Rn,"initState");var Fn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='puc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#puc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#suc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#suc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#suc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#suc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#suc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#suc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#suc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#suc-icon-id__h)'/><defs><linearGradient id='suc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Dn=`${Fn} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${at}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var Xi=class Xi extends y{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",L(this._showLoader.bind(this),300));this.init$={...this.init$,...Rn(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((i,r)=>{let o=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(i(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=ai(this.$.cdnUrl),i=vt(this.$.cdnUrl,t);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let r=Jr(this.$.cdnUrl),o=ro(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=vt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===O.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(U(this.$["*originalUrl"],D("json"))),i=await fetch(t).then(n=>n.json()),{width:r,height:o}=i;this.$["*imageSize"]={width:r,height:o},this.$["*tabId"]===O.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==at&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let i=this.ref["img-el"];i.src!==t&&(this._imgLoading=!0,i.src=t||at)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=ki(t)}),this.sub("tabs",t=>{this.$["*tabList"]=Pn(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=F("uc-image",{"uc-image_hidden_to_cropper":t===O.CROP,"uc-image_hidden_effects":t!==O.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let i=this.$["*originalUrl"],r=D(wt(t),"preview"),o=U(i,r),n={originalUrl:i,cdnUrlModifiers:r,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(Xi,"CloudImageEditorBlock"),h(Xi,"styleAttrs",["uc-cloud-image-editor"]);var ct=Xi;ct.template=Dn;ct.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Ar=class Ar extends y{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return;if(e===""&&t.height<=A&&t.width<=A)return!0;let i=t.height<=A&&(e.includes("n")||e.includes("s")),r=t.width<=A&&(e.includes("e")||e.includes("w"));return i||r}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:r,height:o}=e,n=this.ref["svg-el"],a=Z("mask",{id:"backdrop-mask"}),c=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=Z("rect",{x:t,y:i,width:r,height:o,fill:"black"});a.appendChild(c),a.appendChild(u);let p=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(p),n.appendChild(a),this._backdropMask=a,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:r,height:o}=e;this._backdropMaskInner&&Ot(this._backdropMaskInner,{x:t,y:i,width:r,height:o})}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:i,pathNode:r,interactionNode:o,groupNode:n}=t,a=i==="",c=i.length===2,{x:u,y:p,width:d,height:f}=e;if(a){let g={x:u+d/3,y:p+f/3,width:d/3,height:f/3};Ot(o,g)}else{let g=Et(Math.min(d,f)/(24*2+34)/2,0,1),{d:b,center:w}=c?zo(e,i,g):Bo(e,i,g),x=Math.max(Ns*Et(Math.min(d,f)/Ns/3,0,1),No);Ot(o,{x:w[0]-x,y:w[1]-x,width:x*2,height:x*2}),Ot(r,{d:b})}let m=this._shouldThumbBeDisabled(i);n.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Ot(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let r=`${["n","","s"][t]}${["w","","e"][i]}`,o=Z("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=Z("rect",{fill:"transparent"}),a=Z("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(n),e[r]={direction:r,pathNode:a,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return e}_createGuides(){let e=Z("svg"),t=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let r=Z("line",{x1:`${Ie*i}%`,y1:"0%",x2:`${Ie*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(r)}for(let i=1;i<=2;i++){let r=Z("line",{x1:"0%",y1:`${Ie*i}%`,x2:"100%",y2:`${Ie*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(r)}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this.ref["svg-el"],t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))t.appendChild(o);e.appendChild(t),this._frameThumbs=r,this._frameGuides=i}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(this._shouldThumbBeDisabled(e))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-o,c=t.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(e){this._updateCursor(),this.$.dragging&&(e.stopPropagation(),e.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(e){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this.ref["svg-el"],{x:i,y:r}=t.getBoundingClientRect(),o=e.x-i,n=e.y-r,a=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[a,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(e,t){var u,p;let[i,r]=t,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],a=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=a?a.width/a.height:void 0;if(e===""?n=jo({rect:n,delta:[i,r],imageBox:o}):n=Ho({rect:n,delta:[i,r],direction:e,aspectRatio:c,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return Ht(Wt(n),this.$["*imageBox"])}_handleSvgPointerMove_(e){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Go(n,[e.x,e.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let e=this._hoverThumb;this.ref["svg-el"].style.cursor=e?Vo(e.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(e){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=A||e.width<=A,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",e=>{this._frameGuides&&this._frameGuides.setAttribute("class",F({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&e,"uc-guides--semi-hidden":!this._guidesHidden&&!e}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(Ar,"CropFrame");var je=Ar;je.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var Er=class Er extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=F({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(Er,"EditorButtonControl");var _t=Er;_t.template=`<button type="button" role="option"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Pc(s){let e=s+90;return e=e>=360?0:e,e}l(Pc,"nextAngle");function Rc(s,e){return s==="rotate"?Pc(e):["mirror","flip"].includes(s)?!e:null}l(Rc,"nextValue");var Tr=class Tr extends _t{initCallback(){super.initCallback(),this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e)}),this.$["on.click"]=e=>{let t=this.$["*cropperEl"].getValue(this._operation),i=Rc(this._operation,t);this.$["*cropperEl"].setValue(this._operation,i)}}};l(Tr,"EditorCropButtonControl");var oe=Tr;var He={FILTER:"filter",COLOR_OPERATION:"color_operation"},ut="original",Sr=class Sr extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,i){this._controlType=t==="filter"?He.FILTER:He.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ut?void 0:this.$.value,filter:this._filter===ut?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:i}=st[this._operation],[r,o]=t;this.$.min=r,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===He.FILTER){let a=o;if(n){let{name:c,amount:u}=n;a=c===this._filter?u:o}this.$.value=a,this.$.defaultValue=a}if(this._controlType===He.COLOR_OPERATION){let a=typeof n!="undefined"?n:i;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===He.FILTER?this._filter===ut?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let i=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=i})}};l(Sr,"EditorSlider");var Ge=Sr;Ge.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function We(s){let e=new Image;return{promise:new Promise((r,o)=>{e.src=s,e.onload=r,e.onerror=o}),image:e,cancel:l(()=>{e.naturalWidth===0&&(e.src=at)},"cancel")}}l(We,"preloadImage");function Xe(s){let e=[];for(let o of s){let n=We(o);e.push(n)}let t=e.map(o=>o.image);return{promise:Promise.allSettled(e.map(o=>o.promise)),images:t,cancel:l(()=>{e.forEach(o=>{o.cancel()})},"cancel")}}l(Xe,"batchPreloadImages");var kr=class kr extends _t{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,i=Math.ceil(t*e),r=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==ut?{name:this._filter,amount:o}:void 0,U(this._originalUrl,D(ci,wt(n),`quality/${r}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(e,t){var r;if(e[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:a,cancel:c}=We(o);this._cancelPreload=c,a.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(r=this._cancelPreload)==null||r.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===ut,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("isOriginal",t=>{this.$.iconSize=t?40:20}),this.sub("active",t=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=t?"1":"0";let r=this.ref["preview-el"];t?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let i=await this.proxyUrl(this._previewSrc()),r=this.ref["preview-el"];r.style.backgroundImage&&(r.style.backgroundImage="none",r.style.backgroundImage=`url(${i})`)}})}destroyCallback(){var e,t;super.destroyCallback(),(e=this._observer)==null||e.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};l(kr,"EditorFilterControl");var Ft=kr;Ft.template=`<button type="button" role="option"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var $r=class $r extends _t{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:i}=st[this._operation],r=t[this._operation],o=typeof r!="undefined"?r!==i:!1;this.$.active=o})}};l($r,"EditorOperationControl");var ne=$r;function Nn(s,e){let t={};for(let i of e){let r=s[i];(s.hasOwnProperty(i)||r!==void 0)&&(t[i]=r)}return t}l(Nn,"pick");function le(s,e,t){let r=window.devicePixelRatio,o=Math.min(Math.ceil(e*r),3e3),n=r>=2?"lightest":"normal";return U(s,D(ci,wt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}l(le,"viewerImageSrc");function Fc(s){return s?[({dimensions:t,coords:i})=>[...t,...i].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:i})=>t.every(r=>r>0)&&i.every(r=>r>=0)].every(t=>t(s)):!0}l(Fc,"validateCrop");var Ir=class Ir extends y{constructor(){super();h(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=L(this._commit.bind(this),300),this._handleResizeThrottled=Gi(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],i=Nn(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...i};this.$["*operations"]=r}_initCanvas(){let t=this.ref["canvas-el"],i=t.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${o}px`,t.width=r*n,t.height=o*n,i==null||i.scale(n,n),this._canvas=t,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,i=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Gt({width:t.naturalWidth,height:t.naturalHeight},o),c;if(a.width>n.width-i*2||a.height>n.height-i*2){let u=a.width/a.height,p=n.width/n.height;if(u>p){let d=n.width-i*2,f=d/u,m=0+i,g=i+(n.height-i*2)/2-f/2;c={x:m,y:g,width:d,height:f}}else{let d=n.height-i*2,f=d*u,m=i+(n.width-i*2)/2-f/2,g=0+i;c={x:m,y:g,width:f,height:d}}}else{let{width:u,height:p}=a,d=i+(n.width-i*2)/2-u/2,f=i+(n.height-i*2)/2-p/2;c={x:d,y:f,width:u,height:p}}this.$["*imageBox"]=Wt(c)}_alignCrop(){var f;let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[m,g],coords:[b,w]}=n,{width:x}=Gt(this._imageSize,o),v=a/x;t=Ht(Wt({x:c+b*v,y:u+w*v,width:m*v,height:g*v}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],d=p?p.width/p.height:void 0;if(!Wo(t,i)||d&&!Xo(t,d)){let m=i.width/i.height,g=i.width,b=i.height;d&&(m>d?g=Math.min(i.height*d,i.width):b=Math.min(i.width/d,i.height)),t={x:i.x+i.width/2-g/2,y:i.y+i.height/2-b/2,width:g,height:b}}this.$["*cropBox"]=Ht(Wt(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let i=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:c}=o,u=Gt({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=F({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=i,{width:c,height:u}=Gt(this._imageSize,o),{width:p,height:d}=t,f=n/c,m=a/u;return[Et(Math.round(p/f),1,c),Et(Math.round(d/m),1,u)]}_getCropTransformation(){let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:c,y:u}=i,{width:p,height:d}=Gt(this._imageSize,o),{x:f,y:m}=t,g=n/p,b=a/d,w=this._getCropDimensions(),x={dimensions:w,coords:[Et(Math.round((f-c)/g),0,p-w[0]),Et(Math.round((m-u)/b),0,d-w[1])]};if(!Fc(x)){console.error("Cropper is trying to create invalid crop object",{payload:x});return}if(!(w[0]===p&&w[1]===d))return x}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:i,mirror:r,flip:o}=t,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:i,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(t,i){this.$["*operations"]={...this.$["*operations"],[t]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:i})}catch(r){console.error("Failed to activate cropper",{error:r})}this._observer=new ResizeObserver(([r])=>{r.contentRect.width>0&&r.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var i;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=F({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(i=this._observer)==null||i.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),i=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(i,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,a=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-a)/o}px)`,this.style.transformOrigin=`${n}px ${a}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,i){var p;let r=this.offsetWidth;i={...i,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(le(t,r,i)),{promise:n,cancel:a,image:c}=We(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=a,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(t){let i="crop",r=this.$["*loadingOperations"];return r.get(i)||r.set(i,new Map),r.get(i).get(t)||(r.set(i,r.get(i).set(t,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(i))!=null&&o.has(t)&&(r.get(i).delete(t),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};l(Ir,"EditorImageCropper");var qe=Ir;qe.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Or(s,e,t){let i=Array(t);t--;for(let r=t;r>=0;r--)i[r]=Math.ceil((r*e+(t-r)*s)/t);return i}l(Or,"linspace");function Dc(s){return s.reduce((e,t,i)=>i<s.length-1?[...e,[t,s[i+1]]]:e,[])}l(Dc,"splitBySections");function Nc(s,e,t){let i=Dc(s).find(([r,o])=>r<=e&&e<=o);return s.map(r=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(e-i[0])/o;return i[0]===r?e>t?1:1-n:i[1]===r?e>=t?n:1:0})}l(Nc,"calculateOpacities");function zc(s,e){return s.map((t,i)=>t<e?s.length-i:i)}l(zc,"calculateZIndices");function zn(s,e){let t=st[s].keypointsNumber,{range:i,zero:r}=st[s];return[...new Set([...Or(i[0],r,t+1),...Or(r,i[1],t+1),r,e])].sort((o,n)=>o-n)}l(zn,"keypointsRange");var Lr=class Lr extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=L(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var r;(r=i==null?void 0:i.get(t))!=null&&r.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}async _imageSrc({url:e=this._url,filter:t=this._filter,operation:i,value:r}={}){let o={...this._transformations};i&&(o[i]=t?{name:t,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(le(e,n,o))}async _constructKeypoint(e,t){return{src:await this._imageSrc({operation:e,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}async _addKeypoint(e,t,i){let r=l(()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(r())return;let o=await this._constructKeypoint(e,i),n=new Image;n.src=o.src;let a=this._handleImageLoading(o.src);n.addEventListener("load",a,{once:!0}),n.addEventListener("error",a,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(r())return;let c=this._keypoints,u=c.findIndex(d=>d.value>i),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(n,p),this._update(e,i))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(e){e=typeof e=="string"?parseInt(e,10):e,this._update(this._operation,e),this._addKeypointDebounced(this._operation,this._filter,e)}_update(e,t){this._operation=e,this._value=t;let{zero:i}=st[e],r=this._keypoints.map(a=>a.value),o=Nc(r,t,i),n=zc(r,i);for(let[a,c]of Object.entries(this._keypoints))c.opacity=o[a],c.zIndex=n[a];this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){let e=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&e.appendChild(this._previewImage);let t=document.createElement("div");e.appendChild(t);let i=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=Xe(i);r.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await o,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(e),this._flush())}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:e,filter:t,operation:i,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=zn(i,r),n=await Promise.all(o.map(c=>this._imageSrc({url:e,filter:t,operation:i,value:c}))),{cancel:a}=Xe(n);this._cancelBatchPreload=a}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:!0}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:e,operation:t,value:i,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=e,this._operation=t||"initial",this._value=i,this._filter=r,this._fromViewer=o,typeof i!="number"&&!r){let a=await this._imageSrc({operation:t,value:i});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=await Promise.all(zn(t,i).map(a=>this._constructKeypoint(t,a))),this._update(t,i),this._initNodes()}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=F({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(Lr,"EditorImageFader");var qi=Lr;var Bc=1,Ur=class Ur extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;Math.abs(i)>Bc?this.scrollLeft+=i:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};l(Ur,"EditorScroller");var Ke=Ur;Ke.template=" <slot></slot> ";function Vc(s){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${s}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${s}" data-id="${s}" icon="${s}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${s}" ></uc-btn-ui></uc-presence-toggle>`}l(Vc,"renderTabToggle");function jc(s){return`<uc-presence-toggle id="tab_${s}" class="uc-tab-content" set="visible: presence.tabContent.${s}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${s}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}l(jc,"renderTabContent");var Mr=class Mr extends y{constructor(){super();h(this,"_updateInfoTooltip",L(()=>{var n,a;let t=this.$["*editorTransformations"],i=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===O.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(ut);else if(this.$["*tabId"]===O.TUNING&&i){o=!0;let c=(t==null?void 0:t[i])||st[i].zero;r=this.l10n(i)+" "+c}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ut,"*currentOperation":null,showLoader:!1,filters:no,colorOperations:oo,cropOperations:lo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let i=t.currentTarget.getAttribute("data-id");i&&this._activateTab(i,{fromViewer:!1})},tab_role:"tab",[`tab_${O.TUNING}`]:`tab_${O.TUNING}`,[`tab_${O.CROP}`]:`tab_${O.CROP}`,[`tab_${O.FILTERS}`]:`tab_${O.FILTERS}`},this._debouncedShowLoader=L(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===O.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let i=new ne;return i.operation=t,i}_createFilterControl(t){let i=new Ft;return i.filter=t,i}_createToggleControl(t){let i=new oe;return i.operation=t,i}_renderControlsList(t){let i=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===O.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):t===O.FILTERS?[ut,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):t===O.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);r.appendChild(n)}),[...r.children].forEach((o,n)=>{n===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),i.innerHTML="",i.appendChild(r)}_activateTab(t,{fromViewer:i}){this.$["*tabId"]=t,t===O.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let r of H){let o=r===t,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(t){let i=this.ref[`controls-list-${t}`];i&&(i.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(le(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=Xe([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let i=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let i=!1;for(let[,r]of t.entries()){if(i)break;for(let[,o]of r.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let i of H){this.$[`presence.tabToggle.${i}`]=t.includes(i);let r=this.ref[`tab-toggle-${i}`];r.style.gridColumn=t.indexOf(i)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(Mr,"EditorToolbar");var Ze=Mr;Ze.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${H.map(jc).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${H.map(Vc).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider;" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider;" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var Pr=class Pr extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":""},this.defineAccessor("active",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return F("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",e=>{this._iconSingle=!this.$.text,this._iconHidden=!e,this.$.iconCss=this._iconCss()}),this.sub("theme",e=>{e!=="custom"&&(this.className=`uc-${e}`)}),this.sub("text",e=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",e=>{this.$["aria-role"]=e||""}),this.defineAccessor("aria-controls",e=>{this.$["aria-controls"]=e||""})}set reverse(e){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(Pr,"BtnUi");var ae=Pr;ae.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ae.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var Rr=class Rr extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let e=this.ref["line-el"];e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",e=>{typeof e=="boolean"&&(e?this._start():this._stop())})}_start(){this._active=!0;let{width:e}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(Rr,"LineLoaderUi");var Ye=Rr;Ye.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var Ki={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Fr=class Fr extends y{constructor(){super(),this._visible=!1,this._visibleStyle=Ki.visible,this._hiddenStyle=Ki.hidden,this._externalTransitions=!1,this.defineAccessor("styles",e=>{e&&(this._externalTransitions=!0,this._visibleStyle=e.visible,this._hiddenStyle=e.hidden)}),this.defineAccessor("visible",e=>{typeof e=="boolean"&&(this._visible=e,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Mn(this,{[Ki.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(Ki.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};l(Fr,"PresenceToggle");var Je=Fr;Je.template="<slot></slot> ";var Dr=class Dr extends y{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let r=this.ref["input-el"];i?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:r}=i.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",a.appendChild(u);for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(a),this._stepsCount=n}destroyCallback(){var t;(t=this._observer)==null||t.disconnect()}};l(Dr,"SliderUi");var Qe=Dr;Qe.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var Nr=class Nr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",i=>{i&&(this.$.cdnUrl=i)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let i=t.detail;this.entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new ct,i=this.$.cdnUrl,r=this.cfg.cropPreset,o=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",i),r&&t.setAttribute("crop-preset",r),o&&t.setAttribute("tabs",o),t.addEventListener("apply",n=>{let a=n;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),t.addEventListener("cancel",n=>{let a=n;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),t.addEventListener("change",n=>{let a=n;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(Nr,"CloudImageEditorActivity");var Zi=Nr;var Hc=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Bn=l(function(s,e="i"){let t=s.split("*").map(Hc);return new RegExp("^"+t.join(".+")+"$",e)},"wildcardRegexp");var Gc=l(s=>Object.keys(s).reduce((t,i)=>{let r=s[i],o=Object.keys(r).reduce((n,a)=>{let c=r[a];return n+`${a}: ${c};`},"");return t+`${i}{${o}}`},""),"styleToCss");function Vn({textColor:s,backgroundColor:e,linkColor:t,linkColorHover:i,secondaryColor:r,secondaryHover:o,secondaryForegroundColor:n,fontFamily:a,fontSize:c,radius:u}){let p=`solid 1px ${r}`;return Gc({body:{color:s,"background-color":e,"font-family":a,"font-size":c},".side-bar":{background:"inherit","border-right":p},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":p},".list-table-body .list-items":{"border-bottom":p},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:i},".main-content.loading":{background:`${e} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:i},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:i},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:i},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:i,background:"none"},"input[type=submit], .button, button":{color:n,background:r,"box-shadow":"none",border:"none","border-radius":u},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":u,background:r,border:p}})}l(Vn,"buildStyles");var St={};window.addEventListener("message",s=>{let e;try{e=JSON.parse(s.data)}catch{return}if((e==null?void 0:e.type)in St){let t=St[e.type];for(let[i,r]of t)s.source===i&&r(e)}});var jn=l(function(s,e,t){s in St||(St[s]=[]),St[s].push([e,t])},"registerMessage"),Hn=l(function(s,e){s in St&&(St[s]=St[s].filter(t=>t[0]!==e))},"unregisterMessage");function Gn(s){let e=[];for(let[t,i]of Object.entries(s))i==null||typeof i=="string"&&i.length===0||e.push(`${t}=${encodeURIComponent(i)}`);return e.join("&")}l(Gn,"queryString");var zr=class zr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.EXTERNAL);h(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let i=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:r,source:o})}this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",t=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let i=N(this.cfg.externalSourcesPreferredTypes);for(let r of i){let o=Bn(r);for(let[n,a]of Object.entries(t.alternatives))if(o.test(n))return a}}return t.url}sendMessage(t){var i,r;(r=(i=this._iframe)==null?void 0:i.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:Vn(t)})}remoteUrl(){var u,p;let{pubkey:t,remoteTabSessionKey:i,socialBaseUrl:r}=this.cfg,{externalSourceType:o}=this.activityParams,a={lang:((p=(u=this.l10n("social-source-lang"))==null?void 0:u.split("-"))==null?void 0:p[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:i},c=new URL(`/window3/${o}`,r);return c.search=Gn(a),c.toString()}mountIframe(){let t=ls({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),jn("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Hn("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(zr,"ExternalSource");var ti=zr;ti.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon set="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div></div><div set="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var Br=class Br extends S{constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,ns(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let a=this._createValidationInput();this.appendChild(a),this._validationInputElement=a}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let a=(i=t.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(a);return}let r=t.group?t.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let a of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=a,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};l(Br,"FormInput");var Yi=Br;var Vr=class Vr extends _{};l(Vr,"ActivityHeader");var Ji=Vr;var jr=class jr extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var i;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((i=this.$.options.find(r=>r.value==this.value))==null?void 0:i.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let i="";t==null||t.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};l(jr,"Select");var ei=jr;ei.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var ts=class ts extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",e=>{this.toggleAttribute("hidden",!!e)})}};l(ts,"Copyright"),h(ts,"template",`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Qi=ts;var ce=class ce extends rt{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",e=>{this.set$({isHidden:I(e)})}),this.sub("*modalActive",e=>{this._lastModalActive!==e&&this.emit(e?$.MODAL_OPEN:$.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=e},!1)}};l(ce,"FileUploaderRegular"),h(ce,"styleAttrs",[...j(ce,ce,"styleAttrs"),"uc-file-uploader-regular"]);var ue=ce;ue.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;ue.bindAttributes({headless:null});var he=class he extends rt{initCallback(){super.initCallback();let e=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=_.activities.UPLOAD_LIST:this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};l(he,"FileUploaderMinimal"),h(he,"styleAttrs",[...j(he,he,"styleAttrs"),"uc-file-uploader-minimal"]);var ii=he;ii.template=`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var de=class de extends rt{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let e=this.$["*history"];return e.length>1&&e[e.length-1]!==_.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let e=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(e.initActivity||_.activities.START_FROM)&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};l(de,"FileUploaderInline"),h(de,"styleAttrs",[...j(de,de,"styleAttrs"),"uc-file-uploader-inline"]);var si=de;si.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var pe=class pe extends ct{initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}};l(pe,"CloudImageEditor"),h(pe,"styleAttrs",[...j(pe,pe,"styleAttrs"),"uc-wgt-common"]);var es=pe;function is(s){for(let e in s){let t=[...e].reduce((i,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),i+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),s[e].reg&&s[e].reg(t)}}l(is,"defineComponents");var Hr="UC";async function Wn(s,e=!1){return new Promise((t,i)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Hr]){t(window[Hr]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{i()},r.onload=()=>{let o=window[Hr];e&&is(o),t(o)},document.head.appendChild(r)})}l(Wn,"loadFileUploaderFrom");return il(Wc);})();
|
|
29
|
+
`))}}return e}l(ro,"operationsToTransformations");var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),H=[O.CROP,O.TUNING,O.FILTERS],oo=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],no=["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"],lo=["rotate","mirror","flip"],st=Object.freeze({brightness:{zero:q.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:q.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:q.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:q.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:q.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:q.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:q.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:q.enhance,range:[0,100],keypointsNumber:1},filter:{zero:q.filter,range:[0,100],keypointsNumber:1}});var ao=l(s=>s?s.split(",").map(e=>e.trim()):[],"deserealizeCsv"),zt=l(s=>s?s.join(","):"","serializeCsv");var $l="https://ucarecdn.com",Il="https://upload.uploadcare.com",Ol="https://social.uploadcare.com",Q={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:zt(H),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:$l,baseUrl:Il,socialBaseUrl:Ol,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var $=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),cs=class cs{constructor(e){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=e}bindTarget(e){this._targets.add(e)}unbindTarget(e){this._targets.delete(e)}_dispatch(e,t){var i;for(let r of this._targets)r.dispatchEvent(new CustomEvent(e,{detail:t}));(i=this._debugPrint)==null||i.call(this,()=>{let r=t&&typeof t=="object"?{...t}:t;return[`event "${e}"`,r]})}emit(e,t,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let r=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(e,typeof t=="function"?t():t),this._timeoutStore.delete(e)},r);this._timeoutStore.set(e,o)}};l(cs,"EventEmitter");var ui=cs;function L(s,e){let t,i=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),e)},"debounced");return i.cancel=()=>{clearTimeout(t)},i}l(L,"debounce");var co="--uploadcare-blocks-window-height",xe=class xe{static registerClient(e){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(e)}static unregisterClient(e){this.clientsRegistry.delete(e),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(co)}};l(xe,"WindowHeightTracker"),h(xe,"clientsRegistry",new Set),h(xe,"flush",L(()=>{document.documentElement.style.setProperty(co,`${window.innerHeight}px`)},100));var Ce=xe;var uo=l(s=>{var i;let e=new Intl.Locale(s),t="ltr";return typeof e.getTextInfo=="function"&&e.getTextInfo().direction?t=e.getTextInfo().direction:"textInfo"in e&&((i=e.textInfo)!=null&&i.direction)&&(t=e.textInfo.direction),t},"getLocaleDirection");var hi=l((s,e)=>new Intl.PluralRules(s).select(e),"getPluralForm");var Ll=l(s=>s,"DEFAULT_TRANSFORMER"),us="{{",po="}}",ho="plural:";function Ae(s,e,t={}){var n;let{openToken:i=us,closeToken:r=po,transform:o=Ll}=t;for(let a in e){let c=(n=e[a])==null?void 0:n.toString();s=s.replaceAll(i+a+r,typeof c=="string"?o(c):c)}return s}l(Ae,"applyTemplateData");function fo(s){let e=[],t=s.indexOf(us);for(;t!==-1;){let i=s.indexOf(po,t),r=s.substring(t+2,i);if(r.startsWith(ho)){let o=s.substring(t+2,i).replace(ho,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));e.push({variable:r,pluralKey:n,countVariable:a})}t=s.indexOf(us,i)}return e}l(fo,"getPluralObjects");var mo=l(({element:s,attribute:e,onSuccess:t,onTimeout:i,timeout:r=300})=>{let o=s.getAttribute(e);if(o!==null){t(o);return}let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[e]});let a=setTimeout(()=>{n.disconnect(),i()},r),c=l(u=>{let p=s.getAttribute(e);u.type==="attributes"&&u.attributeName===e&&p!==null&&(clearTimeout(a),n.disconnect(),t(p))},"handleMutation")},"waitForAttribute");function go(s){return Object.prototype.toString.call(s)==="[object Object]"}l(go,"isObject");var Ul=/\W|_/g;function Ml(s){return s.split(Ul).map((e,t)=>e.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+e.slice(1)).join("")}l(Ml,"camelizeString");function bo(s,{ignoreKeys:e}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>gt(t,{ignoreKeys:e})):s}l(bo,"camelizeArrayItems");function gt(s,{ignoreKeys:e}={ignoreKeys:[]}){if(Array.isArray(s))return bo(s,{ignoreKeys:e});if(!go(s))return s;let t={};for(let i of Object.keys(s)){let r=s[i];if(e.includes(i)){t[i]=r;continue}go(r)?r=gt(r,{ignoreKeys:e}):Array.isArray(r)&&(r=bo(r,{ignoreKeys:e})),t[Ml(i)]=r}return t}l(gt,"camelizeKeys");var Pl=l(s=>new Promise(e=>setTimeout(e,s)),"delay");function bs({libraryName:s,libraryVersion:e,userAgent:t,publicKey:i="",integration:r=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:i,libraryName:s,libraryVersion:e,languageName:o,integration:r});let n=[s,e,i].filter(Boolean).join("/"),a=[o,r].filter(Boolean).join("; ");return`${n} (${a})`}l(bs,"getUserAgent$1");var Rl={factor:2,time:100};function Fl(s,e=Rl){let t=0;function i(r){let o=Math.round(e.time*e.factor**t);return r({attempt:t,retry:l(a=>Pl(a!=null?a:o).then(()=>(t+=1,i(r))),"retry")})}return l(i,"runAttempt"),i(s)}l(Fl,"retrier");var Cs=class Cs extends Error{};l(Cs,"UploadcareError");var Ee=Cs,pi=class pi extends Ee{constructor(t){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,pi.prototype),this.originalProgressEvent=t}};l(pi,"NetworkError");var Bt=pi,gi=l((s,e)=>{s&&(s.aborted?Promise.resolve().then(e):s.addEventListener("abort",()=>e(),{once:!0}))},"onCancel"),fi=class fi extends Ee{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,fi.prototype)}};l(fi,"CancelError");var xt=fi,Dl=500,yo=l(({check:s,interval:e=Dl,timeout:t,signal:i})=>new Promise((r,o)=>{let n,a;gi(i,()=>{n&&clearTimeout(n),o(new xt("Poll cancelled"))}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new xt("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(i)).then(u=>{u?(a&&clearTimeout(a),r(u)):n=setTimeout(c,e)}).catch(u=>{a&&clearTimeout(a),o(u)})}catch(u){a&&clearTimeout(a),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),k={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},bi="application/octet-stream",vo="original",Ct=l(({method:s,url:e,data:t,headers:i={},signal:r,onProgress:o})=>new Promise((n,a)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,e,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",gi(r,()=>{p=!0,c.abort(),a(new xt)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:e,data:t,headers:i||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let x=w.split(": "),v=x.shift(),C=x.join(": ");v&&typeof v!="undefined"&&(m[v]=C)});let g=c.response,b=c.status;n({request:d,data:g,headers:m,status:b})}},c.onerror=d=>{p||a(new Bt(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),t?c.send(t):c.send()}),"request");function Nl(s,...e){return s}l(Nl,"identity");var zl=l(({name:s})=>s?[s]:[],"getFileOptions"),Bl=Nl,Vl=l(()=>new FormData,"getFormData"),wo=l(s=>!1,"isBuffer"),_i=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),yi=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),vi=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),Vt=l(s=>_i(s)||yi(s)||wo()||vi(s),"isFileData"),jl=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Hl=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),Gl=l(s=>!!s&&typeof s=="object"&&"data"in s&&Vt(s.data),"isFileValue");function xo(s,e,t){if(Array.isArray(t))for(let i of t)xo(s,`${e}[]`,i);else if(Gl(t)){let{name:i,contentType:r}=t,o=Bl(t.data,i,r!=null?r:bi),n=zl({name:i,contentType:r});s.push([e,o,...n])}else if(Hl(t))for(let[i,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${e}[${i}]`,String(r)]);else jl(t)&&t&&s.push([e,t.toString()])}l(xo,"collectParams");function Wl(s){let e=[];for(let[t,i]of Object.entries(s))xo(e,t,i);return e}l(Wl,"getFormDataParams");function wi(s){let e=Vl(),t=Wl(s);for(let i of t){let[r,o,...n]=i;e.append(r,o,...n)}return e}l(wi,"buildFormData");var mi=class mi extends Ee{constructor(t,i,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=t,this.code=i,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,mi.prototype)}};l(mi,"UploadError");var z=mi,Xl=l(s=>{let e=new URLSearchParams;for(let[t,i]of Object.entries(s))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(r=>{var o;return(o=r[1])!=null?o:!1}).forEach(r=>e.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(i)?i.forEach(r=>{e.append(`${t}[]`,r)}):typeof i=="string"&&i?e.set(t,i):typeof i=="number"&&e.set(t,i.toString());return e.toString()},"buildSearchParams"),ft=l((s,e,t)=>{let i=new URL(s);return i.pathname=(i.pathname+e).replace("//","/"),t&&(i.search=Xl(t)),i.toString()},"getUrl"),ql="6.14.1",Kl="UploadcareUploadClient",Zl=ql;function It(s){return bs({libraryName:Kl,libraryVersion:Zl,...s})}l(It,"getUserAgent");var Yl="RequestThrottledError",_o=15e3,Jl=1e3;function Ql(s){let{headers:e}=s||{};if(!e||typeof e["retry-after"]!="string")return _o;let t=parseInt(e["retry-after"],10);return Number.isFinite(t)?t*1e3:_o}l(Ql,"getTimeoutFromThrottledRequest");function At(s,e){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:i}=e;return Fl(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===Yl&&r<t)return o(Ql(n));if(n instanceof Bt&&r<i)return o((r+1)*Jl);throw n}))}l(At,"retryIfFailed");var Co=l(s=>{let e="";return(_i(s)||yi(s)||vi(s))&&(e=s.type),e||bi},"getContentType"),Ao=l(s=>{let e="";return yi(s)&&s.name?e=s.name:_i(s)||wo()?e="":vi(s)&&s.name&&(e=s.name),e||vo},"getFileName");function _s(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(_s,"getStoreValue");function ta(s,{publicKey:e,fileName:t,contentType:i,baseURL:r=k.baseURL,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",url:ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:wi({signature:o,expire:n,file:{data:s,name:t||Ao(s),contentType:i||Co(s)},UPLOADCARE_PUB_KEY:e,UPLOADCARE_STORE:_s(a),source:p,metadata:b}),signal:c,onProgress:u}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ta,"base");var ps;(function(s){s.Token="token",s.FileInfo="file_info"})(ps||(ps={}));function ea(s,{publicKey:e,baseURL:t=k.baseURL,store:i,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:e,source_url:s,store:_s(i),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:c,source:u,metadata:b}),signal:p}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ea,"fromUrl");var G;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(G||(G={}));var ia=l(s=>"status"in s&&s.status===G.Error,"isErrorResponse");function sa(s,{publicKey:e,baseURL:t=k.baseURL,signal:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}={}){return At(()=>Ct({method:"GET",headers:e?{"X-UC-User-Agent":It({publicKey:e,integration:r,userAgent:o})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:i}).then(({data:c,headers:u,request:p})=>{let d=gt(JSON.parse(c));if("error"in d&&!ia(d))throw new z(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}l(sa,"fromUrlStatus");function ra(s,{publicKey:e,baseURL:t=k.baseURL,jsonpCallback:i,secureSignature:r,secureExpire:o,signal:n,source:a,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:c,userAgent:u})},url:ft(t,"/group/",{jsonerrors:1}),data:wi({files:s,callback:i,pub_key:e,signature:r,expire:o,source:a}),signal:n}).then(({data:f,headers:m,request:g})=>{let b=gt(JSON.parse(f));if("error"in b)throw new z(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}l(ra,"group");function Eo(s,{publicKey:e,baseURL:t=k.baseURL,signal:i,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"GET",headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},url:ft(t,"/info/",{jsonerrors:1,pub_key:e,file_id:s,source:r}),signal:i}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Eo,"info");function oa(s,{publicKey:e,contentType:t,fileName:i,multipartChunkSize:r=k.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=k.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>Ct({method:"POST",url:ft(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:wi({filename:i||vo,size:s,content_type:t||bi,part_size:r,UPLOADCARE_STORE:_s(c),UPLOADCARE_PUB_KEY:e,signature:n,expire:a,source:p,metadata:b}),signal:u}).then(({data:w,headers:x,request:v})=>{let C=gt(JSON.parse(w));if("error"in C)throw new z(C.error.content,C.error.errorCode,v,C,x);return C.parts=Object.keys(C.parts).map(M=>C.parts[Number(M)]),C}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}l(oa,"multipartStart");function na(s,e,{contentType:t,signal:i,onProgress:r,retryThrottledRequestMaxTimes:o=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"PUT",url:e,data:s,onProgress:r,signal:i,headers:{"Content-Type":t||bi}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}l(na,"multipartUpload");function la(s,{publicKey:e,baseURL:t=k.baseURL,source:i="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return At(()=>Ct({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},data:wi({uuid:s,UPLOADCARE_PUB_KEY:e,source:i}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(la,"multipartComplete");function ys(s,{publicKey:e,baseURL:t,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:c,onProgress:u}){return yo({check:p=>Eo(s,{publicKey:e,baseURL:t,signal:p,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}l(ys,"isReadyPoll");function aa(s){return"defaultEffects"in s}l(aa,"isGroupFileInfo");var As=class As{constructor(e,{baseCDN:t=k.baseCDN,fileName:i}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:o}=e,n=ft(t,`${r}/`),a=o?ft(`https://${o}.s3.amazonaws.com/`,`${r}/${e.filename}`):null;this.uuid=r,this.name=i||e.filename,this.size=e.size,this.isStored=e.isStored,this.isImage=e.isImage,this.mimeType=e.mimeType,this.cdnUrl=n,this.originalFilename=e.originalFilename,this.imageInfo=e.imageInfo,this.videoInfo=e.videoInfo,this.contentInfo=e.contentInfo,this.metadata=e.metadata||null,this.s3Bucket=o||null,this.s3Url=a,aa(e)&&(this.defaultEffects=e.defaultEffects)}};l(As,"UploadcareFile");var mt=As,ca=l((s,{publicKey:e,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,contentType:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>ta(s,{publicKey:e,fileName:t,contentType:a,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:x})=>ys(x,{publicKey:e,baseURL:i,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(x=>new mt(x,{baseCDN:b})),"uploadDirect"),ua=l((s,{publicKey:e,fileName:t,baseURL:i,signal:r,onProgress:o,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Eo(s,{publicKey:e,baseURL:i,signal:r,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new mt(f,{baseCDN:d,fileName:t})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),ha=l((s,{signal:e}={})=>{let t=null,i=null,r=s.map(()=>new AbortController),o=l(n=>()=>{i=n,r.forEach((a,c)=>c!==n&&a.abort())},"createStopRaceCallback");return gi(e,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,a)=>{let c=o(a);return Promise.resolve().then(()=>n({stopRace:c,signal:r[a].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(i===null)throw t;return n[i]})},"race"),da=window.WebSocket,Es=class Es{constructor(){h(this,"events",Object.create({}))}emit(e,t){var i;(i=this.events[e])==null||i.forEach(r=>r(t))}on(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}off(e,t){t?this.events[e]=this.events[e].filter(i=>i!==t):this.events[e]=[]}};l(Es,"Events");var fs=Es,pa=l((s,e)=>s==="success"?{status:G.Success,...e}:s==="progress"?{status:G.Progress,...e}:{status:G.Error,...e},"response"),Ts=class Ts{constructor(e,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new fs);h(this,"disconnectTimeoutId",null);this.key=e,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let e=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new da(e),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let i=JSON.parse(t.data.toString());switch(i.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(i.channel,pa(i.event,JSON.parse(i.data)))}})}}disconnect(){let e=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{e()},this.disconnectTime):e()}send(e,t){var r;let i=JSON.stringify({event:e,data:t});(r=this.ws)==null||r.send(i)}subscribe(e,t){this.subscribers+=1,this.connect();let i=`task-status-${e}`,r={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(e){this.subscribers-=1;let t=`task-status-${e}`,i={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(e){return this.emmitter.on("error",e),()=>this.emmitter.off("error",e)}};l(Ts,"Pusher");var ms=Ts,hs=null,vs=l(s=>{if(!hs){let e=typeof window=="undefined"?0:3e4;hs=new ms(s,e)}return hs},"getPusher"),fa=l(s=>{vs(s).connect()},"preconnect");function ma({token:s,publicKey:e,baseURL:t,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:c}){return yo({check:u=>sa(s,{publicKey:e,baseURL:t,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case G.Error:return new z(p.error,p.errorCode);case G.Waiting:return!1;case G.Unknown:return new z(`Token "${s}" was not found.`);case G.Progress:return a&&(p.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:p.done/p.total})),!1;case G.Success:return a&&a({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}l(ma,"pollStrategy");var ga=l(({token:s,pusherKey:e,signal:t,onProgress:i})=>new Promise((r,o)=>{let n=vs(e),a=n.onError(o),c=l(()=>{a(),n.unsubscribe(s)},"destroy");gi(t,()=>{c(),o(new xt("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case G.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case G.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),r(u);break}case G.Error:c(),o(new z(u.msg,u.error_code))}})}),"pushStrategy"),ba=l((s,{publicKey:e,fileName:t,baseURL:i,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=k.pusherKey,metadata:x})=>Promise.resolve(fa(w)).then(()=>ea(s,{publicKey:e,fileName:t,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:x})).catch(v=>{let C=vs(w);return C==null||C.disconnect(),Promise.reject(v)}).then(v=>v.type===ps.FileInfo?v:ha([({signal:C})=>ma({token:v.token,publicKey:e,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:C}),({signal:C})=>ga({token:v.token,pusherKey:w,signal:C,onProgress:d})],{signal:p})).then(v=>{if(v instanceof z)throw v;return v}).then(v=>ys(v.uuid,{publicKey:e,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:p})).then(v=>new mt(v,{baseCDN:r})),"uploadFromUrl"),ds=new WeakMap,_a=l(async s=>{if(ds.has(s))return ds.get(s);let e=await fetch(s.uri).then(t=>t.blob());return ds.set(s,e),e},"getBlobFromReactNativeAsset"),To=l(async s=>{if(yi(s)||_i(s))return s.size;if(vi(s))return(await _a(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),ya=l((s,e=k.multipartMinFileSize)=>s>=e,"isMultipart"),So=l(s=>{let e="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(e);return!Vt(s)&&t.test(s)},"isUuid"),ws=l(s=>{let e="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(e);return!Vt(s)&&t.test(s)},"isUrl"),va=l((s,e)=>new Promise((t,i)=>{let r=[],o=!1,n=e.length,a=[...e],c=l(()=>{let u=e.length-a.length,p=a.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():t(r))}).catch(d=>{o=!0,i(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),wa=l((s,e,t,i)=>{let r=i*e,o=Math.min(r+i,t);return s.slice(r,o)},"sliceChunk"),xa=l(async(s,e,t)=>i=>wa(s,i,e,t),"prepareChunks"),Ca=l((s,e,{publicKey:t,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>na(s,e,{publicKey:t,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),Aa=l(async(s,{publicKey:e,fileName:t,fileSize:i,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=k.multipartChunkSize,maxConcurrentRequests:x=k.maxConcurrentRequests,baseCDN:v,metadata:C})=>{let M=i!=null?i:await To(s),K,et=l((P,V)=>{if(!u)return;K||(K=Array(P).fill(0));let J=l(it=>it.reduce((ht,ss)=>ht+ss,0),"sum");return it=>{it.isComputable&&(K[V]=it.value,u({isComputable:!0,value:J(K)/P}))}},"createProgressHandler");return b||(b=Co(s)),oa(M,{publicKey:e,contentType:b,fileName:t||Ao(s),baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:C}).then(async({uuid:P,parts:V})=>{let J=await xa(s,M,w);return Promise.all([P,va(x,V.map((it,ht)=>()=>Ca(J(ht),it,{publicKey:e,contentType:b,onProgress:et(V.length,ht),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([P])=>la(P,{publicKey:e,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(P=>P.isReady?P:ys(P.uuid,{publicKey:e,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(P=>new mt(P,{baseCDN:v}))},"uploadMultipart");async function xs(s,{publicKey:e,fileName:t,baseURL:i=k.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:x,baseCDN:v=k.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:M,pusherKey:K,metadata:et}){if(Vt(s)){let P=await To(s);return ya(P,b)?Aa(s,{publicKey:e,contentType:g,multipartChunkSize:w,fileSize:P,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:et}):ca(s,{publicKey:e,fileName:t,contentType:g,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:et})}if(ws(s))return ba(s,{publicKey:e,fileName:t,baseURL:i,baseCDN:v,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:M,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:K,metadata:et});if(So(s))return ua(s,{publicKey:e,fileName:t,baseURL:i,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${s}" is not supported`)}l(xs,"uploadFile");var Ss=class Ss{constructor(e,{baseCDN:t=k.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=e.id,this.filesCount=e.filesCount;let i=e.files.filter(Boolean);this.totalSize=Object.values(i).reduce((r,o)=>r+o.size,0),this.isStored=!!e.datetimeStored,this.isImage=!!Object.values(i).filter(r=>r.isImage).length,this.cdnUrl=e.cdnUrl,this.files=i.map(r=>new mt(r,{baseCDN:t})),this.createdAt=e.datetimeCreated,this.storedAt=e.datetimeStored}};l(Ss,"UploadcareGroup");var gs=Ss,Ea=l(s=>{for(let e of s)if(!Vt(e))return!1;return!0},"isFileDataArray"),Ta=l(s=>{for(let e of s)if(!So(e))return!1;return!0},"isUuidArray"),Sa=l(s=>{for(let e of s)if(!ws(e))return!1;return!0},"isUrlArray");function ko(s,{publicKey:e,fileName:t,baseURL:i=k.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=k.multipartChunkSize,baseCDN:w=k.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v,jsonpCallback:C}){if(!Ea(s)&&!Sa(s)&&!Ta(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let M,K=!0,et=s.length,P=l((V,J)=>{if(!c)return;M||(M=Array(V).fill(0));let it=l(ht=>ht.reduce((ss,Xn)=>ss+Xn)/V,"normalize");return ht=>{if(!ht.isComputable||!K){K=!1,c({isComputable:!1});return}M[J]=ht.value,c({isComputable:!0,value:it(M)})}},"createProgressHandler");return Promise.all(s.map((V,J)=>Vt(V)||ws(V)?xs(V,{publicKey:e,fileName:t,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:P(et,J),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v}).then(it=>it.uuid):V)).then(V=>ra(V,{publicKey:e,baseURL:i,jsonpCallback:C,secureSignature:r,secureExpire:o,signal:a,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(J=>new gs(J,{baseCDN:w})).then(J=>(c&&c({isComputable:!0,value:1}),J)))}l(ko,"uploadFileGroup");var ks=class ks{constructor(e){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=e}_run(){let e=this._concurrency-this._running;for(let t=0;t<e;t++){let i=this._pending.shift();if(!i)return;let r=this._resolvers.get(i),o=this._rejectors.get(i);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(n=>r(n)).catch(n=>o(n))}}add(e){return new Promise((t,i)=>{this._resolvers.set(e,t),this._rejectors.set(e,i),this._pending.push(e),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(e){this._concurrency=e,this._run()}get concurrency(){return this._concurrency}};l(ks,"Queue");var di=ks;var $s=l(()=>({}),"blockCtx"),Is=l(s=>({...$s(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),xi=l(s=>({...Is(s),"*commonProgress":0,"*uploadList":[],"*focusedEntry":null,"*uploadQueue":new di(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var Te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"Selected:","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error ocurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit button","file-item-remove-button":"Remove button"};var Ci=new Map,Os=new Map,$o=l((s,e)=>{Ci.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Ci.set(s,{...Te,...e})},"defineLocaleSync"),ka=l((s,e)=>{Os.set(s,e)},"defineLocaleAsync"),Ls=l((s,e)=>{typeof e=="function"?ka(s,e):$o(s,e)},"defineLocale"),Io=l(async s=>{if(!Ci.has(s)){if(!Os.has(s))throw new Error(`Locale ${s} is not defined`);let t=await Os.get(s)();$o(s,t)}return Ci.get(s)},"resolveLocaleDefinition");Ls("en",Te);var bt=l(s=>`*l10n/${s}`,"localeStateKey"),$a="en",Us=class Us{constructor(e){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=e;for(let[t,i]of Object.entries(Te))this._blockInstance.add(bt(t),i,!1);setTimeout(()=>{e.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let i=await Io(t);if(t!==$a&&this._localeName!==t)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,a]of Object.entries(i)){let c=r==null?void 0:r[n];this._blockInstance.add(bt(n),c!=null?c:a,!0);for(let u of this._callbacks)u()}}),e.subConfigValue("localeDefinitionOverride",t=>{var r;if(!t)return;let i=t[this._localeName];if(i)for(let[o,n]of Object.entries(i)){(r=this._blockInstance)==null||r.add(bt(o),n,!0);for(let a of this._callbacks)a()}})})}onLocaleChange(e){let t=L(e,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(e,t,i){var o,n,a;e.$[t]=i(),this._boundBlocks.has(e)||this._boundBlocks.set(e,new Map),(n=(o=this._boundBlocks.get(e))==null?void 0:o.get(t))==null||n();let r=this.onLocaleChange(()=>{e.$[t]=i()});(a=this._boundBlocks.get(e))==null||a.set(t,r)}destroyL10nBindings(e){let t=this._boundBlocks.get(e);if(t){for(let i of t.values())i();this._boundBlocks.delete(e)}}destroy(){this._callbacks.clear()}};l(Us,"LocaleManager");var Ai=Us;function Oo(s,e){[...s.querySelectorAll("[l10n]")].forEach(t=>{let i=t.getAttribute("l10n");if(!i)return;let r="textContent",o=!1;if(i.includes(":")){let c=i.split(":");r=c[0],i=c[1],r.startsWith("@")&&(r=r.slice(1),o=!0)}let n=i;e.has(n)&&e.sub(n,c=>{if(!c)return;e.l10nProcessorSubs.has(n)||e.l10nProcessorSubs.set(n,new Set);let u=e.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),e.allSubs.delete(f)});let p=bt(c).replace("*","");e.nodeCtx.has(p)||e.nodeCtx.add(p,c);let d=e.nodeCtx.sub(p,()=>{t[r]=e.l10n(c)});u==null||u.add(d),e.allSubs.add(d),t.removeAttribute("l10n")});let a=bt(i);e.has(a)||e.add(a,""),e.sub(a,()=>{i=i,o?t.setAttribute(r,e.l10n(i)):t[r]=e.l10n(i)}),t.removeAttribute("l10n")})}l(Oo,"l10nProcessor");var W=l(s=>`*cfg/${s}`,"sharedConfigKey");var Ia={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Se(s,e){e.tabIndex=0,e.focus(),s.tabIndex=-1}l(Se,"focus");function Ms(s){let e=s.role||s.type||s.tagName;if(!e)return null;let t=Ia[e.toLowerCase()];if(!t)return null;for(let i of t){let r=s.closest(`[role=${i}]`);if(r)return r}}l(Ms,"findGroupNodeByEventTarget");function Ps(s,e){return e.role==="toolbar"?Oa(e):e.querySelectorAll(`[role=${s.role}]`)}l(Ps,"getItems");function Oa(s){return[...s.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}l(Oa,"getToolbarItems");function La(s){let e=s.getAttribute("aria-orientation");if(e==="vertical")return!1;if(e==="horizontal")return!0;let t=s.role;return t==="menubar"||t==="tablist"||t==="toolbar"}l(La,"isHorizontalOrientation");function Lo(s){return e=>{let t=!1,i=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=Ms(d.target);if(!f){a();return}let m=Ps(d.target,f),g=Array.from(m).indexOf(d.target),b="ArrowDown",w="ArrowUp";if(La(f)&&(e.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),d.key===b)d.preventDefault(),Se(d.target,m[g+1]||m[0]);else if(d.key===w)d.preventDefault(),Se(d.target,m[g-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),Se(d.target,m[0]);else if(d.key==="End")d.preventDefault(),Se(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let x=Date.now();x-r<=i?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=x;let v=Array.from(m).find(C=>{var M,K,et;return(et=(K=(M=C.textContent)==null?void 0:M.trim())==null?void 0:K.toLowerCase())==null?void 0:et.startsWith(o)});v&&(d.preventDefault(),Se(d.target,v))}}l(n,"keyDown");function a(){t=!1,e.removeEventListener("keydown",n)}l(a,"stop");function c(d){let f=Ms(d.target);if(f){t||(t=!0,e.addEventListener("keydown",n));let m=Ps(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1)}else t&&a()}l(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===e.document)&&a()}l(u,"focusOut");function p(d){let f=Ms(d.target);if(f){let m=Ps(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return l(p,"click"),e.addEventListener("click",p),e.addEventListener("focusin",c),e.addEventListener("focusout",u),()=>{a(),e.removeEventListener("click",p),e.removeEventListener("focusin",c),e.removeEventListener("focusout",u)}}}l(Lo,"focusGroupKeyUX");function Uo(){return s=>{let e,t;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){e=o.target,e.setAttribute("aria-hidden","false"),t=e.hidden,t&&(e.hidden=!1);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0)}}l(i,"jump");function r(o){e&&e.contains(o.target)&&(!o.relatedTarget||!e.contains(o.relatedTarget))&&(o.target.tabIndex=-1,e.setAttribute("aria-hidden","true"),t&&(e.hidden=!0),e=null)}return l(r,"focusOut"),s.addEventListener("keyuxJump",i),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",i),s.removeEventListener("focusout",r)}}}l(Uo,"hiddenKeyUX");function Mo(){return s=>{let e=[];function t(u){let p=s.document.activeElement;p&&p!==s.document.body&&e.push(new WeakRef(p)),u.focus({focusVisible:!0})}l(t,"focus");function i(){let u=e.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():i()}l(i,"back");let r=0,o;function n(u){clearInterval(o);let p=u.getAttribute("aria-controls");p&&(o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(p);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:!0})),t(f))}},50))}l(n,"jump");function a(u){u.clientX===0&&u.clientY===0&&n(u.target)}l(a,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&i()}return l(c,"keyDown"),s.addEventListener("click",a),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",a),s.removeEventListener("keydown",c)}}}l(Mo,"jumpKeyUX");function Po(s){let e,t=s.split(" ");function i(){e&&e.classList.remove(...t)}l(i,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(i(),o.target.classList.add(...t),e=o.target)}return l(r,"click"),o=>(o.addEventListener("keyup",i),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",i),o.removeEventListener("click",r)})}l(Po,"pressKeyUX");function Ro(s,e){let t=e.map(i=>i(s));return()=>{t.forEach(i=>i())}}l(Ro,"startKeyUX");var Fs=class Fs{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(e,t){let i=l(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&t(r)},"wrappedListener");this._listeners.set(t,i),window.addEventListener(e,i)}removeEventListener(e,t){let i=this._listeners.get(t);i&&window.removeEventListener(e,i),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(e){this._scope.push(e)}destroy(){this._scope=[],this._listeners.forEach((e,t)=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",e),this._listeners.delete(t)})}};l(Fs,"ScopedMinimalWindow");var Rs=Fs,Ds=class Ds{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new Rs,this._destroyKeyUX=Ro(this._scopedWindow,[Lo(),Po("is-pressed"),Mo(),Uo()])}registerBlock(e){this._scopedWindow.registerScope(e)}destroy(){var e;(e=this._destroyKeyUX)==null||e.call(this),this._scopedWindow.destroy()}};l(Ds,"A11y");var Ei=Ds;var Ua="uc-",ke=class ke extends $t{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",$s());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Oo)}l10n(t,i={}){if(!t)return"";let r=this.$[bt(t)]||t,o=fo(r);for(let a of o)i[a.variable]=this.pluralize(a.pluralKey,Number(i[a.countVariable]));return Ae(r,i)}pluralize(t,i){let r=this.l10n("locale-id")||"en",o=hi(r,i);return this.l10n(`${t}__${o}`)}bindL10n(t,i){var r;(r=this.localeManager)==null||r.bindL10n(this,t,i)}emit(t,i,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,i,r)}hasBlockInCtx(t){for(let i of this.blocksRegistry)if(t(i))return!0;return!1}setOrAddState(t,i){this.add$({[t]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?mo({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),Ce.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Ce.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new ui(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ai(this)),this.has("*a11y")||this.add("*a11y",new Ei),this.sub(bt("locale-id"),i=>{let r=uo(i);this.style.direction=r==="ltr"?"":r})}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var i;let t=this.blocksRegistry;t==null||t.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;T.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:ai(t),cdnUrlModifiers:as(t),fileName:li(t)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),t}return this.cfg.secureDeliveryProxy?Ae(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:i=>window.encodeURIComponent(i)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(i,r,o)=>{if(typeof r!="string")return!1;let n=W(r);return this.has(n)||this.add(n,Q[r]),this.$[n]=o,!0},get:(i,r)=>{let o=W(r);return this.has(o)||this.add(o,Q[r]),this.$[W(r)]}})}return this.__cfgProxy}subConfigValue(t,i){let r=W(t);this.has(r)||this.add(r,Q[t]),this.sub(r,i)}debugPrint(...t){if(!this.cfg.debug)return;let i=t;if(typeof(t==null?void 0:t[0])=="function"){let r=t[0];i=r()}console.log(`[${this.ctxName}]`,...i)}static reg(t){if(!t){super.reg();return}t.startsWith(Ua)&&super.reg(t)}};l(ke,"Block"),h(ke,"StateConsumerScope",null),h(ke,"styleAttrs",[]);var y=ke;var Fo="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='apuc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#apuc-icon-id__a)'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#asuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#asuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#asuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#asuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#asuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#asuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#asuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ti=class Ti extends y{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",xi(this));h(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=Fo+t+"<slot></slot>"}static get template(){return this._template}};l(Ti,"SolutionBlock"),h(Ti,"styleAttrs",["uc-wgt-common"]);var rt=Ti;var Do="active",$e="___ACTIVITY_IS_ACTIVE___",ot=class ot extends y{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Is(this));h(this,"_debouncedHistoryFlush",L(this._historyFlush.bind(this),10))}_deactivate(){var i;let t=ot._activityCallbacks.get(this);this[$e]=!1,this.removeAttribute(Do),(i=t==null?void 0:t.deactivateCallback)==null||i.call(t)}_activate(){var i;let t=ot._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[$e]=!0,this.setAttribute(Do,""),(i=t==null?void 0:t.activateCallback)==null||i.call(t),this._debouncedHistoryFlush(),this.emit($.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[$e]?this._deactivate():this.activityType===t&&!this[$e]&&this._activate(),t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_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&&ot._activityCallbacks.has(this)}get isActivityActive(){return this[$e]}get couldOpenActivity(){return!0}registerActivity(t,i={}){let{onActivate:r,onDeactivate:o}=i;ot._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ot._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof ot&&r.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var i;let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(a=>a.activityType===r);o=(i=n==null?void 0:n.couldOpenActivity)!=null?i:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}};l(ot,"ActivityBlock"),h(ot,"_activityCallbacks",new Map);var _=ot;_.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Ie=33.333333333333336,A=1,Ns=24,No=6;function Ot(s,e){for(let t in e)s.setAttributeNS(null,t,e[t].toString())}l(Ot,"setSvgNodeAttrs");function Z(s,e={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Ot(t,e),t}l(Z,"createSvgNode");function zo(s,e,t){let{x:i,y:r,width:o,height:n}=s,a=e.includes("w")?0:1,c=e.includes("n")?0:1,u=[-1,1][a],p=[-1,1][c],d=[i+a*o+1.5*u,r+c*n+1.5*p-24*t*p],f=[i+a*o+1.5*u,r+c*n+1.5*p],m=[i+a*o-24*t*u+1.5*u,r+c*n+1.5*p];return{d:`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,center:f}}l(zo,"cornerPath");function Bo(s,e,t){let{x:i,y:r,width:o,height:n}=s,a=["n","s"].includes(e)?.5:{w:0,e:1}[e],c=["w","e"].includes(e)?.5:{n:0,s:1}[e],u=[-1,1][a],p=[-1,1][c],d,f;["n","s"].includes(e)?(d=[i+a*o-34*t/2,r+c*n+1.5*p],f=[i+a*o+34*t/2,r+c*n+1.5*p]):(d=[i+a*o+1.5*u,r+c*n-34*t/2],f=[i+a*o+1.5*u,r+c*n+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]}`,g=[f[0]-(f[0]-d[0])/2,f[1]-(f[1]-d[1])/2];return{d:m,center:g}}l(Bo,"sidePath");function Vo(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Vo,"thumbCursor");function jo({rect:s,delta:[e,t],imageBox:i}){return Ht({...s,x:s.x+e,y:s.y+t},i)}l(jo,"moveRect");function Ht(s,e){let{x:t}=s,{y:i}=s;return s.x<e.x?t=e.x:s.x+s.width>e.x+e.width&&(t=e.x+e.width-s.width),s.y<e.y?i=e.y:s.y+s.height>e.y+e.height&&(i=e.y+e.height-s.height),{...s,x:t,y:i}}l(Ht,"constraintRect");function Ma({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[,r]=e,{y:o,width:n,height:a}=s;o+=r,a-=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o<=i.y&&(o=i.y,a=s.y+s.height-o,t&&(n=a*t,c=s.x+s.width/2-n/2)),c<=i.x&&(c=i.x,o=s.y+s.height-a),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,t&&(a=n/t),o=s.y+s.height-a),a<A&&(a=A,t&&(n=a*t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),n<A&&(n=A,t&&(a=n/t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:c,y:o,width:n,height:a}}l(Ma,"resizeNorth");function Pa({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r]=e,{x:o,width:n,height:a}=s;o+=r,n-=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o<=i.x&&(o=i.x,n=s.x+s.width-o,t&&(a=n/t,c=s.y+s.height/2-a/2)),c<=i.y&&(c=i.y,o=s.x+s.width-n),c+a>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-a),a=i.y+i.height-c,t&&(n=a*t),o=s.x+s.width-n),a<A&&(a=A,t&&(n=a*t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),n<A&&(n=A,t&&(a=n/t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:a}}l(Pa,"resizeWest");function Ra({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[,r]=e,{y:o,width:n,height:a}=s;a+=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o+a>=i.y+i.height&&(a=i.y+i.height-o,t&&(n=a*t),c=s.x+s.width/2-n/2),c<=i.x&&(c=i.x,o=s.y),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,t&&(a=n/t),o=s.y),a<A&&(a=A,t&&(n=a*t),c=s.x+s.width/2-n/2),n<A&&(n=A,t&&(a=n/t),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:a}}l(Ra,"resizeSouth");function Fa({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r]=e,{x:o,width:n,height:a}=s;n+=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o+n>=i.x+i.width&&(n=i.x+i.width-o,t&&(a=n/t),c=s.y+s.height/2-a/2),c<=i.y&&(c=i.y,o=s.x),c+a>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-a),a=i.y+i.height-c,t&&(n=a*t),o=s.x),a<A&&(a=A,t&&(n=a*t),c=s.y+s.height/2-a/2),n<A&&(n=A,t&&(a=n/t),c=s.y+s.height/2-a/2),{x:o,y:c,width:n,height:a}}l(Fa,"resizeEast");function Da({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),a+o<i.y&&(o=i.y-a),n+=r,c-=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=i.y&&(u=u-(i.y-a),c=u*t,n=s.x+s.width-c,a=i.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/t,n=i.x,a=s.y+s.height-u)),u<A&&(u=A,t&&(c=u*t),n=s.x+s.width-c,a=s.y+s.height-u),c<A&&(c=A,t&&(u=c/t),n=s.x+s.width-c,a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(Da,"resizeNorthWest");function Na({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),a+o<i.y&&(o=i.y-a),c+=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=i.y&&(u=u-(i.y-a),c=u*t,n=s.x,a=i.y)):t&&(r=u*t-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/t,n=i.x+i.width-c,a=s.y+s.height-u)),u<A&&(u=A,t&&(c=u*t),a=s.y+s.height-u),c<A&&(c=A,t&&(u=c/t),a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(Na,"resizeNorthEast");function za({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),a+u+o>i.y+i.height&&(o=i.y+i.height-a-u),n+=r,c-=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=i.y+i.height&&(u=i.y+i.height-a,c=u*t,n=s.x+s.width-c,a=i.y+i.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/t,n=i.x,a=s.y)),u<A&&(u=A,t&&(c=u*t),n=s.x+s.width-c),c<A&&(c=A,t&&(u=c/t),n=s.x+s.width-c),{x:n,y:a,width:c,height:u}}l(za,"resizeSouthWest");function Ba({rect:s,delta:e,aspectRatio:t,imageBox:i}){let[r,o]=e,{x:n,y:a,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),a+u+o>i.y+i.height&&(o=i.y+i.height-a-u),c+=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=i.y+i.height&&(u=i.y+i.height-a,c=u*t,n=s.x,a=i.y+i.height-u)):t&&(r=u*t-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/t,n=i.x+i.width-c,a=s.y)),u<A&&(u=A,t&&(c=u*t)),c<A&&(c=A,t&&(u=c/t)),{x:n,y:a,width:c,height:u}}l(Ba,"resizeSouthEast");function Ho({direction:s,...e}){switch(s){case"n":return Ma(e);case"w":return Pa(e);case"s":return Ra(e);case"e":return Fa(e);case"nw":return Da(e);case"ne":return Na(e);case"sw":return za(e);case"se":return Ba(e);default:return e.rect}}l(Ho,"resizeRect");function Go(s,[e,t]){return s.x<=e&&e<=s.x+s.width&&s.y<=t&&t<=s.y+s.height}l(Go,"rectContainsPoint");function Wo(s,e){return s.x>=e.x&&s.y>=e.y&&s.x+s.width<=e.x+e.width&&s.y+s.height<=e.y+e.height}l(Wo,"isRectInsideRect");function Xo(s,e){return Math.abs(s.width/s.height-e)<.1}l(Xo,"isRectMatchesAspectRatio");function Gt({width:s,height:e},t){let i=t/90%2!==0;return{width:i?e:s,height:i?s:e}}l(Gt,"rotateSize");function qo(s,e,t){let i=s/e,r,o;i>t?(r=Math.round(e*t),o=e):(r=s,o=Math.round(s/t));let n=Math.round((s-r)/2),a=Math.round((e-o)/2);return n+r>s&&(r=s-n),a+o>e&&(o=e-a),{x:n,y:a,width:r,height:o}}l(qo,"calculateMaxCenteredCropFrame");function Wt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(Wt,"roundRect");function Et(s,e,t){return Math.min(Math.max(s,e),t)}l(Et,"clamp");var ki=l(s=>{if(!s)return[];let[e,t]=s.split(":").map(Number);if(!Number.isFinite(e)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:e,height:t}]},"parseCropPreset");var Lt="blocks",Ut="1.4.0";function Ko(s){return bs({...s,libraryName:Lt,libraryVersion:Ut})}l(Ko,"customUserAgent");var Zo=l(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Yo=l((s,{threshold:e})=>{let{secureExpire:t}=s,i=Zo(Date.now()),r=Number(t),o=Zo(e);return i+o>=r},"isSecureTokenExpired");var zs=class zs{constructor(e){h(this,"_block");h(this,"_secureToken",null);this._block=e}_debugPrint(...e){this._block.debugPrint("[secure-uploads]",...e)}async getSecureToken(){let{secureSignature:e,secureExpire:t,secureUploadsSignatureResolver:i}=this._block.cfg;if((e||t)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Yo(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let r=await i();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this._debugPrint("Secure signature resolved:",r),this._debugPrint("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this._secureToken=r):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r)}}return this._secureToken}return e&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:e,secureExpire:t}),{secureSignature:e,secureExpire:t}):null}};l(zs,"SecureUploadsManager");var $i=zs;var Jo="[Typed State] Wrong property name: ",Va="[Typed State] Wrong property type: ",Bs=class Bs{constructor(e,t){this.__typedSchema=e,this.__ctxId=t||kt.generate(),this.__schema=Object.keys(e).reduce((i,r)=>(i[r]=e[r].value,i),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(e,t){if(!this.__typedSchema.hasOwnProperty(e)){console.warn(Jo+e);return}let i=this.__typedSchema[e];if((t==null?void 0:t.constructor)===i.type||t instanceof i.type||i.nullable&&t===null){this.__data.pub(e,t);return}console.warn(Va+e)}setMultipleValues(e){for(let t in e)this.setValue(t,e[t])}getValue(e){if(!this.__typedSchema.hasOwnProperty(e)){console.warn(Jo+e);return}return this.__data.read(e)}subscribe(e,t){return this.__data.sub(e,t)}remove(){T.deleteCtx(this.__ctxId)}};l(Bs,"TypedData");var Ii=Bs;var Vs=class Vs{constructor(e){this.__typedSchema=e.typedSchema,this.__ctxId=e.ctxName||kt.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=e.watchList||[],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;let t=Object.create(null);this.__notifyObservers=(i,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[i]||(t[i]=new Set),t[i].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let e=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],e,t)})}observeCollection(e){return this.__collectionObservers.add(e),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(e)}}unobserveCollection(e){var t;(t=this.__collectionObservers)==null||t.delete(e)}add(e){let t=new Ii(this.__typedSchema);for(let i in e)t.setValue(i,e[i]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(i=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(i,()=>{this.__notifyObservers(i,t.uid)}))}),t.uid}read(e){return this.__data.read(e)}readProp(e,t){return this.read(e).getValue(t)}publishProp(e,t,i){this.read(e).setValue(t,i)}remove(e){this.__removed.add(this.__data.read(e)),this.__items.delete(e),this.notify(),this.__data.pub(e,null),delete this.__subsMap[e]}clearAll(){this.__items.forEach(e=>{this.remove(e)})}observeProperties(e){return this.__propertyObservers.add(e),()=>{this.unobserveProperties(e)}}unobserveProperties(e){var t;(t=this.__propertyObservers)==null||t.delete(e)}findItems(e){let t=[];return this.__items.forEach(i=>{let r=this.read(i);e(r)&&t.push(i)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let e in this.__subsMap)this.__subsMap[e].forEach(t=>{t.remove()}),delete this.__subsMap[e]}};l(Vs,"TypedCollection");var Oi=Vs;var X=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Oe=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Li=l(s=>s?s.filter(e=>typeof e=="string").map(e=>N(e)).flat():[],"mergeFileTypes"),js=l((s,e)=>e.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),Qo=l((s,e)=>e.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),tn=l(s=>{let e=s==null?void 0:s.type;return e?js(e,Oe):!1},"fileIsImage");var ja=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ha=new RegExp(`^/?(${ja.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),en=l(({url:s,cdnBase:e})=>{let t=new URL(e),i=new URL(s);if(t.host!==i.host)return null;let[,r,o,n]=Ha.exec(i.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var sn=l(s=>{let e=new Map;return(...t)=>{let i=JSON.stringify(t);if(e.has(i))return e.get(i);let r=s(...t);return e.set(i,r),r}},"memoize");var rn=new Set;function on(s){rn.has(s)||(rn.add(s),console.warn(s))}l(on,"warnOnce");function Ga(s){let e=!1;return setTimeout(()=>{e=!0},0),l(i=>(...r)=>(e&&on(s),i(...r)),"withAssert")}l(Ga,"createAsyncAssertWrapper");function nn(s){let e={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(r=>r.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>t.allEntries.filter(r=>r.status==="success"),failedEntries:()=>t.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>t.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>t.allEntries.filter(r=>r.status==="idle")},t={},i=Ga("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[r,o]of Object.entries(e)){let n=r,c=sn(i(o));Object.defineProperty(t,n,{get:c,enumerable:!0})}return t}l(nn,"buildOutputCollectionState");var Hs=class Hs{constructor(e){h(this,"_ctx");h(this,"addFileFromUrl",l((e,{silent:t,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:e,fileName:i!=null?i:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",l((e,{silent:t,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({uuid:e,fileName:i!=null?i:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",l((e,{silent:t,fileName:i,source:r}={})=>{var a;let o=en({url:e,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:e,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(a=i!=null?i:o.filename)!=null?a:null,silent:t!=null?t:!1,source:r!=null?r:X.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",l((e,{silent:t,fileName:i,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:e,isImage:tn(e),mimeType:e.type,fileName:i!=null?i:e.name,fileSize:e.size,silent:t!=null?t:!1,source:r!=null?r:X.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",l(e=>{if(!this._uploadCollection.read(e))throw new Error(`File with internalId ${e} not found`);this._uploadCollection.remove(e)},"removeFileByInternalId"));h(this,"uploadAll",l(()=>{let e=this._uploadCollection.items().filter(t=>{let i=this._uploadCollection.read(t);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});e.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(e),this._ctx.emit($.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",l((e={})=>{var o;let t=zt(Li([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Oe:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("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.");let i="data-uploadcare-temporary-input",r=document.createElement("input");r.setAttribute(i,""),r.style.display="none",r.type="file",r.multiple=this.cfg.multiple,e.captureCamera?(r.capture=this.cfg.cameraCapture,r.accept="image/*"):r.accept=t,r.addEventListener("change",()=>{r.files&&([...r.files].forEach(n=>this.addFileFromObject(n,{source:e.captureCamera?X.CAMERA:X.LOCAL})),this._ctx.$["*currentActivity"]=_.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),r.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(n=>n.remove()),document.body.appendChild(r),r.dispatchEvent(new MouseEvent("click"))},"openSystemDialog"));h(this,"getOutputItem",l(e=>{var n,a,c,u,p,d,f,m,g,b;let t=T.getCtx(e).store,i=t.fileInfo,r=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(a=(n=i==null?void 0:i.uuid)!=null?n:t.uuid)!=null?a:null,internalId:e,name:(c=i==null?void 0:i.originalFilename)!=null?c:t.fileName,size:(u=i==null?void 0:i.size)!=null?u:t.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:t.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(m=(f=t.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:i!=null?i:null,metadata:(b=(g=t.metadata)!=null?g:i==null?void 0:i.metadata)!=null?b:null,isSuccess:r==="success",isUploading:r==="uploading",isFailed:r==="failed",isRemoved:r==="removed",errors:t.errors,status:r}},"getOutputItem"));h(this,"getOutputCollectionState",l(()=>nn(this._ctx),"getOutputCollectionState"));h(this,"initFlow",l((e=!1)=>{var t;if(this._uploadCollection.size>0&&!e)this._ctx.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let i=this._sourceList[0];if(i==="local"){this._ctx.$["*currentActivity"]=_.activities.UPLOAD_LIST,this.openSystemDialog();return}let r=this._ctx.$["*blocksRegistry"],o=l(a=>"type"in a&&a.type===i,"isSourceBtn"),n=[...r].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":_.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)},"initFlow"));h(this,"doneFlow",l(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)},"doneFlow"));h(this,"setCurrentActivity",l((e,t={})=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===e)){this._ctx.set$({"*currentActivityParams":t,"*currentActivity":e});return}console.warn(`Activity type "${e}" not found in the context`)},"setCurrentActivity"));h(this,"setModalState",l(e=>{if(e&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",e)},"setModalState"));this._ctx=e}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let e=[];return this.cfg.sourceList&&(e=N(this.cfg.sourceList)),e}};l(Hs,"UploaderPublicApi");var Ui=Hs;var Gs=l((s,e)=>{let t=e.cfg.imgOnly,i=s.isImage;if(!(!t||i)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:e.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Ws=l((s,e)=>{let t=e.cfg.imgOnly,i=e.cfg.accept,r=Li([...t?Oe:[],i]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let a=js(o,r),c=Qo(n,r);if(!a&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:e.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var lt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Le=l(s=>Math.ceil(s*100)/100,"round"),ln=l((s,e=Mt.AUTO)=>{let t=e===Mt.AUTO;if(e===Mt.BYTE||t&&s<lt**1){let i=hi("en-US",s),r={one:"byte",other:"bytes"}[i];return`${s} ${r}`}return e===Mt.KB||t&&s<lt**2?`${Le(s/lt**1)} KB`:e===Mt.MB||t&&s<lt**3?`${Le(s/lt**2)} MB`:e===Mt.GB||t&&s<lt**4?`${Le(s/lt**3)} GB`:e===Mt.TB||t&&s<lt**5?`${Le(s/lt**4)} TB`:`${Le(s/lt**5)} PB`},"prettyBytes");var Xs=l((s,e)=>{let t=e.cfg.maxLocalFileSizeBytes,i=s.size;if(t&&i&&i>t)return{type:"FILE_SIZE_EXCEEDED",message:e.l10n("files-max-size-limit-error",{maxFileSize:ln(t)}),payload:{entry:s}}},"validateMaxSizeLimit");var qs=l((s,e)=>{let{internalId:t}=s,i=e._uploadCollection.read(t),r=i==null?void 0:i.getValue("uploadError");if(!r)return;if(r instanceof z)return{type:"UPLOAD_ERROR",message:r.message,payload:{entry:s,error:r}};if(r instanceof Bt)return{type:"NETWORK_ERROR",message:r.message,payload:{entry:s,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:s,error:o}}},"validateUploadError");var Ks=l((s,e)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:e.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Zs=l((s,e)=>{let t=s.totalCount,i=e.cfg.multiple?e.cfg.multipleMin:0,r=e.cfg.multiple?e.cfg.multipleMax:1;if(i&&t<i)return{type:"TOO_FEW_FILES",message:e.l10n("files-count-limit-error-too-few",{min:i,max:r,total:t}),payload:{total:t,min:i,max:r}};if(r&&t>r)return{type:"TOO_MANY_FILES",message:e.l10n("files-count-limit-error-too-many",{min:i,max:r,total:t}),payload:{total:t,min:i,max:r}}},"validateMultiple");var Mi={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Ys=class Ys{constructor(e){h(this,"_blockInstance");h(this,"_fileValidators",[Gs,Ws,Xs,qs]);h(this,"_collectionValidators",[Zs,Ks]);this._blockInstance=e,this._uploadCollection=this._blockInstance.uploadCollection;let t=l(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(e){let t=e!=null?e:this._uploadCollection.items();for(let i of t){let r=this._uploadCollection.read(i);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let e=this._blockInstance.api.getOutputCollectionState(),t=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=i(e,this._blockInstance.api);if(!r)continue;r&&(t.push(r),r.message||console.warn(Mi.message))}catch(r){console.warn(Mi.collection,r)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit($.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(e){let t=this._blockInstance.api.getOutputItem(e.uid),i=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(t,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Mi.message))}catch(o){console.warn(Mi.file,o)}e.setValue("errors",i)}_addCustomTypeToValidators(e){return e.map(t=>(...i)=>{let r=t(...i);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};l(Ys,"ValidationManager");var Pi=Ys;var an=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:mt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var Ri=class Ri extends _{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",xi(this));h(this,"_flushOutputItems",L(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));h(this,"_handleCollectionUpdate",l((t,i,r)=>{var o;(i.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of i)n.getValue("silent")||this.emit($.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of r)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit($.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",l(t=>{this._flushOutputItems();let i=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit($.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let a of t.errors){let{errors:c}=T.getCtx(a).store;c.length>0&&(this.emit($.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit($.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(a=>!!a.getValue("fileInfo")),n=i.findItems(a=>a.getValue("errors").length>0);i.size>0&&n.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit($.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var a;return!!((a=this.uploadCollection.read(n))!=null&&a.getValue("cdnUrl"))}).forEach(n=>{this.emit($.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",l(()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");t+=a});let o=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit($.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof Ri?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new Oi({typedSchema:an,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new Ui(this)),this.has("*validationManager")||this.add("*validationManager",new Pi(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,i;(t=this._unobserveCollectionProperties)==null||t.call(this),(i=this._unobserveCollection)==null||i.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new $i(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let i=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await ko(r,{...i,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit($.GROUP_CREATED,a),this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=a}setInitialCrop(){let t=ki(this.cfg.cropPreset);if(t){let[i]=t,r=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of r){let n=o.getValue("fileInfo"),{width:a,height:c}=n.imageInfo,u=i.width/i.height,p=qo(a,c,u),d=D(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:U(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===_.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=o,this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let r=this.api.getOutputItem(t);return await i(r)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ko,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,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.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};l(Ri,"UploaderBlock");var S=Ri;S.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});S.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...S.extSrcList});var Xt=l(s=>{var e;return(e=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:e.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var R=l(s=>String(s),"asString"),tt=l(s=>{let e=Number(s);if(Number.isNaN(e))throw new Error(`Invalid number: "${s}"`);return e},"asNumber"),I=l(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),Wa=l(s=>s==="auto"?s:I(s),"asStore"),Xa=l(s=>{let e=R(s);if(e!=="user"&&e!=="environment"&&e!=="")throw new Error(`Invalid "cameraCapture" value: "${e}"`);return e},"asCameraCapture"),qa=l(s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Ka=l(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),Js=l(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),cn=l(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),Za={pubkey:R,multiple:I,multipleMin:tt,multipleMax:tt,confirmUpload:I,imgOnly:I,accept:R,externalSourcesPreferredTypes:R,store:Wa,cameraMirror:I,cameraCapture:Xa,sourceList:R,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:I,useLocalImageEditor:I,useCloudImageEditor:I,cloudImageEditorTabs:R,removeCopyright:I,cropPreset:R,imageShrink:R,modalScrollLock:I,modalBackdropStrokes:I,sourceListWrap:I,remoteTabSessionKey:R,cdnCname:R,baseUrl:R,socialBaseUrl:R,secureSignature:R,secureExpire:R,secureDeliveryProxy:R,retryThrottledRequestMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:I,saveUrlForRecurrentUploads:I,groupOutput:I,userAgentIntegration:R,debug:I,localeName:R,metadata:qa,secureUploadsExpireThreshold:tt,localeDefinitionOverride:Ka,secureUploadsSignatureResolver:Js,secureDeliveryProxyUrlResolver:Js,iconHrefResolver:Js,fileValidators:cn,collectionValidators:cn},un=l((s,e)=>{if(!(typeof e=="undefined"||e===null))try{return Za[s](e)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),Q[s]}},"normalizeConfigValue");var Qs=[...new Set(["debug",...Object.keys(Q)])],Ya=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],Ja=l(s=>Ya.includes(s),"isComplexKey"),qt=Qs.filter(s=>!Ja(s)),Qa={...Object.fromEntries(qt.map(s=>[Xt(s),s])),...Object.fromEntries(qt.map(s=>[s.toLowerCase(),s]))},tc={...Object.fromEntries(qt.map(s=>[Xt(s),W(s)])),...Object.fromEntries(qt.map(s=>[s.toLowerCase(),W(s)]))},hn=l(s=>"__"+s,"getLocalPropName"),tr=class tr extends y{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Q).map(([t,i])=>[W(t),i]))}}_flushValueToAttribute(t,i){if(qt.includes(t)){let r=[...new Set([Xt(t),t.toLowerCase()])];for(let o of r)typeof i=="undefined"||i===null?this.removeAttribute(o):this.getAttribute(o)!==i.toString()&&this.setAttribute(o,i.toString())}}_flushValueToState(t,i){this.$[W(t)]!==i&&(typeof i=="undefined"||i===null?this.$[W(t)]=Q[t]:this.$[W(t)]=i)}_setValue(t,i){let r=this,o=un(t,i),n=hn(t);r[n]!==o&&(this._assertSameValueDifferentReference(t,r[n],o),r[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let i=this,r=hn(t);return i[r]}_assertSameValueDifferentReference(t,i,r){this.cfg.debug&&r!==i&&typeof r=="object"&&typeof i=="object"&&JSON.stringify(r)===JSON.stringify(i)&&(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:`,i),console.warn(`[uc-config] "${t}" new value:`,r))}initCallback(){var i;super.initCallback();let t=this;for(let r of qt)this.sub(W(r),o=>{this._setValue(r,o)},!1);for(let r of Qs){let o=(i=t[r])!=null?i:this.$[W(r)];o!==Q[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(t,i,r){if(i===r)return;let o=this,n=Qa[t];o[n]=r}};l(tr,"ConfigClass");var Ue=tr;Ue.bindAttributes(tc);for(let s of Qs)Ue.prototype[s]=void 0;var dn=Ue;var er=class er extends y{constructor(){super(),this.init$={...this.init$,name:"",href:"",title:""}}initCallback(){super.initCallback(),this.sub("name",e=>{if(!e)return;let t=`#uc-icon-${e}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let r=i(e);t=r!=null?r:t}this.$.href=t})})}};l(er,"Icon");var Kt=er;Kt.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><title>{{title}}</title><use set="@href: href;"></use></svg>`;Kt.bindAttributes({name:"name",title:"title"});var pn=l(s=>[...new Set(s)],"uniqueArray");var fn=l(s=>Object.entries(s).filter(([e,t])=>t!==void 0&&t!=="").map(([e,t])=>e==="cdn-operations"||e==="analytics"?t:`${e}/${t}`),"parseObjectToString");var ec="https://ucarecdn.com",Me=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ec},"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 Zt="--uc-img-",ir="unresolved";var sr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),rr=3e3,or=5e3,nr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var gn=Object.create(null),mn;for(let s in Me)gn[Zt+s]=((mn=Me[s])==null?void 0:mn.default)||"";var lr=class lr extends $t{constructor(){super(...arguments);h(this,"cssInit$",gn)}$$(t){return this.$[Zt+t]}set$$(t){for(let i in t)this.$[Zt+i]=t[i]}sub$$(t,i){this.sub(Zt+t,r=>{r===null||r===""||i(r)})}analyticsParams(){return`-/@clib/${Lt}/${Ut}/uc-img/`}initAttributes(t){[...this.attributes].forEach(i=>{Me[i.name]||t.setAttribute(i.name,i.value)})}initIntersection(t,i){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(i(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Me)}attributeChangedCallback(t,i,r){window.setTimeout(()=>{this.$[Zt+t]=r})}};l(lr,"ImgConfig");var Fi=lr;var ar=class ar extends Fi{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!sr&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let i=t.match(/\d+/)[0],r=t.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>or&&this.hasFormatJPG)return or+r;if(Number(o)>rr&&!this.hasFormatJPG)return rr+r}return t}_getCdnModifiers(t,i){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return D(...fn(r))}_getUrlBase(t="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(sr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(t,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return U(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(U(vt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(U(vt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(U(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(U(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Ae(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,i=1,r=!0){let o=t.getBoundingClientRect(),n=i*Math.round(o.width),a=r?"":i*Math.round(o.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(t){let i=l(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)t.addEventListener(o,i)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:nr.PREVIEW,img:this._imgPreview}:{type:nr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=N(this.$$("breakpoints"));return pn(t.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let r=`image-set(${[...i].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{t.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:i,srcset:r}){i&&(t.src=i),r&&(t.srcset=r)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:i,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(ir,""),r.addEventListener("load",()=>{r.removeAttribute(ir),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:t,srcset:i})})}async renderImage(){var t,i;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var r;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};l(ar,"ImgBase");var zi=ar;var cr=class cr extends zi{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",e=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=e?"lazy":"eager")})}};l(cr,"Img");var Bi=cr;var Yt=class Yt extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=I(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};l(Yt,"SimpleBtn"),h(Yt,"styleAttrs",[...j(Yt,Yt,"styleAttrs"),"uc-simple-btn"]);var Jt=Yt;Jt.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;Jt.bindAttributes({dropzone:null});var ur=class ur extends _{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(ur,"StartFrom");var Pe=ur;Pe.template='<div class="uc-content"><slot></slot></div>';function ic(s){return new Promise(e=>{typeof window.FileReader!="function"&&e(!1);try{let t=new FileReader;t.onerror=()=>{e(!0)};let i=l(r=>{r.type!=="loadend"&&t.abort(),e(!1)},"onLoad");t.onloadend=i,t.onprogress=i,t.readAsDataURL(s)}catch{e(!1)}})}l(ic,"checkIsDirectory");function sc(s,e){return new Promise(t=>{let i=0,r=[],o=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(i++,a.file(c=>{i--;let u=new File([c],c.name,{type:c.type||e});r.push({type:"file",file:u,fullPath:a.fullPath}),i===0&&t(r)})):a.isDirectory&&n(a.createReader())},"readEntry"),n=l(a=>{i++,a.readEntries(c=>{i--;for(let u of c)o(u);i===0&&t(r)})},"readReaderContent");o(s)})}l(sc,"readEntryContentAsync");function bn(s){let e=[],t=[];for(let i=0;i<s.items.length;i++){let r=s.items[i];if(r)if(r.kind==="file"){let o=r.type;if(typeof r.webkitGetAsEntry=="function"||typeof r.getAsEntry=="function"){let a=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();t.push(sc(a,o).then(c=>{c&&e.push(...c)}));continue}let n=r.getAsFile();n&&t.push(ic(n).then(a=>{a||e.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(o=>{r.getAsString(n=>{e.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>e)}l(bn,"getDropItems");var B={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},_n=["focus"],rc=100,hr=new Map;function oc(s,e){let t=Math.max(Math.min(s[0],e.x+e.width),e.x),i=Math.max(Math.min(s[1],e.y+e.height),e.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-i)*(s[1]-i))}l(oc,"distance");function dr(s){let e=0,t=document.body,i=new Set,r=l(g=>i.add(g),"handleSwitch"),o=B.INACTIVE,n=l(g=>{s.shouldIgnore()&&g!==B.INACTIVE||(o!==g&&i.forEach(b=>b(g)),o=g)},"setState"),a=l(()=>e>0,"isDragging");r(g=>s.onChange(g));let c=l(()=>{e=0,n(B.INACTIVE)},"onResetEvent"),u=l(()=>{e+=1,o===B.INACTIVE&&n(B.ACTIVE)},"onDragEnter"),p=l(()=>{e-=1,a()||n(B.INACTIVE)},"onDragLeave"),d=l(g=>{g.preventDefault(),e=0,n(B.INACTIVE)},"onDrop"),f=l(g=>{if(s.shouldIgnore())return;a()||(e+=1);let b=[g.x,g.y],w=s.element.getBoundingClientRect(),x=Math.floor(oc(b,w)),v=x<rc,C=g.composedPath().includes(s.element);hr.set(s.element,x);let M=Math.min(...hr.values())===x;C&&M?(g.preventDefault(),n(B.OVER)):n(v&&M?B.NEAR:B.ACTIVE)},"onDragOver"),m=l(async g=>{if(s.shouldIgnore())return;g.preventDefault();let b=await bn(g.dataTransfer);s.onItems(b),n(B.INACTIVE)},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),s.element.addEventListener("drop",m),_n.forEach(g=>{window.addEventListener(g,c)}),()=>{hr.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",m),_n.forEach(g=>{window.removeEventListener(g,c)})}}l(dr,"addDropzone");var yn="uc-drop-area",Qt=`${yn}/registry`,te=class te extends S{constructor(){super(),this.init$={...this.init$,state:B.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[Qt]:null}}isActive(){if(!this.$.isEnabled)return!1;let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,i=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return t&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[Qt]||(this.$[Qt]=new Set),this.$[Qt].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!I(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:I(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:I(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:I(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=dr({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:X.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:X.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let e=this.ref["content-wrapper"];e&&(this._destroyContentWrapperDropzone=dr({element:e,onChange:t=>{var r;let i=(r=Object.entries(B).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();i&&e.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let i=(r=Object.entries(B).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",t=>{let i=N(t);this.$.isEnabled=i.includes(S.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[Qt]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let e=this.cfg.multiple,t=this.cfg.multipleMax,i=this.uploadCollection.size;return!(e&&t&&i>=t||!e&&i>0)}destroyCallback(){var t,i;super.destroyCallback();let e=this.$[Qt];e&&(e.delete(this),e.size===0&&T.deleteCtx(yn)),(t=this._destroyDropzone)==null||t.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};l(te,"DropArea"),h(te,"styleAttrs",[...j(te,te,"styleAttrs"),"uc-drop-area"]);var ee=te;ee.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;ee.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var nc="src-type-",pr=class pr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:S.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:S.sourceTypes.URL,activity:_.activities.URL,textKey:"from-url"}),this.registerType({type:S.sourceTypes.CAMERA,activity:_.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:_.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(S.extSrcList))this.registerType({type:t,activity:_.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:i,activate:r,activityParams:o={}}=t;(r?r():!!i)&&this.set$({"*currentActivityParams":o,"*currentActivity":i})}applyType(t){let i=this._registeredTypes[t];if(!i){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:o=t}=i;this.$["src-type"]=`${nc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};l(pr,"SourceBtn");var ie=pr;ie.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;ie.bindAttributes({type:null});var fr=class fr extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{let t=N(e),i="";t.forEach(r=>{i+=`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};l(fr,"SourceList");var Vi=fr;var Hi=l(()=>{let s=[];return{stack:s,promiseReadJpegChunks:l(t=>new Promise((i,r)=>{let o=2,n=l((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result))}),d.addEventListener("error",f=>{r(`Reader error: ${f}`)}),d.readAsArrayBuffer(u)},"readToView"),a=l(()=>n(t.slice(o,o+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=l(()=>{let u=o;return n(t.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){i(!0);return}let f=p.getUint16(2)-2;return n(t.slice(o,o+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:m}),a()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),a()})}),"promiseReadJpegChunks")}},"readJpegChunks"),lc=l(async s=>{let e=[],{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s),i.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&e.push(o)}),e},"getIccProfile"),wn=l(async(s,e,t)=>{{let i=[],r=[],{promiseReadJpegChunks:o,stack:n}=Hi();await o(s),n.forEach(u=>{if(u.marker===e)return i.push(u.startPos),r.push(u.length)});let a=[s.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+e),p.setUint16(2,u.byteLength+2),a.push(p.buffer),a.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&a.push(s.slice(c,i[u])),c=i[u]+r[u]+4;return a.push(s.slice(c,s.size)),new Blob(a,{type:s.type})}},"replaceJpegChunk"),ac=226,xn=l((s,e)=>wn(s,ac,e.map(t=>t.buffer)),"replaceIccProfile"),cc=l(async s=>{try{return await xn(s,[])}catch(e){throw new Error(`Failed to strip ICC profile: ${e}`)}},"stripIccProfile"),uc=l((s,e,t)=>new Promise((i,r)=>{let o=l(n=>{if(!n){r("Failed to convert canvas to blob");return}i(n)},"callback");s.toBlob(o,e,t),s.width=s.height=1}),"canvasToBlob"),Re=l(()=>{let s=document.createElement("canvas"),e=s.getContext("2d");return{canvas:s,ctx:e}},"createCanvas"),hc=l(s=>{let{ctx:t,canvas:i}=Re();i.width=i.height=50,t.drawImage(s,0,0,50,50);let r=t.getImageData(0,0,50,50).data;i.width=i.height=1;for(let o=3;o<r.length;o+=4)if(r[o]<254)return!0;return!1},"hasTransparency"),dc=l(async s=>{let e=null,{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s),i.forEach(({marker:r,view:o})=>{if(!e&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){e=o;return}}),e},"getExif"),pc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ji,fc=l(()=>new Promise(s=>{if(ji!==void 0)s(ji);else{let e=new Image;e.addEventListener("load",()=>{ji=e.naturalWidth<e.naturalHeight,e.src="//:0",s(ji)}),e.src=pc}}),"isBrowserApplyExifOrientation"),mc=l((s,e)=>{let t,i,r,o;if(!s||s.byteLength<14||s.getUint32(0)!==1165519206||s.getUint16(4)!==0)return;if(s.getUint16(6)===18761)i=!0;else if(s.getUint16(6)===19789)i=!1;else return;if(s.getUint16(8,i)!==42)return;r=8+s.getUint32(10,i);let n=s.getUint16(r-2,i);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(s.byteLength<r+10)return;s.getUint16(r,i)===274&&e(r+8,i),r+=12}},"findExifOrientation"),gc=l((s,e)=>{mc(s,(t,i)=>s.setUint16(t,e,i))},"setExifOrientation"),bc=l(async(s,e,t)=>(t&&gc(e,1),wn(s,225,[e.buffer])),"replaceExif"),_c=l((s,e)=>new Promise((t,i)=>{e&&(s.src=e),s.complete?t(s):(s.addEventListener("load",()=>{t(s)}),s.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),yc=l(s=>_c(new Image,s),"imageLoader"),vc=[1,3],wc=[192,193,194,195,197,198,199,201,202,203,205,206,207],vn={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},xc=l(async s=>{let e=!1,{promiseReadJpegChunks:t,stack:i}=Hi();return await t(s).then(()=>(i.forEach(({marker:r,view:o})=>{if(!e&&wc.indexOf(r)>=0){let n=o.getUint8(5);vc.indexOf(n)<0&&(e=!0)}}),e)).catch(()=>e)},"shouldSkipShrink"),Cn=l((s,e)=>{let t={};return(...i)=>{let r=e(i,t);return r in t?t[r]:t[r]=s(...i)}},"memoize"),An=l((s,e)=>{let[t]=s,i=Object.keys(e).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<i.length;r++){let o=i[r],n=!!e[o];if(o>t&&n||o<t&&!n)return o}return t},"memoKeySerializer"),Tt={R:55,G:110,B:165,A:255},Cc=`rgba(${Tt.R}, ${Tt.G}, ${Tt.B}, ${Tt.A/255})`,En=l((s,e)=>{try{let t=[s-1,e-1,1,1],{canvas:i,ctx:r}=Re();i.width=1,i.height=1;let{canvas:o,ctx:n}=Re();o.width=s,o.height=e,n&&(n.fillStyle=Cc,n.fillRect(...t),r.drawImage(o,s-1,e-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,c=!1;return a&&(c=a[0]===Tt.R&&a[1]===Tt.G&&a[2]===Tt.B&&a[3]===Tt.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${e}.`),!1}},"canvasTest");function Tn(s){return(...e)=>new Promise(t=>{setTimeout(()=>{let i=s(...e);t(i)},0)})}l(Tn,"wrapAsync");var Ac=Tn(Cn(En,An)),Ec=Tn(Cn(En,An)),Sn=l(async(s,e)=>{let t=vn.squareSide.find(n=>n*n>=s*e),i=vn.dimension.find(n=>n>=s&&n>=e);if(!t||!i)throw new Error("Not supported");let[r,o]=await Promise.all([Ac(t,t),Ec(i,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),kn=l(async(s,e,t)=>{try{let{ctx:i,canvas:r}=Re();return r.width=e,r.height=t,i.imageSmoothingQuality="high",i.drawImage(s,0,0,e,t),s instanceof HTMLImageElement&&(s.src="//:0"),s instanceof HTMLCanvasElement&&(s.width=s.height=1),r}catch(i){throw new Error("Canvas resize error",{cause:i})}},"canvasResize"),Tc=l(({img:s,targetW:e,targetH:t})=>kn(s,e,t),"native"),Sc=l(function({sourceW:s,targetW:e,targetH:t,step:i}){let r=[],o=e,n=t;do r.push([o,n]),o=Math.round(o/i),n=Math.round(n/i);while(o<s*i);return r.reverse()},"calcShrinkSteps"),kc=l(({img:s,sourceW:e,targetW:t,targetH:i,step:r})=>Sc({sourceW:e,targetW:t,targetH:i,step:r}).reduce((n,[a,c])=>n.then(u=>Sn(a,c).then(()=>kn(u,a,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),$c=l(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Ic=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),mr=.71,Oc=l((s,e)=>{if(s.width*mr*s.height*mr<e.size)throw new Error("Not required");let t=s.width,i=s.height,r=t/i,o=Math.floor(Math.sqrt(e.size*r)),n=Math.floor(e.size/Math.sqrt(e.size*r));return Sn(o,n).then(()=>{let{ctx:a}=Re();return"imageSmoothingQuality"in a&&!$c()&&!Ic?Tc({img:s,targetW:o,targetH:n}):kc({img:s,sourceW:t,targetW:o,targetH:n,step:mr})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),$n=l(async(s,e)=>{try{if(await xc(s))throw new Error("Should skipped");let i=await Promise.allSettled([dc(s),fc(),lc(s)]),o=!i.some(b=>b.status==="rejected"),[n,a,c]=i,u=await cc(s).catch(()=>s),p=await yc(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Oc(p,e),f="image/jpeg",m=(e==null?void 0:e.quality)||.8;!o&&hc(d)&&(f="image/png",m=void 0);let g=await uc(d,f,m);if(o&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await bc(g,b,w)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await xn(g,c.value)),g}catch(t){let i;throw t instanceof Error&&(i=t.message),typeof t=="string"&&(i=t),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:t})}},"shrinkFile");function Lc(s){let e=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(e)}l(Lc,"createSvgBlobUrl");function gr(s="hsl(209, 21%, 65%)",e=32,t=32){return Lc(`<svg width="${e}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${s}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}l(gr,"fileCssBg");function In(s,e=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),i=t.getContext("2d"),r=new Image,o=new Promise((n,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=e,t.height=e*c):(t.height=e,t.width=e/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,t.width,t.height),i.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){a();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),o}l(In,"generateThumb");var Uc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,On=l(s=>{let e=Uc.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!e.length)return!1;let t=e[1]*e[2],i=16384*16384;return t>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${e[1]}x${e[2]} (${Math.ceil(t/1e3/100)/10}MP).`),!1):{quality:e[3]?e[3]/100:void 0,size:t}},"parseShrink");var Y=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3)}),se=class se extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",L(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",L(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:Y.IDLE,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===_.activities.DETAILS)?this.$["*currentActivity"]=_.activities.DETAILS:this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[i]=t;this._isIntersecting=i.isIntersecting,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),i.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,i=Y.IDLE;t.getValue("errors").length>0?i=Y.FAILED:t.getValue("isUploading")?i=Y.UPLOADING:t.getValue("fileInfo")&&(i=Y.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(U(vt(this.cfg.cdnCname,this._entry.getValue("uuid")),D(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((i=t.getValue("file"))!=null&&i.type.includes("image"))try{let r=await In(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",gr(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",gr(r))}}_subEntry(t,i){let r=this._entry.subscribe(t,o=>{this.isConnected&&i(o)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=i,i&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=i.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{se.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),se.activeInstances.add(this)}_handleState(t){var i,r,o,n;t===Y.FAILED?this.$.badgeIcon="badge-error":t===Y.FINISHED&&(this.$.badgeIcon="badge-success"),t===Y.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===Y.FAILED,isUploading:t===Y.UPLOADING,isFinished:t===Y.FINISHED,progressVisible:t===Y.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((i=this._entry)==null?void 0:i.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message})}destroyCallback(){super.destroyCallback(),se.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return On(this.cfg.imageShrink)}_processShrink(t){return $n(t,this._settingsOfShrink())}async upload(){var r,o,n,a,c;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let u=new AbortController;t.setValue("abortController",u);let p=l(async()=>{let f=t.getValue("file");f&&this.cfg.imageShrink&&(f=await this._processShrink(f).catch(()=>f));let m=f||t.getValue("externalUrl")||t.getValue("uuid"),b={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:w=>{if(w.isComputable){let x=w.value*100;t.setValue("uploadProgress",x)}},signal:u.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",m,b),xs(m,b)},"uploadTask"),d=await this.$["*uploadQueue"].add(p);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(n=(o=(r=d.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:d.mimeType,uuid:d.uuid,cdnUrl:(a=t.getValue("cdnUrl"))!=null?a:d.cdnUrl,cdnUrlModifiers:(c=t.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(u){u instanceof xt&&u.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:u}),t===this._entry&&this._debouncedCalculateState()}}}};l(se,"FileItem");var re=se;re.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div class="uc-file-name-wrapper"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;re.activeInstances=new Set;var Pt=class Pt extends y{constructor(){super();h(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",l(t=>{this._mouseDownTarget=t.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",l(t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};l(Pt,"Modal"),h(Pt,"styleAttrs",[...j(Pt,Pt,"styleAttrs"),"uc-modal"]),h(Pt,"StateConsumerScope","modal");var Fe=Pt;Fe.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Gi=l((s,e)=>{let t,i,r,o=l((...n)=>{t?(clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=e&&(s(...n),r=Date.now())},Math.max(e-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),o},"throttle");var br=class br extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",_.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",Gi(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit($.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit($.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),i={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=i.failed===0&&t.errors.length===0,c=!1,u=!1,p=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&r)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!t.group:!0;p=i.total===i.succeed&&r&&a&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:i.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(t){let i=l(r=>{let o=t[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return t.uploading>0?i("uploading"):t.failed>0?i("failed"):t.succeed>0?i("succeed"):i("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let i=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};l(br,"UploadList");var De=br;De.template=`<uc-activity-header><span class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var _r=class _r extends S{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:X.URL_TAB}),this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let i=t.target.value;this.set$({importDisabled:!i})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(_r,"UrlSource");var Ne=_r;Ne.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var yr=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var vr=class vr extends S{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:yr(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",l(()=>{yr()&&this._subscribePermissions(),this._capture()},"_onActivate"));h(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));h(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_setPermissionsState",L(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let i=await navigator.mediaDevices.getUserMedia(t);i.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=i,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.error("Failed to capture camera",i)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),i=`camera-${t}.jpeg`,r="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],i,{lastModified:t,type:r});this.api.addFileFromObject(n,{source:X.CAMERA}),this.set$({"*currentActivity":_.activities.UPLOAD_LIST})},r)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",i=>{this.$.videoTransformCss=i?"scaleX(-1)":null});try{let r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));r.length>1&&(this.$.cameraSelectOptions=r,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=r[0])==null?void 0:t.value}catch{}}};l(vr,"CameraSource");var ze=vr;ze.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" set="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var wr=class wr extends S{constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};l(wr,"UploadCtxProviderClass");var Wi=wr;Wi.EventType=$;var Ln=Wi;var xr=class xr extends S{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};l(xr,"ProgressBarCommon");var Be=xr;Be.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var Cr=class Cr extends y{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let i=this._value;if(this._value=t,t===0&&i>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};l(Cr,"ProgressBar");var Ve=Cr;Ve.template='<div ref="line" class="uc-progress"></div>';var at="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Un(...s){return s.reduce((e,t)=>{if(typeof t=="string")return e[t]=!0,e;for(let i of Object.keys(t))e[i]=t[i];return e},{})}l(Un,"normalize");function F(...s){let e=Un(...s);return Object.keys(e).reduce((t,i)=>(e[i]&&t.push(i),t),[]).join(" ")}l(F,"classNames");function Mn(s,...e){let t=Un(...e);for(let i of Object.keys(t))s.classList.toggle(i,t[i])}l(Mn,"applyClassNames");var Pn=l(s=>{if(!s)return H;let e=ao(s).filter(t=>H.includes(t));return e.length===0?H:e},"parseTabs");function Rn(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":H,"*tabId":O.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:at,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:zt(H),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let e=s.querySelectorAll("img");for(let t of e){let i=t.src;t.src=at,t.src=i}s.$["*networkProblems"]=!1},"*on.apply":e=>{if(!e)return;let t=s.$["*originalUrl"],i=D(wt(e),"preview"),r=U(t,i),o={originalUrl:t,cdnUrlModifiers:i,cdnUrl:r,transformations:e};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(Rn,"initState");var Fn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='puc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#puc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#suc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#suc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#suc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#suc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#suc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#suc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#suc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#suc-icon-id__h)'/><defs><linearGradient id='suc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Dn=`${Fn} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${at}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var Xi=class Xi extends y{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",L(this._showLoader.bind(this),300));this.init$={...this.init$,...Rn(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((i,r)=>{let o=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(i(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=ai(this.$.cdnUrl),i=vt(this.$.cdnUrl,t);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let r=Jr(this.$.cdnUrl),o=ro(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=vt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===O.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(U(this.$["*originalUrl"],D("json"))),i=await fetch(t).then(n=>n.json()),{width:r,height:o}=i;this.$["*imageSize"]={width:r,height:o},this.$["*tabId"]===O.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==at&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let i=this.ref["img-el"];i.src!==t&&(this._imgLoading=!0,i.src=t||at)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=ki(t)}),this.sub("tabs",t=>{this.$["*tabList"]=Pn(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=F("uc-image",{"uc-image_hidden_to_cropper":t===O.CROP,"uc-image_hidden_effects":t!==O.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let i=this.$["*originalUrl"],r=D(wt(t),"preview"),o=U(i,r),n={originalUrl:i,cdnUrlModifiers:r,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(Xi,"CloudImageEditorBlock"),h(Xi,"styleAttrs",["uc-cloud-image-editor"]);var ct=Xi;ct.template=Dn;ct.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Ar=class Ar extends y{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return;if(e===""&&t.height<=A&&t.width<=A)return!0;let i=t.height<=A&&(e.includes("n")||e.includes("s")),r=t.width<=A&&(e.includes("e")||e.includes("w"));return i||r}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:r,height:o}=e,n=this.ref["svg-el"],a=Z("mask",{id:"backdrop-mask"}),c=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=Z("rect",{x:t,y:i,width:r,height:o,fill:"black"});a.appendChild(c),a.appendChild(u);let p=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(p),n.appendChild(a),this._backdropMask=a,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:r,height:o}=e;this._backdropMaskInner&&Ot(this._backdropMaskInner,{x:t,y:i,width:r,height:o})}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:i,pathNode:r,interactionNode:o,groupNode:n}=t,a=i==="",c=i.length===2,{x:u,y:p,width:d,height:f}=e;if(a){let g={x:u+d/3,y:p+f/3,width:d/3,height:f/3};Ot(o,g)}else{let g=Et(Math.min(d,f)/(24*2+34)/2,0,1),{d:b,center:w}=c?zo(e,i,g):Bo(e,i,g),x=Math.max(Ns*Et(Math.min(d,f)/Ns/3,0,1),No);Ot(o,{x:w[0]-x,y:w[1]-x,width:x*2,height:x*2}),Ot(r,{d:b})}let m=this._shouldThumbBeDisabled(i);n.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Ot(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let r=`${["n","","s"][t]}${["w","","e"][i]}`,o=Z("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=Z("rect",{fill:"transparent"}),a=Z("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(n),e[r]={direction:r,pathNode:a,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return e}_createGuides(){let e=Z("svg"),t=Z("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let r=Z("line",{x1:`${Ie*i}%`,y1:"0%",x2:`${Ie*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(r)}for(let i=1;i<=2;i++){let r=Z("line",{x1:"0%",y1:`${Ie*i}%`,x2:"100%",y2:`${Ie*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(r)}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this.ref["svg-el"],t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))t.appendChild(o);e.appendChild(t),this._frameThumbs=r,this._frameGuides=i}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(this._shouldThumbBeDisabled(e))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-o,c=t.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(e){this._updateCursor(),this.$.dragging&&(e.stopPropagation(),e.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(e){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this.ref["svg-el"],{x:i,y:r}=t.getBoundingClientRect(),o=e.x-i,n=e.y-r,a=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[a,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(e,t){var u,p;let[i,r]=t,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],a=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=a?a.width/a.height:void 0;if(e===""?n=jo({rect:n,delta:[i,r],imageBox:o}):n=Ho({rect:n,delta:[i,r],direction:e,aspectRatio:c,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return Ht(Wt(n),this.$["*imageBox"])}_handleSvgPointerMove_(e){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Go(n,[e.x,e.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let e=this._hoverThumb;this.ref["svg-el"].style.cursor=e?Vo(e.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(e){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=A||e.width<=A,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",e=>{this._frameGuides&&this._frameGuides.setAttribute("class",F({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&e,"uc-guides--semi-hidden":!this._guidesHidden&&!e}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(Ar,"CropFrame");var je=Ar;je.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var Er=class Er extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=F({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(Er,"EditorButtonControl");var _t=Er;_t.template=`<button type="button" role="option"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Pc(s){let e=s+90;return e=e>=360?0:e,e}l(Pc,"nextAngle");function Rc(s,e){return s==="rotate"?Pc(e):["mirror","flip"].includes(s)?!e:null}l(Rc,"nextValue");var Tr=class Tr extends _t{initCallback(){super.initCallback(),this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e)}),this.$["on.click"]=e=>{let t=this.$["*cropperEl"].getValue(this._operation),i=Rc(this._operation,t);this.$["*cropperEl"].setValue(this._operation,i)}}};l(Tr,"EditorCropButtonControl");var oe=Tr;var He={FILTER:"filter",COLOR_OPERATION:"color_operation"},ut="original",Sr=class Sr extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,i){this._controlType=t==="filter"?He.FILTER:He.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ut?void 0:this.$.value,filter:this._filter===ut?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:i}=st[this._operation],[r,o]=t;this.$.min=r,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===He.FILTER){let a=o;if(n){let{name:c,amount:u}=n;a=c===this._filter?u:o}this.$.value=a,this.$.defaultValue=a}if(this._controlType===He.COLOR_OPERATION){let a=typeof n!="undefined"?n:i;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===He.FILTER?this._filter===ut?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let i=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=i})}};l(Sr,"EditorSlider");var Ge=Sr;Ge.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function We(s){let e=new Image;return{promise:new Promise((r,o)=>{e.src=s,e.onload=r,e.onerror=o}),image:e,cancel:l(()=>{e.naturalWidth===0&&(e.src=at)},"cancel")}}l(We,"preloadImage");function Xe(s){let e=[];for(let o of s){let n=We(o);e.push(n)}let t=e.map(o=>o.image);return{promise:Promise.allSettled(e.map(o=>o.promise)),images:t,cancel:l(()=>{e.forEach(o=>{o.cancel()})},"cancel")}}l(Xe,"batchPreloadImages");var kr=class kr extends _t{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,i=Math.ceil(t*e),r=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==ut?{name:this._filter,amount:o}:void 0,U(this._originalUrl,D(ci,wt(n),`quality/${r}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(e,t){var r;if(e[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:a,cancel:c}=We(o);this._cancelPreload=c,a.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(r=this._cancelPreload)==null||r.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===ut,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("isOriginal",t=>{this.$.iconSize=t?40:20}),this.sub("active",t=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=t?"1":"0";let r=this.ref["preview-el"];t?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let i=await this.proxyUrl(this._previewSrc()),r=this.ref["preview-el"];r.style.backgroundImage&&(r.style.backgroundImage="none",r.style.backgroundImage=`url(${i})`)}})}destroyCallback(){var e,t;super.destroyCallback(),(e=this._observer)==null||e.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};l(kr,"EditorFilterControl");var Ft=kr;Ft.template=`<button type="button" role="option"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var $r=class $r extends _t{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:i}=st[this._operation],r=t[this._operation],o=typeof r!="undefined"?r!==i:!1;this.$.active=o})}};l($r,"EditorOperationControl");var ne=$r;function Nn(s,e){let t={};for(let i of e){let r=s[i];(s.hasOwnProperty(i)||r!==void 0)&&(t[i]=r)}return t}l(Nn,"pick");function le(s,e,t){let r=window.devicePixelRatio,o=Math.min(Math.ceil(e*r),3e3),n=r>=2?"lightest":"normal";return U(s,D(ci,wt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}l(le,"viewerImageSrc");function Fc(s){return s?[({dimensions:t,coords:i})=>[...t,...i].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:i})=>t.every(r=>r>0)&&i.every(r=>r>=0)].every(t=>t(s)):!0}l(Fc,"validateCrop");var Ir=class Ir extends y{constructor(){super();h(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=L(this._commit.bind(this),300),this._handleResizeThrottled=Gi(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],i=Nn(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...i};this.$["*operations"]=r}_initCanvas(){let t=this.ref["canvas-el"],i=t.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${o}px`,t.width=r*n,t.height=o*n,i==null||i.scale(n,n),this._canvas=t,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,i=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Gt({width:t.naturalWidth,height:t.naturalHeight},o),c;if(a.width>n.width-i*2||a.height>n.height-i*2){let u=a.width/a.height,p=n.width/n.height;if(u>p){let d=n.width-i*2,f=d/u,m=0+i,g=i+(n.height-i*2)/2-f/2;c={x:m,y:g,width:d,height:f}}else{let d=n.height-i*2,f=d*u,m=i+(n.width-i*2)/2-f/2,g=0+i;c={x:m,y:g,width:f,height:d}}}else{let{width:u,height:p}=a,d=i+(n.width-i*2)/2-u/2,f=i+(n.height-i*2)/2-p/2;c={x:d,y:f,width:u,height:p}}this.$["*imageBox"]=Wt(c)}_alignCrop(){var f;let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[m,g],coords:[b,w]}=n,{width:x}=Gt(this._imageSize,o),v=a/x;t=Ht(Wt({x:c+b*v,y:u+w*v,width:m*v,height:g*v}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],d=p?p.width/p.height:void 0;if(!Wo(t,i)||d&&!Xo(t,d)){let m=i.width/i.height,g=i.width,b=i.height;d&&(m>d?g=Math.min(i.height*d,i.width):b=Math.min(i.width/d,i.height)),t={x:i.x+i.width/2-g/2,y:i.y+i.height/2-b/2,width:g,height:b}}this.$["*cropBox"]=Ht(Wt(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let i=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:c}=o,u=Gt({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=F({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=i,{width:c,height:u}=Gt(this._imageSize,o),{width:p,height:d}=t,f=n/c,m=a/u;return[Et(Math.round(p/f),1,c),Et(Math.round(d/m),1,u)]}_getCropTransformation(){let t=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:c,y:u}=i,{width:p,height:d}=Gt(this._imageSize,o),{x:f,y:m}=t,g=n/p,b=a/d,w=this._getCropDimensions(),x={dimensions:w,coords:[Et(Math.round((f-c)/g),0,p-w[0]),Et(Math.round((m-u)/b),0,d-w[1])]};if(!Fc(x)){console.error("Cropper is trying to create invalid crop object",{payload:x});return}if(!(w[0]===p&&w[1]===d))return x}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:i,mirror:r,flip:o}=t,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:i,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(t,i){this.$["*operations"]={...this.$["*operations"],[t]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:i})}catch(r){console.error("Failed to activate cropper",{error:r})}this._observer=new ResizeObserver(([r])=>{r.contentRect.width>0&&r.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var i;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=F({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(i=this._observer)==null||i.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),i=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(i,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,a=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-a)/o}px)`,this.style.transformOrigin=`${n}px ${a}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,i){var p;let r=this.offsetWidth;i={...i,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(le(t,r,i)),{promise:n,cancel:a,image:c}=We(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=a,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(t){let i="crop",r=this.$["*loadingOperations"];return r.get(i)||r.set(i,new Map),r.get(i).get(t)||(r.set(i,r.get(i).set(t,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(i))!=null&&o.has(t)&&(r.get(i).delete(t),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};l(Ir,"EditorImageCropper");var qe=Ir;qe.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Or(s,e,t){let i=Array(t);t--;for(let r=t;r>=0;r--)i[r]=Math.ceil((r*e+(t-r)*s)/t);return i}l(Or,"linspace");function Dc(s){return s.reduce((e,t,i)=>i<s.length-1?[...e,[t,s[i+1]]]:e,[])}l(Dc,"splitBySections");function Nc(s,e,t){let i=Dc(s).find(([r,o])=>r<=e&&e<=o);return s.map(r=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(e-i[0])/o;return i[0]===r?e>t?1:1-n:i[1]===r?e>=t?n:1:0})}l(Nc,"calculateOpacities");function zc(s,e){return s.map((t,i)=>t<e?s.length-i:i)}l(zc,"calculateZIndices");function zn(s,e){let t=st[s].keypointsNumber,{range:i,zero:r}=st[s];return[...new Set([...Or(i[0],r,t+1),...Or(r,i[1],t+1),r,e])].sort((o,n)=>o-n)}l(zn,"keypointsRange");var Lr=class Lr extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=L(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var r;(r=i==null?void 0:i.get(t))!=null&&r.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}async _imageSrc({url:e=this._url,filter:t=this._filter,operation:i,value:r}={}){let o={...this._transformations};i&&(o[i]=t?{name:t,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(le(e,n,o))}async _constructKeypoint(e,t){return{src:await this._imageSrc({operation:e,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}async _addKeypoint(e,t,i){let r=l(()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(r())return;let o=await this._constructKeypoint(e,i),n=new Image;n.src=o.src;let a=this._handleImageLoading(o.src);n.addEventListener("load",a,{once:!0}),n.addEventListener("error",a,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(r())return;let c=this._keypoints,u=c.findIndex(d=>d.value>i),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(n,p),this._update(e,i))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(e){e=typeof e=="string"?parseInt(e,10):e,this._update(this._operation,e),this._addKeypointDebounced(this._operation,this._filter,e)}_update(e,t){this._operation=e,this._value=t;let{zero:i}=st[e],r=this._keypoints.map(a=>a.value),o=Nc(r,t,i),n=zc(r,i);for(let[a,c]of Object.entries(this._keypoints))c.opacity=o[a],c.zIndex=n[a];this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){let e=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&e.appendChild(this._previewImage);let t=document.createElement("div");e.appendChild(t);let i=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=Xe(i);r.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await o,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(e),this._flush())}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:e,filter:t,operation:i,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=zn(i,r),n=await Promise.all(o.map(c=>this._imageSrc({url:e,filter:t,operation:i,value:c}))),{cancel:a}=Xe(n);this._cancelBatchPreload=a}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:!0}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:e,operation:t,value:i,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=e,this._operation=t||"initial",this._value=i,this._filter=r,this._fromViewer=o,typeof i!="number"&&!r){let a=await this._imageSrc({operation:t,value:i});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=await Promise.all(zn(t,i).map(a=>this._constructKeypoint(t,a))),this._update(t,i),this._initNodes()}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=F({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(Lr,"EditorImageFader");var qi=Lr;var Bc=1,Ur=class Ur extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;Math.abs(i)>Bc?this.scrollLeft+=i:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};l(Ur,"EditorScroller");var Ke=Ur;Ke.template=" <slot></slot> ";function Vc(s){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${s}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${s}" data-id="${s}" icon="${s}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${s}" ></uc-btn-ui></uc-presence-toggle>`}l(Vc,"renderTabToggle");function jc(s){return`<uc-presence-toggle id="tab_${s}" class="uc-tab-content" set="visible: presence.tabContent.${s}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${s}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}l(jc,"renderTabContent");var Mr=class Mr extends y{constructor(){super();h(this,"_updateInfoTooltip",L(()=>{var n,a;let t=this.$["*editorTransformations"],i=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===O.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(ut);else if(this.$["*tabId"]===O.TUNING&&i){o=!0;let c=(t==null?void 0:t[i])||st[i].zero;r=this.l10n(i)+" "+c}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ut,"*currentOperation":null,showLoader:!1,filters:no,colorOperations:oo,cropOperations:lo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let i=t.currentTarget.getAttribute("data-id");i&&this._activateTab(i,{fromViewer:!1})},tab_role:"tab",[`tab_${O.TUNING}`]:`tab_${O.TUNING}`,[`tab_${O.CROP}`]:`tab_${O.CROP}`,[`tab_${O.FILTERS}`]:`tab_${O.FILTERS}`},this._debouncedShowLoader=L(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===O.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let i=new ne;return i.operation=t,i}_createFilterControl(t){let i=new Ft;return i.filter=t,i}_createToggleControl(t){let i=new oe;return i.operation=t,i}_renderControlsList(t){let i=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===O.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):t===O.FILTERS?[ut,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):t===O.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);r.appendChild(n)}),[...r.children].forEach((o,n)=>{n===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),i.innerHTML="",i.appendChild(r)}_activateTab(t,{fromViewer:i}){this.$["*tabId"]=t,t===O.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let r of H){let o=r===t,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(t){let i=this.ref[`controls-list-${t}`];i&&(i.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(le(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=Xe([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let i=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let i=!1;for(let[,r]of t.entries()){if(i)break;for(let[,o]of r.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let i of H){this.$[`presence.tabToggle.${i}`]=t.includes(i);let r=this.ref[`tab-toggle-${i}`];r.style.gridColumn=t.indexOf(i)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(Mr,"EditorToolbar");var Ze=Mr;Ze.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${H.map(jc).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${H.map(Vc).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider;" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider;" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var Pr=class Pr extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":""},this.defineAccessor("active",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return F("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",e=>{this._iconSingle=!this.$.text,this._iconHidden=!e,this.$.iconCss=this._iconCss()}),this.sub("theme",e=>{e!=="custom"&&(this.className=`uc-${e}`)}),this.sub("text",e=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",e=>{this.$["aria-role"]=e||""}),this.defineAccessor("aria-controls",e=>{this.$["aria-controls"]=e||""})}set reverse(e){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(Pr,"BtnUi");var ae=Pr;ae.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ae.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var Rr=class Rr extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let e=this.ref["line-el"];e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",e=>{typeof e=="boolean"&&(e?this._start():this._stop())})}_start(){this._active=!0;let{width:e}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(Rr,"LineLoaderUi");var Ye=Rr;Ye.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var Ki={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Fr=class Fr extends y{constructor(){super(),this._visible=!1,this._visibleStyle=Ki.visible,this._hiddenStyle=Ki.hidden,this._externalTransitions=!1,this.defineAccessor("styles",e=>{e&&(this._externalTransitions=!0,this._visibleStyle=e.visible,this._hiddenStyle=e.hidden)}),this.defineAccessor("visible",e=>{typeof e=="boolean"&&(this._visible=e,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Mn(this,{[Ki.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(Ki.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};l(Fr,"PresenceToggle");var Je=Fr;Je.template="<slot></slot> ";var Dr=class Dr extends y{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let r=this.ref["input-el"];i?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:r}=i.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",a.appendChild(u);for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(a),this._stepsCount=n}destroyCallback(){var t;(t=this._observer)==null||t.disconnect()}};l(Dr,"SliderUi");var Qe=Dr;Qe.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var Nr=class Nr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",i=>{i&&(this.$.cdnUrl=i)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let i=t.detail;this.entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new ct,i=this.$.cdnUrl,r=this.cfg.cropPreset,o=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",i),r&&t.setAttribute("crop-preset",r),o&&t.setAttribute("tabs",o),t.addEventListener("apply",n=>{let a=n;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),t.addEventListener("cancel",n=>{let a=n;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),t.addEventListener("change",n=>{let a=n;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(Nr,"CloudImageEditorActivity");var Zi=Nr;var Hc=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Bn=l(function(s,e="i"){let t=s.split("*").map(Hc);return new RegExp("^"+t.join(".+")+"$",e)},"wildcardRegexp");var Gc=l(s=>Object.keys(s).reduce((t,i)=>{let r=s[i],o=Object.keys(r).reduce((n,a)=>{let c=r[a];return n+`${a}: ${c};`},"");return t+`${i}{${o}}`},""),"styleToCss");function Vn({textColor:s,backgroundColor:e,linkColor:t,linkColorHover:i,secondaryColor:r,secondaryHover:o,secondaryForegroundColor:n,fontFamily:a,fontSize:c,radius:u}){let p=`solid 1px ${r}`;return Gc({body:{color:s,"background-color":e,"font-family":a,"font-size":c},".side-bar":{background:"inherit","border-right":p},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":p},".list-table-body .list-items":{"border-bottom":p},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:i},".main-content.loading":{background:`${e} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:i},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:i},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:i},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:i,background:"none"},"input[type=submit], .button, button":{color:n,background:r,"box-shadow":"none",border:"none","border-radius":u},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":u,background:r,border:p}})}l(Vn,"buildStyles");var St={};window.addEventListener("message",s=>{let e;try{e=JSON.parse(s.data)}catch{return}if((e==null?void 0:e.type)in St){let t=St[e.type];for(let[i,r]of t)s.source===i&&r(e)}});var jn=l(function(s,e,t){s in St||(St[s]=[]),St[s].push([e,t])},"registerMessage"),Hn=l(function(s,e){s in St&&(St[s]=St[s].filter(t=>t[0]!==e))},"unregisterMessage");function Gn(s){let e=[];for(let[t,i]of Object.entries(s))i==null||typeof i=="string"&&i.length===0||e.push(`${t}=${encodeURIComponent(i)}`);return e.join("&")}l(Gn,"queryString");var zr=class zr extends S{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.EXTERNAL);h(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let i=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:r,source:o})}this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",t=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let i=N(this.cfg.externalSourcesPreferredTypes);for(let r of i){let o=Bn(r);for(let[n,a]of Object.entries(t.alternatives))if(o.test(n))return a}}return t.url}sendMessage(t){var i,r;(r=(i=this._iframe)==null?void 0:i.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:Vn(t)})}remoteUrl(){var u,p;let{pubkey:t,remoteTabSessionKey:i,socialBaseUrl:r}=this.cfg,{externalSourceType:o}=this.activityParams,a={lang:((p=(u=this.l10n("social-source-lang"))==null?void 0:u.split("-"))==null?void 0:p[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:i},c=new URL(`/window3/${o}`,r);return c.search=Gn(a),c.toString()}mountIframe(){let t=ls({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),jn("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Hn("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(zr,"ExternalSource");var ti=zr;ti.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon set="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div></div><div set="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var Br=class Br extends S{constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,ns(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let a=this._createValidationInput();this.appendChild(a),this._validationInputElement=a}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let a=(i=t.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(a);return}let r=t.group?t.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let a of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=a,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};l(Br,"FormInput");var Yi=Br;var Vr=class Vr extends _{};l(Vr,"ActivityHeader");var Ji=Vr;var jr=class jr extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var i;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((i=this.$.options.find(r=>r.value==this.value))==null?void 0:i.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let i="";t==null||t.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};l(jr,"Select");var ei=jr;ei.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var ts=class ts extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",e=>{this.toggleAttribute("hidden",!!e)})}};l(ts,"Copyright"),h(ts,"template",`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Qi=ts;var ce=class ce extends rt{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",e=>{this.set$({isHidden:I(e)})}),this.sub("*modalActive",e=>{this._lastModalActive!==e&&this.emit(e?$.MODAL_OPEN:$.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=e},!1)}};l(ce,"FileUploaderRegular"),h(ce,"styleAttrs",[...j(ce,ce,"styleAttrs"),"uc-file-uploader-regular"]);var ue=ce;ue.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;ue.bindAttributes({headless:null});var he=class he extends rt{initCallback(){super.initCallback();let e=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=_.activities.UPLOAD_LIST:this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};l(he,"FileUploaderMinimal"),h(he,"styleAttrs",[...j(he,he,"styleAttrs"),"uc-file-uploader-minimal"]);var ii=he;ii.template=`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var de=class de extends rt{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let e=this.$["*history"];return e.length>1&&e[e.length-1]!==_.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let e=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(e.initActivity||_.activities.START_FROM)&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};l(de,"FileUploaderInline"),h(de,"styleAttrs",[...j(de,de,"styleAttrs"),"uc-file-uploader-inline"]);var si=de;si.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var pe=class pe extends ct{initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}};l(pe,"CloudImageEditor"),h(pe,"styleAttrs",[...j(pe,pe,"styleAttrs"),"uc-wgt-common"]);var es=pe;function is(s){for(let e in s){let t=[...e].reduce((i,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),i+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),s[e].reg&&s[e].reg(t)}}l(is,"defineComponents");var Hr="UC";async function Wn(s,e=!1){return new Promise((t,i)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Hr]){t(window[Hr]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{i()},r.onload=()=>{let o=window[Hr];e&&is(o),t(o)},document.head.appendChild(r)})}l(Wn,"loadFileUploaderFrom");return il(Wc);})();
|