@uploadcare/file-uploader 1.11.2-alpha.0 → 1.11.2
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/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +8 -13
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +1 -1
- package/index.ssr.js +1 -1
- package/package.json +2 -4
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +1 -1
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
"use strict";var UC=(()=>{var gt=Object.defineProperty;var
|
|
27
|
-
`,"\\n"),t=
|
|
28
|
-
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,e,i){var r;if(e===i)return;let o=(r=this.constructor.__attrDesc)==null?void 0:r[t];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[t]=i}getCssData(t,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=Aa(i)}catch{!e&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((e,i)=>i===0?"":e).join("--")}__initStyleAttrObserver(){pe||(pe=new Set),pe.add(this.updateCssData),Ve||(Ve=new MutationObserver(t=>{t[0].type==="attributes"&&pe.forEach(e=>{e()})}),Ve.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let i=this.getCssData(this.__extractCssName(t),!0);i===null&&(i=e),this.add(t,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,e,i){let r="__"+t;this[r]=this[t],Object.defineProperty(this,t,{set:o=>{this[r]=o,i?window.setTimeout(()=>{e==null||e(o)}):e==null||e(o)},get:()=>this[r]}),this[t]=this[r]}static set shadowStyles(t){let e=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(t){if(!this.__rootStylesLink){let e=new Blob([t],{type:"text/css"}),i=URL.createObjectURL(e),r=document.createElement("link");r.href=i,r.rel="stylesheet",this.__rootStylesLink=r}}},a(vt,"_BaseComponent"),vt),Ie=ve;cr(Ie,"template");var wt,lr=(wt=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))t.route=i.replace("?","");else if(i.includes("=")){let r=i.split("=");t.options[r[0]]=decodeURI(r[1])}else t.options[i]=!0}),t}static notify(){let t=this.readAddressBar(),e=this.appMap[t.route];if(e&&e.title&&(document.title=e.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${t.route}" not found...`);return}let i=new CustomEvent(lr.routingEventName,{detail:{route:t.route,options:Object.assign(e||{},t.options)}});window.dispatchEvent(i)}static reflect(t,e={}){let i=this.appMap[t];if(!i){this._print("Wrong route: "+t);return}let r="?"+t;for(let n in e)e[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${e[n]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,r),document.title=o}static applyRoute(t,e={}){this.reflect(t,e),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,e){this.setRoutingMap(e);let i=T.registerCtx({route:null,options:null,title:null},t);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||""})}),lr.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}},a(wt,"AppRouter"),wt);lr.appMap=Object.create(null);function At(s,t){for(let e in t)e.includes("-")?s.style.setProperty(e,t[e]):s.style[e]=t[e]}a(At,"applyStyles");function Ea(s,t){for(let e in t)t[e].constructor===Boolean?t[e]?s.setAttribute(e,""):s.removeAttribute(e):s.setAttribute(e,t[e])}a(Ea,"applyAttributes");function ur(s={tag:"div"}){let t=document.createElement(s.tag);if(s.attributes&&Ea(t,s.attributes),s.styles&&At(t,s.styles),s.properties)for(let e in s.properties)t[e]=s.properties[e];return s.processors&&s.processors.forEach(e=>{e(t)}),s.children&&s.children.forEach(e=>{let i=ur(e);t.appendChild(i)}),t}a(ur,"create");var Ys="idb-store-ready",Ta="symbiote-db",Sa="symbiote-idb-update_",Ct,$a=(Ct=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(Ys,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return Sa+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,e){this.name=t,this.storeName=e,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(e,{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(t){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((r,o)=>{i.onsuccess=n=>{var l;(l=n.target.result)!=null&&l._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${t}"`))},i.onerror=n=>{o(n)}})}write(t,e,i=!1){let r={_key:t,_value:e},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((l,c)=>{n.onsuccess=u=>{i||this._notifySubscribers(t),l(u.target.result)},n.onerror=u=>{c(u)}})}delete(t,e=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((o,n)=>{r.onsuccess=l=>{e||this._notifySubscribers(t),o(l)},r.onerror=l=>{n(l)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,r)=>{e.onsuccess=o=>{let n=o.target.result;i(n.map(l=>l._value))},e.onerror=o=>{r(o)}})}subscribe(t,e){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let i=this._subscriptionsMap[t];return i.add(e),{remove:()=>{i.delete(e),i.size||delete this._subscriptionsMap[t]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Js.clear(this.name)}},a(Ct,"DbInstance"),Ct),xt,Js=(xt=class{static get readyEventName(){return Ys}static open(t=Ta,e="store"){let i=t+"/"+e;return this._reg[i]||(this._reg[i]=new $a(t,e)),this._reg[i]}static clear(t){window.indexedDB.deleteDatabase(t);for(let e in this._reg)e.split("/")[0]===t&&delete this._reg[e]}},a(xt,"IDB"),xt);cr(Js,"_reg",Object.create(null));var Qs=a(s=>{if(typeof s!="string"||!s)return"";let t=s.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},"normalizeCdnOperation"),li=a((...s)=>s.filter(t=>typeof t=="string"&&t).map(t=>Qs(t)).join("/-/"),"joinCdnOperations"),V=a((...s)=>{let t=li(...s);return t?`-/${t}/`:""},"createCdnUrlModifiers");function ci(s){let t=new URL(s),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),r=e.lastIndexOf("/"),o="";return i>=0?o=e.slice(i):r>=0&&(o=e.slice(r+1)),o}a(ci,"extractFilename");function ui(s){let t=new URL(s),{pathname:e}=t,i=e.indexOf("/"),r=e.indexOf("/",i+1);return e.substring(i+1,r)}a(ui,"extractUuid");function hr(s){let t=to(s),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}a(hr,"extractCdnUrlModifiers");function eo(s){return hr(s).split("/-/").filter(Boolean).map(e=>Qs(e))}a(eo,"extractOperations");function to(s){let t=new URL(s),e=ci(s),i=io(e)?ro(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}a(to,"trimFilename");function io(s){return s.startsWith("http")}a(io,"isFileUrl");function ro(s){let t=new URL(s);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}a(ro,"splitFileUrl");var R=a((s,t,e)=>{let i=new URL(to(s));if(e=e||ci(s),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),io(e)){let r=ro(e);i.pathname=i.pathname+(t||"")+(r.pathname||""),i.search=r.search,i.hash=r.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},"createCdnUrl"),we=a((s,t)=>{let e=new URL(s);return e.pathname=t+"/",e.toString()},"createOriginalUrl");var B=a((s,t=",")=>s.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0),"stringToArray");var K=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}),oo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Ia(s,t){if(typeof t=="number"){let e=t;return K[s]!==e?`${s}/${e}`:""}if(typeof t=="boolean"){let e=t;return K[s]!==e?`${s}`:""}if(s==="filter"&&t){let{name:e,amount:i}=t;return K.filter===i?"":`${s}/${e}/${i}`}if(s==="crop"&&t){let{dimensions:e,coords:i}=t;return`${s}/${e.join("x")}/${i.join(",")}`}return""}a(Ia,"transformationToStr");function Ce(s){return li(...oo.filter(t=>typeof s[t]!="undefined"&&s[t]!==null).map(t=>{let e=s[t];return Ia(t,e)}).filter(t=>!!t))}a(Ce,"transformationsToOperations");var hi=li("format/auto","progressive/yes"),fe=a(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),so=a(()=>!0,"asBoolean"),ka=a(([s,t])=>({name:s,amount:typeof t!="undefined"?Number(t):100}),"asFilter"),Oa=a(([s,t])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:B(s,"x").map(Number),coords:B(t).map(Number)}},"asCrop"),La=Object.freeze({enhance:fe,brightness:fe,exposure:fe,gamma:fe,contrast:fe,saturation:fe,vibrance:fe,warmth:fe,filter:ka,mirror:so,flip:so,rotate:fe,crop:Oa});function no(s){let t={};for(let e of s){let[i,...r]=e.split("/");if(!oo.includes(i))continue;let o=i,n=La[o];try{let l=n(r);t[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
-
`))}}return t}a(no,"operationsToTransformations");var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),W=[O.CROP,O.TUNING,O.FILTERS],ao=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],lo=["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"],co=["rotate","mirror","flip"],se=Object.freeze({brightness:{zero:K.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:K.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:K.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:K.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:K.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:K.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:K.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:K.enhance,range:[0,100],keypointsNumber:1},filter:{zero:K.filter,range:[0,100],keypointsNumber:1}});var uo=a(s=>s?s.split(",").map(t=>t.trim()):[],"deserealizeCsv"),ze=a(s=>s?s.join(","):"","serializeCsv");var Ua="https://ucarecdn.com",Pa="https://upload.uploadcare.com",Ra="https://social.uploadcare.com",te={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:ze(W),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Ua,baseUrl:Pa,socialBaseUrl:Ra,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:[],defaultCameraMode:"photo",enableAudioRecording:!0,enableVideoRecording:!0,maxVideoRecordingDuration:null,mediaRecorerOptions:null};var I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),dr=class dr{constructor(t){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let r of this._targets)r.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let r=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,r]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let r=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},r);this._timeoutStore.set(t,o)}};a(dr,"EventEmitter");var di=dr;function P(s,t){let e,i=a((...r)=>{clearTimeout(e),e=setTimeout(()=>s(...r),t)},"debounced");return i.cancel=()=>{clearTimeout(e)},i}a(P,"debounce");var ho="--uploadcare-blocks-window-height",Et=class Et{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),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(ho)}};a(Et,"WindowHeightTracker"),h(Et,"clientsRegistry",new Set),h(Et,"flush",P(()=>{document.documentElement.style.setProperty(ho,`${window.innerHeight}px`)},100));var Tt=Et;var po=a(s=>{var i;let t=new Intl.Locale(s),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e},"getLocaleDirection");var pi=a((s,t)=>new Intl.PluralRules(s).select(t),"getPluralForm");var Ma=a(s=>s,"DEFAULT_TRANSFORMER"),pr="{{",mo="}}",fo="plural:";function St(s,t,e={}){var n;let{openToken:i=pr,closeToken:r=mo,transform:o=Ma}=e;for(let l in t){let c=(n=t[l])==null?void 0:n.toString();s=s.replaceAll(i+l+r,typeof c=="string"?o(c):c)}return s}a(St,"applyTemplateData");function go(s){let t=[],e=s.indexOf(pr);for(;e!==-1;){let i=s.indexOf(mo,e),r=s.substring(e+2,i);if(r.startsWith(fo)){let o=s.substring(e+2,i).replace(fo,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));t.push({variable:r,pluralKey:n,countVariable:l})}e=s.indexOf(pr,i)}return t}a(go,"getPluralObjects");var bo=a(({element:s,attribute:t,onSuccess:e,onTimeout:i,timeout:r=300})=>{let o=s.getAttribute(t);if(o!==null){e(o);return}let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{n.disconnect(),i()},r),c=a(u=>{let p=s.getAttribute(t);u.type==="attributes"&&u.attributeName===t&&p!==null&&(clearTimeout(l),n.disconnect(),e(p))},"handleMutation")},"waitForAttribute");function _o(s){return Object.prototype.toString.call(s)==="[object Object]"}a(_o,"isObject");var Da=/\W|_/g;function Fa(s){return s.split(Da).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}a(Fa,"camelizeString");function yo(s,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(s)?s.map(e=>be(e,{ignoreKeys:t})):s}a(yo,"camelizeArrayItems");function be(s,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(s))return yo(s,{ignoreKeys:t});if(!_o(s))return s;let e={};for(let i of Object.keys(s)){let r=s[i];if(t.includes(i)){e[i]=r;continue}_o(r)?r=be(r,{ignoreKeys:t}):Array.isArray(r)&&(r=yo(r,{ignoreKeys:t})),e[Fa(i)]=r}return e}a(be,"camelizeKeys");var Na=a(s=>new Promise(t=>setTimeout(t,s)),"delay");function vr({libraryName:s,libraryVersion:t,userAgent:e,publicKey:i="",integration:r=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:s,libraryVersion:t,languageName:o,integration:r});let n=[s,t,i].filter(Boolean).join("/"),l=[o,r].filter(Boolean).join("; ");return`${n} (${l})`}a(vr,"getUserAgent$1");var Va={factor:2,time:100};function Ba(s,t=Va){let e=0;function i(r){let o=Math.round(t.time*t.factor**e);return r({attempt:e,retry:a(l=>Na(l!=null?l:o).then(()=>(e+=1,i(r))),"retry")})}return a(i,"runAttempt"),i(s)}a(Ba,"retrier");var Tr=class Tr extends Error{};a(Tr,"UploadcareError");var $t=Tr,mi=class mi extends $t{constructor(e){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,mi.prototype),this.originalProgressEvent=e}};a(mi,"NetworkError");var He=mi,_i=a((s,t)=>{s&&(s.aborted?Promise.resolve().then(t):s.addEventListener("abort",()=>t(),{once:!0}))},"onCancel"),gi=class gi extends $t{constructor(e="Request canceled"){super(e);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,gi.prototype)}};a(gi,"CancelError");var xe=gi,za=500,wo=a(({check:s,interval:t=za,timeout:e,signal:i})=>new Promise((r,o)=>{let n,l;_i(i,()=>{n&&clearTimeout(n),o(new xe("Poll cancelled"))}),e&&(l=setTimeout(()=>{n&&clearTimeout(n),o(new xe("Timed out"))},e));let c=a(()=>{try{Promise.resolve(s(i)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,t)}).catch(u=>{l&&clearTimeout(l),o(u)})}catch(u){l&&clearTimeout(l),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),S={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"},yi="application/octet-stream",Co="original",Ae=a(({method:s,url:t,data:e,headers:i={},signal:r,onProgress:o})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,t,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",_i(r,()=>{p=!0,c.abort(),l(new xe)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:t,data:e,headers:i||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let C=w.split(": "),v=C.shift(),x=C.join(": ");v&&typeof v!="undefined"&&(m[v]=x)});let g=c.response,b=c.status;n({request:d,data:g,headers:m,status:b})}},c.onerror=d=>{p||l(new He(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),e?c.send(e):c.send()}),"request");function Ha(s,...t){return s}a(Ha,"identity");var ja=a(({name:s})=>s?[s]:[],"getFileOptions"),Ga=Ha,Wa=a(()=>new FormData,"getFormData"),xo=a(s=>!1,"isBuffer"),vi=a(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),wi=a(s=>typeof File!="undefined"&&s instanceof File,"isFile"),Ci=a(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),je=a(s=>vi(s)||wi(s)||xo()||Ci(s),"isFileData"),Xa=a(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),qa=a(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),Ka=a(s=>!!s&&typeof s=="object"&&"data"in s&&je(s.data),"isFileValue");function Ao(s,t,e){if(Array.isArray(e))for(let i of e)Ao(s,`${t}[]`,i);else if(Ka(e)){let{name:i,contentType:r}=e,o=Ga(e.data,i,r!=null?r:yi),n=ja({name:i,contentType:r});s.push([t,o,...n])}else if(qa(e))for(let[i,r]of Object.entries(e))typeof r!="undefined"&&s.push([`${t}[${i}]`,String(r)]);else Xa(e)&&e&&s.push([t,e.toString()])}a(Ao,"collectParams");function Za(s){let t=[];for(let[e,i]of Object.entries(s))Ao(t,e,i);return t}a(Za,"getFormDataParams");function xi(s){let t=Wa(),e=Za(s);for(let i of e){let[r,o,...n]=i;t.append(r,o,...n)}return t}a(xi,"buildFormData");var bi=class bi extends $t{constructor(e,i,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,bi.prototype)}};a(bi,"UploadError");var z=bi,Ya=a(s=>{let t=new URLSearchParams;for(let[e,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=>t.set(`${e}[${r[0]}]`,String(r[1]))):Array.isArray(i)?i.forEach(r=>{t.append(`${e}[]`,r)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},"buildSearchParams"),me=a((s,t,e)=>{let i=new URL(s);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Ya(e)),i.toString()},"getUrl"),Ja="6.14.1",Qa="UploadcareUploadClient",el=Ja;function ke(s){return vr({libraryName:Qa,libraryVersion:el,...s})}a(ke,"getUserAgent");var tl="RequestThrottledError",vo=15e3,il=1e3;function rl(s){let{headers:t}=s||{};if(!t||typeof t["retry-after"]!="string")return vo;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:vo}a(rl,"getTimeoutFromThrottledRequest");function Ee(s,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return Ba(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===tl&&r<e)return o(rl(n));if(n instanceof He&&r<i)return o((r+1)*il);throw n}))}a(Ee,"retryIfFailed");var Eo=a(s=>{let t="";return(vi(s)||wi(s)||Ci(s))&&(t=s.type),t||yi},"getContentType"),To=a(s=>{let t="";return wi(s)&&s.name?t=s.name:vi(s)||xo()?t="":Ci(s)&&s.name&&(t=s.name),t||Co},"getFileName");function wr(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}a(wr,"getStoreValue");function sl(s,{publicKey:t,fileName:e,contentType:i,baseURL:r=S.baseURL,secureSignature:o,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",url:me(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},data:xi({file:{data:s,name:e||To(s),contentType:i||Eo(s)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:wr(l),signature:o,expire:n,source:p,metadata:b}),signal:c,onProgress:u}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}a(sl,"base");var gr;(function(s){s.Token="token",s.FileInfo="file_info"})(gr||(gr={}));function ol(s,{publicKey:t,baseURL:e=S.baseURL,store:i,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},url:me(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:s,store:wr(i),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:b}),signal:p}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}a(ol,"fromUrl");var X;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(X||(X={}));var nl=a(s=>"status"in s&&s.status===X.Error,"isErrorResponse");function al(s,{publicKey:t,baseURL:e=S.baseURL,signal:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=S.retryNetworkErrorMaxTimes}={}){return Ee(()=>Ae({method:"GET",headers:t?{"X-UC-User-Agent":ke({publicKey:t,integration:r,userAgent:o})}:void 0,url:me(e,"/from_url/status/",{jsonerrors:1,token:s}),signal:i}).then(({data:c,headers:u,request:p})=>{let d=be(JSON.parse(c));if("error"in d&&!nl(d))throw new z(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(al,"fromUrlStatus");function ll(s,{publicKey:t,baseURL:e=S.baseURL,jsonpCallback:i,secureSignature:r,secureExpire:o,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:c,userAgent:u})},url:me(e,"/group/",{jsonerrors:1}),data:xi({files:s,callback:i,pub_key:t,signature:r,expire:o,source:l}),signal:n}).then(({data:f,headers:m,request:g})=>{let b=be(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})}a(ll,"group");function So(s,{publicKey:t,baseURL:e=S.baseURL,signal:i,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"GET",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:o,userAgent:n})},url:me(e,"/info/",{jsonerrors:1,pub_key:t,file_id:s,source:r}),signal:i}).then(({data:u,headers:p,request:d})=>{let f=be(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(So,"info");function cl(s,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:r=S.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",url:me(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},data:xi({filename:i||Co,size:s,content_type:e||yi,part_size:r,UPLOADCARE_STORE:wr(c),UPLOADCARE_PUB_KEY:t,signature:n,expire:l,source:p,metadata:b}),signal:u}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x.parts=Object.keys(x.parts).map(D=>x.parts[Number(D)]),x}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}a(cl,"multipartStart");function ul(s,t,{contentType:e,signal:i,onProgress:r,retryThrottledRequestMaxTimes:o=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"PUT",url:t,data:s,onProgress:r,signal:i,headers:{"Content-Type":e||yi}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}a(ul,"multipartUpload");function hl(s,{publicKey:t,baseURL:e=S.baseURL,source:i="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"POST",url:me(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:o,userAgent:n})},data:xi({uuid:s,UPLOADCARE_PUB_KEY:t,source:i}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=be(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(hl,"multipartComplete");function Cr(s,{publicKey:t,baseURL:e,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return wo({check:p=>So(s,{publicKey:t,baseURL:e,signal:p,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}a(Cr,"isReadyPoll");function dl(s){return"defaultEffects"in s}a(dl,"isGroupFileInfo");var Sr=class Sr{constructor(t,{baseCDN:e=S.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}=t,n=me(e,`${r}/`),l=o?me(`https://${o}.s3.amazonaws.com/`,`${r}/${t.filename}`):null;this.uuid=r,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=n,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=o||null,this.s3Url=l,dl(t)&&(this.defaultEffects=t.defaultEffects)}};a(Sr,"UploadcareFile");var ge=Sr,pl=a((s,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>sl(s,{publicKey:t,fileName:e,contentType:l,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:C})=>Cr(C,{publicKey:t,baseURL:i,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(C=>new ge(C,{baseCDN:b})),"uploadDirect"),fl=a((s,{publicKey:t,fileName:e,baseURL:i,signal:r,onProgress:o,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>So(s,{publicKey:t,baseURL:i,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new ge(f,{baseCDN:d,fileName:e})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),ml=a((s,{signal:t}={})=>{let e=null,i=null,r=s.map(()=>new AbortController),o=a(n=>()=>{i=n,r.forEach((l,c)=>c!==n&&l.abort())},"createStopRaceCallback");return _i(t,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,l)=>{let c=o(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(e=u,null))})).then(n=>{if(i===null)throw e;return n[i]})},"race"),gl=window.WebSocket,$r=class $r{constructor(){h(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(r=>r(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}};a($r,"Events");var br=$r,bl=a((s,t)=>s==="success"?{status:X.Success,...t}:s==="progress"?{status:X.Progress,...t}:{status:X.Error,...t},"response"),Ir=class Ir{constructor(t,e=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 br);h(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new gl(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.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,bl(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=a(()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var r;let i=JSON.stringify({event:t,data:e});(r=this.ws)==null||r.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,r={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(r=>r.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}};a(Ir,"Pusher");var _r=Ir,fr=null,xr=a(s=>{if(!fr){let t=typeof window=="undefined"?0:3e4;fr=new _r(s,t)}return fr},"getPusher"),_l=a(s=>{xr(s).connect()},"preconnect");function yl({token:s,publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return wo({check:u=>al(s,{publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case X.Error:return new z(p.error,p.errorCode);case X.Waiting:return!1;case X.Unknown:return new z(`Token "${s}" was not found.`);case X.Progress:return l&&(p.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:p.done/p.total})),!1;case X.Success:return l&&l({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}a(yl,"pollStrategy");var vl=a(({token:s,pusherKey:t,signal:e,onProgress:i})=>new Promise((r,o)=>{let n=xr(t),l=n.onError(o),c=a(()=>{l(),n.unsubscribe(s)},"destroy");_i(e,()=>{c(),o(new xe("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case X.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case X.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),r(u);break}case X.Error:c(),o(new z(u.msg,u.error_code))}})}),"pushStrategy"),wl=a((s,{publicKey:t,fileName:e,baseURL:i,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=S.pusherKey,metadata:C})=>Promise.resolve(_l(w)).then(()=>ol(s,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:C})).catch(v=>{let x=xr(w);return x==null||x.disconnect(),Promise.reject(v)}).then(v=>v.type===gr.FileInfo?v:ml([({signal:x})=>yl({token:v.token,publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:x}),({signal:x})=>vl({token:v.token,pusherKey:w,signal:x,onProgress:d})],{signal:p})).then(v=>{if(v instanceof z)throw v;return v}).then(v=>Cr(v.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:p})).then(v=>new ge(v,{baseCDN:r})),"uploadFromUrl"),mr=new WeakMap,Cl=a(async s=>{if(mr.has(s))return mr.get(s);let t=await fetch(s.uri).then(e=>e.blob());return mr.set(s,t),t},"getBlobFromReactNativeAsset"),$o=a(async s=>{if(wi(s)||vi(s))return s.size;if(Ci(s))return(await Cl(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),xl=a((s,t=S.multipartMinFileSize)=>s>=t,"isMultipart"),Io=a(s=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!je(s)&&e.test(s)},"isUuid"),Ar=a(s=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!je(s)&&e.test(s)},"isUrl"),Al=a((s,t)=>new Promise((e,i)=>{let r=[],o=!1,n=t.length,l=[...t],c=a(()=>{let u=t.length-l.length,p=l.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():e(r))}).catch(d=>{o=!0,i(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),El=a((s,t,e,i)=>{let r=i*t,o=Math.min(r+i,e);return s.slice(r,o)},"sliceChunk"),Tl=a(async(s,t,e)=>i=>El(s,i,t,e),"prepareChunks"),Sl=a((s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>ul(s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),$l=a(async(s,{publicKey:t,fileName:e,fileSize:i,baseURL:r,secureSignature:o,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=S.multipartChunkSize,maxConcurrentRequests:C=S.maxConcurrentRequests,baseCDN:v,metadata:x})=>{let D=i!=null?i:await $o(s),Z,ie=a((F,j)=>{if(!u)return;Z||(Z=Array(F).fill(0));let ee=a(re=>re.reduce((de,ar)=>de+ar,0),"sum");return re=>{re.isComputable&&(Z[j]=re.value,u({isComputable:!0,value:ee(Z)/F}))}},"createProgressHandler");return b||(b=Eo(s)),cl(D,{publicKey:t,contentType:b,fileName:e||To(s),baseURL:r,secureSignature:o,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:x}).then(async({uuid:F,parts:j})=>{let ee=await Tl(s,D,w);return Promise.all([F,Al(C,j.map((re,de)=>()=>Sl(ee(de),re,{publicKey:t,contentType:b,onProgress:ie(j.length,de),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([F])=>hl(F,{publicKey:t,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(F=>F.isReady?F:Cr(F.uuid,{publicKey:t,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(F=>new ge(F,{baseCDN:v}))},"uploadMultipart");async function Er(s,{publicKey:t,fileName:e,baseURL:i=S.baseURL,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:v=S.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:D,pusherKey:Z,metadata:ie}){if(je(s)){let F=await $o(s);return xl(F,b)?$l(s,{publicKey:t,contentType:g,multipartChunkSize:w,fileSize:F,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ie}):pl(s,{publicKey:t,fileName:e,contentType:g,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ie})}if(Ar(s))return wl(s,{publicKey:t,fileName:e,baseURL:i,baseCDN:v,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:D,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:Z,metadata:ie});if(Io(s))return fl(s,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${s}" is not supported`)}a(Er,"uploadFile");var kr=class kr{constructor(t,{baseCDN:e=S.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=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((r,o)=>r+o.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(r=>r.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(r=>new ge(r,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}};a(kr,"UploadcareGroup");var yr=kr,Il=a(s=>{for(let t of s)if(!je(t))return!1;return!0},"isFileDataArray"),kl=a(s=>{for(let t of s)if(!Io(t))return!1;return!0},"isUuidArray"),Ol=a(s=>{for(let t of s)if(!Ar(t))return!1;return!0},"isUrlArray");function ko(s,{publicKey:t,fileName:e,baseURL:i=S.baseURL,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=S.multipartChunkSize,baseCDN:w=S.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:v,jsonpCallback:x}){if(!Il(s)&&!Ol(s)&&!kl(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let D,Z=!0,ie=s.length,F=a((j,ee)=>{if(!c)return;D||(D=Array(j).fill(0));let re=a(de=>de.reduce((ar,Yn)=>ar+Yn)/j,"normalize");return de=>{if(!de.isComputable||!Z){Z=!1,c({isComputable:!1});return}D[ee]=de.value,c({isComputable:!0,value:re(D)})}},"createProgressHandler");return Promise.all(s.map((j,ee)=>je(j)||Ar(j)?Er(j,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:F(ie,ee),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:v}).then(re=>re.uuid):j)).then(j=>ll(j,{publicKey:t,baseURL:i,jsonpCallback:x,secureSignature:r,secureExpire:o,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(ee=>new yr(ee,{baseCDN:w})).then(ee=>(c&&c({isComputable:!0,value:1}),ee)))}a(ko,"uploadFileGroup");var Or=class Or{constructor(t){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){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(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};a(Or,"Queue");var fi=Or;var Lr=a(()=>({}),"blockCtx"),Ur=a(s=>({...Lr(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),Ai=a(s=>({...Ur(s),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new fi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var It={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-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","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var Ei=new Map,Pr=new Map,Oo=a((s,t)=>{Ei.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Ei.set(s,{...It,...t})},"defineLocaleSync"),Ll=a((s,t)=>{Pr.set(s,t)},"defineLocaleAsync"),Rr=a((s,t)=>{typeof t=="function"?Ll(s,t):Oo(s,t)},"defineLocale"),Lo=a(async s=>{if(!Ei.has(s)){if(!Pr.has(s))throw new Error(`Locale ${s} is not defined`);let e=await Pr.get(s)();Oo(s,e)}return Ei.get(s)},"resolveLocaleDefinition");Rr("en",It);var _e=a(s=>`*l10n/${s}`,"localeStateKey"),Ul="en",Mr=class Mr{constructor(t){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(It))this._blockInstance.add(_e(e),i,!1);setTimeout(()=>{t.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let i=await Lo(e);if(e!==Ul&&this._localeName!==e)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[n,l]of Object.entries(i)){let c=r==null?void 0:r[n];this._blockInstance.add(_e(n),c!=null?c:l,!0);for(let u of this._callbacks)u()}}),t.subConfigValue("localeDefinitionOverride",e=>{var r;if(!e)return;let i=e[this._localeName];if(i)for(let[o,n]of Object.entries(i)){(r=this._blockInstance)==null||r.add(_e(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=P(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var o,n,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(n=(o=this._boundBlocks.get(t))==null?void 0:o.get(e))==null||n();let r=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,r)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};a(Mr,"LocaleManager");var Ti=Mr;function Uo(s,t){[...s.querySelectorAll("[l10n]")].forEach(e=>{let i=e.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;t.has(n)&&t.sub(n,c=>{if(!c)return;t.l10nProcessorSubs.has(n)||t.l10nProcessorSubs.set(n,new Set);let u=t.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),t.allSubs.delete(f)});let p=_e(c).replace("*","");t.nodeCtx.has(p)||t.nodeCtx.add(p,c);let d=t.nodeCtx.sub(p,()=>{e[r]=t.l10n(c)});u==null||u.add(d),t.allSubs.add(d),e.removeAttribute("l10n")});let l=_e(i);t.has(l)||t.add(l,""),t.sub(l,()=>{i=i,o?e.setAttribute(r,t.l10n(i)):e[r]=t.l10n(i)}),e.removeAttribute("l10n")})}a(Uo,"l10nProcessor");var q=a(s=>`*cfg/${s}`,"sharedConfigKey");var Pl={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function kt(s,t){t.tabIndex=0,t.focus(),s.tabIndex=-1}a(kt,"focus");function Dr(s){let t=s.role||s.type||s.tagName;if(!t)return null;let e=Pl[t.toLowerCase()];if(!e)return null;for(let i of e){let r=s.closest(`[role=${i}]`);if(r)return r}}a(Dr,"findGroupNodeByEventTarget");function Fr(s,t){return t.role==="toolbar"?Rl(t):t.querySelectorAll(`[role=${s.role}]`)}a(Fr,"getItems");function Rl(s){return[...s.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}a(Rl,"getToolbarItems");function Ml(s){let t=s.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=s.role;return e==="menubar"||e==="tablist"||e==="toolbar"}a(Ml,"isHorizontalOrientation");function Po(s){return t=>{let e=!1,i=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=Dr(d.target);if(!f){l();return}let m=Fr(d.target,f),g=Array.from(m).indexOf(d.target),b="ArrowDown",w="ArrowUp";if(Ml(f)&&(t.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),d.key===b)d.preventDefault(),kt(d.target,m[g+1]||m[0]);else if(d.key===w)d.preventDefault(),kt(d.target,m[g-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),kt(d.target,m[0]);else if(d.key==="End")d.preventDefault(),kt(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let C=Date.now();C-r<=i?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=C;let v=Array.from(m).find(x=>{var D,Z,ie;return(ie=(Z=(D=x.textContent)==null?void 0:D.trim())==null?void 0:Z.toLowerCase())==null?void 0:ie.startsWith(o)});v&&(d.preventDefault(),kt(d.target,v))}}a(n,"keyDown");function l(){e=!1,t.removeEventListener("keydown",n)}a(l,"stop");function c(d){let f=Dr(d.target);if(f){e||(e=!0,t.addEventListener("keydown",n));let m=Fr(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1)}else e&&l()}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===t.document)&&l()}a(u,"focusOut");function p(d){let f=Dr(d.target);if(f){let m=Fr(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return a(p,"click"),t.addEventListener("click",p),t.addEventListener("focusin",c),t.addEventListener("focusout",u),()=>{l(),t.removeEventListener("click",p),t.removeEventListener("focusin",c),t.removeEventListener("focusout",u)}}}a(Po,"focusGroupKeyUX");function Ro(){return s=>{let t,e;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){t=o.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.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)}}a(i,"jump");function r(o){t&&t.contains(o.target)&&(!o.relatedTarget||!t.contains(o.relatedTarget))&&(o.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return a(r,"focusOut"),s.addEventListener("keyuxJump",i),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",i),s.removeEventListener("focusout",r)}}}a(Ro,"hiddenKeyUX");function Mo(){return s=>{let t=[];function e(u){let p=s.document.activeElement;p&&p!==s.document.body&&t.push(new WeakRef(p)),u.focus({focusVisible:!0})}a(e,"focus");function i(){let u=t.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():i()}a(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})),e(f))}},50))}a(n,"jump");function l(u){u.clientX===0&&u.clientY===0&&n(u.target)}a(l,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&i()}return a(c,"keyDown"),s.addEventListener("click",l),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",l),s.removeEventListener("keydown",c)}}}a(Mo,"jumpKeyUX");function Do(s){let t,e=s.split(" ");function i(){t&&t.classList.remove(...e)}a(i,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(i(),o.target.classList.add(...e),t=o.target)}return a(r,"click"),o=>(o.addEventListener("keyup",i),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",i),o.removeEventListener("click",r)})}a(Do,"pressKeyUX");function Fo(s,t){let e=t.map(i=>i(s));return()=>{e.forEach(i=>i())}}a(Fo,"startKeyUX");var Vr=class Vr{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(t,e){let i=a(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&e(r)},"wrappedListener");this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}};a(Vr,"ScopedMinimalWindow");var Nr=Vr,Br=class Br{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new Nr,this._destroyKeyUX=Fo(this._scopedWindow,[Po(),Do("is-pressed"),Mo(),Ro()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};a(Br,"A11y");var Si=Br;var Dl="uc-",Ot=class Ot extends Ie{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",Lr());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Uo)}l10n(e,i={}){if(!e)return"";let r=this.$[_e(e)]||e,o=go(r);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return St(r,i)}pluralize(e,i){let r=this.l10n("locale-id")||"en",o=pi(r,i);return this.l10n(`${e}__${o}`)}bindL10n(e,i){var r;(r=this.localeManager)==null||r.bindL10n(this,e,i)}emit(e,i,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(e,i,r)}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?bo({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),Tt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Tt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new di(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ti(this)),this.has("*a11y")||this.add("*a11y",new Si),this.sub(_e("locale-id"),i=>{let r=po(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;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;T.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:ui(e),cdnUrlModifiers:hr(e),fileName:ci(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?St(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(i,r,o)=>{if(typeof r!="string")return!1;let n=q(r);return this.has(n)||this.add(n,te[r]),this.$[n]=o,!0},get:(i,r)=>{let o=q(r);return this.has(o)||this.add(o,te[r]),this.$[q(r)]}})}return this.__cfgProxy}subConfigValue(e,i){let r=q(e);this.has(r)||this.add(r,te[e]),this.sub(r,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let r=e[0];i=r()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(Dl)&&super.reg(e)}};a(Ot,"Block"),h(Ot,"StateConsumerScope",null),h(Ot,"styleAttrs",[]);var y=Ot;var No="<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 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-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 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var $i=class $i extends y{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Ai(this));h(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=No+e+"<slot></slot>"}static get template(){return this._template}};a($i,"SolutionBlock"),h($i,"styleAttrs",["uc-wgt-common"]);var oe=$i;var Vo="active",Lt="___ACTIVITY_IS_ACTIVE___",ne=class ne extends y{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Ur(this));h(this,"_debouncedHistoryFlush",P(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=ne._activityCallbacks.get(this);this[Lt]=!1,this.removeAttribute(Vo),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=ne._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Lt]=!0,this.setAttribute(Vo,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",e=>{this.setAttribute("current-activity",e)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Lt]?this._deactivate():this.activityType===e&&!this[Lt]&&this._activate()}catch(r){console.error(`Error in activity "${this.activityType}". `,r),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",e=>{!e&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&ne._activityCallbacks.has(this)}get isActivityActive(){return this[Lt]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:r,onDeactivate:o}=i;ne._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ne._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof ne&&r.activityType===e)||(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 e=this.$["*history"];if(e){let r=e.pop();for(;r===this.activityType;)r=e.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(l=>l.activityType===r);o=(i=n==null?void 0:n.couldOpenActivity)!=null?i:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=e,r||this.setOrAddState("*modalActive",!1)}}};a(ne,"ActivityBlock"),h(ne,"_activityCallbacks",new Map);var _=ne;_.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"});var Ut=33.333333333333336,A=1,zr=24,Bo=6;function Oe(s,t){for(let e in t)s.setAttributeNS(null,e,t[e].toString())}a(Oe,"setSvgNodeAttrs");function Y(s,t={}){let e=document.createElementNS("http://www.w3.org/2000/svg",s);return Oe(e,t),e}a(Y,"createSvgNode");function zo(s,t,e){let{x:i,y:r,width:o,height:n}=s,l=t.includes("w")?0:1,c=t.includes("n")?0:1,u=[-1,1][l],p=[-1,1][c],d=[i+l*o+1.5*u,r+c*n+1.5*p-24*e*p],f=[i+l*o+1.5*u,r+c*n+1.5*p],m=[i+l*o-24*e*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}}a(zo,"cornerPath");function Ho(s,t,e){let{x:i,y:r,width:o,height:n}=s,l=["n","s"].includes(t)?.5:{w:0,e:1}[t],c=["w","e"].includes(t)?.5:{n:0,s:1}[t],u=[-1,1][l],p=[-1,1][c],d,f;["n","s"].includes(t)?(d=[i+l*o-34*e/2,r+c*n+1.5*p],f=[i+l*o+34*e/2,r+c*n+1.5*p]):(d=[i+l*o+1.5*u,r+c*n-34*e/2],f=[i+l*o+1.5*u,r+c*n+34*e/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}}a(Ho,"sidePath");function jo(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}a(jo,"thumbCursor");function Go({rect:s,delta:[t,e],imageBox:i}){return We({...s,x:s.x+t,y:s.y+e},i)}a(Go,"moveRect");function We(s,t){let{x:e}=s,{y:i}=s;return s.x<t.x?e=t.x:s.x+s.width>t.x+t.width&&(e=t.x+t.width-s.width),s.y<t.y?i=t.y:s.y+s.height>t.y+t.height&&(i=t.y+t.height-s.height),{...s,x:e,y:i}}a(We,"constraintRect");function Fl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:n,height:l}=s;o+=r,l-=r,e&&(n=l*e);let c=s.x+s.width/2-n/2;return o<=i.y&&(o=i.y,l=s.y+s.height-o,e&&(n=l*e,c=s.x+s.width/2-n/2)),c<=i.x&&(c=i.x,o=s.y+s.height-l),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,e&&(l=n/e),o=s.y+s.height-l),l<A&&(l=A,e&&(n=l*e,c=s.x+s.width/2-n/2),o=s.y+s.height-l),n<A&&(n=A,e&&(l=n/e,c=s.x+s.width/2-n/2),o=s.y+s.height-l),{x:c,y:o,width:n,height:l}}a(Fl,"resizeNorth");function Nl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:n,height:l}=s;o+=r,n-=r,e&&(l=n/e);let c=s.y+s.height/2-l/2;return o<=i.x&&(o=i.x,n=s.x+s.width-o,e&&(l=n/e,c=s.y+s.height/2-l/2)),c<=i.y&&(c=i.y,o=s.x+s.width-n),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(n=l*e),o=s.x+s.width-n),l<A&&(l=A,e&&(n=l*e),c=s.y+s.height/2-l/2,o=s.x+s.width-n),n<A&&(n=A,e&&(l=n/e),c=s.y+s.height/2-l/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:l}}a(Nl,"resizeWest");function Vl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:n,height:l}=s;l+=r,e&&(n=l*e);let c=s.x+s.width/2-n/2;return o+l>=i.y+i.height&&(l=i.y+i.height-o,e&&(n=l*e),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,e&&(l=n/e),o=s.y),l<A&&(l=A,e&&(n=l*e),c=s.x+s.width/2-n/2),n<A&&(n=A,e&&(l=n/e),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:l}}a(Vl,"resizeSouth");function Bl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:n,height:l}=s;n+=r,e&&(l=n/e);let c=s.y+s.height/2-l/2;return o+n>=i.x+i.width&&(n=i.x+i.width-o,e&&(l=n/e),c=s.y+s.height/2-l/2),c<=i.y&&(c=i.y,o=s.x),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(n=l*e),o=s.x),l<A&&(l=A,e&&(n=l*e),c=s.y+s.height/2-l/2),n<A&&(n=A,e&&(l=n/e),c=s.y+s.height/2-l/2),{x:o,y:c,width:n,height:l}}a(Bl,"resizeEast");function zl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),l+o<i.y&&(o=i.y-l),n+=r,c-=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,n=s.x+s.width-c,l=i.y)):e&&(r=u*e-c,c=c+r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/e,n=i.x,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),n=s.x+s.width-c,l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),n=s.x+s.width-c,l=s.y+s.height-u),{x:n,y:l,width:c,height:u}}a(zl,"resizeNorthWest");function Hl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),l+o<i.y&&(o=i.y-l),c+=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,n=s.x,l=i.y)):e&&(r=u*e-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/e,n=i.x+i.width-c,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),l=s.y+s.height-u),{x:n,y:l,width:c,height:u}}a(Hl,"resizeNorthEast");function jl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),n+=r,c-=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,n=s.x+s.width-c,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/e,n=i.x,l=s.y)),u<A&&(u=A,e&&(c=u*e),n=s.x+s.width-c),c<A&&(c=A,e&&(u=c/e),n=s.x+s.width-c),{x:n,y:l,width:c,height:u}}a(jl,"resizeSouthWest");function Gl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),c+=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,n=s.x,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/e,n=i.x+i.width-c,l=s.y)),u<A&&(u=A,e&&(c=u*e)),c<A&&(c=A,e&&(u=c/e)),{x:n,y:l,width:c,height:u}}a(Gl,"resizeSouthEast");function Wo({direction:s,...t}){switch(s){case"n":return Fl(t);case"w":return Nl(t);case"s":return Vl(t);case"e":return Bl(t);case"nw":return zl(t);case"ne":return Hl(t);case"sw":return jl(t);case"se":return Gl(t);default:return t.rect}}a(Wo,"resizeRect");function Xo(s,[t,e]){return s.x<=t&&t<=s.x+s.width&&s.y<=e&&e<=s.y+s.height}a(Xo,"rectContainsPoint");function qo(s,t){return s.x>=t.x&&s.y>=t.y&&s.x+s.width<=t.x+t.width&&s.y+s.height<=t.y+t.height}a(qo,"isRectInsideRect");function Ko(s,t){return Math.abs(s.width/s.height-t)<.1}a(Ko,"isRectMatchesAspectRatio");function Xe({width:s,height:t},e){let i=e/90%2!==0;return{width:i?t:s,height:i?s:t}}a(Xe,"rotateSize");function Zo(s,t,e){let i=s/t,r,o;i>e?(r=Math.round(t*e),o=t):(r=s,o=Math.round(s/e));let n=Math.round((s-r)/2),l=Math.round((t-o)/2);return n+r>s&&(r=s-n),l+o>t&&(o=t-l),{x:n,y:l,width:r,height:o}}a(Zo,"calculateMaxCenteredCropFrame");function qe(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}a(qe,"roundRect");function Te(s,t,e){return Math.min(Math.max(s,t),e)}a(Te,"clamp");var ki=a(s=>{if(!s)return[];let[t,e]=s.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:t,height:e}]},"parseCropPreset");var Le="blocks",Ue="1.11.1";function Yo(s){return vr({...s,libraryName:Le,libraryVersion:Ue})}a(Yo,"customUserAgent");var Jo=a(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Qo=a((s,{threshold:t})=>{let{secureExpire:e}=s,i=Jo(Date.now()),r=Number(e),o=Jo(t);return i+o>=r},"isSecureTokenExpired");var Hr=class Hr{constructor(t){h(this,"_block");h(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Qo(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 t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};a(Hr,"SecureUploadsManager");var Oi=Hr;var en="[Typed State] Wrong property name: ",Wl="[Typed State] Wrong property type: ",jr=class jr{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||$e.generate(),this.__schema=Object.keys(t).reduce((i,r)=>(i[r]=t[r].value,i),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(en+t);return}let i=this.__typedSchema[t];if((e==null?void 0:e.constructor)===i.type||e instanceof i.type||i.nullable&&e===null){this.__data.pub(t,e);return}console.warn(Wl+t)}setMultipleValues(t){for(let e in t)this.setValue(e,t[e])}getValue(t){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(en+t);return}return this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){T.deleteCtx(this.__ctxId)}};a(jr,"TypedData");var Li=jr;var Gr=class Gr{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||$e.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=t.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 e=Object.create(null);this.__notifyObservers=(i,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(o=>{o({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new Li(this.__typedSchema);for(let i in t)e.setValue(i,t[i]);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){return this.read(t).getValue(e)}publishProp(t,e,i){this.read(t).setValue(e,i)}remove(t){this.__removed.add(this.__data.read(t)),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let r=this.read(i);t(r)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};a(Gr,"TypedCollection");var Ui=Gr;var Pe=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),U=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Pe});var Pt=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Pi=a(s=>s?s.filter(t=>typeof t=="string").map(t=>B(t)).flat():[],"mergeFileTypes"),Wr=a((s,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),s.startsWith(e)):s===e),"matchMimeType"),tn=a((s,t)=>t.some(e=>e.startsWith(".")?s.toLowerCase().endsWith(e.toLowerCase()):!1),"matchExtension"),rn=a(s=>{let t=s==null?void 0:s.type;return t?Wr(t,Pt):!1},"fileIsImage");var Xl=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ql=new RegExp(`^/?(${Xl.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),sn=a(({url:s,cdnBase:t})=>{let e=new URL(t),i=new URL(s);if(e.host!==i.host)return null;let[,r,o,n]=ql.exec(i.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var on=a(s=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let r=s(...e);return t.set(i,r),r}},"memoize");var nn=new Set;function an(s){nn.has(s)||(nn.add(s),console.warn(s))}a(an,"warnOnce");function Kl(s){let t=!1;return setTimeout(()=>{t=!0},0),a(i=>(...r)=>(t&&an(s),i(...r)),"withAssert")}a(Kl,"createAsyncAssertWrapper");function ln(s){let t={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>e.failedEntries.length,successCount:()=>e.successEntries.length,uploadingCount:()=>e.uploadingEntries.length,status:()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle",isSuccess:()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,isUploading:()=>e.allEntries.some(r=>r.status==="uploading"),isFailed:()=>e.errors.length>0||e.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>e.allEntries.filter(r=>r.status==="success"),failedEntries:()=>e.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>e.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>e.allEntries.filter(r=>r.status==="idle")},e={},i=Kl("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(t)){let n=r,c=on(i(o));Object.defineProperty(e,n,{get:c,enumerable:!0})}return e}a(ln,"buildOutputCollectionState");var Xr=class Xr{constructor(t){h(this,"_ctx");h(this,"addFileFromUrl",a((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",a((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",a((t,{silent:e,fileName:i,source:r}={})=>{var l;let o=sn({url:t,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:t,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=i!=null?i:o.filename)!=null?l:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",a((t,{silent:e,fileName:i,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:t,isImage:rn(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:r!=null?r:U.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",a(t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)},"removeFileByInternalId"));h(this,"uploadAll",a(()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",a((t={})=>{var o;let e=ze(Pi([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Pt:[]]));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="uploadcare-file-input",r=document.createElement("input");r.setAttribute(i,""),At(r,{opacity:0,height:0,width:0,visibility:"hidden"}),r.type="file",r.multiple=this.cfg.multiple,t.captureCamera?(r.capture=this.cfg.cameraCapture,r.accept=this.cfg.enableVideoRecording?["image/*","video/*"].join(","):"image/*"):r.accept=e,r.addEventListener("change",()=>{r.files&&([...r.files].forEach(n=>this.addFileFromObject(n,{source:t.captureCamera?U.CAMERA:U.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",a(t=>{var n,l,c,u,p,d,f,m,g,b;let e=T.getCtx(t).store,i=e.fileInfo,r=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(n=i==null?void 0:i.uuid)!=null?n:e.uuid)!=null?l:null,internalId:t,name:(c=i==null?void 0:i.originalFilename)!=null?c:e.fileName,size:(u=i==null?void 0:i.size)!=null?u:e.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:e.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(b=(g=e.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:e.errors,status:r,source:e==null?void 0:e.source}},"getOutputItem"));h(this,"getOutputCollectionState",a(()=>ln(this._ctx),"getOutputCollectionState"));h(this,"initFlow",a((t=!1)=>{var e;if(this._uploadCollection.size>0&&!t)this._ctx.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((e=this._sourceList)==null?void 0:e.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=a(l=>"type"in l&&l.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",a(()=>{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",a((t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)},"setCurrentActivity"));h(this,"getCurrentActivity",a(()=>this._ctx.$["*currentActivity"],"getCurrentActivity"));h(this,"setModalState",a(t=>{if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",t)},"setModalState"));this._ctx=t}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 t=[];return this.cfg.sourceList&&(t=B(this.cfg.sourceList)),t}};a(Xr,"UploaderPublicApi");var Ri=Xr;var qr=a((s,t)=>{let e=t.cfg.imgOnly,i=s.isImage;if(!(!e||i)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Kr=a((s,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,r=Pi([...e?Pt:[],i]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let l=Wr(o,r),c=tn(n,r);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var le=1e3,Re=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Rt=a(s=>Math.ceil(s*100)/100,"round"),cn=a((s,t=Re.AUTO)=>{let e=t===Re.AUTO;if(t===Re.BYTE||e&&s<le**1){let i=pi("en-US",s),r={one:"byte",other:"bytes"}[i];return`${s} ${r}`}return t===Re.KB||e&&s<le**2?`${Rt(s/le**1)} KB`:t===Re.MB||e&&s<le**3?`${Rt(s/le**2)} MB`:t===Re.GB||e&&s<le**4?`${Rt(s/le**3)} GB`:t===Re.TB||e&&s<le**5?`${Rt(s/le**4)} TB`:`${Rt(s/le**5)} PB`},"prettyBytes");var Zr=a((s,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=s.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:cn(e)}),payload:{entry:s}}},"validateMaxSizeLimit");var Yr=a((s,t)=>{let{internalId:e}=s,i=t._uploadCollection.read(e),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 He)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 Jr=a((s,t)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Qr=a((s,t)=>{let e=s.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,r=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:r,total:e}),payload:{total:e,min:i,max:r}};if(r&&e>r)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:r,total:e}),payload:{total:e,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."},es=class es{constructor(t){h(this,"_blockInstance");h(this,"_fileValidators",[qr,Kr,Zr,Yr]);h(this,"_collectionValidators",[Qr,Jr]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=a(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let r=this._uploadCollection.read(i);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=i(t,this._blockInstance.api);if(!r)continue;r&&(e.push(r),r.message||console.warn(Mi.message))}catch(r){console.warn(Mi.collection,r)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(I.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(e,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Mi.message))}catch(o){console.warn(Mi.file,o)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let r=e(...i);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};a(es,"ValidationManager");var Di=es;var un=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:ge,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 Fi=class Fi extends _{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",Ai(this));h(this,"_flushOutputItems",P(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));h(this,"_handleCollectionUpdate",a((e,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(I.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(I.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=e.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",a(e=>{this._flushOutputItems();let i=this.uploadCollection,r=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(e.errors){for(let l of e.errors){let{errors:c}=T.getCtx(l).store;c.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(l=>!!l.getValue("fileInfo")),n=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&n.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(n=>{var l;return!!((l=this.uploadCollection.read(n))!=null&&l.getValue("cdnUrl"))}).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",a(()=>{let e=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");e+=l});let o=r.length?Math.round(e/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof Fi?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ui({typedSchema:un,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new Ri(this)),this.has("*validationManager")||this.add("*validationManager",new Di(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 e,i;(e=this._unobserveCollectionProperties)==null||e.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",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Oi(this)),this.has("*modalActive")&&this.sub("*modalActive",e=>{e&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(e){let i=await this.getUploadClientOptions(),r=e.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await ko(r,{...i,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let e=ki(this.cfg.cropPreset);if(e){let[i]=e,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:l,height:c}=n.imageInfo,u=i.width/i.height,p=Zo(l,c,u),d=V(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:R(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===_.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let r=this.api.getOutputItem(e);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:Yo,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))}};a(Fi,"UploaderBlock");var $=Fi;$.extSrcList=Object.freeze({...Pe});$.sourceTypes=Object.freeze({...U});var Ke=a(s=>{var t;return(t=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:t.map(e=>e.toLowerCase()).join("-")},"toKebabCase");var M=a(s=>String(s),"asString"),J=a(s=>{let t=Number(s);if(Number.isNaN(t))throw new Error(`Invalid number: "${s}"`);return t},"asNumber"),k=a(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"),Zl=a(s=>s==="auto"?s:k(s),"asStore"),Yl=a(s=>{let t=M(s);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid "cameraCapture" value: "${t}"`);return t},"asCameraCapture"),Jl=a(s=>{let t=M(s);if(t!=="photo"&&t!=="video")throw new Error(`Invalid "CameraTab" value: "${t}"`);return t},"asCameraTab"),Ql=a(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"),hn=a(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),ts=a(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),dn=a(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),ec={pubkey:M,multiple:k,multipleMin:J,multipleMax:J,confirmUpload:k,imgOnly:k,accept:M,externalSourcesPreferredTypes:M,store:Zl,cameraMirror:k,cameraCapture:Yl,sourceList:M,maxLocalFileSizeBytes:J,thumbSize:J,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:M,removeCopyright:k,cropPreset:M,imageShrink:M,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:M,cdnCname:M,baseUrl:M,socialBaseUrl:M,secureSignature:M,secureExpire:M,secureDeliveryProxy:M,retryThrottledRequestMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:M,debug:k,localeName:M,metadata:Ql,secureUploadsExpireThreshold:J,localeDefinitionOverride:hn,secureUploadsSignatureResolver:ts,secureDeliveryProxyUrlResolver:ts,iconHrefResolver:ts,fileValidators:dn,collectionValidators:dn,defaultCameraMode:Jl,enableAudioRecording:k,enableVideoRecording:k,mediaRecorerOptions:hn,maxVideoRecordingDuration:J},pn=a((s,t)=>{if(!(typeof t=="undefined"||t===null))try{return ec[s](t)}catch(e){return console.error(`Invalid value for config key "${s}".`,e),te[s]}},"normalizeConfigValue");var is=[...new Set(["debug",...Object.keys(te)])],tc=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorerOptions"],ic=a(s=>tc.includes(s),"isComplexKey"),Ze=is.filter(s=>!ic(s)),rc={...Object.fromEntries(Ze.map(s=>[Ke(s),s])),...Object.fromEntries(Ze.map(s=>[s.toLowerCase(),s]))},sc={...Object.fromEntries(Ze.map(s=>[Ke(s),q(s)])),...Object.fromEntries(Ze.map(s=>[s.toLowerCase(),q(s)]))},fn=a(s=>"__"+s,"getLocalPropName"),rs=class rs extends y{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(te).map(([e,i])=>[q(e),i]))}}_flushValueToAttribute(e,i){if(Ze.includes(e)){let r=[...new Set([Ke(e),e.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(e,i){this.$[q(e)]!==i&&(typeof i=="undefined"||i===null?this.$[q(e)]=te[e]:this.$[q(e)]=i)}_setValue(e,i){let r=this,o=pn(e,i),n=fn(e);r[n]!==o&&(this._assertSameValueDifferentReference(e,r[n],o),r[n]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o))}_getValue(e){let i=this,r=fn(e);return i[r]}_assertSameValueDifferentReference(e,i,r){this.cfg.debug&&r!==i&&typeof r=="object"&&typeof i=="object"&&JSON.stringify(r)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" 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] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,r))}initCallback(){var i;super.initCallback();let e=this;for(let r of Ze)this.sub(q(r),o=>{this._setValue(r,o)},!1);for(let r of is){let o=(i=e[r])!=null?i:this.$[q(r)];o!==te[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(e,i,r){if(i===r)return;let o=this,n=rc[e];o[n]=r}};a(rs,"ConfigClass");var Mt=rs;Mt.bindAttributes(sc);for(let s of is)Mt.prototype[s]=void 0;var mn=Mt;var ss=class ss extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let r=i(t);e=r!=null?r:e}this.$.href=e})})}};a(ss,"Icon");var Ye=ss;Ye.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Ye.bindAttributes({name:"name"});var gn=a(s=>[...new Set(s)],"uniqueArray");var bn=a(s=>Object.entries(s).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`),"parseObjectToString");var oc="https://ucarecdn.com",Dt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:oc},"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 Je="--uc-img-",os="unresolved";var ns=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),as=3e3,ls=5e3,cs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var yn=Object.create(null),_n;for(let s in Dt)yn[Je+s]=((_n=Dt[s])==null?void 0:_n.default)||"";var us=class us extends Ie{constructor(){super(...arguments);h(this,"cssInit$",yn)}$$(e){return this.$[Je+e]}set$$(e){for(let i in e)this.$[Je+i]=e[i]}sub$$(e,i){this.sub(Je+e,r=>{r===null||r===""||i(r)})}analyticsParams(){return`-/@clib/${Le}/${Ue}/uc-img/`}initAttributes(e){[...this.attributes].forEach(i=>{Dt[i.name]||e.setAttribute(i.name,i.value)})}initIntersection(e,i){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(i(),this._isnObserver.unobserve(e))})},r),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Dt)}attributeChangedCallback(e,i,r){window.setTimeout(()=>{this.$[Je+e]=r})}};a(us,"ImgConfig");var Ni=us;var hs=class hs extends Ni{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!ns&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let i=e.match(/\d+/)[0],r=e.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>ls&&this.hasFormatJPG)return ls+r;if(Number(o)>as&&!this.hasFormatJPG)return as+r}return e}_getCdnModifiers(e,i){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return V(...bn(r))}_getUrlBase(e="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(ns&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(e,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return R(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(R(we(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(R(we(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(R(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(R(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?St(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:r=>window.encodeURIComponent(r)}):e}_getElSize(e,i=1,r=!0){let o=e.getBoundingClientRect(),n=i*Math.round(o.width),l=r?"":i*Math.round(o.height);return n||l?`${n||""}x${l||""}`:null}_setupEventProxy(e){let i=a(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)e.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:cs.PREVIEW,img:this._imgPreview}:{type:cs.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=B(this.$$("breakpoints"));return gn(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let r=`image-set(${[...i].join(", ")})`;e.style.setProperty("background-image",r),e.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{e.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:i,srcset:r}){i&&(e.src=i),r&&(e.srcset=r)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:i,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(os,""),r.addEventListener("load",()=>{r.removeAttribute(os),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:e,srcset:i})})}async renderImage(){var e,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((e=this._imgPreview)==null?void 0:e.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()}};a(hs,"ImgBase");var zi=hs;var ds=class ds extends zi{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager")})}};a(ds,"Img");var Hi=ds;var Qe=class Qe extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e!="undefined"&&(this.$.withDropZone=k(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};a(Qe,"SimpleBtn"),h(Qe,"styleAttrs",[...G(Qe,Qe,"styleAttrs"),"uc-simple-btn"]);var et=Qe;et.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>`;et.bindAttributes({dropzone:null});var ps=class ps extends _{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};a(ps,"StartFrom");var Ft=ps;Ft.template='<div class="uc-content"><slot></slot></div>';function nc(s){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=a(r=>{r.type!=="loadend"&&e.abort(),t(!1)},"onLoad");e.onloadend=i,e.onprogress=i,e.readAsDataURL(s)}catch{t(!1)}})}a(nc,"checkIsDirectory");function ac(s,t){return new Promise(e=>{let i=0,r=[],o=a(l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(c=>{i--;let u=new File([c],c.name,{type:c.type||t});r.push({type:"file",file:u,fullPath:l.fullPath}),i===0&&e(r)})):l.isDirectory&&n(l.createReader())},"readEntry"),n=a(l=>{i++,l.readEntries(c=>{i--;for(let u of c)o(u);i===0&&e(r)})},"readReaderContent");o(s)})}a(ac,"readEntryContentAsync");function vn(s){let t=[],e=[];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 l=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();e.push(ac(l,o).then(c=>{c&&t.push(...c)}));continue}let n=r.getAsFile();n&&e.push(nc(n).then(l=>{l||t.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&e.push(new Promise(o=>{r.getAsString(n=>{t.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(e).then(()=>t)}a(vn,"getDropItems");var H={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},wn=["focus"],lc=100,fs=new Map;function cc(s,t){let e=Math.max(Math.min(s[0],t.x+t.width),t.x),i=Math.max(Math.min(s[1],t.y+t.height),t.y);return Math.sqrt((s[0]-e)*(s[0]-e)+(s[1]-i)*(s[1]-i))}a(cc,"distance");function ms(s){let t=0,e=document.body,i=new Set,r=a(g=>i.add(g),"handleSwitch"),o=H.INACTIVE,n=a(g=>{s.shouldIgnore()&&g!==H.INACTIVE||(o!==g&&i.forEach(b=>b(g)),o=g)},"setState"),l=a(()=>t>0,"isDragging");r(g=>s.onChange(g));let c=a(()=>{t=0,n(H.INACTIVE)},"onResetEvent"),u=a(()=>{t+=1,o===H.INACTIVE&&n(H.ACTIVE)},"onDragEnter"),p=a(()=>{t-=1,l()||n(H.INACTIVE)},"onDragLeave"),d=a(g=>{g.preventDefault(),t=0,n(H.INACTIVE)},"onDrop"),f=a(g=>{if(s.shouldIgnore())return;l()||(t+=1);let b=[g.x,g.y],w=s.element.getBoundingClientRect(),C=Math.floor(cc(b,w)),v=C<lc,x=g.composedPath().includes(s.element);fs.set(s.element,C);let D=Math.min(...fs.values())===C;x&&D?(g.preventDefault(),n(H.OVER)):n(v&&D?H.NEAR:H.ACTIVE)},"onDragOver"),m=a(async g=>{if(s.shouldIgnore())return;g.preventDefault();let b=await vn(g.dataTransfer);s.onItems(b),n(H.INACTIVE)},"onElementDrop");return e.addEventListener("drop",d),e.addEventListener("dragleave",p),e.addEventListener("dragenter",u),e.addEventListener("dragover",f),s.element.addEventListener("drop",m),wn.forEach(g=>{window.addEventListener(g,c)}),()=>{fs.delete(s.element),e.removeEventListener("drop",d),e.removeEventListener("dragleave",p),e.removeEventListener("dragenter",u),e.removeEventListener("dragover",f),s.element.removeEventListener("drop",m),wn.forEach(g=>{window.removeEventListener(g,c)})}}a(ms,"addDropzone");var Cn="uc-drop-area",tt=`${Cn}/registry`,it=class it extends ${constructor(){super(),this.init$={...this.init$,state:H.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[tt]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return e&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[tt]||(this.$[tt]=new Set),this.$[tt].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!k(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:k(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:k(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:k(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=ms({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this.$.state=e},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:U.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:U.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=ms({element:t,onChange:e=>{var r;let i=(r=Object.entries(H).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&t.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",e=>{var r;let i=(r=Object.entries(H).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=B(e);this.$.isEnabled=i.includes(U.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{e.type==="keydown"?(e.code==="Space"||e.code==="Enter")&&this.api.openSystemDialog():e.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.$[tt]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[tt];t&&(t.delete(this),t.size===0&&T.deleteCtx(Cn)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};a(it,"DropArea"),h(it,"styleAttrs",[...G(it,it,"styleAttrs"),"uc-drop-area"]);var rt=it;rt.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>`;rt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var uc="src-type-",gs=class gs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:U.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:U.URL,activity:_.activities.URL,textKey:"from-url"}),this.registerType({type:U.CAMERA,activity:_.activities.CAMERA,activate:()=>{let e="capture"in document.createElement("input");return e&&this.api.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:_.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(Pe))this.registerType({type:e,activity:_.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type],{activity:i,activate:r,activityParams:o={}}=e;(r?r():!!i)&&this.set$({"*currentActivityParams":o,"*currentActivity":i})}applyType(e){let i=this._registeredTypes[e];if(!i){console.warn("Unsupported source type: "+e);return}let{textKey:r=e,icon:o=e}=i;this.$["src-type"]=`${uc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};a(gs,"SourceBtn");var st=gs;st.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;st.bindAttributes({type:null});var bs=class bs extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{let e=B(t),i="";e.forEach(r=>{i+=`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};a(bs,"SourceList");var ji=bs;var Wi=a(()=>{let s=[];return{stack:s,promiseReadJpegChunks:a(e=>new Promise((i,r)=>{let o=2,n=a((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"),l=a(()=>n(e.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=a(()=>{let u=o;return n(e.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(e.slice(o,o+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:m}),l()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(e.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),hc=a(async s=>{let t=[],{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s),i.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&t.push(o)}),t},"getIccProfile"),An=a(async(s,t,e)=>{{let i=[],r=[],{promiseReadJpegChunks:o,stack:n}=Wi();await o(s),n.forEach(u=>{if(u.marker===t)return i.push(u.startPos),r.push(u.length)});let l=[s.slice(0,2)];for(let u of e){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+t),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&l.push(s.slice(c,i[u])),c=i[u]+r[u]+4;return l.push(s.slice(c,s.size)),new Blob(l,{type:s.type})}},"replaceJpegChunk"),dc=226,En=a((s,t)=>An(s,dc,t.map(e=>e.buffer)),"replaceIccProfile"),pc=a(async s=>{try{return await En(s,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},"stripIccProfile"),fc=a((s,t,e)=>new Promise((i,r)=>{let o=a(n=>{if(!n){r("Failed to convert canvas to blob");return}i(n)},"callback");s.toBlob(o,t,e),s.width=s.height=1}),"canvasToBlob"),Nt=a(()=>{let s=document.createElement("canvas"),t=s.getContext("2d");return{canvas:s,ctx:t}},"createCanvas"),mc=a(s=>{let{ctx:e,canvas:i}=Nt();i.width=i.height=50,e.drawImage(s,0,0,50,50);let r=e.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"),gc=a(async s=>{let t=null,{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s),i.forEach(({marker:r,view:o})=>{if(!t&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){t=o;return}}),t},"getExif"),bc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Gi,_c=a(()=>new Promise(s=>{if(Gi!==void 0)s(Gi);else{let t=new Image;t.addEventListener("load",()=>{Gi=t.naturalWidth<t.naturalHeight,t.src="//:0",s(Gi)}),t.src=bc}}),"isBrowserApplyExifOrientation"),yc=a((s,t)=>{let e,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(e=0,o=n;o>=0?e<o:e>o;o>=0?++e:--e){if(s.byteLength<r+10)return;s.getUint16(r,i)===274&&t(r+8,i),r+=12}},"findExifOrientation"),vc=a((s,t)=>{yc(s,(e,i)=>s.setUint16(e,t,i))},"setExifOrientation"),wc=a(async(s,t,e)=>(e&&vc(t,1),An(s,225,[t.buffer])),"replaceExif"),Cc=a((s,t)=>new Promise((e,i)=>{t&&(s.src=t),s.complete?e(s):(s.addEventListener("load",()=>{e(s)}),s.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),xc=a(s=>Cc(new Image,s),"imageLoader"),Ac=[1,3],Ec=[192,193,194,195,197,198,199,201,202,203,205,206,207],xn={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Tc=a(async s=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s).then(()=>(i.forEach(({marker:r,view:o})=>{if(!t&&Ec.indexOf(r)>=0){let n=o.getUint8(5);Ac.indexOf(n)<0&&(t=!0)}}),t)).catch(()=>t)},"shouldSkipShrink"),Tn=a((s,t)=>{let e={};return(...i)=>{let r=t(i,e);return r in e?e[r]:e[r]=s(...i)}},"memoize"),Sn=a((s,t)=>{let[e]=s,i=Object.keys(t).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<i.length;r++){let o=i[r],n=!!t[o];if(o>e&&n||o<e&&!n)return o}return e},"memoKeySerializer"),Se={R:55,G:110,B:165,A:255},Sc=`rgba(${Se.R}, ${Se.G}, ${Se.B}, ${Se.A/255})`,$n=a((s,t)=>{try{let e=[s-1,t-1,1,1],{canvas:i,ctx:r}=Nt();i.width=1,i.height=1;let{canvas:o,ctx:n}=Nt();o.width=s,o.height=t,n&&(n.fillStyle=Sc,n.fillRect(...e),r.drawImage(o,s-1,t-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Se.R&&l[1]===Se.G&&l[2]===Se.B&&l[3]===Se.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${t}.`),!1}},"canvasTest");function In(s){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=s(...t);e(i)},0)})}a(In,"wrapAsync");var $c=In(Tn($n,Sn)),Ic=In(Tn($n,Sn)),kn=a(async(s,t)=>{let e=xn.squareSide.find(n=>n*n>=s*t),i=xn.dimension.find(n=>n>=s&&n>=t);if(!e||!i)throw new Error("Not supported");let[r,o]=await Promise.all([$c(e,e),Ic(i,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),On=a(async(s,t,e)=>{try{let{ctx:i,canvas:r}=Nt();return r.width=t,r.height=e,i.imageSmoothingQuality="high",i.drawImage(s,0,0,t,e),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"),kc=a(({img:s,targetW:t,targetH:e})=>On(s,t,e),"native"),Oc=a(function({sourceW:s,targetW:t,targetH:e,step:i}){let r=[],o=t,n=e;do r.push([o,n]),o=Math.round(o/i),n=Math.round(n/i);while(o<s*i);return r.reverse()},"calcShrinkSteps"),Lc=a(({img:s,sourceW:t,targetW:e,targetH:i,step:r})=>Oc({sourceW:t,targetW:e,targetH:i,step:r}).reduce((n,[l,c])=>n.then(u=>kn(l,c).then(()=>On(u,l,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),Uc=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Pc=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),_s=.71,Rc=a((s,t)=>{if(s.width*_s*s.height*_s<t.size)throw new Error("Not required");let e=s.width,i=s.height,r=e/i,o=Math.floor(Math.sqrt(t.size*r)),n=Math.floor(t.size/Math.sqrt(t.size*r));return kn(o,n).then(()=>{let{ctx:l}=Nt();return"imageSmoothingQuality"in l&&!Uc()&&!Pc?kc({img:s,targetW:o,targetH:n}):Lc({img:s,sourceW:e,targetW:o,targetH:n,step:_s})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Ln=a(async(s,t)=>{try{if(await Tc(s))throw new Error("Should skipped");let i=await Promise.allSettled([gc(s),_c(),hc(s)]),o=!i.some(b=>b.status==="rejected"),[n,l,c]=i,u=await pc(s).catch(()=>s),p=await xc(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Rc(p,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!o&&mc(d)&&(f="image/png",m=void 0);let g=await fc(d,f,m);if(o&&n.status==="fulfilled"&&n.value){let b=n.value,w=l.status==="fulfilled"?l.value:!1;g=await wc(g,b,w)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await En(g,c.value)),g}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}},"shrinkFile");function Mc(s){let t=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(t)}a(Mc,"createSvgBlobUrl");function ys(s="hsl(209, 21%, 65%)",t=32,e=32){return Mc(`<svg width="${t}" height="${e}" 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>`)}a(ys,"fileCssBg");function Un(s,t=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let e=document.createElement("canvas"),i=e.getContext("2d"),r=new Image,o=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(e.width=t,e.height=t*c):(e.height=t,e.width=t/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(r,0,0,e.width,e.height),e.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{l(c)}});return r.src=URL.createObjectURL(s),o}a(Un,"generateThumb");var Dc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Pn=a(s=>{let t=Dc.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}},"parseShrink");var Q=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),ot=class ot extends ${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",P(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",P(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:Q.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let e of this._entrySubs)e.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(e){let[i]=e;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 e=this._entry,i=Q.IDLE;e.getValue("errors").length>0?i=Q.FAILED:e.getValue("isUploading")?i=Q.UPLOADING:e.getValue("fileInfo")&&(i=Q.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let e=this._entry;if(e.getValue("fileInfo")&&e.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(R(we(this.cfg.cdnCname,this._entry.getValue("uuid")),V(e.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=e.getValue("thumbUrl");n!==o&&(e.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!e.getValue("thumbUrl"))if((i=e.getValue("file"))!=null&&i.type.includes("image"))try{let r=await Un(e.getValue("file"),this.cfg.thumbSize);e.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(r))}}_subEntry(e,i){let r=this._entry.subscribe(e,o=>{this.isConnected&&i(o)});this._entrySubs.add(r)}_handleEntryId(e){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(e);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",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{ot.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{e.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),ot.activeInstances.add(this)}_handleState(e){var i,r,o,n,l,c,u;e===Q.FAILED?this.$.badgeIcon="badge-error":e===Q.FINISHED&&(this.$.badgeIcon="badge-success"),e===Q.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:e===Q.FAILED,isUploading:e===Q.UPLOADING,isFinished:e===Q.FINISHED,progressVisible:e===Q.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,ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(l=this._entry)==null?void 0:l.getValue("fileName"),status:this.l10n((u=(c=e==null?void 0:e.description)==null?void 0:c.toLocaleLowerCase())!=null?u:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),ot.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 e;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return Pn(this.cfg.imageShrink)}_processShrink(e){return Ln(e,this._settingsOfShrink())}async upload(){var r,o,n,l,c,u;let e=this._entry;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setValue("isUploading",!0),e.setValue("errors",[]);try{let p=new AbortController;e.setValue("abortController",p);let d=a(async()=>{let m=e.getValue("file");m&&this.cfg.imageShrink&&(m=await this._processShrink(m).catch(()=>m));let g=m||e.getValue("externalUrl")||e.getValue("uuid"),w={...await this.getUploadClientOptions(),fileName:e.getValue("fileName"),source:e.getValue("source"),onProgress:C=>{if(C.isComputable){let v=C.value*100;e.setValue("uploadProgress",v)}},signal:p.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",g,w),Er(g,w)},"uploadTask"),f=await this.$["*uploadQueue"].add(d);e.setMultipleValues({fileInfo:f,isUploading:!1,fileName:f.originalFilename,fileSize:f.size,isImage:f.isImage,mimeType:(n=(o=(r=f.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:f.mimeType,uuid:f.uuid,cdnUrl:(l=e.getValue("cdnUrl"))!=null?l:f.cdnUrl,cdnUrlModifiers:(c=e.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100,source:(u=e.getValue("source"))!=null?u:null}),e===this._entry&&this._debouncedCalculateState()}catch(p){p instanceof xe&&p.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:p}),e===this._entry&&this._debouncedCalculateState()}}}};a(ot,"FileItem");var nt=ot;nt.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 aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><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>`;nt.activeInstances=new Set;var Me=class Me extends y{constructor(){super();h(this,"_handleBackdropClick",a(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",a(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",a(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",a(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",a(e=>{e.target===this.ref.dialog&&e.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(){super.initCallback(),this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp),this.sub("*modalActive",e=>{this.$.isOpen!==e&&(this.$.isOpen=e),e&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",e=>{e?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",e=>{e?(this.show(),this.setAttribute("aria-modal","true")):(this.hide(),this.setAttribute("aria-modal","false"))})}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)}};a(Me,"Modal"),h(Me,"styleAttrs",[...G(Me,Me,"styleAttrs"),"uc-modal"]),h(Me,"StateConsumerScope","modal");var Vt=Me;Vt.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Xi=a((s,t)=>{let e,i,r,o=a((...n)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=t&&(s(...n),r=Date.now())},Math.max(t-(Date.now()-r),0))):(s(...n),r=Date.now(),e=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),o},"throttle");var vs=class vs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",_.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",Xi(()=>{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(I.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},r=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=e.errors.some(f=>f.type==="TOO_MANY_FILES"),n=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.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?!!e.group:!0;p=i.total===i.succeed&&r&&l&&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(e){let i=a(r=>{let o=e[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.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",e=>{e&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.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)}};a(vs,"UploadList");var Bt=vs;Bt.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><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 ws=class ws extends ${constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:e=>{e.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:U.URL}),this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:e=>{let i=e.target.value;this.set$({importDisabled:!i})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};a(ws,"UrlSource");var zt=ws;zt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><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" l10n="@title:a11y-activity-header-button-close" ><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 Rn=a(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Fc={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Mn=["camera","microphone"];function qi(s){let t=Math.floor(s/60).toString().padStart(2,"0"),e=Math.floor(s%60).toString().padStart(2,"0");return`${t}:${e}`}a(qi,"formatTime");var Dn="image/jpeg",Nc="video/webm",L=class L extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"_chunks",[]);h(this,"_mediaRecorder",null);h(this,"_stream",null);h(this,"_selectedAudioId",null);h(this,"_selectedCameraId",null);h(this,"_chooseActionWithCamera",a(()=>{var e;if(this._activeTab===L.types.PHOTO&&this._shot(),this._activeTab===L.types.VIDEO){if(((e=this._mediaRecorder)==null?void 0:e.state)==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera"));h(this,"_updateTimer",a(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let i=this.cfg.maxVideoRecordingDuration-e;if(i<=0){this.ref.timer.textContent=qi(i),this._stopRecording();return}this.ref.timer.textContent=qi(i)}else this.ref.timer.textContent=qi(e);this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer"));h(this,"_startTimer",a(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer"));h(this,"_stopTimer",a(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer"));h(this,"_startTimeline",a(()=>{let e=this.ref.video.currentTime,i=this.ref.video.duration;this.ref.line.style.transform=`scaleX(${e/i})`,this.ref.timer.textContent=qi(e),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline"));h(this,"_stopTimeline",a(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline"));h(this,"_startRecording",a(()=>{var e;try{this._chunks=[],this._options={...this.cfg.mediaRecorerOptions},(e=this.cfg.mediaRecorerOptions)!=null&&e.mimeType&&MediaRecorder.isTypeSupported(this.cfg.mediaRecorerOptions.mimeType)?this._options.mimeType=this.cfg.mediaRecorerOptions.mimeType:this._options.mimeType=Nc;let i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;(i||r)&&(this._options.mimeType="video/mp4"),this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",o=>{this._chunks.push(o.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(L.events.PLAY))}catch(i){console.error("Failed to start recording",i)}},"_startRecording"));h(this,"_stopRecording",a(()=>{var e,i;(e=this._mediaRecorder)==null||e.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(L.events.STOP)}),(i=this._mediaRecorder)==null||i.stop(),this.classList.remove("uc-recording")},"_stopRecording"));h(this,"_toggleRecording",a(()=>{var e;((e=this._mediaRecorder)==null?void 0:e.state)!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording"));h(this,"_toggleEnableAudio",a(()=>{var e;(e=this._stream)==null||e.getAudioTracks().forEach(i=>{i.enabled=!i.enabled,this.$.toggleMicorphoneIcon=i.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!i.enabled})},"_toggleEnableAudio"));h(this,"_previewVideo",a(()=>{var e;try{let i=new Blob(this._chunks,{type:(e=this._mediaRecorder)==null?void 0:e.mimeType}),r=URL.createObjectURL(i);this.ref.video.muted=!1,this.ref.video.volume=1,this.$.video=null,this.ref.video.src=r,this.ref.video.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),this.ref.video.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(i){console.error("Failed to preview video",i)}},"_previewVideo"));h(this,"_retake",a(()=>{this._setCameraState(L.events.RETAKE),this._activeTab===L.types.VIDEO&&(this.$.video=this._stream,this.ref.video.muted=!0),this.ref.video.play()},"_retake"));h(this,"_accept",a(()=>{var o,n,l;if(this._setCameraState(L.events.ACCEPT),this._activeTab===L.types.PHOTO){(o=this._canvas)==null||o.toBlob(c=>{let u=this._createFile("camera","jpeg",Dn,c);this._toSend(u)},Dn);return}let e=new Blob(this._chunks,{type:(n=this._mediaRecorder)==null?void 0:n.mimeType}),i=this._guessExtensionByMime((l=this._mediaRecorder)==null?void 0:l.mimeType),r=this._createFile("video",i,`video/${i}`,e);this._toSend(r),this._chunks=[]},"_accept"));h(this,"_handlePhoto",a(e=>{e===L.events.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===L.events.RETAKE||e===L.events.ACCEPT)&&this.set$({tabVideoHidden:!this.cfg.enableVideoRecording,cameraHidden:!1,tabCameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this.cameraDevices.length<=1})},"_handlePhoto"));h(this,"_handleVideo",a(e=>{e===L.events.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===L.events.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicorphoneHidden:!0,cameraActionsHidden:!1}),(e===L.events.RETAKE||e===L.events.ACCEPT)&&this.set$({timerHidden:!0,tabCameraHidden:!1,cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicorphoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording,cameraSelectHidden:this.cameraDevices.length<=1})},"_handleVideo"));h(this,"_setCameraState",a(e=>{this._activeTab===L.types.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===L.types.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState"));h(this,"_handleActiveTab",a(e=>{this.ref.switcher.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e)}),e===L.types.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicorphoneHidden:!0}),e===L.types.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording,audioToggleMicorphoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab"));h(this,"_createFile",a((e,i,r,o)=>{let n=Date.now(),l=`${e}-${n}.${i}`;return new File([o],l,{lastModified:n,type:r})},"_createFile"));h(this,"_toSend",a(e=>{this.api.addFileFromObject(e,{source:U.CAMERA}),this.set$({"*currentActivity":_.activities.UPLOAD_LIST})},"_toSend"));h(this,"_setPermissionsState",P(e=>{this.classList.toggle("uc-initialized",e==="granted");let i=this._activeTab===L.types.VIDEO&&this.cfg.enableAudioRecording,r=this._activeTab===L.types.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!1,messageHidden:!0,timerHidden:!0,currentIcon:r,audioToggleMicorphoneHidden:!i,audioSelectHidden:!i}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!1,tabVideoHidden:!this.cfg.enableVideoRecording,cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300));h(this,"_makeStreamInactive",a(()=>{var r,o;if(!this._stream)return!1;let e=(r=this._stream)==null?void 0:r.getAudioTracks(),i=(o=this._stream)==null?void 0:o.getVideoTracks();e.forEach(n=>n.stop()),i.forEach(n=>n.stop())},"_makeStreamInactive"));h(this,"_stopCapture",a(()=>{var e;this._capturing&&(this.ref.video.volume=0,(e=this.$.video)==null||e.getTracks()[0].stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture"));h(this,"_capture",a(async()=>{let e={video:Fc,audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video.volume=0;try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.log("Failed to capture camera",i)}},"_capture"));h(this,"_handlePermissionsChange",a(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_permissionAccess",a(async()=>{try{for(let e of Mn)this[`${e}Response`]=await navigator.permissions.query({name:e}),this[`${e}Response`].addEventListener("change",this._handlePermissionsChange)}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this._capture()}},"_permissionAccess"));h(this,"_getPermission",a(()=>{},"_getPermission"));h(this,"_requestDeviceAccess",a(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){console.log("Failed to get user media",e)}},"_requestDeviceAccess"));h(this,"_getDevices",a(async()=>{var e,i;try{let r=await navigator.mediaDevices.enumerateDevices();this.cameraDevices=r.filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId})),this.audioDevices=this.cfg.enableAudioRecording&&r.filter(o=>o.kind==="audioinput").map(o=>({text:o.label.trim(),value:o.deviceId})),this.cameraDevices.length>1&&this.set$({cameraSelectOptions:this.cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=(e=this.cameraDevices[0])==null?void 0:e.value,this.audioDevices.length>1&&this.set$({audioSelectOptions:this.audioDevices,audioSelectHidden:!1}),this._selectedAudioId=(i=this.audioDevices[0])==null?void 0:i.value}catch(r){console.log("Failed to get devices",r)}},"_getDevices"));h(this,"_onActivate",a(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture()},"_onActivate"));h(this,"_onDeactivate",a(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate"));this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:Rn(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicorphoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicorphoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:e=>{this._selectedCameraId=e.target.value,this._capture()},onAudioSelectChange:e=>{this._selectedAudioId=e.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>this._shot(),onRequestPermissions:()=>this._capture(),onStartCamera:()=>this._chooseActionWithCamera(),onStartRecording:()=>this._startRecording(),onStopRecording:()=>this._stopRecording(),onToggleRecording:()=>this._toggleRecording(),onToggleAudio:()=>this._toggleEnableAudio(),onRetake:()=>this._retake(),onAccept:()=>this._accept(),onClickTab:e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._handleActiveTab(i)}}}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_guessExtensionByMime(e){let i={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e&&(e=e.split("/"),(e==null?void 0:e[0])==="video")){e=e.slice(1).join("/");let r=e==null?void 0:e.split(";")[0];if(i[r])return i[r]}return"avi"}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicorphoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("enableVideoRecording",e=>{this.$.tabVideoHidden=!e}),this.subConfigValue("defaultCameraMode",e=>{if(this.cfg.enableVideoRecording){this._handleActiveTab(e);return}this._handleActiveTab("photo")})}_destroy(){for(let e of Mn)this[`${e}Response`].removeEventListener("change",this._handlePermissionsChange);navigator.mediaDevices.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};a(L,"CameraSource");var De=L;De.types=Object.freeze({PHOTO:"photo",VIDEO:"video"});De.events=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});De.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><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" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted 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></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"><button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button><button type="button" class="uc-primary-btn" set="onclick: onAccept">Accept</button></div><button type="button" class="uc-shot-btn uc-camera-action" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicorphoneHidden;"><uc-icon set="@name:toggleMicorphoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var Cs=class Cs extends ${constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};a(Cs,"UploadCtxProviderClass");var Ki=Cs;Ki.EventType=I;var Fn=Ki;var xs=class xs extends ${constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){var e;super.destroyCallback(),(e=this._unobserveCollection)==null||e.call(this)}};a(xs,"ProgressBarCommon");var Ht=xs;Ht.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var As=class As extends y{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",e=>{if(e===void 0)return;let i=this._value;if(this._value=e,e===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",e=>{this.ref.line.classList.toggle("uc-progress--hidden",!e)})}};a(As,"ProgressBar");var jt=As;jt.template='<div ref="line" class="uc-progress"></div>';var ce="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Nn(...s){return s.reduce((t,e)=>{if(typeof e=="string")return t[e]=!0,t;for(let i of Object.keys(e))t[i]=e[i];return t},{})}a(Nn,"normalize");function N(...s){let t=Nn(...s);return Object.keys(t).reduce((e,i)=>(t[i]&&e.push(i),e),[]).join(" ")}a(N,"classNames");function Vn(s,...t){let e=Nn(...t);for(let i of Object.keys(e))s.classList.toggle(i,e[i])}a(Vn,"applyClassNames");var Bn=a(s=>{if(!s)return W;let t=uo(s).filter(e=>W.includes(e));return t.length===0?W:t},"parseTabs");function zn(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":W,"*tabId":O.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:ce,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:ze(W),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let t=s.querySelectorAll("img");for(let e of t){let i=e.src;e.src=ce,e.src=i}s.$["*networkProblems"]=!1},"*on.apply":t=>{if(!t)return;let e=s.$["*originalUrl"],i=V(Ce(t),"preview"),r=R(e,i),o={originalUrl:e,cdnUrlModifiers:i,cdnUrl:r,transformations:t};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}))}}}a(zn,"initState");var Hn="<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 jn=`${Hn} <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="${ce}" 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 Zi=class Zi extends y{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",P(this._showLoader.bind(this),300));this.init$={...this.init$,...zn(this)}}_showLoader(e){this.$.showLoader=e}_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(([l])=>{l.contentRect.width>0&&l.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 e=ui(this.$.cdnUrl),i=we(this.$.cdnUrl,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let r=eo(this.$.cdnUrl),o=no(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=we(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,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 e=await this.proxyUrl(R(this.$["*originalUrl"],V("json"))),i=await fetch(e).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(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==ce&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let i=this.ref["img-el"];i.src!==e&&(this._imgLoading=!0,i.src=e||ce)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=ki(e)}),this.sub("tabs",e=>{this.$["*tabList"]=Bn(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=N("uc-image",{"uc-image_hidden_to_cropper":e===O.CROP,"uc-image_hidden_effects":e!==O.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let i=this.$["*originalUrl"],r=V(Ce(e),"preview"),o=R(i,r),n={originalUrl:i,cdnUrlModifiers:r,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};a(Zi,"CloudImageEditorBlock"),h(Zi,"styleAttrs",["uc-cloud-image-editor"]);var ue=Zi;ue.template=jn;ue.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Es=class Es 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(t){let e=this.$["*imageBox"];if(!e)return;if(t===""&&e.height<=A&&e.width<=A)return!0;let i=e.height<=A&&(t.includes("n")||t.includes("s")),r=e.width<=A&&(t.includes("e")||t.includes("w"));return i||r}_createBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t,n=this.ref["svg-el"],l=Y("mask",{id:"backdrop-mask"}),c=Y("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=Y("rect",{x:e,y:i,width:r,height:o,fill:"black"});l.appendChild(c),l.appendChild(u);let p=Y("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(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t;this._backdropMaskInner&&Oe(this._backdropMaskInner,{x:e,y:i,width:r,height:o})}_updateFrame(){let t=this.$["*cropBox"];if(!(!t||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:i,pathNode:r,interactionNode:o,groupNode:n}=e,l=i==="",c=i.length===2,{x:u,y:p,width:d,height:f}=t;if(l)Oe(o,{x:u,y:p,width:d,height:f});else{let g=Te(Math.min(d,f)/(24*2+34)/2,0,1),{d:b,center:w}=c?zo(t,i,g):Ho(t,i,g),C=Math.max(zr*Te(Math.min(d,f)/zr/3,0,1),Bo);Oe(o,{x:w[0]-C,y:w[1]-C,width:C*2,height:C*2}),Oe(r,{d:b})}let m=this._shouldThumbBeDisabled(i);n.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Oe(this._frameGuides,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1})}}_createThumb(t,e){let i=Y("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let r=Y("rect",{fill:"transparent"}),o=Y("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(o),i.appendChild(r),t[e]={direction:e,pathNode:o,interactionNode:r,groupNode:i},e===""&&(i.style.cursor="move"),r.addEventListener("pointerdown",this._handlePointerDown.bind(this,e))}_createThumbs(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let r=`${["n","","s"][e]}${["w","","e"][i]}`;r!==""&&this._createThumb(t,r)}return this._createThumb(t,""),t}_createGuides(){let t=Y("svg"),e=Y("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let r=Y("line",{x1:`${Ut*i}%`,y1:"0%",x2:`${Ut*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}for(let i=1;i<=2;i++){let r=Y("line",{x1:"0%",y1:`${Ut*i}%`,x2:"100%",y2:`${Ut*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_createFrame(){let t=this.ref["svg-el"],e=document.createDocumentFragment(),i=this._createGuides();e.appendChild(i);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))e.appendChild(o);t.appendChild(e),this._frameThumbs=r,this._frameGuides=i}_handlePointerDown(t,e){if(!this._frameThumbs)return;let i=this._frameThumbs[t];if(this._shouldThumbBeDisabled(t))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,c=e.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,c],this._dragStartCrop={...r}}_handlePointerUp_(t){this._updateCursor(),this.$.dragging&&(t.stopPropagation(),t.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(t){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;t.stopPropagation(),t.preventDefault();let e=this.ref["svg-el"],{x:i,y:r}=e.getBoundingClientRect(),o=t.x-i,n=t.y-r,l=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(t,e){var u,p;let[i,r]=e,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],l=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=l?l.width/l.height:void 0;if(t===""?n=Go({rect:n,delta:[i,r],imageBox:o}):n=Wo({rect:n,delta:[i,r],direction:t,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 We(qe(n),this.$["*imageBox"])}_handleSvgPointerMove_(t){if(!this._frameThumbs)return;let e=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 Xo(n,[t.x,t.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let t=this._hoverThumb;this.ref["svg-el"].style.cursor=t?jo(t.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(t){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=A||t.width<=A,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",N({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),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)}};a(Es,"CropFrame");var Gt=Es;Gt.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var Ts=class Ts extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=N({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};a(Ts,"EditorButtonControl");var ye=Ts;ye.template=`<button type="button" role="option" l10n="@title:title-prop"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Bc(s){let t=s+90;return t=t>=360?0:t,t}a(Bc,"nextAngle");function zc(s,t){return s==="rotate"?Bc(t):["mirror","flip"].includes(s)?!t:null}a(zc,"nextValue");var Ss=class Ss extends ye{initCallback(){super.initCallback(),this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(t).toLowerCase()})))}),this.$["on.click"]=()=>{let t=this.$["*cropperEl"].getValue(this._operation),e=zc(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};a(Ss,"EditorCropButtonControl");var at=Ss;var Wt={FILTER:"filter",COLOR_OPERATION:"color_operation"},he="original",$s=class $s extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":e=>{this.$["*faderEl"].set(e),this.$.value=e}})}setOperation(e,i){this._controlType=e==="filter"?Wt.FILTER:Wt.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===he?void 0:this.$.value,filter:this._filter===he?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:i}=se[this._operation],[r,o]=e;this.$.min=r,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===Wt.FILTER){let l=o;if(n){let{name:c,amount:u}=n;l=c===this._filter?u:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===Wt.COLOR_OPERATION){let l=typeof n!="undefined"?n:i;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===Wt.FILTER?this._filter===he?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let i=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=i})}};a($s,"EditorSlider");var Xt=$s;Xt.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 qt(s){let t=new Image;return{promise:new Promise((r,o)=>{t.src=s,t.onload=r,t.onerror=o}),image:t,cancel:a(()=>{t.naturalWidth===0&&(t.src=ce)},"cancel")}}a(qt,"preloadImage");function Kt(s){let t=[];for(let o of s){let n=qt(o);t.push(n)}let e=t.map(o=>o.image);return{promise:Promise.allSettled(t.map(o=>o.promise)),images:e,cancel:a(()=>{t.forEach(o=>{o.cancel()})},"cancel")}}a(Kt,"batchPreloadImages");var Is=class Is extends ye{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,i=Math.ceil(e*t),r=e>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==he?{name:this._filter,amount:o}:void 0,R(this._originalUrl,V(hi,Ce(n),`quality/${r}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(t,e){var r;if(t[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:c}=qt(o);this._cancelPreload=c,l.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),e.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",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===he,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=e?"1":"0";let r=this.ref["preview-el"];e?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){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 t,e;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};a(Is,"EditorFilterControl");var Ne=Is;Ne.template=`<button type="button" role="option" l10n="@title:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var ks=class ks extends ye{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:i}=se[this._operation],r=e[this._operation],o=typeof r!="undefined"?r!==i:!1;this.$.active=o})}};a(ks,"EditorOperationControl");var lt=ks;function Gn(s,t){let e={};for(let i of t){let r=s[i];(s.hasOwnProperty(i)||r!==void 0)&&(e[i]=r)}return e}a(Gn,"pick");function ct(s,t,e){let r=window.devicePixelRatio,o=Math.min(Math.ceil(t*r),3e3),n=r>=2?"lightest":"normal";return R(s,V(hi,Ce(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Le}/${Ue}/uc-cloud-image-editor/`))}a(ct,"viewerImageSrc");function Hc(s){return s?[({dimensions:e,coords:i})=>[...e,...i].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:e,coords:i})=>e.every(r=>r>0)&&i.every(r=>r>=0)].every(e=>e(s)):!0}a(Hc,"validateCrop");var Os=class Os 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=P(this._commit.bind(this),300),this._handleResizeThrottled=Xi(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 e=this.$["*editorTransformations"],i=Gn(e,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...i};this.$["*operations"]=r}_initCanvas(){let e=this.ref["canvas-el"],i=e.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${r}px`,e.style.height=`${o}px`,e.width=r*n,e.height=o*n,i==null||i.scale(n,n),this._canvas=e,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,i=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=Xe({width:e.naturalWidth,height:e.naturalHeight},o),c;if(l.width>n.width-i*2||l.height>n.height-i*2){let u=l.width/l.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}=l,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"]=qe(c)}_alignCrop(){var f;let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[m,g],coords:[b,w]}=n,{width:C}=Xe(this._imageSize,o),v=l/C;e=We(qe({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(!qo(e,i)||d&&!Ko(e,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)),e={x:i.x+i.width/2-g/2,y:i.y+i.height/2-b/2,width:g,height:b}}this.$["*cropBox"]=We(qe(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let i=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:c}=o,u=Xe({width:r.width,height:r.height},c);e.save(),e.translate(r.x+r.width/2,r.y+r.height/2),e.rotate(c*Math.PI*-1/180),e.scale(n?-1:1,l?-1:1),e.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=N({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:l}=i,{width:c,height:u}=Xe(this._imageSize,o),{width:p,height:d}=e,f=n/c,m=l/u;return[Te(Math.round(p/f),1,c),Te(Math.round(d/m),1,u)]}_getCropTransformation(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:l,x:c,y:u}=i,{width:p,height:d}=Xe(this._imageSize,o),{x:f,y:m}=e,g=n/p,b=l/d,w=this._getCropDimensions(),C={dimensions:w,coords:[Te(Math.round((f-c)/g),0,p-w[0]),Te(Math.round((m-u)/b),0,d-w[1])]};if(!Hc(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===p&&w[1]===d))return C}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:i,mirror:r,flip:o}=e,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:i,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(e,i){this.$["*operations"]={...this.$["*operations"],[e]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,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:e=!1}={}){var i;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=N({"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 e=this._getCropDimensions(),i=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(i,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${n}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,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(ct(e,r,i)),{promise:n,cancel:l,image:c}=qt(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=l,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(e){let i="crop",r=this.$["*loadingOperations"];return r.get(i)||r.set(i,new Map),r.get(i).get(e)||(r.set(i,r.get(i).set(e,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(i))!=null&&o.has(e)&&(r.get(i).delete(e),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",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};a(Os,"EditorImageCropper");var Zt=Os;Zt.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Ls(s,t,e){let i=Array(e);e--;for(let r=e;r>=0;r--)i[r]=Math.ceil((r*t+(e-r)*s)/e);return i}a(Ls,"linspace");function jc(s){return s.reduce((t,e,i)=>i<s.length-1?[...t,[e,s[i+1]]]:t,[])}a(jc,"splitBySections");function Gc(s,t,e){let i=jc(s).find(([r,o])=>r<=t&&t<=o);return s.map(r=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(t-i[0])/o;return i[0]===r?t>e?1:1-n:i[1]===r?t>=e?n:1:0})}a(Gc,"calculateOpacities");function Wc(s,t){return s.map((e,i)=>e<t?s.length-i:i)}a(Wc,"calculateZIndices");function Wn(s,t){let e=se[s].keypointsNumber,{range:i,zero:r}=se[s];return[...new Set([...Ls(i[0],r,e+1),...Ls(r,i[1],e+1),r,t])].sort((o,n)=>o-n)}a(Wn,"keypointsRange");var Us=class Us extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=P(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(t){let e=this._operation,i=this.$["*loadingOperations"];return i.get(e)||i.set(e,new Map),i.get(e).get(t)||(i.set(e,i.get(e).set(t,!0)),this.$["*loadingOperations"]=i),()=>{var r;(r=i==null?void 0:i.get(e))!=null&&r.has(t)&&(i.get(e).delete(t),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let t of this._keypoints){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString())}})}async _imageSrc({url:t=this._url,filter:e=this._filter,operation:i,value:r}={}){let o={...this._transformations};i&&(o[i]=e?{name:e,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(ct(t,n,o))}async _constructKeypoint(t,e){return{src:await this._imageSrc({operation:t,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(t,e){return this._operation===t&&this._filter===e}async _addKeypoint(t,e,i){let r=a(()=>!this._isSame(t,e)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(r())return;let o=await this._constructKeypoint(t,i),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{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(t,i))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(t){t=typeof t=="string"?parseInt(t,10):t,this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t)}_update(t,e){this._operation=t,this._value=e;let{zero:i}=se[t],r=this._keypoints.map(l=>l.value),o=Gc(r,e,i),n=Wc(r,i);for(let[l,c]of Object.entries(this._keypoints))c.opacity=o[l],c.zIndex=n[l];this._flush()}_createPreviewImage(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async _initNodes(){let t=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&t.appendChild(this._previewImage);let e=document.createElement("div");t.appendChild(e);let i=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=Kt(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 l=this._operation,c=this._filter;await o,this._isActive&&this._isSame(l,c)&&(this._container&&this._container.remove(),this._container=e,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(t),this._flush())}async setTransformations(t){if(this._transformations=t,this._previewImage){let e=await this._imageSrc(),i=this._handleImageLoading(e);this._previewImage.src=e,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:t,filter:e,operation:i,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Wn(i,r),n=await Promise.all(o.map(c=>this._imageSrc({url:t,filter:e,operation:i,value:c}))),{cancel:l}=Kt(n);this._cancelBatchPreload=l}_setOriginalSrc(t){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let i=this._handleImageLoading(t);e.addEventListener("error",i,{once:!0}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:t,operation:e,value:i,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=t,this._operation=e||"initial",this._value=i,this._filter=r,this._fromViewer=o,typeof i!="number"&&!r){let l=await this._imageSrc({operation:e,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Wn(e,i).map(l=>this._constructKeypoint(e,l))),this._update(e,i),this._initNodes()}deactivate({hide:t=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),t&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=N({"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()}};a(Us,"EditorImageFader");var Yi=Us;var Xc=1,Ps=class Ps extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;Math.abs(i)>Xc?this.scrollLeft+=i:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};a(Ps,"EditorScroller");var Yt=Ps;Yt.template=" <slot></slot> ";function qc(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}; title-prop: a11y-editor-tab-${s}" ></uc-btn-ui></uc-presence-toggle>`}a(qc,"renderTabToggle");function Kc(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>`}a(Kc,"renderTabContent");var Rs=class Rs extends y{constructor(){super();h(this,"_updateInfoTooltip",P(()=>{var n,l;let e=this.$["*editorTransformations"],i=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===O.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=e==null?void 0:e.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(he);else if(this.$["*tabId"]===O.TUNING&&i){o=!0;let c=(e==null?void 0:e[i])||se[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":he,"*currentOperation":null,showLoader:!1,filters:lo,colorOperations:ao,cropOperations:co,"*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 e;(e=this._cancelPreload)==null||e.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":e=>{let i=e.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}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=P(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(e){let i=new lt;return i.operation=e,i}_createFilterControl(e){let i=new Ne;return i.filter=e,i}_createToggleControl(e){let i=new at;return i.operation=e,i}_renderControlsList(e){let i=this.ref[`controls-list-${e}`],r=document.createDocumentFragment();e===O.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):e===O.FILTERS?[he,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):e===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(e,{fromViewer:i}){this.$["*tabId"]=e,e===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 W){let o=r===e,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(e){let i=this.ref[`controls-list-${e}`];i&&(i.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(ct(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=Kt([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var r;let i=(r=e==null?void 0:e.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",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let i=!1;for(let[,r]of e.entries()){if(i)break;for(let[,o]of r.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let i of W){this.$[`presence.tabToggle.${i}`]=e.includes(i);let r=this.ref[`tab-toggle-${i}`];r.style.gridColumn=e.indexOf(i)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}};a(Rs,"EditorToolbar");var Jt=Rs;Jt.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">${W.map(Kc).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> ${W.map(qc).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop: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 Ms=class Ms 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":"","title-prop":""},this.defineAccessor("active",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return N("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",t=>{this._iconSingle=!this.$.text,this._iconHidden=!t,this.$.iconCss=this._iconCss()}),this.sub("theme",t=>{t!=="custom"&&(this.className=`uc-${t}`)}),this.sub("text",t=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",t=>{this.$["aria-role"]=t||""}),this.defineAccessor("aria-controls",t=>{this.$["aria-controls"]=t||""}),this.defineAccessor("title-prop",t=>{this.$["title-prop"]=t||""})}set reverse(t){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};a(Ms,"BtnUi");var ut=Ms;ut.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ut.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls;" l10n="@title:title-prop"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var Ds=class Ds extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let t=this.ref["line-el"];t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",t=>{typeof t=="boolean"&&(t?this._start():this._stop())})}_start(){this._active=!0;let{width:t}=this.getBoundingClientRect(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};a(Ds,"LineLoaderUi");var Qt=Ds;Qt.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var Ji={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Fs=class Fs extends y{constructor(){super(),this._visible=!1,this._visibleStyle=Ji.visible,this._hiddenStyle=Ji.hidden,this._externalTransitions=!1,this.defineAccessor("styles",t=>{t&&(this._externalTransitions=!0,this._visibleStyle=t.visible,this._hiddenStyle=t.hidden)}),this.defineAccessor("visible",t=>{typeof t=="boolean"&&(this._visible=t,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Vn(this,{[Ji.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(Ji.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};a(Fs,"PresenceToggle");var ei=Fs;ei.template="<slot></slot> ";var Ns=class Ns extends y{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderChange":()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)}});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 e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(e-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="1";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 l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(l),this._stepsCount=n}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};a(Ns,"SliderUi");var ti=Ns;ti.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 Vs=class Vs extends ${constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CLOUD_IMG_EDIT);h(this,"_entry");h(this,"_instance")}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let i=e.detail;this._entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams;if(this._entry=this.uploadCollection.read(e),!this._entry)throw new Error(`Entry with internalId "${e}" not found`);let i=this._entry.getValue("cdnUrl");if(!i)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let r=new ue,o=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;r.setAttribute("ctx-name",this.ctxName),r.setAttribute("cdn-url",i),o&&r.setAttribute("crop-preset",o),n&&r.setAttribute("tabs",n),r.addEventListener("apply",l=>{let c=l;this.handleApply(c),this.debugPrint('editor event "apply"',c.detail)}),r.addEventListener("cancel",l=>{let c=l;this.handleCancel(),this.debugPrint('editor event "cancel"',c.detail)}),r.addEventListener("change",l=>{let c=l;this.debugPrint('editor event "change"',c.detail)}),this.innerHTML="",this.appendChild(r),this._instance=r}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};a(Vs,"CloudImageEditorActivity");var Qi=Vs;var Zc=a(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Xn=a(function(s,t="i"){let e=s.split("*").map(Zc);return new RegExp("^"+e.join(".+")+"$",t)},"wildcardRegexp");function Yc(s,t){return window.getComputedStyle(s).getPropertyValue(t).trim()}a(Yc,"getCssValue");var Jc=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"];function qn(s){return Jc.reduce((t,e)=>{let i=Yc(s,e);return i&&(t[e]=i),t},{})}a(qn,"buildThemeDefinition");var Qc=["selected-files-change"],eu=a(s=>!s||typeof s!="object"?!1:"type"in s&&Qc.includes(s.type),"isWhitelistedMessage"),Bs=class Bs{constructor(t){h(this,"_handlerMap",new Map);h(this,"_context");h(this,"_handleMessage",a(t=>{if(t.source!==this._context)return;let e=t.data;if(!eu(e))return;let i=this._handlerMap.get(e.type);if(i)for(let r of i)r(e)},"_handleMessage"));this._context=t,window.addEventListener("message",this._handleMessage)}on(t,e){var r;let i=(r=this._handlerMap.get(t))!=null?r:new Set;this._handlerMap.has(t)||this._handlerMap.set(t,i),i.add(e)}send(t){this._context.postMessage(t,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};a(Bs,"MessageBridge");var er=Bs;function Kn(s){let t=[];for(let[e,i]of Object.entries(s))i==null||typeof i=="string"&&i.length===0||t.push(`${e}=${encodeURIComponent(i)}`);return t.join("&")}a(Kn,"queryString");var zs=class zs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.EXTERNAL);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",onDone:()=>{for(let e of this.$.selectedList){let i=this.extractUrlFromSelectedFile(e),{filename:r}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:r,source:o})}this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onSelectAll:()=>{var e;(e=this._messageBridge)==null||e.send({type:"select-all"})},onDeselectAll:()=>{var e;(e=this._messageBridge)==null||e.send({type:"deselect-all"})}}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e==null?void 0:e[0].toUpperCase()}${e==null?void 0:e.slice(1)}`,activityIcon:e}),this.mountIframe()}}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()})}extractUrlFromSelectedFile(e){if(e.alternatives){let i=B(this.cfg.externalSourcesPreferredTypes);for(let r of i){let o=Xn(r);for(let[n,l]of Object.entries(e.alternatives))if(o.test(n))return l}}return e.url}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({isSelectionReady:e.isReady,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyStyles(),this.setupL10n()}applyStyles(){var e;(e=this._messageBridge)==null||e.send({type:"set-theme-definition",theme:qn(this)})}setupL10n(){var e;(e=this._messageBridge)==null||e.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){var p,d;let{pubkey:e,remoteTabSessionKey:i,socialBaseUrl:r,multiple:o}=this.cfg,{externalSourceType:n}=this.activityParams,c={lang:((d=(p=this.l10n("social-source-lang"))==null?void 0:p.split("-"))==null?void 0:d[0])||"en",public_key:e,images_only:"false",session_key:i,wait_for_theme:!0,multiple:o.toString()},u=new URL(`/window4/${n}`,r);return u.search=Kn(c),u.toString()}mountIframe(){var i;let e=ur({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&((i=this._messageBridge)==null||i.destroy(),this._messageBridge=new er(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){var e;(e=this._messageBridge)==null||e.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isSelectionReady:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};a(zs,"ExternalSource");var ii=zs;ii.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close" ><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 set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isSelectionReady" l10n="done" ></button></div></div>`;var Hs=class Hs extends ${constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,At(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let r=e.group?e.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=e.allEntries.map(l=>l.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 l of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=l,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};a(Hs,"FormInput");var tr=Hs;var js=class js extends _{};a(js,"ActivityHeader");var ir=js;var Gs=class Gs extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:e=>{var i;e.preventDefault(),e.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",e=>{var r;this.$.currentText=((r=e==null?void 0:e[0])==null?void 0:r.text)||"";let i="";e==null||e.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};a(Gs,"Select");var ri=Gs;ri.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var sr=class sr extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};a(sr,"Copyright"),h(sr,"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 rr=sr;var ht=class ht extends oe{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",t=>{this.set$({isHidden:k(t)})}),this.sub("*modalActive",t=>{this._lastModalActive!==t&&this.emit(t?I.MODAL_OPEN:I.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=t},!1)}};a(ht,"FileUploaderRegular"),h(ht,"styleAttrs",[...G(ht,ht,"styleAttrs"),"uc-file-uploader-regular"]);var dt=ht;dt.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>`;dt.bindAttributes({headless:null});var pt=class pt extends oe{initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=_.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};a(pt,"FileUploaderMinimal"),h(pt,"styleAttrs",[...G(pt,pt,"styleAttrs"),"uc-file-uploader-minimal"]);var si=pt;si.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 ft=class ft extends oe{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let t=this.$["*history"];return t.length>1&&t[t.length-1]!==_.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0&&this.$["*currentActivity"]===(t.initActivity||_.activities.START_FROM)&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};a(ft,"FileUploaderInline"),h(ft,"styleAttrs",[...G(ft,ft,"styleAttrs"),"uc-file-uploader-inline"]);var oi=ft;oi.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 mt=class mt extends ue{initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}};a(mt,"CloudImageEditor"),h(mt,"styleAttrs",[...G(mt,mt,"styleAttrs"),"uc-wgt-common"]);var or=mt;function nr(s){for(let t in s){let e=[...t].reduce((i,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),i+=r),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),s[t].reg&&s[t].reg(e)}}a(nr,"defineComponents");var Ws="UC";async function Zn(s,t=!1){return new Promise((e,i)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[Ws]){e(window[Ws]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{i()},r.onload=()=>{let o=window[Ws];t&&nr(o),e(o)},document.head.appendChild(r)})}a(Zn,"loadFileUploaderFrom");return na(tu);})();
|
|
26
|
+
"use strict";var UC=(()=>{var gt=Object.defineProperty;var Qn=Object.getOwnPropertyDescriptor;var ea=Object.getOwnPropertyNames;var ta=Object.getPrototypeOf,ia=Object.prototype.hasOwnProperty;var ra=Reflect.get;var sa=(s,t,e)=>t in s?gt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var a=(s,t)=>gt(s,"name",{value:t,configurable:!0});var oa=(s,t)=>{for(var e in t)gt(s,e,{get:t[e],enumerable:!0})},na=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ea(t))!ia.call(s,r)&&r!==e&>(s,r,{get:()=>t[r],enumerable:!(i=Qn(t,r))||i.enumerable});return s};var aa=s=>na(gt({},"__esModule",{value:!0}),s);var h=(s,t,e)=>(sa(s,typeof t!="symbol"?t+"":t,e),e);var G=(s,t,e)=>ra(ta(s),e,t);var tu={};oa(tu,{ActivityBlock:()=>_,ActivityHeader:()=>ir,BaseComponent:()=>Ie,Block:()=>y,BtnUi:()=>ut,CameraSource:()=>De,CloudImageEditor:()=>or,CloudImageEditorActivity:()=>Qi,CloudImageEditorBlock:()=>ue,Config:()=>mn,Copyright:()=>rr,CropFrame:()=>Gt,Data:()=>T,DropArea:()=>rt,EditorCropButtonControl:()=>at,EditorFilterControl:()=>Ne,EditorImageCropper:()=>Zt,EditorImageFader:()=>Yi,EditorOperationControl:()=>lt,EditorScroller:()=>Yt,EditorSlider:()=>Xt,EditorToolbar:()=>Jt,ExternalSource:()=>ii,ExternalUploadSource:()=>Pe,FileItem:()=>nt,FileUploaderInline:()=>oi,FileUploaderMinimal:()=>si,FileUploaderRegular:()=>dt,FormInput:()=>tr,Icon:()=>Ye,Img:()=>Hi,LineLoaderUi:()=>Qt,Modal:()=>Vt,PACKAGE_NAME:()=>Le,PACKAGE_VERSION:()=>Ue,PresenceToggle:()=>ei,ProgressBar:()=>jt,ProgressBarCommon:()=>Ht,Select:()=>ri,SimpleBtn:()=>et,SliderUi:()=>ti,SolutionBlock:()=>oe,SourceBtn:()=>st,SourceList:()=>ji,StartFrom:()=>Ft,UID:()=>$e,UploadCtxProvider:()=>Nn,UploadList:()=>Bt,UploadSource:()=>U,UploaderBlock:()=>$,UrlSource:()=>zt,defineComponents:()=>nr,defineLocale:()=>Rr,loadFileUploaderFrom:()=>Yn,toKebabCase:()=>Ke});var la=Object.defineProperty,ca=a((s,t,e)=>t in s?la(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,"__defNormalProp"),cr=a((s,t,e)=>(ca(s,typeof t!="symbol"?t+"":t,e),e),"__publicField");function ua(s){let t=a(e=>{var i;for(let r in e)((i=e[r])==null?void 0:i.constructor)===Object&&(e[r]=t(e[r]));return{...e}},"clone");return t(s)}a(ua,"cloneObj");var _t,T=(_t=class{constructor(t){t.constructor===Object?this.store=ua(t):(this._storeIsProxy=!0,this.store=t),this.callbackMap=Object.create(null)}static warn(t,e){console.warn(`Symbiote Data: cannot ${t}. Prop name: `+e)}read(t){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(T.warn("read",t),null):this.store[t]}has(t){return this._storeIsProxy?this.store[t]!==void 0:this.store.hasOwnProperty(t)}add(t,e,i=!1){!i&&Object.keys(this.store).includes(t)||(this.store[t]=e,this.notify(t))}pub(t,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(t)){T.warn("publish",t);return}this.store[t]=e,this.notify(t)}multiPub(t){for(let e in t)this.pub(e,t[e])}notify(t){this.callbackMap[t]&&this.callbackMap[t].forEach(e=>{e(this.store[t])})}sub(t,e,i=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(T.warn("subscribe",t),null):(this.callbackMap[t]||(this.callbackMap[t]=new Set),this.callbackMap[t].add(e),i&&e(this.store[t]),{remove:()=>{this.callbackMap[t].delete(e),this.callbackMap[t].size||delete this.callbackMap[t]},callback:e})}static registerCtx(t,e=Symbol()){let i=T.globalStore.get(e);return i?console.warn('State: context UID "'+e+'" already in use'):(i=new T(t),T.globalStore.set(e,i)),i}static deleteCtx(t){T.globalStore.delete(t)}static getCtx(t,e=!0){return T.globalStore.get(t)||(e&&console.warn('State: wrong context UID - "'+t+'"'),null)}},a(_t,"Data"),_t);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"}),Ks="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",ha=Ks.length-1,yt,$e=(yt=class{static generate(t="XXXXXXXXX-XXX"){let e="";for(let i=0;i<t.length;i++)e+=t[i]==="-"?t[i]:Ks.charAt(Math.random()*ha);return e}},a(yt,"UID"),yt);function Zs(s,t,e){let i=!0,r,o=t.split(".");return o.forEach((n,l)=>{l<o.length-1?s=s[n]:r=n}),s?s[r]=e:i=!1,i}a(Zs,"setNestedProp");function da(s){return s.split("-").map((t,e)=>t&&e?t[0].toUpperCase()+t.slice(1):t).join("").split("_").map((t,e)=>t&&e?t.toUpperCase():t).join("")}a(da,"kebabToCamel");function pa(s,t){[...s.querySelectorAll(`[${E.REPEAT_ATTR}]`)].forEach(e=>{var n;let i=e.getAttribute(E.REPEAT_ITEM_TAG_ATTR),r;if(i&&(r=window.customElements.get(i)),!r){r=(n=class extends t.BaseComponent{constructor(){super(),i||(this.style.display="contents")}},a(n,"itemClass"),n);let l=e.innerHTML;r.template=l,r.reg(i)}for(;e.firstChild;)e.firstChild.remove();let o=e.getAttribute(E.REPEAT_ATTR);t.sub(o,l=>{if(!l){for(;e.firstChild;)e.firstChild.remove();return}let c=[...e.children],u,p=a(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&&e.appendChild(u);let f=c.slice(d.length,c.length);for(let m of f)m.remove()},"fillItems");if(l.constructor===Array)p(l);else if(l.constructor===Object){let d=[];for(let f in l){let m=l[f];Object.defineProperty(m,"_KEY_",{value:f,enumerable:!0}),d.push(m)}p(d)}else console.warn("Symbiote repeat data type error:"),console.log(l)}),e.removeAttribute(E.REPEAT_ATTR),e.removeAttribute(E.REPEAT_ITEM_TAG_ATTR)})}a(pa,"repeatProcessor");var Xs="__default__";function fa(s,t){if(t.shadowRoot)return;let e=[...s.querySelectorAll("slot")];if(!e.length)return;let i={};e.forEach(r=>{let o=r.getAttribute("name")||Xs;i[o]={slot:r,fr:document.createDocumentFragment()}}),t.initChildren.forEach(r=>{var o;let n=Xs;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()})}a(fa,"slotProcessor");function ma(s,t){[...s.querySelectorAll(`[${E.EL_REF_ATTR}]`)].forEach(e=>{let i=e.getAttribute(E.EL_REF_ATTR);t.ref[i]=e,e.removeAttribute(E.EL_REF_ATTR)})}a(ma,"refProcessor");function ga(s,t){[...s.querySelectorAll(`[${E.BIND_ATTR}]`)].forEach(e=>{let r=e.getAttribute(E.BIND_ATTR).split(";");[...e.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let n=da(o.name.replace("-",""));r.push(n+":"+o.value),e.removeAttribute(o.name)}}),r.forEach(o=>{if(!o)return;let n=o.split(":").map(p=>p.trim()),l=n[0],c;l.indexOf(E.ATTR_BIND_PRFX)===0&&(c=!0,l=l.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("!","")),t.sub(p,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):Zs(e,l,f)||(e[E.SET_LATER_KEY]||(e[E.SET_LATER_KEY]=Object.create(null)),e[E.SET_LATER_KEY][l]=f)})}}),e.removeAttribute(E.BIND_ATTR)})}a(ga,"domSetProcessor");var ni="{{",bt="}}",ba="skip-text";function _a(s){let t,e=[],i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var o;return!((o=r.parentElement)!=null&&o.hasAttribute(ba))&&r.textContent.includes(ni)&&r.textContent.includes(bt)&&1}});for(;t=i.nextNode();)e.push(t);return e}a(_a,"getTextNodesWithTokens");var ya=a(function(s,t){_a(s).forEach(i=>{let r=[],o;for(;i.textContent.includes(bt);)i.textContent.startsWith(ni)?(o=i.textContent.indexOf(bt)+bt.length,i.splitText(o),r.push(i)):(o=i.textContent.indexOf(ni),i.splitText(o)),i=i.nextSibling;r.forEach(n=>{let l=n.textContent.replace(ni,"").replace(bt,"");n.textContent="",t.sub(l,c=>{n.textContent=c})})})},"txtNodesProcessor"),va=[pa,fa,ma,ga,ya],ai="'",Be='"',wa=/\\([0-9a-fA-F]{1,6} ?)/g;function Ca(s){return(s[0]===Be||s[0]===ai)&&(s[s.length-1]===Be||s[s.length-1]===ai)}a(Ca,"hasLeadingTrailingQuotes");function xa(s){return(s[0]===Be||s[0]===ai)&&(s=s.slice(1)),(s[s.length-1]===Be||s[s.length-1]===ai)&&(s=s.slice(0,-1)),s}a(xa,"trimQuotes");function Aa(s){let t="",e="";for(var i=0;i<s.length;i++){let r=s[i+1];s[i]==="\\"&&r==='"'?(t+='\\"',i++):s[i]==='"'&&e!=="\\"?t+='\\"':t+=s[i],e=s[i]}return t}a(Aa,"escapeQuotes");function Ea(s){let t=s;Ca(s)&&(t=xa(t),t=t.replace(wa,(e,i)=>String.fromCodePoint(parseInt(i.trim(),16))),t=t.replaceAll(`\\
|
|
27
|
+
`,"\\n"),t=Aa(t),t=Be+t+Be);try{return JSON.parse(t)}catch{throw new Error(`Failed to parse CSS property value: ${t}. Original input: ${s}`)}}a(Ea,"parseCssPropertyValue");var qs=0,Ve=null,pe=null,vt,ve=(vt=class extends HTMLElement{constructor(){super(),cr(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=this.__boundCssProps)==null||t.forEach(e=>{let i=this.getCssData(this.__extractCssName(e),!0);i!==null&&this.$[e]!==i&&(this.$[e]=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 ve}initCallback(){}__initCallback(){var t;this.__initialized||(this.__initialized=!0,(t=this.initCallback)==null||t.call(this))}render(t,e=this.renderShadow){let i;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(E.USE_TPL);if(o){let n=this.getRootNode(),l=(n==null?void 0:n.querySelector(o))||document.querySelector(o);l?t=l.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(t||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(t==null?void 0:t.constructor)===DocumentFragment)i=t;else if((t==null?void 0:t.constructor)===String){let o=document.createElement("template");o.innerHTML=t,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=a(()=>{i&&(e&&this.shadowRoot.appendChild(i)||this.appendChild(i)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){e=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=r,this.shadowRoot.prepend(o)}else r()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=$e.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 t;let e=((t=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}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(t,e){let i,r;if(t.startsWith(E.EXT_DATA_CTX_PRFX))i=e.nodeCtx,r=t.replace(E.EXT_DATA_CTX_PRFX,"");else if(t.includes(E.NAMED_DATA_CTX_SPLTR)){let o=t.split(E.NAMED_DATA_CTX_SPLTR);i=T.getCtx(o[0]),r=o[1]}else i=e.localCtx,r=t;return{ctx:i,name:r}}sub(t,e,i=!0){let r=a(n=>{this.isConnected&&e(n)},"subCb"),o=ve.__parseProp(t,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(t){let e=ve.__parseProp(t,this);e.ctx.notify(e.name)}has(t){let e=ve.__parseProp(t,this);return e.ctx.has(e.name)}add(t,e,i=!1){let r=ve.__parseProp(t,this);r.ctx.add(r.name,e,i)}add$(t,e=!1){for(let i in t)this.add(i,t[i],e)}get $(){if(!this.__stateProxy){let t=Object.create(null);this.__stateProxy=new Proxy(t,{set:(e,i,r)=>{let o=ve.__parseProp(i,this);return o.ctx.pub(o.name,r),!0},get:(e,i)=>{let r=ve.__parseProp(i,this);return r.ctx.read(r.name)}})}return this.__stateProxy}set$(t,e=!1){for(let i in t){let r=t[i];e||![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 t=this.constructor.__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(E.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(E.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(E.NAMED_DATA_CTX_SPLTR)){let i=e.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$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var t;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(t=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(E.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[E.SET_LATER_KEY]){for(let i in this[E.SET_LATER_KEY])Zs(this,i,this[E.SET_LATER_KEY][i]);delete this[E.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let i of va)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 t of this.allSubs)t.remove(),this.allSubs.delete(t);for(let t of this.tplProcessors)this.tplProcessors.delete(t);pe==null||pe.delete(this.updateCssData),pe!=null&&pe.size||(Ve==null||Ve.disconnect(),Ve=null,pe=null)},100)))}static reg(t,e=!1){t||(qs++,t=`${E.AUTO_TAG_PRFX}-${qs}`),this.__tag=t;let i=window.customElements.get(t);if(i){!e&&i!==this&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
|
|
28
|
+
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,e,i){var r;if(e===i)return;let o=(r=this.constructor.__attrDesc)==null?void 0:r[t];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[t]=i}getCssData(t,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=Ea(i)}catch{!e&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((e,i)=>i===0?"":e).join("--")}__initStyleAttrObserver(){pe||(pe=new Set),pe.add(this.updateCssData),Ve||(Ve=new MutationObserver(t=>{t[0].type==="attributes"&&pe.forEach(e=>{e()})}),Ve.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let i=this.getCssData(this.__extractCssName(t),!0);i===null&&(i=e),this.add(t,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,e,i){let r="__"+t;this[r]=this[t],Object.defineProperty(this,t,{set:o=>{this[r]=o,i?window.setTimeout(()=>{e==null||e(o)}):e==null||e(o)},get:()=>this[r]}),this[t]=this[r]}static set shadowStyles(t){let e=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(t){if(!this.__rootStylesLink){let e=new Blob([t],{type:"text/css"}),i=URL.createObjectURL(e),r=document.createElement("link");r.href=i,r.rel="stylesheet",this.__rootStylesLink=r}}},a(vt,"_BaseComponent"),vt),Ie=ve;cr(Ie,"template");var wt,lr=(wt=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))t.route=i.replace("?","");else if(i.includes("=")){let r=i.split("=");t.options[r[0]]=decodeURI(r[1])}else t.options[i]=!0}),t}static notify(){let t=this.readAddressBar(),e=this.appMap[t.route];if(e&&e.title&&(document.title=e.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${t.route}" not found...`);return}let i=new CustomEvent(lr.routingEventName,{detail:{route:t.route,options:Object.assign(e||{},t.options)}});window.dispatchEvent(i)}static reflect(t,e={}){let i=this.appMap[t];if(!i){this._print("Wrong route: "+t);return}let r="?"+t;for(let n in e)e[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${e[n]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,r),document.title=o}static applyRoute(t,e={}){this.reflect(t,e),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,e){this.setRoutingMap(e);let i=T.registerCtx({route:null,options:null,title:null},t);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||""})}),lr.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}},a(wt,"AppRouter"),wt);lr.appMap=Object.create(null);function At(s,t){for(let e in t)e.includes("-")?s.style.setProperty(e,t[e]):s.style[e]=t[e]}a(At,"applyStyles");function Ta(s,t){for(let e in t)t[e].constructor===Boolean?t[e]?s.setAttribute(e,""):s.removeAttribute(e):s.setAttribute(e,t[e])}a(Ta,"applyAttributes");function ur(s={tag:"div"}){let t=document.createElement(s.tag);if(s.attributes&&Ta(t,s.attributes),s.styles&&At(t,s.styles),s.properties)for(let e in s.properties)t[e]=s.properties[e];return s.processors&&s.processors.forEach(e=>{e(t)}),s.children&&s.children.forEach(e=>{let i=ur(e);t.appendChild(i)}),t}a(ur,"create");var Ys="idb-store-ready",Sa="symbiote-db",$a="symbiote-idb-update_",Ct,Ia=(Ct=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(Ys,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return $a+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,e){this.name=t,this.storeName=e,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(e,{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(t){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((r,o)=>{i.onsuccess=n=>{var l;(l=n.target.result)!=null&&l._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${t}"`))},i.onerror=n=>{o(n)}})}write(t,e,i=!1){let r={_key:t,_value:e},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((l,c)=>{n.onsuccess=u=>{i||this._notifySubscribers(t),l(u.target.result)},n.onerror=u=>{c(u)}})}delete(t,e=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((o,n)=>{r.onsuccess=l=>{e||this._notifySubscribers(t),o(l)},r.onerror=l=>{n(l)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,r)=>{e.onsuccess=o=>{let n=o.target.result;i(n.map(l=>l._value))},e.onerror=o=>{r(o)}})}subscribe(t,e){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let i=this._subscriptionsMap[t];return i.add(e),{remove:()=>{i.delete(e),i.size||delete this._subscriptionsMap[t]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Js.clear(this.name)}},a(Ct,"DbInstance"),Ct),xt,Js=(xt=class{static get readyEventName(){return Ys}static open(t=Sa,e="store"){let i=t+"/"+e;return this._reg[i]||(this._reg[i]=new Ia(t,e)),this._reg[i]}static clear(t){window.indexedDB.deleteDatabase(t);for(let e in this._reg)e.split("/")[0]===t&&delete this._reg[e]}},a(xt,"IDB"),xt);cr(Js,"_reg",Object.create(null));var Qs=a(s=>{if(typeof s!="string"||!s)return"";let t=s.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},"normalizeCdnOperation"),li=a((...s)=>s.filter(t=>typeof t=="string"&&t).map(t=>Qs(t)).join("/-/"),"joinCdnOperations"),V=a((...s)=>{let t=li(...s);return t?`-/${t}/`:""},"createCdnUrlModifiers");function ci(s){let t=new URL(s),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),r=e.lastIndexOf("/"),o="";return i>=0?o=e.slice(i):r>=0&&(o=e.slice(r+1)),o}a(ci,"extractFilename");function ui(s){let t=new URL(s),{pathname:e}=t,i=e.indexOf("/"),r=e.indexOf("/",i+1);return e.substring(i+1,r)}a(ui,"extractUuid");function hr(s){let t=to(s),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}a(hr,"extractCdnUrlModifiers");function eo(s){return hr(s).split("/-/").filter(Boolean).map(e=>Qs(e))}a(eo,"extractOperations");function to(s){let t=new URL(s),e=ci(s),i=io(e)?ro(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}a(to,"trimFilename");function io(s){return s.startsWith("http")}a(io,"isFileUrl");function ro(s){let t=new URL(s);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}a(ro,"splitFileUrl");var R=a((s,t,e)=>{let i=new URL(to(s));if(e=e||ci(s),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),io(e)){let r=ro(e);i.pathname=i.pathname+(t||"")+(r.pathname||""),i.search=r.search,i.hash=r.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},"createCdnUrl"),we=a((s,t)=>{let e=new URL(s);return e.pathname=t+"/",e.toString()},"createOriginalUrl");var B=a((s,t=",")=>s.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0),"stringToArray");var K=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}),oo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ka(s,t){if(typeof t=="number"){let e=t;return K[s]!==e?`${s}/${e}`:""}if(typeof t=="boolean"){let e=t;return K[s]!==e?`${s}`:""}if(s==="filter"&&t){let{name:e,amount:i}=t;return K.filter===i?"":`${s}/${e}/${i}`}if(s==="crop"&&t){let{dimensions:e,coords:i}=t;return`${s}/${e.join("x")}/${i.join(",")}`}return""}a(ka,"transformationToStr");function Ce(s){return li(...oo.filter(t=>typeof s[t]!="undefined"&&s[t]!==null).map(t=>{let e=s[t];return ka(t,e)}).filter(t=>!!t))}a(Ce,"transformationsToOperations");var hi=li("format/auto","progressive/yes"),fe=a(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),so=a(()=>!0,"asBoolean"),Oa=a(([s,t])=>({name:s,amount:typeof t!="undefined"?Number(t):100}),"asFilter"),La=a(([s,t])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:B(s,"x").map(Number),coords:B(t).map(Number)}},"asCrop"),Ua=Object.freeze({enhance:fe,brightness:fe,exposure:fe,gamma:fe,contrast:fe,saturation:fe,vibrance:fe,warmth:fe,filter:Oa,mirror:so,flip:so,rotate:fe,crop:La});function no(s){let t={};for(let e of s){let[i,...r]=e.split("/");if(!oo.includes(i))continue;let o=i,n=Ua[o];try{let l=n(r);t[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
+
`))}}return t}a(no,"operationsToTransformations");var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),W=[O.CROP,O.TUNING,O.FILTERS],ao=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],lo=["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"],co=["rotate","mirror","flip"],se=Object.freeze({brightness:{zero:K.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:K.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:K.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:K.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:K.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:K.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:K.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:K.enhance,range:[0,100],keypointsNumber:1},filter:{zero:K.filter,range:[0,100],keypointsNumber:1}});var uo=a(s=>s?s.split(",").map(t=>t.trim()):[],"deserealizeCsv"),ze=a(s=>s?s.join(","):"","serializeCsv");var Pa="https://ucarecdn.com",Ra="https://upload.uploadcare.com",Ma="https://social.uploadcare.com",te={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:ze(W),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Pa,baseUrl:Ra,socialBaseUrl:Ma,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:[],defaultCameraMode:"photo",enableAudioRecording:!0,enableVideoRecording:!0,maxVideoRecordingDuration:null,mediaRecorerOptions:null};var I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),dr=class dr{constructor(t){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let r of this._targets)r.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let r=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,r]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let r=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},r);this._timeoutStore.set(t,o)}};a(dr,"EventEmitter");var di=dr;function P(s,t){let e,i=a((...r)=>{clearTimeout(e),e=setTimeout(()=>s(...r),t)},"debounced");return i.cancel=()=>{clearTimeout(e)},i}a(P,"debounce");var ho="--uploadcare-blocks-window-height",Et=class Et{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),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(ho)}};a(Et,"WindowHeightTracker"),h(Et,"clientsRegistry",new Set),h(Et,"flush",P(()=>{document.documentElement.style.setProperty(ho,`${window.innerHeight}px`)},100));var Tt=Et;var po=a(s=>{var i;let t=new Intl.Locale(s),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e},"getLocaleDirection");var pi=a((s,t)=>new Intl.PluralRules(s).select(t),"getPluralForm");var Da=a(s=>s,"DEFAULT_TRANSFORMER"),pr="{{",mo="}}",fo="plural:";function St(s,t,e={}){var n;let{openToken:i=pr,closeToken:r=mo,transform:o=Da}=e;for(let l in t){let c=(n=t[l])==null?void 0:n.toString();s=s.replaceAll(i+l+r,typeof c=="string"?o(c):c)}return s}a(St,"applyTemplateData");function go(s){let t=[],e=s.indexOf(pr);for(;e!==-1;){let i=s.indexOf(mo,e),r=s.substring(e+2,i);if(r.startsWith(fo)){let o=s.substring(e+2,i).replace(fo,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));t.push({variable:r,pluralKey:n,countVariable:l})}e=s.indexOf(pr,i)}return t}a(go,"getPluralObjects");var bo=a(({element:s,attribute:t,onSuccess:e,onTimeout:i,timeout:r=300})=>{let o=s.getAttribute(t);if(o!==null){e(o);return}let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{n.disconnect(),i()},r),c=a(u=>{let p=s.getAttribute(t);u.type==="attributes"&&u.attributeName===t&&p!==null&&(clearTimeout(l),n.disconnect(),e(p))},"handleMutation")},"waitForAttribute");function _o(s){return Object.prototype.toString.call(s)==="[object Object]"}a(_o,"isObject");var Fa=/\W|_/g;function Na(s){return s.split(Fa).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}a(Na,"camelizeString");function yo(s,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(s)?s.map(e=>be(e,{ignoreKeys:t})):s}a(yo,"camelizeArrayItems");function be(s,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(s))return yo(s,{ignoreKeys:t});if(!_o(s))return s;let e={};for(let i of Object.keys(s)){let r=s[i];if(t.includes(i)){e[i]=r;continue}_o(r)?r=be(r,{ignoreKeys:t}):Array.isArray(r)&&(r=yo(r,{ignoreKeys:t})),e[Na(i)]=r}return e}a(be,"camelizeKeys");var Va=a(s=>new Promise(t=>setTimeout(t,s)),"delay");function vr({libraryName:s,libraryVersion:t,userAgent:e,publicKey:i="",integration:r=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:s,libraryVersion:t,languageName:o,integration:r});let n=[s,t,i].filter(Boolean).join("/"),l=[o,r].filter(Boolean).join("; ");return`${n} (${l})`}a(vr,"getUserAgent$1");var Ba={factor:2,time:100};function za(s,t=Ba){let e=0;function i(r){let o=Math.round(t.time*t.factor**e);return r({attempt:e,retry:a(l=>Va(l!=null?l:o).then(()=>(e+=1,i(r))),"retry")})}return a(i,"runAttempt"),i(s)}a(za,"retrier");var Tr=class Tr extends Error{};a(Tr,"UploadcareError");var $t=Tr,mi=class mi extends $t{constructor(e){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,mi.prototype),this.originalProgressEvent=e}};a(mi,"NetworkError");var He=mi,_i=a((s,t)=>{s&&(s.aborted?Promise.resolve().then(t):s.addEventListener("abort",()=>t(),{once:!0}))},"onCancel"),gi=class gi extends $t{constructor(e="Request canceled"){super(e);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,gi.prototype)}};a(gi,"CancelError");var xe=gi,Ha=500,wo=a(({check:s,interval:t=Ha,timeout:e,signal:i})=>new Promise((r,o)=>{let n,l;_i(i,()=>{n&&clearTimeout(n),o(new xe("Poll cancelled"))}),e&&(l=setTimeout(()=>{n&&clearTimeout(n),o(new xe("Timed out"))},e));let c=a(()=>{try{Promise.resolve(s(i)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,t)}).catch(u=>{l&&clearTimeout(l),o(u)})}catch(u){l&&clearTimeout(l),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),S={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"},yi="application/octet-stream",Co="original",Ae=a(({method:s,url:t,data:e,headers:i={},signal:r,onProgress:o})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,t,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",_i(r,()=>{p=!0,c.abort(),l(new xe)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:t,data:e,headers:i||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let C=w.split(": "),v=C.shift(),x=C.join(": ");v&&typeof v!="undefined"&&(m[v]=x)});let g=c.response,b=c.status;n({request:d,data:g,headers:m,status:b})}},c.onerror=d=>{p||l(new He(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),e?c.send(e):c.send()}),"request");function ja(s,...t){return s}a(ja,"identity");var Ga=a(({name:s})=>s?[s]:[],"getFileOptions"),Wa=ja,Xa=a(()=>new FormData,"getFormData"),xo=a(s=>!1,"isBuffer"),vi=a(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),wi=a(s=>typeof File!="undefined"&&s instanceof File,"isFile"),Ci=a(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),je=a(s=>vi(s)||wi(s)||xo()||Ci(s),"isFileData"),qa=a(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Ka=a(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),Za=a(s=>!!s&&typeof s=="object"&&"data"in s&&je(s.data),"isFileValue");function Ao(s,t,e){if(Array.isArray(e))for(let i of e)Ao(s,`${t}[]`,i);else if(Za(e)){let{name:i,contentType:r}=e,o=Wa(e.data,i,r!=null?r:yi),n=Ga({name:i,contentType:r});s.push([t,o,...n])}else if(Ka(e))for(let[i,r]of Object.entries(e))typeof r!="undefined"&&s.push([`${t}[${i}]`,String(r)]);else qa(e)&&e&&s.push([t,e.toString()])}a(Ao,"collectParams");function Ya(s){let t=[];for(let[e,i]of Object.entries(s))Ao(t,e,i);return t}a(Ya,"getFormDataParams");function xi(s){let t=Xa(),e=Ya(s);for(let i of e){let[r,o,...n]=i;t.append(r,o,...n)}return t}a(xi,"buildFormData");var bi=class bi extends $t{constructor(e,i,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,bi.prototype)}};a(bi,"UploadError");var z=bi,Ja=a(s=>{let t=new URLSearchParams;for(let[e,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=>t.set(`${e}[${r[0]}]`,String(r[1]))):Array.isArray(i)?i.forEach(r=>{t.append(`${e}[]`,r)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},"buildSearchParams"),me=a((s,t,e)=>{let i=new URL(s);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Ja(e)),i.toString()},"getUrl"),Qa="6.14.1",el="UploadcareUploadClient",tl=Qa;function ke(s){return vr({libraryName:el,libraryVersion:tl,...s})}a(ke,"getUserAgent");var il="RequestThrottledError",vo=15e3,rl=1e3;function sl(s){let{headers:t}=s||{};if(!t||typeof t["retry-after"]!="string")return vo;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:vo}a(sl,"getTimeoutFromThrottledRequest");function Ee(s,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return za(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===il&&r<e)return o(sl(n));if(n instanceof He&&r<i)return o((r+1)*rl);throw n}))}a(Ee,"retryIfFailed");var Eo=a(s=>{let t="";return(vi(s)||wi(s)||Ci(s))&&(t=s.type),t||yi},"getContentType"),To=a(s=>{let t="";return wi(s)&&s.name?t=s.name:vi(s)||xo()?t="":Ci(s)&&s.name&&(t=s.name),t||Co},"getFileName");function wr(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}a(wr,"getStoreValue");function ol(s,{publicKey:t,fileName:e,contentType:i,baseURL:r=S.baseURL,secureSignature:o,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",url:me(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},data:xi({file:{data:s,name:e||To(s),contentType:i||Eo(s)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:wr(l),signature:o,expire:n,source:p,metadata:b}),signal:c,onProgress:u}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}a(ol,"base");var gr;(function(s){s.Token="token",s.FileInfo="file_info"})(gr||(gr={}));function nl(s,{publicKey:t,baseURL:e=S.baseURL,store:i,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},url:me(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:s,store:wr(i),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:b}),signal:p}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}a(nl,"fromUrl");var X;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(X||(X={}));var al=a(s=>"status"in s&&s.status===X.Error,"isErrorResponse");function ll(s,{publicKey:t,baseURL:e=S.baseURL,signal:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=S.retryNetworkErrorMaxTimes}={}){return Ee(()=>Ae({method:"GET",headers:t?{"X-UC-User-Agent":ke({publicKey:t,integration:r,userAgent:o})}:void 0,url:me(e,"/from_url/status/",{jsonerrors:1,token:s}),signal:i}).then(({data:c,headers:u,request:p})=>{let d=be(JSON.parse(c));if("error"in d&&!al(d))throw new z(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(ll,"fromUrlStatus");function cl(s,{publicKey:t,baseURL:e=S.baseURL,jsonpCallback:i,secureSignature:r,secureExpire:o,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:c,userAgent:u})},url:me(e,"/group/",{jsonerrors:1}),data:xi({files:s,callback:i,pub_key:t,signature:r,expire:o,source:l}),signal:n}).then(({data:f,headers:m,request:g})=>{let b=be(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})}a(cl,"group");function So(s,{publicKey:t,baseURL:e=S.baseURL,signal:i,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"GET",headers:{"X-UC-User-Agent":ke({publicKey:t,integration:o,userAgent:n})},url:me(e,"/info/",{jsonerrors:1,pub_key:t,file_id:s,source:r}),signal:i}).then(({data:u,headers:p,request:d})=>{let f=be(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(So,"info");function ul(s,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:r=S.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return Ee(()=>Ae({method:"POST",url:me(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:d,userAgent:f})},data:xi({filename:i||Co,size:s,content_type:e||yi,part_size:r,UPLOADCARE_STORE:wr(c),UPLOADCARE_PUB_KEY:t,signature:n,expire:l,source:p,metadata:b}),signal:u}).then(({data:w,headers:C,request:v})=>{let x=be(JSON.parse(w));if("error"in x)throw new z(x.error.content,x.error.errorCode,v,x,C);return x.parts=Object.keys(x.parts).map(D=>x.parts[Number(D)]),x}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}a(ul,"multipartStart");function hl(s,t,{contentType:e,signal:i,onProgress:r,retryThrottledRequestMaxTimes:o=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"PUT",url:t,data:s,onProgress:r,signal:i,headers:{"Content-Type":e||yi}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}a(hl,"multipartUpload");function dl(s,{publicKey:t,baseURL:e=S.baseURL,source:i="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return Ee(()=>Ae({method:"POST",url:me(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:t,integration:o,userAgent:n})},data:xi({uuid:s,UPLOADCARE_PUB_KEY:t,source:i}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=be(JSON.parse(u));if("error"in f)throw new z(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(dl,"multipartComplete");function Cr(s,{publicKey:t,baseURL:e,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return wo({check:p=>So(s,{publicKey:t,baseURL:e,signal:p,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}a(Cr,"isReadyPoll");function pl(s){return"defaultEffects"in s}a(pl,"isGroupFileInfo");var Sr=class Sr{constructor(t,{baseCDN:e=S.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}=t,n=me(e,`${r}/`),l=o?me(`https://${o}.s3.amazonaws.com/`,`${r}/${t.filename}`):null;this.uuid=r,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=n,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=o||null,this.s3Url=l,pl(t)&&(this.defaultEffects=t.defaultEffects)}};a(Sr,"UploadcareFile");var ge=Sr,fl=a((s,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>ol(s,{publicKey:t,fileName:e,contentType:l,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:C})=>Cr(C,{publicKey:t,baseURL:i,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(C=>new ge(C,{baseCDN:b})),"uploadDirect"),ml=a((s,{publicKey:t,fileName:e,baseURL:i,signal:r,onProgress:o,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>So(s,{publicKey:t,baseURL:i,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new ge(f,{baseCDN:d,fileName:e})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),gl=a((s,{signal:t}={})=>{let e=null,i=null,r=s.map(()=>new AbortController),o=a(n=>()=>{i=n,r.forEach((l,c)=>c!==n&&l.abort())},"createStopRaceCallback");return _i(t,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,l)=>{let c=o(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(e=u,null))})).then(n=>{if(i===null)throw e;return n[i]})},"race"),bl=window.WebSocket,$r=class $r{constructor(){h(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(r=>r(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}};a($r,"Events");var br=$r,_l=a((s,t)=>s==="success"?{status:X.Success,...t}:s==="progress"?{status:X.Progress,...t}:{status:X.Error,...t},"response"),Ir=class Ir{constructor(t,e=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 br);h(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new bl(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.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,_l(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=a(()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var r;let i=JSON.stringify({event:t,data:e});(r=this.ws)==null||r.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,r={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(r=>r.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}};a(Ir,"Pusher");var _r=Ir,fr=null,xr=a(s=>{if(!fr){let t=typeof window=="undefined"?0:3e4;fr=new _r(s,t)}return fr},"getPusher"),yl=a(s=>{xr(s).connect()},"preconnect");function vl({token:s,publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return wo({check:u=>ll(s,{publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case X.Error:return new z(p.error,p.errorCode);case X.Waiting:return!1;case X.Unknown:return new z(`Token "${s}" was not found.`);case X.Progress:return l&&(p.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:p.done/p.total})),!1;case X.Success:return l&&l({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}a(vl,"pollStrategy");var wl=a(({token:s,pusherKey:t,signal:e,onProgress:i})=>new Promise((r,o)=>{let n=xr(t),l=n.onError(o),c=a(()=>{l(),n.unsubscribe(s)},"destroy");_i(e,()=>{c(),o(new xe("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case X.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case X.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),r(u);break}case X.Error:c(),o(new z(u.msg,u.error_code))}})}),"pushStrategy"),Cl=a((s,{publicKey:t,fileName:e,baseURL:i,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=S.pusherKey,metadata:C})=>Promise.resolve(yl(w)).then(()=>nl(s,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:C})).catch(v=>{let x=xr(w);return x==null||x.disconnect(),Promise.reject(v)}).then(v=>v.type===gr.FileInfo?v:gl([({signal:x})=>vl({token:v.token,publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:x}),({signal:x})=>wl({token:v.token,pusherKey:w,signal:x,onProgress:d})],{signal:p})).then(v=>{if(v instanceof z)throw v;return v}).then(v=>Cr(v.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:p})).then(v=>new ge(v,{baseCDN:r})),"uploadFromUrl"),mr=new WeakMap,xl=a(async s=>{if(mr.has(s))return mr.get(s);let t=await fetch(s.uri).then(e=>e.blob());return mr.set(s,t),t},"getBlobFromReactNativeAsset"),$o=a(async s=>{if(wi(s)||vi(s))return s.size;if(Ci(s))return(await xl(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Al=a((s,t=S.multipartMinFileSize)=>s>=t,"isMultipart"),Io=a(s=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!je(s)&&e.test(s)},"isUuid"),Ar=a(s=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!je(s)&&e.test(s)},"isUrl"),El=a((s,t)=>new Promise((e,i)=>{let r=[],o=!1,n=t.length,l=[...t],c=a(()=>{let u=t.length-l.length,p=l.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():e(r))}).catch(d=>{o=!0,i(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),Tl=a((s,t,e,i)=>{let r=i*t,o=Math.min(r+i,e);return s.slice(r,o)},"sliceChunk"),Sl=a(async(s,t,e)=>i=>Tl(s,i,t,e),"prepareChunks"),$l=a((s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>hl(s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Il=a(async(s,{publicKey:t,fileName:e,fileSize:i,baseURL:r,secureSignature:o,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=S.multipartChunkSize,maxConcurrentRequests:C=S.maxConcurrentRequests,baseCDN:v,metadata:x})=>{let D=i!=null?i:await $o(s),Z,ie=a((F,j)=>{if(!u)return;Z||(Z=Array(F).fill(0));let ee=a(re=>re.reduce((de,ar)=>de+ar,0),"sum");return re=>{re.isComputable&&(Z[j]=re.value,u({isComputable:!0,value:ee(Z)/F}))}},"createProgressHandler");return b||(b=Eo(s)),ul(D,{publicKey:t,contentType:b,fileName:e||To(s),baseURL:r,secureSignature:o,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:x}).then(async({uuid:F,parts:j})=>{let ee=await Sl(s,D,w);return Promise.all([F,El(C,j.map((re,de)=>()=>$l(ee(de),re,{publicKey:t,contentType:b,onProgress:ie(j.length,de),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([F])=>dl(F,{publicKey:t,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(F=>F.isReady?F:Cr(F.uuid,{publicKey:t,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(F=>new ge(F,{baseCDN:v}))},"uploadMultipart");async function Er(s,{publicKey:t,fileName:e,baseURL:i=S.baseURL,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:v=S.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:D,pusherKey:Z,metadata:ie}){if(je(s)){let F=await $o(s);return Al(F,b)?Il(s,{publicKey:t,contentType:g,multipartChunkSize:w,fileSize:F,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ie}):fl(s,{publicKey:t,fileName:e,contentType:g,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ie})}if(Ar(s))return Cl(s,{publicKey:t,fileName:e,baseURL:i,baseCDN:v,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:D,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:Z,metadata:ie});if(Io(s))return ml(s,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${s}" is not supported`)}a(Er,"uploadFile");var kr=class kr{constructor(t,{baseCDN:e=S.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=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((r,o)=>r+o.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(r=>r.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(r=>new ge(r,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}};a(kr,"UploadcareGroup");var yr=kr,kl=a(s=>{for(let t of s)if(!je(t))return!1;return!0},"isFileDataArray"),Ol=a(s=>{for(let t of s)if(!Io(t))return!1;return!0},"isUuidArray"),Ll=a(s=>{for(let t of s)if(!Ar(t))return!1;return!0},"isUrlArray");function ko(s,{publicKey:t,fileName:e,baseURL:i=S.baseURL,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=S.multipartChunkSize,baseCDN:w=S.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:v,jsonpCallback:x}){if(!kl(s)&&!Ll(s)&&!Ol(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let D,Z=!0,ie=s.length,F=a((j,ee)=>{if(!c)return;D||(D=Array(j).fill(0));let re=a(de=>de.reduce((ar,Jn)=>ar+Jn)/j,"normalize");return de=>{if(!de.isComputable||!Z){Z=!1,c({isComputable:!1});return}D[ee]=de.value,c({isComputable:!0,value:re(D)})}},"createProgressHandler");return Promise.all(s.map((j,ee)=>je(j)||Ar(j)?Er(j,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:n,signal:l,onProgress:F(ie,ee),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:v}).then(re=>re.uuid):j)).then(j=>cl(j,{publicKey:t,baseURL:i,jsonpCallback:x,secureSignature:r,secureExpire:o,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(ee=>new yr(ee,{baseCDN:w})).then(ee=>(c&&c({isComputable:!0,value:1}),ee)))}a(ko,"uploadFileGroup");var Or=class Or{constructor(t){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){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(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};a(Or,"Queue");var fi=Or;var Lr=a(()=>({}),"blockCtx"),Ur=a(s=>({...Lr(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),Ai=a(s=>({...Ur(s),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new fi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var It={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-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","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var Ei=new Map,Pr=new Map,Oo=a((s,t)=>{Ei.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Ei.set(s,{...It,...t})},"defineLocaleSync"),Ul=a((s,t)=>{Pr.set(s,t)},"defineLocaleAsync"),Rr=a((s,t)=>{typeof t=="function"?Ul(s,t):Oo(s,t)},"defineLocale"),Lo=a(async s=>{if(!Ei.has(s)){if(!Pr.has(s))throw new Error(`Locale ${s} is not defined`);let e=await Pr.get(s)();Oo(s,e)}return Ei.get(s)},"resolveLocaleDefinition");Rr("en",It);var _e=a(s=>`*l10n/${s}`,"localeStateKey"),Pl="en",Mr=class Mr{constructor(t){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(It))this._blockInstance.add(_e(e),i,!1);setTimeout(()=>{t.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let i=await Lo(e);if(e!==Pl&&this._localeName!==e)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[n,l]of Object.entries(i)){let c=r==null?void 0:r[n];this._blockInstance.add(_e(n),c!=null?c:l,!0);for(let u of this._callbacks)u()}}),t.subConfigValue("localeDefinitionOverride",e=>{var r;if(!e)return;let i=e[this._localeName];if(i)for(let[o,n]of Object.entries(i)){(r=this._blockInstance)==null||r.add(_e(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=P(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var o,n,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(n=(o=this._boundBlocks.get(t))==null?void 0:o.get(e))==null||n();let r=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,r)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};a(Mr,"LocaleManager");var Ti=Mr;function Uo(s,t){[...s.querySelectorAll("[l10n]")].forEach(e=>{let i=e.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;t.has(n)&&t.sub(n,c=>{if(!c)return;t.l10nProcessorSubs.has(n)||t.l10nProcessorSubs.set(n,new Set);let u=t.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),t.allSubs.delete(f)});let p=_e(c).replace("*","");t.nodeCtx.has(p)||t.nodeCtx.add(p,c);let d=t.nodeCtx.sub(p,()=>{e[r]=t.l10n(c)});u==null||u.add(d),t.allSubs.add(d),e.removeAttribute("l10n")});let l=_e(i);t.has(l)||t.add(l,""),t.sub(l,()=>{i=i,o?e.setAttribute(r,t.l10n(i)):e[r]=t.l10n(i)}),e.removeAttribute("l10n")})}a(Uo,"l10nProcessor");var q=a(s=>`*cfg/${s}`,"sharedConfigKey");var Rl={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function kt(s,t){t.tabIndex=0,t.focus(),s.tabIndex=-1}a(kt,"focus");function Dr(s){let t=s.role||s.type||s.tagName;if(!t)return null;let e=Rl[t.toLowerCase()];if(!e)return null;for(let i of e){let r=s.closest(`[role=${i}]`);if(r)return r}}a(Dr,"findGroupNodeByEventTarget");function Fr(s,t){return t.role==="toolbar"?Ml(t):t.querySelectorAll(`[role=${s.role}]`)}a(Fr,"getItems");function Ml(s){return[...s.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}a(Ml,"getToolbarItems");function Dl(s){let t=s.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=s.role;return e==="menubar"||e==="tablist"||e==="toolbar"}a(Dl,"isHorizontalOrientation");function Po(s){return t=>{let e=!1,i=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=Dr(d.target);if(!f){l();return}let m=Fr(d.target,f),g=Array.from(m).indexOf(d.target),b="ArrowDown",w="ArrowUp";if(Dl(f)&&(t.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),d.key===b)d.preventDefault(),kt(d.target,m[g+1]||m[0]);else if(d.key===w)d.preventDefault(),kt(d.target,m[g-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),kt(d.target,m[0]);else if(d.key==="End")d.preventDefault(),kt(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let C=Date.now();C-r<=i?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=C;let v=Array.from(m).find(x=>{var D,Z,ie;return(ie=(Z=(D=x.textContent)==null?void 0:D.trim())==null?void 0:Z.toLowerCase())==null?void 0:ie.startsWith(o)});v&&(d.preventDefault(),kt(d.target,v))}}a(n,"keyDown");function l(){e=!1,t.removeEventListener("keydown",n)}a(l,"stop");function c(d){let f=Dr(d.target);if(f){e||(e=!0,t.addEventListener("keydown",n));let m=Fr(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1)}else e&&l()}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===t.document)&&l()}a(u,"focusOut");function p(d){let f=Dr(d.target);if(f){let m=Fr(d.target,f);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return a(p,"click"),t.addEventListener("click",p),t.addEventListener("focusin",c),t.addEventListener("focusout",u),()=>{l(),t.removeEventListener("click",p),t.removeEventListener("focusin",c),t.removeEventListener("focusout",u)}}}a(Po,"focusGroupKeyUX");function Ro(){return s=>{let t,e;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){t=o.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.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)}}a(i,"jump");function r(o){t&&t.contains(o.target)&&(!o.relatedTarget||!t.contains(o.relatedTarget))&&(o.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return a(r,"focusOut"),s.addEventListener("keyuxJump",i),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",i),s.removeEventListener("focusout",r)}}}a(Ro,"hiddenKeyUX");function Mo(){return s=>{let t=[];function e(u){let p=s.document.activeElement;p&&p!==s.document.body&&t.push(new WeakRef(p)),u.focus({focusVisible:!0})}a(e,"focus");function i(){let u=t.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():i()}a(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})),e(f))}},50))}a(n,"jump");function l(u){u.clientX===0&&u.clientY===0&&n(u.target)}a(l,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&i()}return a(c,"keyDown"),s.addEventListener("click",l),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",l),s.removeEventListener("keydown",c)}}}a(Mo,"jumpKeyUX");function Do(s){let t,e=s.split(" ");function i(){t&&t.classList.remove(...e)}a(i,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(i(),o.target.classList.add(...e),t=o.target)}return a(r,"click"),o=>(o.addEventListener("keyup",i),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",i),o.removeEventListener("click",r)})}a(Do,"pressKeyUX");function Fo(s,t){let e=t.map(i=>i(s));return()=>{e.forEach(i=>i())}}a(Fo,"startKeyUX");var Vr=class Vr{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(t,e){let i=a(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&e(r)},"wrappedListener");this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}};a(Vr,"ScopedMinimalWindow");var Nr=Vr,Br=class Br{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new Nr,this._destroyKeyUX=Fo(this._scopedWindow,[Po(),Do("is-pressed"),Mo(),Ro()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};a(Br,"A11y");var Si=Br;var Fl="uc-",Ot=class Ot extends Ie{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",Lr());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Uo)}l10n(e,i={}){if(!e)return"";let r=this.$[_e(e)]||e,o=go(r);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return St(r,i)}pluralize(e,i){let r=this.l10n("locale-id")||"en",o=pi(r,i);return this.l10n(`${e}__${o}`)}bindL10n(e,i){var r;(r=this.localeManager)==null||r.bindL10n(this,e,i)}emit(e,i,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(e,i,r)}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?bo({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),Tt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Tt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new di(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ti(this)),this.has("*a11y")||this.add("*a11y",new Si),this.sub(_e("locale-id"),i=>{let r=po(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;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;T.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:ui(e),cdnUrlModifiers:hr(e),fileName:ci(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?St(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(i,r,o)=>{if(typeof r!="string")return!1;let n=q(r);return this.has(n)||this.add(n,te[r]),this.$[n]=o,!0},get:(i,r)=>{let o=q(r);return this.has(o)||this.add(o,te[r]),this.$[q(r)]}})}return this.__cfgProxy}subConfigValue(e,i){let r=q(e);this.has(r)||this.add(r,te[e]),this.sub(r,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let r=e[0];i=r()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(Fl)&&super.reg(e)}};a(Ot,"Block"),h(Ot,"StateConsumerScope",null),h(Ot,"styleAttrs",[]);var y=Ot;var No="<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 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-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 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var $i=class $i extends y{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Ai(this));h(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=No+e+"<slot></slot>"}static get template(){return this._template}};a($i,"SolutionBlock"),h($i,"styleAttrs",["uc-wgt-common"]);var oe=$i;var Vo="active",Lt="___ACTIVITY_IS_ACTIVE___",ne=class ne extends y{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Ur(this));h(this,"_debouncedHistoryFlush",P(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=ne._activityCallbacks.get(this);this[Lt]=!1,this.removeAttribute(Vo),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=ne._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Lt]=!0,this.setAttribute(Vo,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",e=>{this.setAttribute("current-activity",e)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Lt]?this._deactivate():this.activityType===e&&!this[Lt]&&this._activate()}catch(r){console.error(`Error in activity "${this.activityType}". `,r),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",e=>{!e&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&ne._activityCallbacks.has(this)}get isActivityActive(){return this[Lt]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:r,onDeactivate:o}=i;ne._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ne._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof ne&&r.activityType===e)||(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 e=this.$["*history"];if(e){let r=e.pop();for(;r===this.activityType;)r=e.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(l=>l.activityType===r);o=(i=n==null?void 0:n.couldOpenActivity)!=null?i:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=e,r||this.setOrAddState("*modalActive",!1)}}};a(ne,"ActivityBlock"),h(ne,"_activityCallbacks",new Map);var _=ne;_.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"});var Ut=33.333333333333336,A=1,zr=24,Bo=6;function Oe(s,t){for(let e in t)s.setAttributeNS(null,e,t[e].toString())}a(Oe,"setSvgNodeAttrs");function Y(s,t={}){let e=document.createElementNS("http://www.w3.org/2000/svg",s);return Oe(e,t),e}a(Y,"createSvgNode");function zo(s,t,e){let{x:i,y:r,width:o,height:n}=s,l=t.includes("w")?0:1,c=t.includes("n")?0:1,u=[-1,1][l],p=[-1,1][c],d=[i+l*o+1.5*u,r+c*n+1.5*p-24*e*p],f=[i+l*o+1.5*u,r+c*n+1.5*p],m=[i+l*o-24*e*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}}a(zo,"cornerPath");function Ho(s,t,e){let{x:i,y:r,width:o,height:n}=s,l=["n","s"].includes(t)?.5:{w:0,e:1}[t],c=["w","e"].includes(t)?.5:{n:0,s:1}[t],u=[-1,1][l],p=[-1,1][c],d,f;["n","s"].includes(t)?(d=[i+l*o-34*e/2,r+c*n+1.5*p],f=[i+l*o+34*e/2,r+c*n+1.5*p]):(d=[i+l*o+1.5*u,r+c*n-34*e/2],f=[i+l*o+1.5*u,r+c*n+34*e/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}}a(Ho,"sidePath");function jo(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}a(jo,"thumbCursor");function Go({rect:s,delta:[t,e],imageBox:i}){return We({...s,x:s.x+t,y:s.y+e},i)}a(Go,"moveRect");function We(s,t){let{x:e}=s,{y:i}=s;return s.x<t.x?e=t.x:s.x+s.width>t.x+t.width&&(e=t.x+t.width-s.width),s.y<t.y?i=t.y:s.y+s.height>t.y+t.height&&(i=t.y+t.height-s.height),{...s,x:e,y:i}}a(We,"constraintRect");function Nl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:n,height:l}=s;o+=r,l-=r,e&&(n=l*e);let c=s.x+s.width/2-n/2;return o<=i.y&&(o=i.y,l=s.y+s.height-o,e&&(n=l*e,c=s.x+s.width/2-n/2)),c<=i.x&&(c=i.x,o=s.y+s.height-l),c+n>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-c,e&&(l=n/e),o=s.y+s.height-l),l<A&&(l=A,e&&(n=l*e,c=s.x+s.width/2-n/2),o=s.y+s.height-l),n<A&&(n=A,e&&(l=n/e,c=s.x+s.width/2-n/2),o=s.y+s.height-l),{x:c,y:o,width:n,height:l}}a(Nl,"resizeNorth");function Vl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:n,height:l}=s;o+=r,n-=r,e&&(l=n/e);let c=s.y+s.height/2-l/2;return o<=i.x&&(o=i.x,n=s.x+s.width-o,e&&(l=n/e,c=s.y+s.height/2-l/2)),c<=i.y&&(c=i.y,o=s.x+s.width-n),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(n=l*e),o=s.x+s.width-n),l<A&&(l=A,e&&(n=l*e),c=s.y+s.height/2-l/2,o=s.x+s.width-n),n<A&&(n=A,e&&(l=n/e),c=s.y+s.height/2-l/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:l}}a(Vl,"resizeWest");function Bl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:n,height:l}=s;l+=r,e&&(n=l*e);let c=s.x+s.width/2-n/2;return o+l>=i.y+i.height&&(l=i.y+i.height-o,e&&(n=l*e),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,e&&(l=n/e),o=s.y),l<A&&(l=A,e&&(n=l*e),c=s.x+s.width/2-n/2),n<A&&(n=A,e&&(l=n/e),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:l}}a(Bl,"resizeSouth");function zl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:n,height:l}=s;n+=r,e&&(l=n/e);let c=s.y+s.height/2-l/2;return o+n>=i.x+i.width&&(n=i.x+i.width-o,e&&(l=n/e),c=s.y+s.height/2-l/2),c<=i.y&&(c=i.y,o=s.x),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(n=l*e),o=s.x),l<A&&(l=A,e&&(n=l*e),c=s.y+s.height/2-l/2),n<A&&(n=A,e&&(l=n/e),c=s.y+s.height/2-l/2),{x:o,y:c,width:n,height:l}}a(zl,"resizeEast");function Hl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),l+o<i.y&&(o=i.y-l),n+=r,c-=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,n=s.x+s.width-c,l=i.y)):e&&(r=u*e-c,c=c+r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/e,n=i.x,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),n=s.x+s.width-c,l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),n=s.x+s.width-c,l=s.y+s.height-u),{x:n,y:l,width:c,height:u}}a(Hl,"resizeNorthWest");function jl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),l+o<i.y&&(o=i.y-l),c+=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,n=s.x,l=i.y)):e&&(r=u*e-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/e,n=i.x+i.width-c,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),l=s.y+s.height-u),{x:n,y:l,width:c,height:u}}a(jl,"resizeNorthEast");function Gl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+r<i.x&&(r=i.x-n),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),n+=r,c-=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,n=s.x+s.width-c,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,n-=r,n<=i.x&&(c=c-(i.x-n),u=c/e,n=i.x,l=s.y)),u<A&&(u=A,e&&(c=u*e),n=s.x+s.width-c),c<A&&(c=A,e&&(u=c/e),n=s.x+s.width-c),{x:n,y:l,width:c,height:u}}a(Gl,"resizeSouthWest");function Wl({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:n,y:l,width:c,height:u}=s;return n+c+r>i.x+i.width&&(r=i.x+i.width-n-c),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),c+=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,n=s.x,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,n+c>=i.x+i.width&&(c=i.x+i.width-n,u=c/e,n=i.x+i.width-c,l=s.y)),u<A&&(u=A,e&&(c=u*e)),c<A&&(c=A,e&&(u=c/e)),{x:n,y:l,width:c,height:u}}a(Wl,"resizeSouthEast");function Wo({direction:s,...t}){switch(s){case"n":return Nl(t);case"w":return Vl(t);case"s":return Bl(t);case"e":return zl(t);case"nw":return Hl(t);case"ne":return jl(t);case"sw":return Gl(t);case"se":return Wl(t);default:return t.rect}}a(Wo,"resizeRect");function Xo(s,[t,e]){return s.x<=t&&t<=s.x+s.width&&s.y<=e&&e<=s.y+s.height}a(Xo,"rectContainsPoint");function qo(s,t){return s.x>=t.x&&s.y>=t.y&&s.x+s.width<=t.x+t.width&&s.y+s.height<=t.y+t.height}a(qo,"isRectInsideRect");function Ko(s,t){return Math.abs(s.width/s.height-t)<.1}a(Ko,"isRectMatchesAspectRatio");function Xe({width:s,height:t},e){let i=e/90%2!==0;return{width:i?t:s,height:i?s:t}}a(Xe,"rotateSize");function Zo(s,t,e){let i=s/t,r,o;i>e?(r=Math.round(t*e),o=t):(r=s,o=Math.round(s/e));let n=Math.round((s-r)/2),l=Math.round((t-o)/2);return n+r>s&&(r=s-n),l+o>t&&(o=t-l),{x:n,y:l,width:r,height:o}}a(Zo,"calculateMaxCenteredCropFrame");function qe(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}a(qe,"roundRect");function Te(s,t,e){return Math.min(Math.max(s,t),e)}a(Te,"clamp");var ki=a(s=>{if(!s)return[];let[t,e]=s.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:t,height:e}]},"parseCropPreset");var Le="blocks",Ue="1.11.2";function Yo(s){return vr({...s,libraryName:Le,libraryVersion:Ue})}a(Yo,"customUserAgent");var Jo=a(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Qo=a((s,{threshold:t})=>{let{secureExpire:e}=s,i=Jo(Date.now()),r=Number(e),o=Jo(t);return i+o>=r},"isSecureTokenExpired");var Hr=class Hr{constructor(t){h(this,"_block");h(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Qo(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 t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};a(Hr,"SecureUploadsManager");var Oi=Hr;var en="[Typed State] Wrong property name: ",Xl="[Typed State] Wrong property type: ",jr=class jr{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||$e.generate(),this.__schema=Object.keys(t).reduce((i,r)=>(i[r]=t[r].value,i),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(en+t);return}let i=this.__typedSchema[t];if((e==null?void 0:e.constructor)===i.type||e instanceof i.type||i.nullable&&e===null){this.__data.pub(t,e);return}console.warn(Xl+t)}setMultipleValues(t){for(let e in t)this.setValue(e,t[e])}getValue(t){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(en+t);return}return this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){T.deleteCtx(this.__ctxId)}};a(jr,"TypedData");var Li=jr;var Gr=class Gr{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||$e.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=t.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 e=Object.create(null);this.__notifyObservers=(i,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(o=>{o({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new Li(this.__typedSchema);for(let i in t)e.setValue(i,t[i]);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){return this.read(t).getValue(e)}publishProp(t,e,i){this.read(t).setValue(e,i)}remove(t){this.__removed.add(this.__data.read(t)),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let r=this.read(i);t(r)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};a(Gr,"TypedCollection");var Ui=Gr;var Pe=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),U=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Pe});var Pt=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Pi=a(s=>s?s.filter(t=>typeof t=="string").map(t=>B(t)).flat():[],"mergeFileTypes"),Wr=a((s,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),s.startsWith(e)):s===e),"matchMimeType"),tn=a((s,t)=>t.some(e=>e.startsWith(".")?s.toLowerCase().endsWith(e.toLowerCase()):!1),"matchExtension"),rn=a(s=>{let t=s==null?void 0:s.type;return t?Wr(t,Pt):!1},"fileIsImage");var ql=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Kl=new RegExp(`^/?(${ql.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),sn=a(({url:s,cdnBase:t})=>{let e=new URL(t),i=new URL(s);if(e.host!==i.host)return null;let[,r,o,n]=Kl.exec(i.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var on=a(s=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let r=s(...e);return t.set(i,r),r}},"memoize");var nn=new Set;function an(s){nn.has(s)||(nn.add(s),console.warn(s))}a(an,"warnOnce");function Zl(s){let t=!1;return setTimeout(()=>{t=!0},0),a(i=>(...r)=>(t&&an(s),i(...r)),"withAssert")}a(Zl,"createAsyncAssertWrapper");function ln(s){let t={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>e.failedEntries.length,successCount:()=>e.successEntries.length,uploadingCount:()=>e.uploadingEntries.length,status:()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle",isSuccess:()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,isUploading:()=>e.allEntries.some(r=>r.status==="uploading"),isFailed:()=>e.errors.length>0||e.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>e.allEntries.filter(r=>r.status==="success"),failedEntries:()=>e.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>e.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>e.allEntries.filter(r=>r.status==="idle")},e={},i=Zl("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(t)){let n=r,c=on(i(o));Object.defineProperty(e,n,{get:c,enumerable:!0})}return e}a(ln,"buildOutputCollectionState");var Xr=class Xr{constructor(t){h(this,"_ctx");h(this,"addFileFromUrl",a((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",a((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",a((t,{silent:e,fileName:i,source:r}={})=>{var l;let o=sn({url:t,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:t,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=i!=null?i:o.filename)!=null?l:null,silent:e!=null?e:!1,source:r!=null?r:U.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",a((t,{silent:e,fileName:i,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:t,isImage:rn(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:r!=null?r:U.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",a(t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)},"removeFileByInternalId"));h(this,"uploadAll",a(()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",a((t={})=>{var o;let e=ze(Pi([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Pt:[]]));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="uploadcare-file-input",r=document.createElement("input");r.setAttribute(i,""),At(r,{opacity:0,height:0,width:0,visibility:"hidden"}),r.type="file",r.multiple=this.cfg.multiple,t.captureCamera?(r.capture=this.cfg.cameraCapture,r.accept=this.cfg.enableVideoRecording?["image/*","video/*"].join(","):"image/*"):r.accept=e,r.addEventListener("change",()=>{r.files&&([...r.files].forEach(n=>this.addFileFromObject(n,{source:t.captureCamera?U.CAMERA:U.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",a(t=>{var n,l,c,u,p,d,f,m,g,b;let e=T.getCtx(t).store,i=e.fileInfo,r=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(n=i==null?void 0:i.uuid)!=null?n:e.uuid)!=null?l:null,internalId:t,name:(c=i==null?void 0:i.originalFilename)!=null?c:e.fileName,size:(u=i==null?void 0:i.size)!=null?u:e.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:e.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(b=(g=e.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:e.errors,status:r,source:e==null?void 0:e.source}},"getOutputItem"));h(this,"getOutputCollectionState",a(()=>ln(this._ctx),"getOutputCollectionState"));h(this,"initFlow",a((t=!1)=>{var e;if(this._uploadCollection.size>0&&!t)this._ctx.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((e=this._sourceList)==null?void 0:e.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=a(l=>"type"in l&&l.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",a(()=>{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",a((t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)},"setCurrentActivity"));h(this,"getCurrentActivity",a(()=>this._ctx.$["*currentActivity"],"getCurrentActivity"));h(this,"setModalState",a(t=>{if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",t)},"setModalState"));this._ctx=t}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 t=[];return this.cfg.sourceList&&(t=B(this.cfg.sourceList)),t}};a(Xr,"UploaderPublicApi");var Ri=Xr;var qr=a((s,t)=>{let e=t.cfg.imgOnly,i=s.isImage;if(!(!e||i)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Kr=a((s,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,r=Pi([...e?Pt:[],i]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let l=Wr(o,r),c=tn(n,r);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var le=1e3,Re=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Rt=a(s=>Math.ceil(s*100)/100,"round"),cn=a((s,t=Re.AUTO)=>{let e=t===Re.AUTO;if(t===Re.BYTE||e&&s<le**1){let i=pi("en-US",s),r={one:"byte",other:"bytes"}[i];return`${s} ${r}`}return t===Re.KB||e&&s<le**2?`${Rt(s/le**1)} KB`:t===Re.MB||e&&s<le**3?`${Rt(s/le**2)} MB`:t===Re.GB||e&&s<le**4?`${Rt(s/le**3)} GB`:t===Re.TB||e&&s<le**5?`${Rt(s/le**4)} TB`:`${Rt(s/le**5)} PB`},"prettyBytes");var Zr=a((s,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=s.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:cn(e)}),payload:{entry:s}}},"validateMaxSizeLimit");var Yr=a((s,t)=>{let{internalId:e}=s,i=t._uploadCollection.read(e),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 He)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 Jr=a((s,t)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Qr=a((s,t)=>{let e=s.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,r=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:r,total:e}),payload:{total:e,min:i,max:r}};if(r&&e>r)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:r,total:e}),payload:{total:e,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."},es=class es{constructor(t){h(this,"_blockInstance");h(this,"_fileValidators",[qr,Kr,Zr,Yr]);h(this,"_collectionValidators",[Qr,Jr]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=a(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let r=this._uploadCollection.read(i);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=i(t,this._blockInstance.api);if(!r)continue;r&&(e.push(r),r.message||console.warn(Mi.message))}catch(r){console.warn(Mi.collection,r)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(I.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(e,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Mi.message))}catch(o){console.warn(Mi.file,o)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let r=e(...i);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};a(es,"ValidationManager");var Di=es;var un=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:ge,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 Fi=class Fi extends _{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",Ai(this));h(this,"_flushOutputItems",P(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));h(this,"_handleCollectionUpdate",a((e,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(I.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(I.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=e.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",a(e=>{this._flushOutputItems();let i=this.uploadCollection,r=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:n,silent:l}=T.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(e.errors){for(let l of e.errors){let{errors:c}=T.getCtx(l).store;c.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(l=>!!l.getValue("fileInfo")),n=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&n.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(n=>{var l;return!!((l=this.uploadCollection.read(n))!=null&&l.getValue("cdnUrl"))}).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",a(()=>{let e=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");e+=l});let o=r.length?Math.round(e/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof Fi?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ui({typedSchema:un,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new Ri(this)),this.has("*validationManager")||this.add("*validationManager",new Di(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 e,i;(e=this._unobserveCollectionProperties)==null||e.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",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Oi(this)),this.has("*modalActive")&&this.sub("*modalActive",e=>{e&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(e){let i=await this.getUploadClientOptions(),r=e.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await ko(r,{...i,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let e=ki(this.cfg.cropPreset);if(e){let[i]=e,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:l,height:c}=n.imageInfo,u=i.width/i.height,p=Zo(l,c,u),d=V(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:R(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===_.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let r=this.api.getOutputItem(e);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:Yo,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))}};a(Fi,"UploaderBlock");var $=Fi;$.extSrcList=Object.freeze({...Pe});$.sourceTypes=Object.freeze({...U});var Ke=a(s=>{var t;return(t=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:t.map(e=>e.toLowerCase()).join("-")},"toKebabCase");var M=a(s=>String(s),"asString"),J=a(s=>{let t=Number(s);if(Number.isNaN(t))throw new Error(`Invalid number: "${s}"`);return t},"asNumber"),k=a(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"),Yl=a(s=>s==="auto"?s:k(s),"asStore"),Jl=a(s=>{let t=M(s);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid "cameraCapture" value: "${t}"`);return t},"asCameraCapture"),Ql=a(s=>{let t=M(s);if(t!=="photo"&&t!=="video")throw new Error(`Invalid "CameraTab" value: "${t}"`);return t},"asCameraTab"),ec=a(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"),hn=a(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),ts=a(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),dn=a(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),tc={pubkey:M,multiple:k,multipleMin:J,multipleMax:J,confirmUpload:k,imgOnly:k,accept:M,externalSourcesPreferredTypes:M,store:Yl,cameraMirror:k,cameraCapture:Jl,sourceList:M,maxLocalFileSizeBytes:J,thumbSize:J,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:M,removeCopyright:k,cropPreset:M,imageShrink:M,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:M,cdnCname:M,baseUrl:M,socialBaseUrl:M,secureSignature:M,secureExpire:M,secureDeliveryProxy:M,retryThrottledRequestMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:M,debug:k,localeName:M,metadata:ec,secureUploadsExpireThreshold:J,localeDefinitionOverride:hn,secureUploadsSignatureResolver:ts,secureDeliveryProxyUrlResolver:ts,iconHrefResolver:ts,fileValidators:dn,collectionValidators:dn,defaultCameraMode:Ql,enableAudioRecording:k,enableVideoRecording:k,mediaRecorerOptions:hn,maxVideoRecordingDuration:J},pn=a((s,t)=>{if(!(typeof t=="undefined"||t===null))try{return tc[s](t)}catch(e){return console.error(`Invalid value for config key "${s}".`,e),te[s]}},"normalizeConfigValue");var is=[...new Set(["debug",...Object.keys(te)])],ic=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorerOptions"],rc=a(s=>ic.includes(s),"isComplexKey"),Ze=is.filter(s=>!rc(s)),sc={...Object.fromEntries(Ze.map(s=>[Ke(s),s])),...Object.fromEntries(Ze.map(s=>[s.toLowerCase(),s]))},oc={...Object.fromEntries(Ze.map(s=>[Ke(s),q(s)])),...Object.fromEntries(Ze.map(s=>[s.toLowerCase(),q(s)]))},fn=a(s=>"__"+s,"getLocalPropName"),rs=class rs extends y{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(te).map(([e,i])=>[q(e),i]))}}_flushValueToAttribute(e,i){if(Ze.includes(e)){let r=[...new Set([Ke(e),e.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(e,i){this.$[q(e)]!==i&&(typeof i=="undefined"||i===null?this.$[q(e)]=te[e]:this.$[q(e)]=i)}_setValue(e,i){let r=this,o=pn(e,i),n=fn(e);r[n]!==o&&(this._assertSameValueDifferentReference(e,r[n],o),r[n]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o))}_getValue(e){let i=this,r=fn(e);return i[r]}_assertSameValueDifferentReference(e,i,r){this.cfg.debug&&r!==i&&typeof r=="object"&&typeof i=="object"&&JSON.stringify(r)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" 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] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,r))}initCallback(){var i;super.initCallback();let e=this;for(let r of Ze)this.sub(q(r),o=>{this._setValue(r,o)},!1);for(let r of is){let o=(i=e[r])!=null?i:this.$[q(r)];o!==te[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(e,i,r){if(i===r)return;let o=this,n=sc[e];o[n]=r}};a(rs,"ConfigClass");var Mt=rs;Mt.bindAttributes(oc);for(let s of is)Mt.prototype[s]=void 0;var mn=Mt;var ss=class ss extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let r=i(t);e=r!=null?r:e}this.$.href=e})})}};a(ss,"Icon");var Ye=ss;Ye.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Ye.bindAttributes({name:"name"});var gn=a(s=>[...new Set(s)],"uniqueArray");var bn=a(s=>Object.entries(s).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`),"parseObjectToString");var nc="https://ucarecdn.com",Dt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:nc},"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 Je="--uc-img-",os="unresolved";var ns=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),as=3e3,ls=5e3,cs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var yn=Object.create(null),_n;for(let s in Dt)yn[Je+s]=((_n=Dt[s])==null?void 0:_n.default)||"";var us=class us extends Ie{constructor(){super(...arguments);h(this,"cssInit$",yn)}$$(e){return this.$[Je+e]}set$$(e){for(let i in e)this.$[Je+i]=e[i]}sub$$(e,i){this.sub(Je+e,r=>{r===null||r===""||i(r)})}analyticsParams(){return`-/@clib/${Le}/${Ue}/uc-img/`}initAttributes(e){[...this.attributes].forEach(i=>{Dt[i.name]||e.setAttribute(i.name,i.value)})}initIntersection(e,i){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(i(),this._isnObserver.unobserve(e))})},r),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Dt)}attributeChangedCallback(e,i,r){window.setTimeout(()=>{this.$[Je+e]=r})}};a(us,"ImgConfig");var Ni=us;var hs=class hs extends Ni{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!ns&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let i=e.match(/\d+/)[0],r=e.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>ls&&this.hasFormatJPG)return ls+r;if(Number(o)>as&&!this.hasFormatJPG)return as+r}return e}_getCdnModifiers(e,i){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return V(...bn(r))}_getUrlBase(e="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(ns&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(e,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return R(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(R(we(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(R(we(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(R(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(R(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?St(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:r=>window.encodeURIComponent(r)}):e}_getElSize(e,i=1,r=!0){let o=e.getBoundingClientRect(),n=i*Math.round(o.width),l=r?"":i*Math.round(o.height);return n||l?`${n||""}x${l||""}`:null}_setupEventProxy(e){let i=a(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)e.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:cs.PREVIEW,img:this._imgPreview}:{type:cs.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=B(this.$$("breakpoints"));return gn(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let r=`image-set(${[...i].join(", ")})`;e.style.setProperty("background-image",r),e.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{e.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:i,srcset:r}){i&&(e.src=i),r&&(e.srcset=r)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:i,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(os,""),r.addEventListener("load",()=>{r.removeAttribute(os),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:e,srcset:i})})}async renderImage(){var e,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((e=this._imgPreview)==null?void 0:e.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()}};a(hs,"ImgBase");var zi=hs;var ds=class ds extends zi{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager")})}};a(ds,"Img");var Hi=ds;var Qe=class Qe extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e!="undefined"&&(this.$.withDropZone=k(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};a(Qe,"SimpleBtn"),h(Qe,"styleAttrs",[...G(Qe,Qe,"styleAttrs"),"uc-simple-btn"]);var et=Qe;et.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>`;et.bindAttributes({dropzone:null});var ps=class ps extends _{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};a(ps,"StartFrom");var Ft=ps;Ft.template='<div class="uc-content"><slot></slot></div>';function ac(s){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=a(r=>{r.type!=="loadend"&&e.abort(),t(!1)},"onLoad");e.onloadend=i,e.onprogress=i,e.readAsDataURL(s)}catch{t(!1)}})}a(ac,"checkIsDirectory");function lc(s,t){return new Promise(e=>{let i=0,r=[],o=a(l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(c=>{i--;let u=new File([c],c.name,{type:c.type||t});r.push({type:"file",file:u,fullPath:l.fullPath}),i===0&&e(r)})):l.isDirectory&&n(l.createReader())},"readEntry"),n=a(l=>{i++,l.readEntries(c=>{i--;for(let u of c)o(u);i===0&&e(r)})},"readReaderContent");o(s)})}a(lc,"readEntryContentAsync");function vn(s){let t=[],e=[];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 l=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();e.push(lc(l,o).then(c=>{c&&t.push(...c)}));continue}let n=r.getAsFile();n&&e.push(ac(n).then(l=>{l||t.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&e.push(new Promise(o=>{r.getAsString(n=>{t.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(e).then(()=>t)}a(vn,"getDropItems");var H={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},wn=["focus"],cc=100,fs=new Map;function uc(s,t){let e=Math.max(Math.min(s[0],t.x+t.width),t.x),i=Math.max(Math.min(s[1],t.y+t.height),t.y);return Math.sqrt((s[0]-e)*(s[0]-e)+(s[1]-i)*(s[1]-i))}a(uc,"distance");function ms(s){let t=0,e=document.body,i=new Set,r=a(g=>i.add(g),"handleSwitch"),o=H.INACTIVE,n=a(g=>{s.shouldIgnore()&&g!==H.INACTIVE||(o!==g&&i.forEach(b=>b(g)),o=g)},"setState"),l=a(()=>t>0,"isDragging");r(g=>s.onChange(g));let c=a(()=>{t=0,n(H.INACTIVE)},"onResetEvent"),u=a(()=>{t+=1,o===H.INACTIVE&&n(H.ACTIVE)},"onDragEnter"),p=a(()=>{t-=1,l()||n(H.INACTIVE)},"onDragLeave"),d=a(g=>{g.preventDefault(),t=0,n(H.INACTIVE)},"onDrop"),f=a(g=>{if(s.shouldIgnore())return;l()||(t+=1);let b=[g.x,g.y],w=s.element.getBoundingClientRect(),C=Math.floor(uc(b,w)),v=C<cc,x=g.composedPath().includes(s.element);fs.set(s.element,C);let D=Math.min(...fs.values())===C;x&&D?(g.preventDefault(),n(H.OVER)):n(v&&D?H.NEAR:H.ACTIVE)},"onDragOver"),m=a(async g=>{if(s.shouldIgnore())return;g.preventDefault();let b=await vn(g.dataTransfer);s.onItems(b),n(H.INACTIVE)},"onElementDrop");return e.addEventListener("drop",d),e.addEventListener("dragleave",p),e.addEventListener("dragenter",u),e.addEventListener("dragover",f),s.element.addEventListener("drop",m),wn.forEach(g=>{window.addEventListener(g,c)}),()=>{fs.delete(s.element),e.removeEventListener("drop",d),e.removeEventListener("dragleave",p),e.removeEventListener("dragenter",u),e.removeEventListener("dragover",f),s.element.removeEventListener("drop",m),wn.forEach(g=>{window.removeEventListener(g,c)})}}a(ms,"addDropzone");var Cn="uc-drop-area",tt=`${Cn}/registry`,it=class it extends ${constructor(){super(),this.init$={...this.init$,state:H.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[tt]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return e&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[tt]||(this.$[tt]=new Set),this.$[tt].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!k(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:k(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:k(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:k(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=ms({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this.$.state=e},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:U.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:U.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=ms({element:t,onChange:e=>{var r;let i=(r=Object.entries(H).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&t.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",e=>{var r;let i=(r=Object.entries(H).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=B(e);this.$.isEnabled=i.includes(U.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{e.type==="keydown"?(e.code==="Space"||e.code==="Enter")&&this.api.openSystemDialog():e.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.$[tt]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[tt];t&&(t.delete(this),t.size===0&&T.deleteCtx(Cn)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};a(it,"DropArea"),h(it,"styleAttrs",[...G(it,it,"styleAttrs"),"uc-drop-area"]);var rt=it;rt.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>`;rt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var hc="src-type-",gs=class gs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:U.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:U.URL,activity:_.activities.URL,textKey:"from-url"}),this.registerType({type:U.CAMERA,activity:_.activities.CAMERA,activate:()=>{let e="capture"in document.createElement("input");return e&&this.api.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:_.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(Pe))this.registerType({type:e,activity:_.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type],{activity:i,activate:r,activityParams:o={}}=e;(r?r():!!i)&&this.set$({"*currentActivityParams":o,"*currentActivity":i})}applyType(e){let i=this._registeredTypes[e];if(!i){console.warn("Unsupported source type: "+e);return}let{textKey:r=e,icon:o=e}=i;this.$["src-type"]=`${hc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};a(gs,"SourceBtn");var st=gs;st.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;st.bindAttributes({type:null});var bs=class bs extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{let e=B(t),i="";e.forEach(r=>{i+=`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};a(bs,"SourceList");var ji=bs;var Wi=a(()=>{let s=[];return{stack:s,promiseReadJpegChunks:a(e=>new Promise((i,r)=>{let o=2,n=a((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"),l=a(()=>n(e.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=a(()=>{let u=o;return n(e.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(e.slice(o,o+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:m}),l()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(e.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),dc=a(async s=>{let t=[],{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s),i.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&t.push(o)}),t},"getIccProfile"),An=a(async(s,t,e)=>{{let i=[],r=[],{promiseReadJpegChunks:o,stack:n}=Wi();await o(s),n.forEach(u=>{if(u.marker===t)return i.push(u.startPos),r.push(u.length)});let l=[s.slice(0,2)];for(let u of e){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+t),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&l.push(s.slice(c,i[u])),c=i[u]+r[u]+4;return l.push(s.slice(c,s.size)),new Blob(l,{type:s.type})}},"replaceJpegChunk"),pc=226,En=a((s,t)=>An(s,pc,t.map(e=>e.buffer)),"replaceIccProfile"),fc=a(async s=>{try{return await En(s,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},"stripIccProfile"),mc=a((s,t,e)=>new Promise((i,r)=>{let o=a(n=>{if(!n){r("Failed to convert canvas to blob");return}i(n)},"callback");s.toBlob(o,t,e),s.width=s.height=1}),"canvasToBlob"),Nt=a(()=>{let s=document.createElement("canvas"),t=s.getContext("2d");return{canvas:s,ctx:t}},"createCanvas"),gc=a(s=>{let{ctx:e,canvas:i}=Nt();i.width=i.height=50,e.drawImage(s,0,0,50,50);let r=e.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"),bc=a(async s=>{let t=null,{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s),i.forEach(({marker:r,view:o})=>{if(!t&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){t=o;return}}),t},"getExif"),_c="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Gi,yc=a(()=>new Promise(s=>{if(Gi!==void 0)s(Gi);else{let t=new Image;t.addEventListener("load",()=>{Gi=t.naturalWidth<t.naturalHeight,t.src="//:0",s(Gi)}),t.src=_c}}),"isBrowserApplyExifOrientation"),vc=a((s,t)=>{let e,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(e=0,o=n;o>=0?e<o:e>o;o>=0?++e:--e){if(s.byteLength<r+10)return;s.getUint16(r,i)===274&&t(r+8,i),r+=12}},"findExifOrientation"),wc=a((s,t)=>{vc(s,(e,i)=>s.setUint16(e,t,i))},"setExifOrientation"),Cc=a(async(s,t,e)=>(e&&wc(t,1),An(s,225,[t.buffer])),"replaceExif"),xc=a((s,t)=>new Promise((e,i)=>{t&&(s.src=t),s.complete?e(s):(s.addEventListener("load",()=>{e(s)}),s.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),Ac=a(s=>xc(new Image,s),"imageLoader"),Ec=[1,3],Tc=[192,193,194,195,197,198,199,201,202,203,205,206,207],xn={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Sc=a(async s=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=Wi();return await e(s).then(()=>(i.forEach(({marker:r,view:o})=>{if(!t&&Tc.indexOf(r)>=0){let n=o.getUint8(5);Ec.indexOf(n)<0&&(t=!0)}}),t)).catch(()=>t)},"shouldSkipShrink"),Tn=a((s,t)=>{let e={};return(...i)=>{let r=t(i,e);return r in e?e[r]:e[r]=s(...i)}},"memoize"),Sn=a((s,t)=>{let[e]=s,i=Object.keys(t).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<i.length;r++){let o=i[r],n=!!t[o];if(o>e&&n||o<e&&!n)return o}return e},"memoKeySerializer"),Se={R:55,G:110,B:165,A:255},$c=`rgba(${Se.R}, ${Se.G}, ${Se.B}, ${Se.A/255})`,$n=a((s,t)=>{try{let e=[s-1,t-1,1,1],{canvas:i,ctx:r}=Nt();i.width=1,i.height=1;let{canvas:o,ctx:n}=Nt();o.width=s,o.height=t,n&&(n.fillStyle=$c,n.fillRect(...e),r.drawImage(o,s-1,t-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Se.R&&l[1]===Se.G&&l[2]===Se.B&&l[3]===Se.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${t}.`),!1}},"canvasTest");function In(s){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=s(...t);e(i)},0)})}a(In,"wrapAsync");var Ic=In(Tn($n,Sn)),kc=In(Tn($n,Sn)),kn=a(async(s,t)=>{let e=xn.squareSide.find(n=>n*n>=s*t),i=xn.dimension.find(n=>n>=s&&n>=t);if(!e||!i)throw new Error("Not supported");let[r,o]=await Promise.all([Ic(e,e),kc(i,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),On=a(async(s,t,e)=>{try{let{ctx:i,canvas:r}=Nt();return r.width=t,r.height=e,i.imageSmoothingQuality="high",i.drawImage(s,0,0,t,e),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"),Oc=a(({img:s,targetW:t,targetH:e})=>On(s,t,e),"native"),Lc=a(function({sourceW:s,targetW:t,targetH:e,step:i}){let r=[],o=t,n=e;do r.push([o,n]),o=Math.round(o/i),n=Math.round(n/i);while(o<s*i);return r.reverse()},"calcShrinkSteps"),Uc=a(({img:s,sourceW:t,targetW:e,targetH:i,step:r})=>Lc({sourceW:t,targetW:e,targetH:i,step:r}).reduce((n,[l,c])=>n.then(u=>kn(l,c).then(()=>On(u,l,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),Pc=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Rc=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),_s=.71,Mc=a((s,t)=>{if(s.width*_s*s.height*_s<t.size)throw new Error("Not required");let e=s.width,i=s.height,r=e/i,o=Math.floor(Math.sqrt(t.size*r)),n=Math.floor(t.size/Math.sqrt(t.size*r));return kn(o,n).then(()=>{let{ctx:l}=Nt();return"imageSmoothingQuality"in l&&!Pc()&&!Rc?Oc({img:s,targetW:o,targetH:n}):Uc({img:s,sourceW:e,targetW:o,targetH:n,step:_s})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Ln=a(async(s,t)=>{try{if(await Sc(s))throw new Error("Should skipped");let i=await Promise.allSettled([bc(s),yc(),dc(s)]),o=!i.some(b=>b.status==="rejected"),[n,l,c]=i,u=await fc(s).catch(()=>s),p=await Ac(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Mc(p,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!o&&gc(d)&&(f="image/png",m=void 0);let g=await mc(d,f,m);if(o&&n.status==="fulfilled"&&n.value){let b=n.value,w=l.status==="fulfilled"?l.value:!1;g=await Cc(g,b,w)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await En(g,c.value)),g}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}},"shrinkFile");function Dc(s){let t=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(t)}a(Dc,"createSvgBlobUrl");function ys(s="hsl(209, 21%, 65%)",t=32,e=32){return Dc(`<svg width="${t}" height="${e}" 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>`)}a(ys,"fileCssBg");function Un(s,t=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let e=document.createElement("canvas"),i=e.getContext("2d"),r=new Image,o=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(e.width=t,e.height=t*c):(e.height=t,e.width=t/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(r,0,0,e.width,e.height),e.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{l(c)}});return r.src=URL.createObjectURL(s),o}a(Un,"generateThumb");var Fc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Pn=a(s=>{let t=Fc.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}},"parseShrink");var Q=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),ot=class ot extends ${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",P(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",P(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:Q.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let e of this._entrySubs)e.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(e){let[i]=e;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 e=this._entry,i=Q.IDLE;e.getValue("errors").length>0?i=Q.FAILED:e.getValue("isUploading")?i=Q.UPLOADING:e.getValue("fileInfo")&&(i=Q.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let e=this._entry;if(e.getValue("fileInfo")&&e.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(R(we(this.cfg.cdnCname,this._entry.getValue("uuid")),V(e.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=e.getValue("thumbUrl");n!==o&&(e.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!e.getValue("thumbUrl"))if((i=e.getValue("file"))!=null&&i.type.includes("image"))try{let r=await Un(e.getValue("file"),this.cfg.thumbSize);e.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(r))}}_subEntry(e,i){let r=this._entry.subscribe(e,o=>{this.isConnected&&i(o)});this._entrySubs.add(r)}_handleEntryId(e){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(e);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",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{ot.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{e.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),ot.activeInstances.add(this)}_handleState(e){var i,r,o,n,l,c,u;e===Q.FAILED?this.$.badgeIcon="badge-error":e===Q.FINISHED&&(this.$.badgeIcon="badge-success"),e===Q.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:e===Q.FAILED,isUploading:e===Q.UPLOADING,isFinished:e===Q.FINISHED,progressVisible:e===Q.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,ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(l=this._entry)==null?void 0:l.getValue("fileName"),status:this.l10n((u=(c=e==null?void 0:e.description)==null?void 0:c.toLocaleLowerCase())!=null?u:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),ot.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 e;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return Pn(this.cfg.imageShrink)}_processShrink(e){return Ln(e,this._settingsOfShrink())}async upload(){var r,o,n,l,c,u;let e=this._entry;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setValue("isUploading",!0),e.setValue("errors",[]);try{let p=new AbortController;e.setValue("abortController",p);let d=a(async()=>{let m=e.getValue("file");m&&this.cfg.imageShrink&&(m=await this._processShrink(m).catch(()=>m));let g=m||e.getValue("externalUrl")||e.getValue("uuid"),w={...await this.getUploadClientOptions(),fileName:e.getValue("fileName"),source:e.getValue("source"),onProgress:C=>{if(C.isComputable){let v=C.value*100;e.setValue("uploadProgress",v)}},signal:p.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",g,w),Er(g,w)},"uploadTask"),f=await this.$["*uploadQueue"].add(d);e.setMultipleValues({fileInfo:f,isUploading:!1,fileName:f.originalFilename,fileSize:f.size,isImage:f.isImage,mimeType:(n=(o=(r=f.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:f.mimeType,uuid:f.uuid,cdnUrl:(l=e.getValue("cdnUrl"))!=null?l:f.cdnUrl,cdnUrlModifiers:(c=e.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100,source:(u=e.getValue("source"))!=null?u:null}),e===this._entry&&this._debouncedCalculateState()}catch(p){p instanceof xe&&p.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:p}),e===this._entry&&this._debouncedCalculateState()}}}};a(ot,"FileItem");var nt=ot;nt.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 aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><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>`;nt.activeInstances=new Set;var Me=class Me extends y{constructor(){super();h(this,"_handleBackdropClick",a(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",a(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",a(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",a(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",a(e=>{e.target===this.ref.dialog&&e.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(){super.initCallback(),this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp),this.sub("*modalActive",e=>{this.$.isOpen!==e&&(this.$.isOpen=e),e&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",e=>{e?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",e=>{e?(this.show(),this.setAttribute("aria-modal","true")):(this.hide(),this.setAttribute("aria-modal","false"))})}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)}};a(Me,"Modal"),h(Me,"styleAttrs",[...G(Me,Me,"styleAttrs"),"uc-modal"]),h(Me,"StateConsumerScope","modal");var Vt=Me;Vt.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Xi=a((s,t)=>{let e,i,r,o=a((...n)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=t&&(s(...n),r=Date.now())},Math.max(t-(Date.now()-r),0))):(s(...n),r=Date.now(),e=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),o},"throttle");var vs=class vs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",_.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",Xi(()=>{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(I.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},r=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=e.errors.some(f=>f.type==="TOO_MANY_FILES"),n=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.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?!!e.group:!0;p=i.total===i.succeed&&r&&l&&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(e){let i=a(r=>{let o=e[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.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",e=>{e&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.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)}};a(vs,"UploadList");var Bt=vs;Bt.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><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 ws=class ws extends ${constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:e=>{e.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:U.URL}),this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:e=>{let i=e.target.value;this.set$({importDisabled:!i})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};a(ws,"UrlSource");var zt=ws;zt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><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" l10n="@title:a11y-activity-header-button-close" ><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 Rn=a(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Nc={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Mn=["camera","microphone"];function qi(s){let t=Math.floor(s/60).toString().padStart(2,"0"),e=Math.floor(s%60).toString().padStart(2,"0");return`${t}:${e}`}a(qi,"formatTime");var Dn="image/jpeg",Fn="video/webm",L=class L extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"_chunks",[]);h(this,"_mediaRecorder",null);h(this,"_stream",null);h(this,"_selectedAudioId",null);h(this,"_selectedCameraId",null);h(this,"_chooseActionWithCamera",a(()=>{var e;if(this._activeTab===L.types.PHOTO&&this._shot(),this._activeTab===L.types.VIDEO){if(((e=this._mediaRecorder)==null?void 0:e.state)==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera"));h(this,"_updateTimer",a(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let i=this.cfg.maxVideoRecordingDuration-e;if(i<=0){this.ref.timer.textContent=qi(i),this._stopRecording();return}this.ref.timer.textContent=qi(i)}else this.ref.timer.textContent=qi(e);this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer"));h(this,"_startTimer",a(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer"));h(this,"_stopTimer",a(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer"));h(this,"_startTimeline",a(()=>{let e=this.ref.video.currentTime,i=this.ref.video.duration;this.ref.line.style.transform=`scaleX(${e/i})`,this.ref.timer.textContent=qi(e),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline"));h(this,"_stopTimeline",a(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline"));h(this,"_startRecording",a(()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorerOptions};let{mimeType:e}=this.cfg.mediaRecorerOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Fn)?this._options.mimeType=Fn:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",i=>{this._chunks.push(i.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(L.events.PLAY))}catch(e){console.error("Failed to start recording",e)}},"_startRecording"));h(this,"_stopRecording",a(()=>{var e,i;(e=this._mediaRecorder)==null||e.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(L.events.STOP)}),(i=this._mediaRecorder)==null||i.stop(),this.classList.remove("uc-recording")},"_stopRecording"));h(this,"_toggleRecording",a(()=>{var e;((e=this._mediaRecorder)==null?void 0:e.state)!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording"));h(this,"_toggleEnableAudio",a(()=>{var e;(e=this._stream)==null||e.getAudioTracks().forEach(i=>{i.enabled=!i.enabled,this.$.toggleMicorphoneIcon=i.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!i.enabled})},"_toggleEnableAudio"));h(this,"_previewVideo",a(()=>{var e;try{let i=new Blob(this._chunks,{type:(e=this._mediaRecorder)==null?void 0:e.mimeType}),r=URL.createObjectURL(i);this.ref.video.muted=!1,this.ref.video.volume=1,this.$.video=null,this.ref.video.src=r,this.ref.video.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),this.ref.video.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(i){console.error("Failed to preview video",i)}},"_previewVideo"));h(this,"_retake",a(()=>{this._setCameraState(L.events.RETAKE),this._activeTab===L.types.VIDEO&&(this.$.video=this._stream,this.ref.video.muted=!0),this.ref.video.play()},"_retake"));h(this,"_accept",a(()=>{var o,n,l;if(this._setCameraState(L.events.ACCEPT),this._activeTab===L.types.PHOTO){(o=this._canvas)==null||o.toBlob(c=>{let u=this._createFile("camera","jpeg",Dn,c);this._toSend(u)},Dn);return}let e=new Blob(this._chunks,{type:(n=this._mediaRecorder)==null?void 0:n.mimeType}),i=this._guessExtensionByMime((l=this._mediaRecorder)==null?void 0:l.mimeType),r=this._createFile("video",i,`video/${i}`,e);this._toSend(r),this._chunks=[]},"_accept"));h(this,"_handlePhoto",a(e=>{e===L.events.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===L.events.RETAKE||e===L.events.ACCEPT)&&this.set$({tabVideoHidden:!this.cfg.enableVideoRecording,cameraHidden:!1,tabCameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this.cameraDevices.length<=1})},"_handlePhoto"));h(this,"_handleVideo",a(e=>{e===L.events.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===L.events.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicorphoneHidden:!0,cameraActionsHidden:!1}),(e===L.events.RETAKE||e===L.events.ACCEPT)&&this.set$({timerHidden:!0,tabCameraHidden:!1,cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicorphoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording||this.audioDevices.length<=1,cameraSelectHidden:this.cameraDevices.length<=1})},"_handleVideo"));h(this,"_setCameraState",a(e=>{this._activeTab===L.types.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===L.types.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState"));h(this,"_handleActiveTab",a(e=>{this.ref.switcher.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e)}),e===L.types.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicorphoneHidden:!0}),e===L.types.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording||this.audioDevices.length<=1,audioToggleMicorphoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab"));h(this,"_createFile",a((e,i,r,o)=>{let n=Date.now(),l=`${e}-${n}.${i}`;return new File([o],l,{lastModified:n,type:r})},"_createFile"));h(this,"_toSend",a(e=>{this.api.addFileFromObject(e,{source:U.CAMERA}),this.set$({"*currentActivity":_.activities.UPLOAD_LIST})},"_toSend"));h(this,"_setPermissionsState",P(e=>{this.classList.toggle("uc-initialized",e==="granted");let i=this._activeTab===L.types.VIDEO&&this.cfg.enableAudioRecording,r=this._activeTab===L.types.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!1,messageHidden:!0,timerHidden:!0,currentIcon:r,audioToggleMicorphoneHidden:!i,audioSelectHidden:!i}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!1,tabVideoHidden:!this.cfg.enableVideoRecording,cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300));h(this,"_makeStreamInactive",a(()=>{var r,o;if(!this._stream)return!1;let e=(r=this._stream)==null?void 0:r.getAudioTracks(),i=(o=this._stream)==null?void 0:o.getVideoTracks();e.forEach(n=>n.stop()),i.forEach(n=>n.stop())},"_makeStreamInactive"));h(this,"_stopCapture",a(()=>{var e;this._capturing&&(this.ref.video.volume=0,(e=this.$.video)==null||e.getTracks()[0].stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture"));h(this,"_capture",a(async()=>{let e={video:Nc,audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video.volume=0;try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.log("Failed to capture camera",i)}},"_capture"));h(this,"_handlePermissionsChange",a(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_permissionAccess",a(async()=>{try{for(let e of Mn)this[`${e}Response`]=await navigator.permissions.query({name:e}),this[`${e}Response`].addEventListener("change",this._handlePermissionsChange)}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this._capture()}},"_permissionAccess"));h(this,"_getPermission",a(()=>{},"_getPermission"));h(this,"_requestDeviceAccess",a(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){console.log("Failed to get user media",e)}},"_requestDeviceAccess"));h(this,"_getDevices",a(async()=>{var e,i;try{let r=await navigator.mediaDevices.enumerateDevices();this.cameraDevices=r.filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId})),this.audioDevices=this.cfg.enableAudioRecording&&r.filter(o=>o.kind==="audioinput").map(o=>({text:o.label.trim(),value:o.deviceId})),this.cameraDevices.length>1&&this.set$({cameraSelectOptions:this.cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=(e=this.cameraDevices[0])==null?void 0:e.value,this.audioDevices.length>1&&this.set$({audioSelectOptions:this.audioDevices,audioSelectHidden:!1}),this._selectedAudioId=(i=this.audioDevices[0])==null?void 0:i.value}catch(r){console.log("Failed to get devices",r)}},"_getDevices"));h(this,"_onActivate",a(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture()},"_onActivate"));h(this,"_onDeactivate",a(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate"));this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:Rn(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicorphoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicorphoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:e=>{this._selectedCameraId=e.target.value,this._capture()},onAudioSelectChange:e=>{this._selectedAudioId=e.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>this._shot(),onRequestPermissions:()=>this._capture(),onStartCamera:()=>this._chooseActionWithCamera(),onStartRecording:()=>this._startRecording(),onStopRecording:()=>this._stopRecording(),onToggleRecording:()=>this._toggleRecording(),onToggleAudio:()=>this._toggleEnableAudio(),onRetake:()=>this._retake(),onAccept:()=>this._accept(),onClickTab:e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._handleActiveTab(i)}}}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_guessExtensionByMime(e){let i={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e&&(e=e.split("/"),(e==null?void 0:e[0])==="video")){e=e.slice(1).join("/");let r=e==null?void 0:e.split(";")[0];if(i[r])return i[r]}return"avi"}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicorphoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("enableVideoRecording",e=>{this.$.tabVideoHidden=!e}),this.subConfigValue("defaultCameraMode",e=>{if(this.cfg.enableVideoRecording){this._handleActiveTab(e);return}this._handleActiveTab("photo")})}_destroy(){for(let e of Mn)this[`${e}Response`].removeEventListener("change",this._handlePermissionsChange);navigator.mediaDevices.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};a(L,"CameraSource");var De=L;De.types=Object.freeze({PHOTO:"photo",VIDEO:"video"});De.events=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});De.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><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" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted 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></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"><button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button><button type="button" class="uc-primary-btn" set="onclick: onAccept">Accept</button></div><button type="button" class="uc-shot-btn uc-camera-action" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicorphoneHidden;"><uc-icon set="@name:toggleMicorphoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var Cs=class Cs extends ${constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};a(Cs,"UploadCtxProviderClass");var Ki=Cs;Ki.EventType=I;var Nn=Ki;var xs=class xs extends ${constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){var e;super.destroyCallback(),(e=this._unobserveCollection)==null||e.call(this)}};a(xs,"ProgressBarCommon");var Ht=xs;Ht.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var As=class As extends y{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",e=>{if(e===void 0)return;let i=this._value;if(this._value=e,e===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",e=>{this.ref.line.classList.toggle("uc-progress--hidden",!e)})}};a(As,"ProgressBar");var jt=As;jt.template='<div ref="line" class="uc-progress"></div>';var ce="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Vn(...s){return s.reduce((t,e)=>{if(typeof e=="string")return t[e]=!0,t;for(let i of Object.keys(e))t[i]=e[i];return t},{})}a(Vn,"normalize");function N(...s){let t=Vn(...s);return Object.keys(t).reduce((e,i)=>(t[i]&&e.push(i),e),[]).join(" ")}a(N,"classNames");function Bn(s,...t){let e=Vn(...t);for(let i of Object.keys(e))s.classList.toggle(i,e[i])}a(Bn,"applyClassNames");var zn=a(s=>{if(!s)return W;let t=uo(s).filter(e=>W.includes(e));return t.length===0?W:t},"parseTabs");function Hn(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":W,"*tabId":O.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:ce,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:ze(W),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let t=s.querySelectorAll("img");for(let e of t){let i=e.src;e.src=ce,e.src=i}s.$["*networkProblems"]=!1},"*on.apply":t=>{if(!t)return;let e=s.$["*originalUrl"],i=V(Ce(t),"preview"),r=R(e,i),o={originalUrl:e,cdnUrlModifiers:i,cdnUrl:r,transformations:t};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}))}}}a(Hn,"initState");var jn="<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 Gn=`${jn} <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="${ce}" 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 Zi=class Zi extends y{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",P(this._showLoader.bind(this),300));this.init$={...this.init$,...Hn(this)}}_showLoader(e){this.$.showLoader=e}_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(([l])=>{l.contentRect.width>0&&l.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 e=ui(this.$.cdnUrl),i=we(this.$.cdnUrl,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let r=eo(this.$.cdnUrl),o=no(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=we(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,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 e=await this.proxyUrl(R(this.$["*originalUrl"],V("json"))),i=await fetch(e).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(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==ce&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let i=this.ref["img-el"];i.src!==e&&(this._imgLoading=!0,i.src=e||ce)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=ki(e)}),this.sub("tabs",e=>{this.$["*tabList"]=zn(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=N("uc-image",{"uc-image_hidden_to_cropper":e===O.CROP,"uc-image_hidden_effects":e!==O.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let i=this.$["*originalUrl"],r=V(Ce(e),"preview"),o=R(i,r),n={originalUrl:i,cdnUrlModifiers:r,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};a(Zi,"CloudImageEditorBlock"),h(Zi,"styleAttrs",["uc-cloud-image-editor"]);var ue=Zi;ue.template=Gn;ue.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Es=class Es 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(t){let e=this.$["*imageBox"];if(!e)return;if(t===""&&e.height<=A&&e.width<=A)return!0;let i=e.height<=A&&(t.includes("n")||t.includes("s")),r=e.width<=A&&(t.includes("e")||t.includes("w"));return i||r}_createBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t,n=this.ref["svg-el"],l=Y("mask",{id:"backdrop-mask"}),c=Y("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=Y("rect",{x:e,y:i,width:r,height:o,fill:"black"});l.appendChild(c),l.appendChild(u);let p=Y("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(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t;this._backdropMaskInner&&Oe(this._backdropMaskInner,{x:e,y:i,width:r,height:o})}_updateFrame(){let t=this.$["*cropBox"];if(!(!t||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:i,pathNode:r,interactionNode:o,groupNode:n}=e,l=i==="",c=i.length===2,{x:u,y:p,width:d,height:f}=t;if(l)Oe(o,{x:u,y:p,width:d,height:f});else{let g=Te(Math.min(d,f)/(24*2+34)/2,0,1),{d:b,center:w}=c?zo(t,i,g):Ho(t,i,g),C=Math.max(zr*Te(Math.min(d,f)/zr/3,0,1),Bo);Oe(o,{x:w[0]-C,y:w[1]-C,width:C*2,height:C*2}),Oe(r,{d:b})}let m=this._shouldThumbBeDisabled(i);n.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Oe(this._frameGuides,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1})}}_createThumb(t,e){let i=Y("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let r=Y("rect",{fill:"transparent"}),o=Y("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(o),i.appendChild(r),t[e]={direction:e,pathNode:o,interactionNode:r,groupNode:i},e===""&&(i.style.cursor="move"),r.addEventListener("pointerdown",this._handlePointerDown.bind(this,e))}_createThumbs(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let r=`${["n","","s"][e]}${["w","","e"][i]}`;r!==""&&this._createThumb(t,r)}return this._createThumb(t,""),t}_createGuides(){let t=Y("svg"),e=Y("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let r=Y("line",{x1:`${Ut*i}%`,y1:"0%",x2:`${Ut*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}for(let i=1;i<=2;i++){let r=Y("line",{x1:"0%",y1:`${Ut*i}%`,x2:"100%",y2:`${Ut*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_createFrame(){let t=this.ref["svg-el"],e=document.createDocumentFragment(),i=this._createGuides();e.appendChild(i);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))e.appendChild(o);t.appendChild(e),this._frameThumbs=r,this._frameGuides=i}_handlePointerDown(t,e){if(!this._frameThumbs)return;let i=this._frameThumbs[t];if(this._shouldThumbBeDisabled(t))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,c=e.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,c],this._dragStartCrop={...r}}_handlePointerUp_(t){this._updateCursor(),this.$.dragging&&(t.stopPropagation(),t.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(t){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;t.stopPropagation(),t.preventDefault();let e=this.ref["svg-el"],{x:i,y:r}=e.getBoundingClientRect(),o=t.x-i,n=t.y-r,l=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(t,e){var u,p;let[i,r]=e,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],l=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=l?l.width/l.height:void 0;if(t===""?n=Go({rect:n,delta:[i,r],imageBox:o}):n=Wo({rect:n,delta:[i,r],direction:t,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 We(qe(n),this.$["*imageBox"])}_handleSvgPointerMove_(t){if(!this._frameThumbs)return;let e=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 Xo(n,[t.x,t.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let t=this._hoverThumb;this.ref["svg-el"].style.cursor=t?jo(t.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(t){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=A||t.width<=A,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",N({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),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)}};a(Es,"CropFrame");var Gt=Es;Gt.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var Ts=class Ts extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=N({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};a(Ts,"EditorButtonControl");var ye=Ts;ye.template=`<button type="button" role="option" l10n="@title:title-prop"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Bc(s){let t=s+90;return t=t>=360?0:t,t}a(Bc,"nextAngle");function zc(s,t){return s==="rotate"?Bc(t):["mirror","flip"].includes(s)?!t:null}a(zc,"nextValue");var Ss=class Ss extends ye{initCallback(){super.initCallback(),this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(t).toLowerCase()})))}),this.$["on.click"]=()=>{let t=this.$["*cropperEl"].getValue(this._operation),e=zc(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};a(Ss,"EditorCropButtonControl");var at=Ss;var Wt={FILTER:"filter",COLOR_OPERATION:"color_operation"},he="original",$s=class $s extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":e=>{this.$["*faderEl"].set(e),this.$.value=e}})}setOperation(e,i){this._controlType=e==="filter"?Wt.FILTER:Wt.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===he?void 0:this.$.value,filter:this._filter===he?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:i}=se[this._operation],[r,o]=e;this.$.min=r,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===Wt.FILTER){let l=o;if(n){let{name:c,amount:u}=n;l=c===this._filter?u:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===Wt.COLOR_OPERATION){let l=typeof n!="undefined"?n:i;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===Wt.FILTER?this._filter===he?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let i=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=i})}};a($s,"EditorSlider");var Xt=$s;Xt.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 qt(s){let t=new Image;return{promise:new Promise((r,o)=>{t.src=s,t.onload=r,t.onerror=o}),image:t,cancel:a(()=>{t.naturalWidth===0&&(t.src=ce)},"cancel")}}a(qt,"preloadImage");function Kt(s){let t=[];for(let o of s){let n=qt(o);t.push(n)}let e=t.map(o=>o.image);return{promise:Promise.allSettled(t.map(o=>o.promise)),images:e,cancel:a(()=>{t.forEach(o=>{o.cancel()})},"cancel")}}a(Kt,"batchPreloadImages");var Is=class Is extends ye{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,i=Math.ceil(e*t),r=e>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==he?{name:this._filter,amount:o}:void 0,R(this._originalUrl,V(hi,Ce(n),`quality/${r}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(t,e){var r;if(t[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:c}=qt(o);this._cancelPreload=c,l.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),e.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",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===he,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=e?"1":"0";let r=this.ref["preview-el"];e?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){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 t,e;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};a(Is,"EditorFilterControl");var Ne=Is;Ne.template=`<button type="button" role="option" l10n="@title:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var ks=class ks extends ye{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:i}=se[this._operation],r=e[this._operation],o=typeof r!="undefined"?r!==i:!1;this.$.active=o})}};a(ks,"EditorOperationControl");var lt=ks;function Wn(s,t){let e={};for(let i of t){let r=s[i];(s.hasOwnProperty(i)||r!==void 0)&&(e[i]=r)}return e}a(Wn,"pick");function ct(s,t,e){let r=window.devicePixelRatio,o=Math.min(Math.ceil(t*r),3e3),n=r>=2?"lightest":"normal";return R(s,V(hi,Ce(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Le}/${Ue}/uc-cloud-image-editor/`))}a(ct,"viewerImageSrc");function Hc(s){return s?[({dimensions:e,coords:i})=>[...e,...i].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:e,coords:i})=>e.every(r=>r>0)&&i.every(r=>r>=0)].every(e=>e(s)):!0}a(Hc,"validateCrop");var Os=class Os 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=P(this._commit.bind(this),300),this._handleResizeThrottled=Xi(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 e=this.$["*editorTransformations"],i=Wn(e,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...i};this.$["*operations"]=r}_initCanvas(){let e=this.ref["canvas-el"],i=e.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${r}px`,e.style.height=`${o}px`,e.width=r*n,e.height=o*n,i==null||i.scale(n,n),this._canvas=e,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,i=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=Xe({width:e.naturalWidth,height:e.naturalHeight},o),c;if(l.width>n.width-i*2||l.height>n.height-i*2){let u=l.width/l.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}=l,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"]=qe(c)}_alignCrop(){var f;let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[m,g],coords:[b,w]}=n,{width:C}=Xe(this._imageSize,o),v=l/C;e=We(qe({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(!qo(e,i)||d&&!Ko(e,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)),e={x:i.x+i.width/2-g/2,y:i.y+i.height/2-b/2,width:g,height:b}}this.$["*cropBox"]=We(qe(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let i=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:c}=o,u=Xe({width:r.width,height:r.height},c);e.save(),e.translate(r.x+r.width/2,r.y+r.height/2),e.rotate(c*Math.PI*-1/180),e.scale(n?-1:1,l?-1:1),e.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=N({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:l}=i,{width:c,height:u}=Xe(this._imageSize,o),{width:p,height:d}=e,f=n/c,m=l/u;return[Te(Math.round(p/f),1,c),Te(Math.round(d/m),1,u)]}_getCropTransformation(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:l,x:c,y:u}=i,{width:p,height:d}=Xe(this._imageSize,o),{x:f,y:m}=e,g=n/p,b=l/d,w=this._getCropDimensions(),C={dimensions:w,coords:[Te(Math.round((f-c)/g),0,p-w[0]),Te(Math.round((m-u)/b),0,d-w[1])]};if(!Hc(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===p&&w[1]===d))return C}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:i,mirror:r,flip:o}=e,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:i,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(e,i){this.$["*operations"]={...this.$["*operations"],[e]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,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:e=!1}={}){var i;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=N({"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 e=this._getCropDimensions(),i=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(i,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${n}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,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(ct(e,r,i)),{promise:n,cancel:l,image:c}=qt(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=l,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(e){let i="crop",r=this.$["*loadingOperations"];return r.get(i)||r.set(i,new Map),r.get(i).get(e)||(r.set(i,r.get(i).set(e,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(i))!=null&&o.has(e)&&(r.get(i).delete(e),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",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};a(Os,"EditorImageCropper");var Zt=Os;Zt.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Ls(s,t,e){let i=Array(e);e--;for(let r=e;r>=0;r--)i[r]=Math.ceil((r*t+(e-r)*s)/e);return i}a(Ls,"linspace");function jc(s){return s.reduce((t,e,i)=>i<s.length-1?[...t,[e,s[i+1]]]:t,[])}a(jc,"splitBySections");function Gc(s,t,e){let i=jc(s).find(([r,o])=>r<=t&&t<=o);return s.map(r=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(t-i[0])/o;return i[0]===r?t>e?1:1-n:i[1]===r?t>=e?n:1:0})}a(Gc,"calculateOpacities");function Wc(s,t){return s.map((e,i)=>e<t?s.length-i:i)}a(Wc,"calculateZIndices");function Xn(s,t){let e=se[s].keypointsNumber,{range:i,zero:r}=se[s];return[...new Set([...Ls(i[0],r,e+1),...Ls(r,i[1],e+1),r,t])].sort((o,n)=>o-n)}a(Xn,"keypointsRange");var Us=class Us extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=P(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(t){let e=this._operation,i=this.$["*loadingOperations"];return i.get(e)||i.set(e,new Map),i.get(e).get(t)||(i.set(e,i.get(e).set(t,!0)),this.$["*loadingOperations"]=i),()=>{var r;(r=i==null?void 0:i.get(e))!=null&&r.has(t)&&(i.get(e).delete(t),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let t of this._keypoints){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString())}})}async _imageSrc({url:t=this._url,filter:e=this._filter,operation:i,value:r}={}){let o={...this._transformations};i&&(o[i]=e?{name:e,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(ct(t,n,o))}async _constructKeypoint(t,e){return{src:await this._imageSrc({operation:t,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(t,e){return this._operation===t&&this._filter===e}async _addKeypoint(t,e,i){let r=a(()=>!this._isSame(t,e)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(r())return;let o=await this._constructKeypoint(t,i),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{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(t,i))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(t){t=typeof t=="string"?parseInt(t,10):t,this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t)}_update(t,e){this._operation=t,this._value=e;let{zero:i}=se[t],r=this._keypoints.map(l=>l.value),o=Gc(r,e,i),n=Wc(r,i);for(let[l,c]of Object.entries(this._keypoints))c.opacity=o[l],c.zIndex=n[l];this._flush()}_createPreviewImage(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async _initNodes(){let t=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&t.appendChild(this._previewImage);let e=document.createElement("div");t.appendChild(e);let i=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=Kt(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 l=this._operation,c=this._filter;await o,this._isActive&&this._isSame(l,c)&&(this._container&&this._container.remove(),this._container=e,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(t),this._flush())}async setTransformations(t){if(this._transformations=t,this._previewImage){let e=await this._imageSrc(),i=this._handleImageLoading(e);this._previewImage.src=e,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:t,filter:e,operation:i,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Xn(i,r),n=await Promise.all(o.map(c=>this._imageSrc({url:t,filter:e,operation:i,value:c}))),{cancel:l}=Kt(n);this._cancelBatchPreload=l}_setOriginalSrc(t){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let i=this._handleImageLoading(t);e.addEventListener("error",i,{once:!0}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:t,operation:e,value:i,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=t,this._operation=e||"initial",this._value=i,this._filter=r,this._fromViewer=o,typeof i!="number"&&!r){let l=await this._imageSrc({operation:e,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Xn(e,i).map(l=>this._constructKeypoint(e,l))),this._update(e,i),this._initNodes()}deactivate({hide:t=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),t&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=N({"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()}};a(Us,"EditorImageFader");var Yi=Us;var Xc=1,Ps=class Ps extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;Math.abs(i)>Xc?this.scrollLeft+=i:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};a(Ps,"EditorScroller");var Yt=Ps;Yt.template=" <slot></slot> ";function qc(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}; title-prop: a11y-editor-tab-${s}" ></uc-btn-ui></uc-presence-toggle>`}a(qc,"renderTabToggle");function Kc(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>`}a(Kc,"renderTabContent");var Rs=class Rs extends y{constructor(){super();h(this,"_updateInfoTooltip",P(()=>{var n,l;let e=this.$["*editorTransformations"],i=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===O.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=e==null?void 0:e.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(he);else if(this.$["*tabId"]===O.TUNING&&i){o=!0;let c=(e==null?void 0:e[i])||se[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":he,"*currentOperation":null,showLoader:!1,filters:lo,colorOperations:ao,cropOperations:co,"*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 e;(e=this._cancelPreload)==null||e.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":e=>{let i=e.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}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=P(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(e){let i=new lt;return i.operation=e,i}_createFilterControl(e){let i=new Ne;return i.filter=e,i}_createToggleControl(e){let i=new at;return i.operation=e,i}_renderControlsList(e){let i=this.ref[`controls-list-${e}`],r=document.createDocumentFragment();e===O.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):e===O.FILTERS?[he,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):e===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(e,{fromViewer:i}){this.$["*tabId"]=e,e===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 W){let o=r===e,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(e){let i=this.ref[`controls-list-${e}`];i&&(i.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(ct(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=Kt([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var r;let i=(r=e==null?void 0:e.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",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let i=!1;for(let[,r]of e.entries()){if(i)break;for(let[,o]of r.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let i of W){this.$[`presence.tabToggle.${i}`]=e.includes(i);let r=this.ref[`tab-toggle-${i}`];r.style.gridColumn=e.indexOf(i)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}};a(Rs,"EditorToolbar");var Jt=Rs;Jt.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">${W.map(Kc).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> ${W.map(qc).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop: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 Ms=class Ms 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":"","title-prop":""},this.defineAccessor("active",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return N("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",t=>{this._iconSingle=!this.$.text,this._iconHidden=!t,this.$.iconCss=this._iconCss()}),this.sub("theme",t=>{t!=="custom"&&(this.className=`uc-${t}`)}),this.sub("text",t=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",t=>{this.$["aria-role"]=t||""}),this.defineAccessor("aria-controls",t=>{this.$["aria-controls"]=t||""}),this.defineAccessor("title-prop",t=>{this.$["title-prop"]=t||""})}set reverse(t){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};a(Ms,"BtnUi");var ut=Ms;ut.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ut.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls;" l10n="@title:title-prop"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var Ds=class Ds extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let t=this.ref["line-el"];t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",t=>{typeof t=="boolean"&&(t?this._start():this._stop())})}_start(){this._active=!0;let{width:t}=this.getBoundingClientRect(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};a(Ds,"LineLoaderUi");var Qt=Ds;Qt.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var Ji={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Fs=class Fs extends y{constructor(){super(),this._visible=!1,this._visibleStyle=Ji.visible,this._hiddenStyle=Ji.hidden,this._externalTransitions=!1,this.defineAccessor("styles",t=>{t&&(this._externalTransitions=!0,this._visibleStyle=t.visible,this._hiddenStyle=t.hidden)}),this.defineAccessor("visible",t=>{typeof t=="boolean"&&(this._visible=t,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Bn(this,{[Ji.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(Ji.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};a(Fs,"PresenceToggle");var ei=Fs;ei.template="<slot></slot> ";var Ns=class Ns extends y{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderChange":()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)}});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 e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(e-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="1";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 l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(l),this._stepsCount=n}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};a(Ns,"SliderUi");var ti=Ns;ti.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 Vs=class Vs extends ${constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.CLOUD_IMG_EDIT);h(this,"_entry");h(this,"_instance")}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let i=e.detail;this._entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams;if(this._entry=this.uploadCollection.read(e),!this._entry)throw new Error(`Entry with internalId "${e}" not found`);let i=this._entry.getValue("cdnUrl");if(!i)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let r=new ue,o=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;r.setAttribute("ctx-name",this.ctxName),r.setAttribute("cdn-url",i),o&&r.setAttribute("crop-preset",o),n&&r.setAttribute("tabs",n),r.addEventListener("apply",l=>{let c=l;this.handleApply(c),this.debugPrint('editor event "apply"',c.detail)}),r.addEventListener("cancel",l=>{let c=l;this.handleCancel(),this.debugPrint('editor event "cancel"',c.detail)}),r.addEventListener("change",l=>{let c=l;this.debugPrint('editor event "change"',c.detail)}),this.innerHTML="",this.appendChild(r),this._instance=r}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};a(Vs,"CloudImageEditorActivity");var Qi=Vs;var Zc=a(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),qn=a(function(s,t="i"){let e=s.split("*").map(Zc);return new RegExp("^"+e.join(".+")+"$",t)},"wildcardRegexp");function Yc(s,t){return window.getComputedStyle(s).getPropertyValue(t).trim()}a(Yc,"getCssValue");var Jc=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"];function Kn(s){return Jc.reduce((t,e)=>{let i=Yc(s,e);return i&&(t[e]=i),t},{})}a(Kn,"buildThemeDefinition");var Qc=["selected-files-change"],eu=a(s=>!s||typeof s!="object"?!1:"type"in s&&Qc.includes(s.type),"isWhitelistedMessage"),Bs=class Bs{constructor(t){h(this,"_handlerMap",new Map);h(this,"_context");h(this,"_handleMessage",a(t=>{if(t.source!==this._context)return;let e=t.data;if(!eu(e))return;let i=this._handlerMap.get(e.type);if(i)for(let r of i)r(e)},"_handleMessage"));this._context=t,window.addEventListener("message",this._handleMessage)}on(t,e){var r;let i=(r=this._handlerMap.get(t))!=null?r:new Set;this._handlerMap.has(t)||this._handlerMap.set(t,i),i.add(e)}send(t){this._context.postMessage(t,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};a(Bs,"MessageBridge");var er=Bs;function Zn(s){let t=[];for(let[e,i]of Object.entries(s))i==null||typeof i=="string"&&i.length===0||t.push(`${e}=${encodeURIComponent(i)}`);return t.join("&")}a(Zn,"queryString");var zs=class zs extends ${constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",_.activities.EXTERNAL);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",onDone:()=>{for(let e of this.$.selectedList){let i=this.extractUrlFromSelectedFile(e),{filename:r}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:r,source:o})}this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onSelectAll:()=>{var e;(e=this._messageBridge)==null||e.send({type:"select-all"})},onDeselectAll:()=>{var e;(e=this._messageBridge)==null||e.send({type:"deselect-all"})}}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e==null?void 0:e[0].toUpperCase()}${e==null?void 0:e.slice(1)}`,activityIcon:e}),this.mountIframe()}}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()})}extractUrlFromSelectedFile(e){if(e.alternatives){let i=B(this.cfg.externalSourcesPreferredTypes);for(let r of i){let o=qn(r);for(let[n,l]of Object.entries(e.alternatives))if(o.test(n))return l}}return e.url}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({isSelectionReady:e.isReady,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyStyles(),this.setupL10n()}applyStyles(){var e;(e=this._messageBridge)==null||e.send({type:"set-theme-definition",theme:Kn(this)})}setupL10n(){var e;(e=this._messageBridge)==null||e.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){var p,d;let{pubkey:e,remoteTabSessionKey:i,socialBaseUrl:r,multiple:o}=this.cfg,{externalSourceType:n}=this.activityParams,c={lang:((d=(p=this.l10n("social-source-lang"))==null?void 0:p.split("-"))==null?void 0:d[0])||"en",public_key:e,images_only:"false",session_key:i,wait_for_theme:!0,multiple:o.toString()},u=new URL(`/window4/${n}`,r);return u.search=Zn(c),u.toString()}mountIframe(){var i;let e=ur({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&((i=this._messageBridge)==null||i.destroy(),this._messageBridge=new er(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){var e;(e=this._messageBridge)==null||e.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isSelectionReady:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};a(zs,"ExternalSource");var ii=zs;ii.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close" ><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 set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isSelectionReady" l10n="done" ></button></div></div>`;var Hs=class Hs extends ${constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,At(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let r=e.group?e.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=e.allEntries.map(l=>l.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 l of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=l,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};a(Hs,"FormInput");var tr=Hs;var js=class js extends _{};a(js,"ActivityHeader");var ir=js;var Gs=class Gs extends y{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:e=>{var i;e.preventDefault(),e.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",e=>{var r;this.$.currentText=((r=e==null?void 0:e[0])==null?void 0:r.text)||"";let i="";e==null||e.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};a(Gs,"Select");var ri=Gs;ri.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var sr=class sr extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};a(sr,"Copyright"),h(sr,"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 rr=sr;var ht=class ht extends oe{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",t=>{this.set$({isHidden:k(t)})}),this.sub("*modalActive",t=>{this._lastModalActive!==t&&this.emit(t?I.MODAL_OPEN:I.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=t},!1)}};a(ht,"FileUploaderRegular"),h(ht,"styleAttrs",[...G(ht,ht,"styleAttrs"),"uc-file-uploader-regular"]);var dt=ht;dt.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>`;dt.bindAttributes({headless:null});var pt=class pt extends oe{initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=_.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};a(pt,"FileUploaderMinimal"),h(pt,"styleAttrs",[...G(pt,pt,"styleAttrs"),"uc-file-uploader-minimal"]);var si=pt;si.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 ft=class ft extends oe{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let t=this.$["*history"];return t.length>1&&t[t.length-1]!==_.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0&&this.$["*currentActivity"]===(t.initActivity||_.activities.START_FROM)&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};a(ft,"FileUploaderInline"),h(ft,"styleAttrs",[...G(ft,ft,"styleAttrs"),"uc-file-uploader-inline"]);var oi=ft;oi.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 mt=class mt extends ue{initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}};a(mt,"CloudImageEditor"),h(mt,"styleAttrs",[...G(mt,mt,"styleAttrs"),"uc-wgt-common"]);var or=mt;function nr(s){for(let t in s){let e=[...t].reduce((i,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),i+=r),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),s[t].reg&&s[t].reg(e)}}a(nr,"defineComponents");var Ws="UC";async function Yn(s,t=!1){return new Promise((e,i)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[Ws]){e(window[Ws]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{i()},r.onload=()=>{let o=window[Ws];t&&nr(o),e(o)},document.head.appendChild(r)})}a(Yn,"loadFileUploaderFrom");return aa(tu);})();
|