@uploadcare/file-uploader 1.27.0-alpha.0 → 1.27.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CloudImageEditorActivity-HGSS7NV2.css → CloudImageEditorActivity-H7IY5ZRN.css} +2 -2
- package/dist/{CloudImageEditorActivity-HGSS7NV2.layered.css → CloudImageEditorActivity-H7IY5ZRN.layered.css} +2 -2
- package/dist/CloudImageEditorActivity-LKW4OYEK.js +1 -0
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/chunk-BMGLMZ7T.js +7 -0
- package/dist/{chunk-TVCYFFRR.js → chunk-GVVHCZH5.js} +2 -2
- package/dist/chunk-JYWKOLXZ.js +7 -0
- package/dist/{chunk-BDD5ZPFI.js → chunk-PHLC56Y5.js} +2 -2
- package/dist/chunk-SX25NGUM.js +8 -0
- package/dist/chunk-SX25NGUM.js.LEGAL.txt +70 -0
- package/dist/{chunk-LNXFGGSC.js → chunk-TMF3R5Q2.js} +2 -2
- package/dist/{cloud-image-editor-PX6YZMOH.css → cloud-image-editor-ANNQTRKP.css} +2 -2
- package/dist/{cloud-image-editor-PX6YZMOH.layered.css → cloud-image-editor-ANNQTRKP.layered.css} +2 -2
- package/dist/cloud-image-editor-JGU7R22E.js +1 -0
- package/dist/{cloudImageEditorPlugin-WZCVZALK.css → cloudImageEditorPlugin-IUHTPZGK.css} +2 -2
- package/dist/{cloudImageEditorPlugin-WZCVZALK.layered.css → cloudImageEditorPlugin-IUHTPZGK.layered.css} +2 -2
- package/dist/{cloudImageEditorPlugin-BE5HU2W4.js → cloudImageEditorPlugin-TRD2OAR2.js} +4 -4
- package/dist/core.css +2 -2
- package/dist/core.js +5 -5
- package/dist/core.js.LEGAL.txt +8 -0
- package/dist/core.layered.css +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.js +3 -3
- package/dist/index.layered.css +2 -2
- package/dist/index.ssr.js +1 -1
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +2 -2
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/package.json +1 -1
- package/web/file-uploader.iife.min.js +3 -3
- package/web/file-uploader.min.js +3 -3
- package/web/uc-basic.layered.min.css +2 -2
- package/web/uc-basic.min.css +2 -2
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.js +3 -3
- package/web/uc-file-uploader-inline.layered.min.css +2 -2
- package/web/uc-file-uploader-inline.min.css +2 -2
- package/web/uc-file-uploader-inline.min.js +3 -3
- package/web/uc-file-uploader-minimal.layered.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.layered.min.css +2 -2
- package/web/uc-file-uploader-regular.min.css +2 -2
- package/web/uc-file-uploader-regular.min.js +3 -3
- package/web/uc-img.min.js +3 -3
- package/dist/CloudImageEditorActivity-7EK7P3UP.js +0 -1
- package/dist/chunk-5OA6ZVWQ.js +0 -7
- package/dist/chunk-GCTQN3DZ.js +0 -7
- package/dist/chunk-NJ77GRVX.js +0 -8
- package/dist/cloud-image-editor-Q5333S7T.js +0 -1
package/dist/chunk-NJ77GRVX.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-TVCYFFRR.js';import {subscribeKeys,listenKeys,map}from'nanostores';import {html,nothing,LitElement}from'lit';import {Queue}from'@uploadcare/upload-client';import {startKeyUX,focusGroupKeyUX,pressKeyUX,jumpKeyUX,hiddenKeyUX}from'keyux';import {TelemetryAPIService}from'@uploadcare/quality-insights';import {createContext,ContextConsumer,ContextProvider}from'@lit/context';import {property,state}from'lit/decorators.js';import {unsafeSVG}from'lit/directives/unsafe-svg.js';import {createRef,ref}from'lit/directives/ref.js';import {classMap}from'lit/directives/class-map.js';import {ifDefined}from'lit/directives/if-defined.js';import {styleMap}from'lit/directives/style-map.js';import {when}from'lit/directives/when.js';/**
|
|
2
|
-
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.27.0-alpha.0 (MIT)
|
|
4
|
-
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-02-17T11:57:25.085Z
|
|
6
|
-
*/
|
|
7
|
-
var J=class r{static{this._contexts=new Map;}constructor(s,e){this._ctxId=s,this._store=e;}get id(){return this._ctxId}pub(s,e){s in this._store.get()||console.warn(`PubSub#pub: Key "${String(s)}" not found`),this._store.setKey(s,e);}sub(s,e,t=true){return (t?subscribeKeys:listenKeys)(this._store,[s],o=>{e(o[s]);})}read(s){return s in this._store.get()||console.warn(`PubSub#read: Key "${String(s)}" not found`),this._store.get()[s]}add(s,e,t=false){(!(s in this._store.get())||t)&&this._store.setKey(s,e);}has(s){return s in this._store.get()}get store(){return this._store.get()}static registerCtx(s,e){if(r._contexts.has(e))throw new Error(`PubSub: Context with id "${e}" already exists`);let t=map(s);return r._contexts.set(e,t),new r(e,t)}static deleteCtx(s){r._contexts.delete(s);}static getCtx(s){let e=r._contexts.get(s);return e?new r(s,e):null}static hasCtx(s){return r._contexts.has(s)}};var G=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let s=globalThis.crypto;return s&&typeof s.randomUUID=="function"?s.randomUUID():r.generateFastUid()}};var he={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Je=new Map,wt=new Map,Ct=(r,s)=>{Je.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let e={...he,...s};return Je.set(r,e),e},$i=(r,s)=>{wt.set(r,s);},Ni=(r,s)=>{typeof s=="function"?$i(r,s):Ct(r,s);},St=async r=>{let s=Je.get(r);if(!s){let e=wt.get(r);if(!e)throw new Error(`Locale ${r} is not defined`);let t=await e();s=Ct(r,t);}return s};Ni("en",he);var y=r=>`*cfg/${r}`;var Et=r=>r?r.split(",").map(s=>s.trim()).filter(Boolean):[],xe=r=>r.join(",");var xt=r=>{if(typeof r!="string"||!r)return "";let s=r.trim();return s.startsWith("-/")?s=s.slice(2):s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")&&(s=s.slice(0,s.length-1)),s},Ie=(...r)=>r.filter(s=>typeof s=="string"&&!!s).map(s=>xt(s)).join("/-/"),D=(...r)=>{let s=Ie(...r);return s?`-/${s}/`:""};function Re(r){let s=new URL(r),e=s.pathname+s.search+s.hash,t=e.lastIndexOf("http"),i=e.lastIndexOf("/"),o="";return t>=0?o=e.slice(t):i>=0&&(o=e.slice(i+1)),o}function ke(r){let s=new URL(r),{pathname:e}=s,t=e.indexOf("/"),i=e.indexOf("/",t+1);return e.substring(t+1,i)}function et(r){let s=It(r),e=new URL(s),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function tt(r){return et(r).split("/-/").filter(Boolean).map(e=>xt(e))}function It(r){let s=new URL(r),e=Re(r),t=Rt(e)?kt(e).pathname:e;return s.pathname=s.pathname.replace(t,""),s.search="",s.hash="",s.toString()}function Rt(r){return r.startsWith("http")}function kt(r){let s=new URL(r);return {pathname:`${s.origin}${s.pathname??""}`,search:s.search??"",hash:s.hash??""}}var U=(r,s,e)=>{let t=new URL(It(r)),i=e??Re(r),o=s??"";if(t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),i&&Rt(i)){let n=kt(i);t.pathname=`${t.pathname}${o}${n.pathname||""}`,t.search=n.search,t.hash=n.hash;}else t.pathname=`${t.pathname}${o}${i||""}`;return t.toString()},it=(r,s)=>{let e=new URL(r);return e.pathname=`${s}/`,e.toString()};var me=(r,s=",")=>r.trim().split(s).map(e=>e.trim()).filter(e=>e.length>0);var fe=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Mt=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Di(r,s){if(typeof s=="number"){let e=s;return fe[r]!==e?`${r}/${e}`:""}if(typeof s=="boolean"){let e=s;return fe[r]!==e?`${r}`:""}if(r==="filter"&&s){let{name:e,amount:t}=s;return fe.filter===t?"":`${r}/${e}/${t}`}if(r==="crop"&&s){let{dimensions:e,coords:t}=s;return `${r}/${e.join("x")}/${t.join(",")}`}return ""}function W(r){return Ie(...Mt.filter(s=>typeof r[s]<"u"&&r[s]!==null).map(s=>{let e=r[s];return Di(s,e)}).filter(s=>!!s))}var Pe=Ie("format/auto","progressive/yes"),F=([r])=>typeof r<"u"?Number(r):void 0,Pt=()=>true,Ui=([r,s])=>({name:r,amount:typeof s<"u"?Number(s):100}),Fi=([r,s])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(s))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:me(r,"x").map(Number),coords:me(s).map(Number)}},Vi=Object.freeze({enhance:F,brightness:F,exposure:F,gamma:F,contrast:F,saturation:F,vibrance:F,warmth:F,filter:Ui,mirror:Pt,flip:Pt,rotate:F,crop:r=>{let[s,e]=r,{dimensions:t,coords:i}=Fi([s,e]);return {dimensions:t,coords:i}}});function rt(r){let s={};for(let e of r){let[t,...i]=e.split("/");if(!t||!Mt.includes(t))continue;let o=t,n=Vi[o];try{let a=n(i);s[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return s}var b=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),_=Object.freeze([b.CROP,b.TUNING,b.FILTERS]),Ot=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),At=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),Lt=Object.freeze(["rotate","mirror","flip"]),V=fe,M=Object.freeze({brightness:{zero:V.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:V.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:V.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:V.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:V.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:V.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:V.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:V.enhance,range:[0,100],keypointsNumber:1},filter:{zero:V.filter,range:[0,100],keypointsNumber:1}});var zi="https://ucarecdn.com",Ki="https://upload.uploadcare.com",Hi="https://social.uploadcare.com",ji="https://ucarecd.net",Bi={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:zi,cdnCnamePrefixed:ji,baseUrl:Ki,socialBaseUrl:Hi,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:xe(_),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,plugins:[]},z=Object.freeze(Bi);var Me=(r,s)=>(...e)=>{let t=r();if(!t.read(y("debug")))return;let i=e;if(typeof e?.[0]=="function"){let n=e[0];i=n();}let o=[t.id,s].filter(Boolean);console.log(`[${o.join("][")}]`,...i);};var k=class{constructor(s){this._subscriptions=new Set;this._cfgProxy=null;this._debugPrint=Me(()=>this._sharedInstancesBag.ctx,this.constructor.name);this._sharedInstancesBag=s,this._ctx=s.ctx;}addSub(s){this._subscriptions.add(s);}get _cfg(){if(!this._cfgProxy){let s={};this._cfgProxy=new Proxy(s,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(e,t)=>{if(typeof t!="string")return;let i=y(t);return this._sharedInstancesBag.ctx.has(i)?this._sharedInstancesBag.ctx.read(i):z[t]}});}return this._cfgProxy}destroy(){for(let s of this._subscriptions)try{s();}catch{}this._subscriptions.clear();}},Gi={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},O=(r,s,e=true)=>{let t=r.has(s),i=t?r.read(s):null;if(t&&i||!e)return i;throw new Error(`Unexpected error: shared instance for key "${String(s)}" is not available`)},$t=r=>({get ctx(){return r()},get modalManager(){return O(r(),"*modalManager",false)},get pluginManager(){return O(r(),"*pluginManager")},get telemetryManager(){return O(r(),"*telemetryManager")},get localeManager(){return O(r(),"*localeManager")},get a11y(){return O(r(),"*a11y")},get blocksRegistry(){return O(r(),"*blocksRegistry")},get eventEmitter(){return O(r(),"*eventEmitter")},get uploadCollection(){return O(r(),"*uploadCollection")},get secureUploadsManager(){return O(r(),"*secureUploadsManager",false)},get api(){return O(r(),"*publicApi")},get validationManager(){return O(r(),"*validationManager")},when(s,e){let t=Gi[s],i=r(),o=i.has(t)?i.read(t):void 0;if(o)return e(o),()=>{};let n=i.sub(t,a=>{a&&(e(a),n());});return n}});var re=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Oe=class extends k{constructor(){super(...arguments);this._modals=new Map;this._activeModals=new Set;this._subscribers=new Map;}registerModal(e,t){this._modals.set(e,t),this._notify(re.ADD,{id:e,modal:t});}deleteModal(e){let t=this._modals.get(e);return t?(this._modals.delete(e),this._activeModals.delete(e),this._notify(re.DELETE,{id:e,modal:t}),true):false}open(e){let t=this._modals.get(e);return t?(this._activeModals.add(e),this._notify(re.OPEN,{modal:t,id:e}),true):(this._debugPrint(`Modal with ID "${e}" not found`),false)}close(e){let t=this._modals.get(e);return !t||!this._activeModals.has(e)?(this._debugPrint(`Modal with ID "${e}" not found or not active`),false):(this._activeModals.delete(e),this._notify(re.CLOSE,{id:e,modal:t}),true)}toggle(e){return this._modals.has(e)?this._activeModals.has(e)?this.close(e):this.open(e):(this._debugPrint(`Modal with ID "${e}" not found`),false)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),false;let e=Array.from(this._activeModals).pop();return e?this.close(e):false}closeAll(){let e=this._activeModals.size;return this._activeModals.clear(),this._notify(re.CLOSE_ALL,{}),e}subscribe(e,t){return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.delete(t);}_notify(e,t){if(this._subscribers.has(e))for(let i of this._subscribers.get(e)??new Set)try{i(t);}catch(o){this._sharedInstancesBag.telemetryManager.sendEventError(o,"modal subscriber"),this._debugPrint("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(re.DESTROY,{});}};var Nt="1.27.0-alpha.0";var se="blocks",oe=Nt;var st=()=>({}),Xi=r=>({...st(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),Yi=r=>({...Xi(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Queue(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),js=r=>({...Yi(r),"*solution":null});var ot=class{constructor(){this._listeners=new Map;this._scope=[];}addEventListener(s,e){let t=i=>{let o=i.target;o instanceof Node&&this._scope.some(n=>n===o||n.contains(o))&&e(i);};this._listeners.set(e,t),window.addEventListener(s,t);}removeEventListener(s,e){let t=this._listeners.get(e);t&&window.removeEventListener(s,t),this._listeners.delete(e);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(s){this._scope.push(s);}destroy(){this._scope=[];for(let s of this._listeners.values())window.removeEventListener("keydown",s),window.removeEventListener("keyup",s);this._listeners.clear();}},Ae=class{constructor(){this._scopedWindow=new ot,this._destroyKeyUX=startKeyUX(this._scopedWindow,[focusGroupKeyUX(),pressKeyUX("is-pressed"),jumpKeyUX(),hiddenKeyUX()]);}registerBlock(s){this._scopedWindow.registerScope(s);}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy();}};var K=r=>`*l10n/${r}`,ir="en",Le=class extends k{constructor(e){super(e);this._localeName="";for(let[i,o]of Object.entries(he)){let n=this._ctx.has(K(i))?!this._ctx.read(K(i)):true;this._ctx.add(K(i),o,n);}let t=e.pluginManager;t?.onPluginsChange&&this.addSub(t.onPluginsChange(()=>{this._localeName&&this._applyPluginLocales(this._localeName);})),this.addSub(this._ctx.sub(y("localeName"),async i=>{if(!i)return;this._localeName=i;let o=await St(i);i!==ir&&this._localeName!==i||(this._applyPluginLocales(i),this._applyOverrides(i,o));})),this.addSub(this._ctx.sub(y("localeDefinitionOverride"),i=>{if(!i)return;let o=i[this._localeName];o&&this._applyOverrides(this._localeName,o);}));}_applyOverrides(e,t){let i=this._cfg.localeDefinitionOverride?.[e];for(let[o,n]of Object.entries(t)){let a=i?.[o];this._ctx.add(K(o),a??n,true);}}_applyPluginLocales(e){let t=this._sharedInstancesBag.pluginManager;if(!t)return;let i=t.snapshot();for(let o of i.i18n){let{pluginId:n,...a}=o,l=a[e];if(l)for(let[c,p]of Object.entries(l))p!==void 0&&this._ctx.add(K(c),p,true);}}};var $e=class{constructor(){this._definitions=new Map;}register(s,e){if(this._definitions.has(e.name)){console.warn(`[CustomConfig] Config option "${e.name}" is already registered`);return}let t={attribute:true,...e,pluginId:s};this._definitions.set(e.name,t);}unregister(s){this._definitions.delete(s);}unregisterByPlugin(s){for(let[e,t]of this._definitions)t.pluginId===s&&this._definitions.delete(e);}get(s){return this._definitions.get(s)}getAll(){return new Map(this._definitions)}};var Ne=class extends k{constructor(e){super(e);this._plugins=new Map;this._sources=[];this._activities=[];this._fileActions=[];this._icons=[];this._i18n=[];this._subscribers=new Set;this._pluginsUpdate=Promise.resolve();this.configRegistry=new $e;this.addSub(this._ctx.sub(y("plugins"),t=>{this._pluginsUpdate=this._pluginsUpdate.then(()=>this._syncPlugins(t));}));}onPluginsChange(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e);}}async _syncPlugins(e){let t=new Set(this._plugins.keys()),i=new Set;for(let o of e){if(i.has(o.id)){this._debugPrint(`Plugin "${o.id}" is already in the list, skipping duplicate`);continue}i.add(o.id);let n=this._plugins.get(o.id);if(!n||n.plugin!==o)try{await this._registerPlugin(o);}catch(a){this._purgeRegistrations(o.id),this._notifySubscribers(),this._debugPrint(`Plugin "${o.id}" setup failed`,a);}t.delete(o.id);}for(let o of t)this._unregisterPlugin(o);}async _registerPlugin(e){this._plugins.has(e.id)&&this._unregisterPlugin(e.id);let t={sources:[],activities:[],fileActions:[],icons:[],i18n:[]},i=[],l={registry:{registerSource:u=>this._register(this._sources,t.sources,e.id,u),registerActivity:u=>this._register(this._activities,t.activities,e.id,u),registerFileAction:u=>this._register(this._fileActions,t.fileActions,e.id,u),registerIcon:u=>this._register(this._icons,t.icons,e.id,u),registerI18n:u=>this._register(this._i18n,t.i18n,e.id,u),registerConfig:u=>{this.configRegistry.register(e.id,u);}},config:{get:u=>{let h=y(u);return this._ctx.read(h)},subscribe:(u,h)=>{let f=y(u),g=this._ctx.sub(f,C=>{h(C);});return i.push(g),g}},activity:{getParams:()=>this._ctx.read("*currentActivityParams"),subscribeToParams:u=>{let h=this._ctx.sub("*currentActivityParams",f=>{u(f);});return i.push(h),h}}},c=this._sharedInstancesBag.api,p=await e.setup({pluginApi:l,uploaderApi:c})??void 0;this._plugins.set(e.id,{plugin:e,exports:p,registrations:t,configSubscriptions:i}),this._notifySubscribers();}_unregisterPlugin(e){let t=this._plugins.get(e);if(t){this._purgeRegistrations(e);for(let i of t.configSubscriptions)try{i();}catch(o){this._debugPrint("Failed to unsubscribe config listener",o);}t.exports?.dispose?.(),this._plugins.delete(e),this._notifySubscribers();}}snapshot(){return {sources:[...this._sources],activities:[...this._activities],fileActions:[...this._fileActions],icons:[...this._icons],i18n:[...this._i18n]}}destroy(){for(let e of Array.from(this._plugins.keys()))this._unregisterPlugin(e);super.destroy();}_register(e,t,i,o){let n={...o,pluginId:i};return e.push(n),t.push(n),o}_purgeRegistrations(e){this._sources=this._sources.filter(t=>t.pluginId!==e),this._activities=this._activities.filter(t=>t.pluginId!==e),this._fileActions=this._fileActions.filter(t=>t.pluginId!==e),this._icons=this._icons.filter(t=>t.pluginId!==e),this._i18n=this._i18n.filter(t=>t.pluginId!==e),this.configRegistry.unregisterByPlugin(e);}_notifySubscribers(){for(let e of this._subscribers)try{e();}catch{}}};var rr=20,H=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),j=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"}),De=class extends k{constructor(){super(...arguments);this._timeoutStore=new Map;this._targets=new Set;}bindTarget(e){return this._targets.add(e),()=>{this._targets.delete(e);}}_dispatch(e,t){for(let i of this._targets)i.dispatchEvent(new CustomEvent(e,{detail:t}));this._debugPrint?.(()=>{let i=t&&typeof t=="object"?{...t}:t;return [`event "${e}"`,i]});}emit(e,t,i={}){let{debounce:o}=i;if(typeof o!="number"&&!o){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let n=typeof o=="number"?o:rr,a=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this._dispatch(e,l),this._timeoutStore.delete(e);}catch(l){this._debugPrint?.(()=>`Error while getting payload for event "${e}"`,l);}},n);this._timeoutStore.set(e,a);}destroy(){for(let e of this._timeoutStore.values())window.clearTimeout(e);this._targets.clear();}};var Ue=class extends k{constructor(e){super(e);this._sessionId=G.generateRandomUUID();this._config=structuredClone(z);this._initialized=false;this._lastPayload=null;this._isEnabled=false;this._telemetryInstance=new TelemetryAPIService,this._queue=new Queue(10),this.addSub(this._ctx.sub(y("qualityInsights"),t=>{this._isEnabled=!!t;}));for(let t of Object.keys(this._config))this.addSub(this._ctx.sub(y(t),i=>{this._isEnabled&&(this._initialized&&this._config[t]!==i&&this.sendEvent({eventType:H.CHANGE_CONFIG}),this._setConfig(t,i));}));}_init(e){e===H.INIT_SOLUTION&&!this._initialized&&(this._initialized=true);}_setConfig(e,t){this._config[e]!==t&&(this._config[e]=t);}_formattingPayload(e){let t=e.payload?{...e.payload}:{};t.activity&&(t.activity=void 0);let i={...e};return (e.eventType===H.INIT_SOLUTION||e.eventType===H.CHANGE_CONFIG)&&(i.config=this._config),{...i,appVersion:oe,appName:se,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:i.eventType??"",eventTimestamp:this._timestamp,payload:{location:this._location,...t}}}_excludedEvents(e){return !!(e&&[j.CHANGE,j.COMMON_UPLOAD_PROGRESS,j.FILE_ADDED,j.FILE_REMOVED,j.FILE_UPLOAD_START,j.FILE_UPLOAD_PROGRESS,j.FILE_UPLOAD_SUCCESS,j.FILE_UPLOAD_FAILED].includes(e))}sendEvent(e){if(!this._isEnabled)return;let t=this._formattingPayload({eventType:e.eventType,payload:e.payload,config:e.config});this._init(e.eventType),!(this._excludedEvents(e.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,t))&&this._queue.add(async()=>{this._lastPayload=t,await this._telemetryInstance.sendEvent(t);});}sendEventError(e,t="unknown"){this.sendEvent({eventType:H.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:e.message}}});}sendEventCloudImageEditor(e,t,i={}){this.sendEvent({eventType:H.ACTION_EVENT,payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...i}}});}_checkObj(e,t){if(JSON.stringify(e)===JSON.stringify(t))return true;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return false;let i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return false;for(let n of i)if(!Object.hasOwn(t,n)||!this._checkObj(e[n],t[n]))return false;return true}get _timestamp(){return Date.now()}get _solution(){if(!this._ctx.has("*solution"))return null;let e=this._ctx.read("*solution");return e?e.toLowerCase():null}get _activity(){return this._ctx.has("*currentActivity")?this._ctx.read("*currentActivity"):null}get _location(){return location.origin}};var Dt=r=>{let s=new Intl.Locale(r),e="ltr",t=s.getTextInfo?.().direction;return t?e=t:s.textInfo?.direction&&(e=s.textInfo.direction),e};var nr=r=>r;var Ut="plural:";function Fe(r,s={},e={}){let{openToken:t="{{",closeToken:i="}}",transform:o=nr}=e;for(let n in s){let a=s[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);r=r.replaceAll(t+n+i,c);}return r}function Ft(r){let s=[],e=r.indexOf("{{");for(;e!==-1;){let t=r.indexOf("}}",e);if(t===-1)break;let i=r.substring(e+2,t);if(i.startsWith(Ut)){let o=r.substring(e+2,t).replace(Ut,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));s.push({variable:i,pluralKey:n,countVariable:a});}e=r.indexOf("{{",t);}return s}function S(r,s){let e,t=((...i)=>{e&&clearTimeout(e),e=setTimeout(()=>r(...i),s);});return t.cancel=()=>{e&&clearTimeout(e);},t}var Vt="--uploadcare-blocks-window-height",ge=class r{static{this.clientsRegistry=new Set;}static{this.flush=S(()=>{document.documentElement.style.setProperty(Vt,`${window.innerHeight}px`);},100);}static registerClient(s){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(s);}static unregisterClient(s){r.clientsRegistry.delete(s),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Vt);}};var ar=/\\([0-9a-fA-F]{1,6} ?)/g;function lr(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function cr(r){let s=r;return (s[0]==='"'||s[0]==="'")&&(s=s.slice(1)),(s[s.length-1]==='"'||s[s.length-1]==="'")&&(s=s.slice(0,-1)),s}function dr(r){let s="",e="";for(let t=0;t<r.length;t++){let i=r[t+1];r[t]==="\\"&&i==='"'?(s+='\\"',t++):r[t]==='"'&&e!=="\\"?s+='\\"':s+=r[t],e=r[t]??"";}return s}function zt(r){let s=r;lr(r)&&(s=cr(s),s=s.replace(ar,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),s=s.replaceAll(`\\ `,"\\n"),s=dr(s),s='"'+s+'"');try{return JSON.parse(s)}catch{return}}function Kt(r){class s extends r{constructor(){super(...arguments);this._cssDataCache=null;this._computedStyle=null;}getCssData(i,o=false){let n=this._cssDataCache??Object.create(null);if(!Object.keys(n).includes(i)||!n[i]){this._computedStyle||(this._computedStyle=window.getComputedStyle(this));let a=this._computedStyle.getPropertyValue(i).trim();try{n[i]=zt(a);}catch(l){o||console.warn(`CSS Data error: ${i}`,l),n[i]=null;}}return this._cssDataCache=n,n[i]}}return s}function Ht(r){class s extends r{constructor(){super(...arguments);this.willYield=true;this._slotsMap={};this._initialLightDomChildren=null;this._hasAdoptedChildren=false;}createRenderRoot(){return this}connectedCallback(){this._initialLightDomChildren||(this._initialLightDomChildren=Array.from(this.childNodes)),super.connectedCallback();}_adoptChildren(){if(this._hasAdoptedChildren)return;this._hasAdoptedChildren=true,this._slotsMap={};let i=Array.from(this.childNodes),o=i.length?i:this._initialLightDomChildren??[];for(let n of o){let a=this._getSlotNameForChild(n),l=this._slotsMap[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this._slotsMap[a]=l;}this._initialLightDomChildren=null;}_getSlotNameForChild(i){return i instanceof Comment&&i.nextSibling instanceof Element?this._getSlotNameForChild(i.nextSibling):"contentFor"in i?i.contentFor||"":i instanceof Element&&i.hasAttribute("content-for")&&i.getAttribute("content-for")||""}_isTextNodeEmpty(i){return !i.textContent||!i.textContent.trim()}_isSlotEmpty(i){let o=this._slotsMap[i];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this._isTextNodeEmpty(n))}update(i){!this.hasUpdated&&this.willYield&&this._adoptChildren(),super.update(i);}yield(i,o){if(i===""&&!this._slotsMap[i]&&!this._hasAdoptedChildren&&this._initialLightDomChildren?.length){let a=[];for(let l of this._initialLightDomChildren)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this._slotsMap[i]=a,this._hasAdoptedChildren=true,this._initialLightDomChildren=null;}let n=this._slotsMap[i];return html` ${n} ${this._isSlotEmpty(i)?o:void 0} `}}return s}var jt=(r,s)=>new Intl.PluralRules(r).select(s);var ur=r=>(s,e)=>{let t=r(),i=t("locale-id")||"en",o=jt(i,e);return t(`${s}__${o}`)},Bt=r=>{let s=ur(()=>e),e=(t,i={})=>{if(!t)return "";let n=r().read(K(t))||t,a=Ft(n);for(let c of a)i[c.variable]=s(c.pluralKey,Number(i[c.countVariable]));return Fe(n,i)};return e};function Gt(r){class s extends r{static reg(t){let i=this,o=window.customElements.get(t);if(o){o!==i&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(t,i);}}return s}var Wt=createContext("ctx-name-context");function qt(){return function(r){class s extends r{constructor(...i){super(...i);this._symbioteSharedPubSub=null;this._symbioteFirstUpdated=false;this._needsReconnectInit=false;this._ctxNameProvider=void 0;this._pendingSharedAdds=new Map;this._symbioteSubscriptions=new Set;this.init$={};this.ctxOwner=false;this._ctxNameAttrValue=void 0;this._pendingCtxInitOnConnect=false;this.ctxName=this._effectiveCtxName;this._isInitialized=false;this._ctxNameAttrValue=this.getAttribute("ctx-name")||void 0,this.ctxName=this._effectiveCtxName,this._ctxNameConsumer=new ContextConsumer(this,{context:Wt,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this._ctxNameFromContext=o,this._handleCtxNameSourceChange();},subscribe:true});}static set template(i){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get _ctxNameAttr(){return this._ctxNameAttrValue}set _ctxNameAttr(i){let o=i??void 0;this._ctxNameAttrValue!==o&&(this._ctxNameAttrValue=o,this._handleCtxNameSourceChange());}shouldUpdate(i){return this._isInitialized?super.shouldUpdate(i):false}get _effectiveCtxName(){return this._ctxNameAttr||this._ctxNameFromContext||void 0}_handleCtxNameSourceChange(){if(this.ctxName=this._effectiveCtxName,!(!this.ctxName||this._symbioteFirstUpdated)){if(this.isConnected){this._performInitialization();return}this._pendingCtxInitOnConnect=true;}}willUpdate(i){super.willUpdate(i),this.ctxName=this._effectiveCtxName,this.ctxName&&(this._ctxNameProvider?this._ctxNameProvider.setValue(this.ctxName):this._ctxNameProvider=new ContextProvider(this,{context:Wt,initialValue:this.ctxName}));}_applyPendingSharedAdds(){if(!(!this._symbioteSharedPubSub||this._pendingSharedAdds.size===0)){for(let[i,{value:o,rewrite:n}]of this._pendingSharedAdds)this._symbioteSharedPubSub.add(i,o,n);this._pendingSharedAdds.clear();}}_getSharedPubSub(){return !this._symbioteSharedPubSub&&this._effectiveCtxName&&this._initSharedContext(),this._symbioteSharedPubSub&&this._applyPendingSharedAdds(),this._symbioteSharedPubSub}_requireSharedPubSub(){let i=this._getSharedPubSub();if(!i)throw new Error("SymbioteMixin: Shared context is not initialized.");return i}_initSharedContext(){let i=this.init$,o=this._effectiveCtxName;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this._symbioteSharedPubSub){this._symbioteSharedPubSub=J.getCtx(o)??J.registerCtx(i,o);for(let[n,a]of Object.entries(this.init$))this._symbioteSharedPubSub.add(n,a,this.ctxOwner);this._applyPendingSharedAdds();}}get $(){return this._effectiveCtxName&&this._initSharedContext(),new Proxy({},{get:(i,o)=>{if(typeof o=="string")return this._symbioteSharedPubSub?.read(o)},set:(i,o,n)=>(typeof o!="string"||this._symbioteSharedPubSub?.pub(o,n),true)})}sub(i,o,n=true){let a=this._requireSharedPubSub().sub(i,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,p=()=>{c||(c=true,l(),this._symbioteSubscriptions.delete(p));};return this._symbioteSubscriptions.add(p),p}pub(i,o){this._requireSharedPubSub().pub(i,o);}set$(i){for(let[o,n]of Object.entries(i))this.pub(o,n);}get sharedCtx(){return this._requireSharedPubSub()}has(i){return this._symbioteSharedPubSub?.has(i)??false}add(i,o,n=false){let a=this._getSharedPubSub();if(!a){if(!n&&this._pendingSharedAdds.has(i))return;this._pendingSharedAdds.set(i,{value:o,rewrite:n});return}this._pendingSharedAdds.delete(i),a.add(i,o,n);}add$(i,o=false){for(let[n,a]of Object.entries(i))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this._symbioteFirstUpdated?this._isInitialized&&this._needsReconnectInit&&(this._needsReconnectInit=false,this.initCallback()):this.ctxName?(this._pendingCtxInitOnConnect=false,this._performInitialization()):this._pendingCtxInitOnConnect&&this._effectiveCtxName&&(this._pendingCtxInitOnConnect=false,this._performInitialization());}_performInitialization(){if(this._symbioteFirstUpdated)return;this._symbioteFirstUpdated=true,this._initSharedContext();let i=this.init$;if(Object.keys(i).length>0){let o=this._requireSharedPubSub();for(let[n,a]of Object.entries(i))o.read(n)===void 0&&o.pub(n,a),this.sub(n,S(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._isInitialized=true,this.requestUpdate();}firstUpdated(i){super.firstUpdated(i);}disconnectedCallback(){this._cleanupSymbioteSubscriptions(),super.disconnectedCallback(),this._symbioteFirstUpdated&&(this._needsReconnectInit=true);}_cleanupSymbioteSubscriptions(){if(this._symbioteSubscriptions.size!==0){for(let i of [...this._symbioteSubscriptions])i();this._symbioteSubscriptions.clear();}}initCallback(){}}return a([property({type:String,attribute:"ctx-name",noAccessor:true})],s.prototype,"_ctxNameAttr",1),a([state()],s.prototype,"_ctxNameFromContext",2),a([state()],s.prototype,"ctxName",2),a([state()],s.prototype,"_isInitialized",2),s}}var vr=r=>r.tagName?.includes("-")??false,Ve=class{constructor(s){this._trackedElements=new Set;this._originalValues=new Map;this._enabled=false;this._host=s,this._host.addController(this);}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0,this._trackedElements.clear(),this._originalValues.clear();}hostUpdated(){if(!this._unsubscribe&&this._host.has(y("testMode"))){let s=this._host.subConfigValue("testMode",e=>{this._enabled=!!e,this._applyTestMode();});this._unsubscribe=s;}this._collectElements(),this._applyTestMode();}_collectElements(){let s=this._host,e=s.renderRoot??s;if(!e)return;let t=this._host,i=t.tagName?.toLowerCase(),o=Array.from(e.querySelectorAll("[data-testid]")).filter(n=>!vr(n));for(let n of o)if(!(i&&n.closest(i)!==t)&&!this._trackedElements.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this._trackedElements.add(n),this._originalValues.set(n,a);}for(let n of Array.from(this._trackedElements))(!n.isConnected||i&&n.closest(i)!==t)&&(this._trackedElements.delete(n),this._originalValues.delete(n));}_applyTestMode(){if(!this._trackedElements.size)return;let s=this._host.testId||"";for(let e of this._trackedElements){let t=this._originalValues.get(e);t&&(this._enabled?e.setAttribute("data-testid",`${s}--${t}`):e.removeAttribute("data-testid"));}}};var yr=Gt(qt()(Kt(Ht(LitElement)))),v=class extends yr{constructor(){super();this.activityType=null;this.init$=st();this.l10n=Bt(()=>this.sharedCtx);this.debugPrint=Me(()=>this.sharedCtx,this.constructor.name);this._sharedInstancesBag=$t(()=>this.sharedCtx);new Ve(this);}static{this.styleAttrs=[];}emit(e,t,i){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.emit(e,t,i);let n=typeof t=="function"?t():t;this.telemetryManager.sendEvent({eventType:e,payload:n??void 0});}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"");}),super.connectedCallback(),ge.registerClient(this);}initCallback(){this._addSharedContextInstance("*blocksRegistry",()=>new Set),this._addSharedContextInstance("*pluginManager",e=>new Ne(e)),this._addSharedContextInstance("*eventEmitter",e=>new De(e)),this._addSharedContextInstance("*localeManager",e=>new Le(e)),this._addSharedContextInstance("*modalManager",e=>new Oe(e)),this._addSharedContextInstance("*a11y",()=>new Ae),this._addSharedContextInstance("*telemetryManager",e=>new Ue(e)),this.sub(K("locale-id"),e=>{let t=Dt(e);this.style.direction=t==="ltr"?"":t,this.requestUpdate();}),this.subConfigValue("testMode",e=>{if(!e||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this._getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this._getSharedContextInstance("*telemetryManager")}get localeManager(){return this._getSharedContextInstance("*localeManager")}get a11y(){return this._getSharedContextInstance("*a11y")}get blocksRegistry(){return this._getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this._getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),ge.unregisterClient(this);let e=this.blocksRegistry;e?.delete(this),e?.size===0&&setTimeout(()=>{this.isConnected||e?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this._destroySharedContextInstances(),J.deleteCtx(this.ctxName);}_getSharedContextInstances(){let e="*sharedContextInstances";if(!this.has(e)||!this.$[e]){let t=new Map;this.add(e,t,true);}return this.$[e]}_addSharedContextInstance(e,t){let i=this._getSharedContextInstances();if(!i.has(e)&&(!this.has(e)||!this.$[e])){let o=t(this._sharedInstancesBag);this.add(e,o,true),i.set(e,o);return}}_destroySharedContextInstances(){let e=this._getSharedContextInstances();for(let[t,i]of e.entries())i?.destroy?.(),this.pub(t,null);e.clear();}_getSharedContextInstance(e,t=true){if(this.has(e)&&this.$[e])return this.$[e];if(!t)return this.$[e];throw new Error(`Unexpected error: context manager for key "${String(e)}" is not available`)}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:ke(e),cdnUrlModifiers:et(e),fileName:Re(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),this.telemetryManager.sendEventError(t,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?Fe(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this._cfgProxy){let e={};this._cfgProxy=new Proxy(e,{set:(t,i,o)=>{if(typeof i!="string"||!(i in z))return false;let n=i,a=y(n);return this.has(a)||this.add(a,z[n]),this.$[a]=o,true},get:(t,i)=>{let o=y(i);return this.has(o)||this.add(o,z[i]),this.$[o]}});}return this._cfgProxy}subConfigValue(e,t){let i=y(e);return this.has(i)||this.add(i,z[e]),this.sub(i,t)}};var ve=class extends v{constructor(){super(...arguments);this.name="";this._resolvedHref="";this._pluginSvg=null;this._iconHrefResolver=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this._iconHrefResolver=t,this._updateResolvedHref();});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateResolvedHref()));}willUpdate(e){super.willUpdate(e),e.has("name")&&this._updateResolvedHref();}_updateResolvedHref(){if(!this.name){this._resolvedHref="",this._pluginSvg=null;return}let t=this._sharedInstancesBag.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(t){this._pluginSvg=t.svg,this._resolvedHref="";return}this._pluginSvg=null;let i=`#uc-icon-${this.name}`,o=this._iconHrefResolver?.(this.name);this._resolvedHref=o??i;}render(){return this._pluginSvg?html`${this.yield("",html`${unsafeSVG(this._pluginSvg)}`)}`:html` ${this.yield("",html`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this._resolvedHref}></use></svg>`)} `}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback();}};a([property({type:String})],ve.prototype,"name",2),a([state()],ve.prototype,"_resolvedHref",2),a([state()],ve.prototype,"_pluginSvg",2);function Yt(...r){return r.reduce((s,e)=>{if(typeof e=="string")return s[e]=true,s;for(let t of Object.keys(e))s[t]=e[t];return s},{})}function E(...r){let s=Yt(...r);return Object.keys(s).reduce((e,t)=>(s[t]&&e.push(t),e),[]).join(" ")}function Zt(r,...s){let e=Yt(...s);for(let t of Object.keys(e))r.classList.toggle(t,!!e[t]);}var ee={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Ke=class extends v{constructor(){super(...arguments);this._visible=false;this._styles=ee;this._visibleStyle=ee.visible;this._hiddenStyle=ee.hidden;this._externalTransitions=false;this._initialRenderComplete=false;}set visible(e){this._visible=e,this._handleVisible();}get visible(){return this._visible}set styles(e){this._styles=e,this._externalTransitions=true,this._visibleStyle=e.visible??ee.visible,this._hiddenStyle=e.hidden??ee.hidden;}get styles(){return this._styles}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Zt(this,{[ee.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.toggleAttribute("inert",!this._visible);}_dispatchInitialRenderEvent(){this._initialRenderComplete||(this._initialRenderComplete=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this._externalTransitions||this.classList.add(ee.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this._dispatchInitialRenderEvent();},0);}};a([property({type:Boolean})],Ke.prototype,"visible",1),a([property({attribute:false})],Ke.prototype,"styles",1);var at=class extends v{constructor(){super(...arguments);this.active=false;this._lineRef=createRef();this._isAnimating=false;this._handleTransitionEndRight=()=>{let e=this._lineRef.value;e&&(this._resetLine(e),this._isAnimating&&this.active&&this._start());};}firstUpdated(e){super.firstUpdated(e),this.active&&this._start();}updated(e){super.updated(e),e.has("active")&&(this.active?this._start():this._stop());}_start(){let e=this._lineRef.value;if(!e)return;this._isAnimating=true;let{width:t}=this.getBoundingClientRect();e.removeEventListener("transitionend",this._handleTransitionEndRight),e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:true});}_stop(){let e=this._lineRef.value;e&&(this._isAnimating=false,e.removeEventListener("transitionend",this._handleTransitionEndRight),this._resetLine(e));}_resetLine(e){e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)";}render(){return html`<div class="uc-inner"><div class="uc-line" ${ref(this._lineRef)}></div></div>`}};a([property({type:Boolean,reflect:true})],at.prototype,"active",2);var A=class extends v{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(e){super.firstUpdated(e),this._applyReverse(),this._applyThemeClass();}updated(e){super.updated(e),e.has("reverse")&&this._applyReverse(),e.has("theme")&&this._applyThemeClass();}_applyReverse(){this.style.flexDirection=this.reverse?"row-reverse":"";}_applyThemeClass(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get _iconClassMap(){let e=this._computedIconHidden;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":e,"uc-icon_single":this._computedIconSingle}}get _computedIconHidden(){return !this.icon}get _computedIconSingle(){return !this.text&&!this._computedIconHidden}render(){return html`<button type="button" role=${ifDefined(this.ariaRole||void 0)} aria-controls=${ifDefined(this.ariaControls||void 0)} aria-label=${ifDefined(this.l10n(this.titleProp))} title=${ifDefined(this.l10n(this.titleProp))} ><uc-icon class=${classMap(this._iconClassMap)} name=${ifDefined(this.icon||void 0)} ?hidden=${this._computedIconHidden} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};a([property({type:String})],A.prototype,"text",2),a([property({type:String})],A.prototype,"icon",2),a([property({type:Boolean,reflect:true})],A.prototype,"reverse",2),a([property({type:String,reflect:true})],A.prototype,"theme",2),a([property({attribute:"aria-role"})],A.prototype,"ariaRole",2),a([property({attribute:"aria-controls"})],A.prototype,"ariaControls",2),a([property({attribute:"title-prop"})],A.prototype,"titleProp",2),a([property({type:Boolean,noAccessor:true})],A.prototype,"active",2);var ye=33.333333333333336,m=1,lt=24,Jt=6;function X(r,s){for(let[e,t]of Object.entries(s))r.setAttributeNS(null,e,t.toString());}function x(r,s={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return X(e,s),e}function ei(r,s,e){let{x:t,y:i,width:o,height:n}=r,a=s.includes("w")?0:1,l=s.includes("n")?0:1,c=a===0?-1:1,p=l===0?-1:1,u=[t+a*o+1.5*c,i+l*n+1.5*p-24*e*p],h=[t+a*o+1.5*c,i+l*n+1.5*p],f=[t+a*o-24*e*c+1.5*c,i+l*n+1.5*p],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,C=[h[0],h[1]];return {d:g,center:C}}function ti(r,s,e){let{x:t,y:i,width:o,height:n}=r,a=s==="n"||s==="s",l=s==="w"||s==="e",c=a?.5:s==="w"?0:1,p=l?.5:s==="n"?0:1,u=s==="w"?-1:s==="e"?1:0,h=s==="n"?-1:s==="s"?1:0,f,g;a?(f=[t+c*o-34*e/2,i+p*n+1.5*h],g=[t+c*o+34*e/2,i+p*n+1.5*h]):(f=[t+c*o+1.5*u,i+p*n-34*e/2],g=[t+c*o+1.5*u,i+p*n+34*e/2]);let C=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,I=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:C,center:I}}function ii(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function ri({rect:r,delta:[s,e],imageBox:t}){return ae({...r,x:r.x+s,y:r.y+e},t)}function ae(r,s){let{x:e}=r,{y:t}=r;return r.x<s.x?e=s.x:r.x+r.width>s.x+s.width&&(e=s.x+s.width-r.width),r.y<s.y?t=s.y:r.y+r.height>s.y+s.height&&(t=s.y+s.height-r.height),{...r,x:e,y:t}}function Rr({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[,i]=s,{y:o,width:n,height:a}=r;o+=i,a-=i,e&&(n=a*e);let l=r.x+r.width/2-n/2;return o<=t.y&&(o=t.y,a=r.y+r.height-o,e&&(n=a*e,l=r.x+r.width/2-n/2)),l<=t.x&&(l=t.x,o=r.y+r.height-a),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=r.y+r.height-a),a<m&&(a=m,e&&(n=a*e,l=r.x+r.width/2-n/2),o=r.y+r.height-a),n<m&&(n=m,e&&(a=n/e,l=r.x+r.width/2-n/2),o=r.y+r.height-a),{x:l,y:o,width:n,height:a}}function kr({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i]=s,{x:o,width:n,height:a}=r;o+=i,n-=i,e&&(a=n/e);let l=r.y+r.height/2-a/2;return o<=t.x&&(o=t.x,n=r.x+r.width-o,e&&(a=n/e,l=r.y+r.height/2-a/2)),l<=t.y&&(l=t.y,o=r.x+r.width-n),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=r.x+r.width-n),a<m&&(a=m,e&&(n=a*e),l=r.y+r.height/2-a/2,o=r.x+r.width-n),n<m&&(n=m,e&&(a=n/e),l=r.y+r.height/2-a/2,o=r.x+r.width-n),{x:o,y:l,width:n,height:a}}function Pr({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[,i]=s,{y:o,width:n,height:a}=r;a+=i,e&&(n=a*e);let l=r.x+r.width/2-n/2;return o+a>=t.y+t.height&&(a=t.y+t.height-o,e&&(n=a*e),l=r.x+r.width/2-n/2),l<=t.x&&(l=t.x,o=r.y),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=r.y),a<m&&(a=m,e&&(n=a*e),l=r.x+r.width/2-n/2),n<m&&(n=m,e&&(a=n/e),l=r.x+r.width/2-n/2),{x:l,y:o,width:n,height:a}}function Mr({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i]=s,{x:o,width:n,height:a}=r;n+=i,e&&(a=n/e);let l=r.y+r.height/2-a/2;return o+n>=t.x+t.width&&(n=t.x+t.width-o,e&&(a=n/e),l=r.y+r.height/2-a/2),l<=t.y&&(l=t.y,o=r.x),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=r.x),a<m&&(a=m,e&&(n=a*e),l=r.y+r.height/2-a/2),n<m&&(n=m,e&&(a=n/e),l=r.y+r.height/2-a/2),{x:o,y:l,width:n,height:a}}function Or({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i,o]=s,{x:n,y:a,width:l,height:c}=r;return n+i<t.x&&(i=t.x-n),a+o<t.y&&(o=t.y-a),n+=i,l-=i,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x+r.width-l,a=t.y)):e&&(i=c*e-l,l=l+i,n-=i,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y+r.height-c)),c<m&&(c=m,e&&(l=c*e),n=r.x+r.width-l,a=r.y+r.height-c),l<m&&(l=m,e&&(c=l/e),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Ar({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i,o]=s,{x:n,y:a,width:l,height:c}=r;return n+l+i>t.x+t.width&&(i=t.x+t.width-n-l),a+o<t.y&&(o=t.y-a),l+=i,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x,a=t.y)):e&&(i=c*e-l,l+=i,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y+r.height-c)),c<m&&(c=m,e&&(l=c*e),a=r.y+r.height-c),l<m&&(l=m,e&&(c=l/e),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Lr({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i,o]=s,{x:n,y:a,width:l,height:c}=r;return n+i<t.x&&(i=t.x-n),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),n+=i,l-=i,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x+r.width-l,a=t.y+t.height-c)):e&&(i=c*e-l,l+=i,n-=i,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y)),c<m&&(c=m,e&&(l=c*e),n=r.x+r.width-l),l<m&&(l=m,e&&(c=l/e),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function $r({rect:r,delta:s,aspectRatio:e,imageBox:t}){let[i,o]=s,{x:n,y:a,width:l,height:c}=r;return n+l+i>t.x+t.width&&(i=t.x+t.width-n-l),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),l+=i,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x,a=t.y+t.height-c)):e&&(i=c*e-l,l+=i,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y)),c<m&&(c=m,e&&(l=c*e)),l<m&&(l=m,e&&(c=l/e)),{x:n,y:a,width:l,height:c}}function si({direction:r,...s}){switch(r){case "n":return Rr(s);case "w":return kr(s);case "s":return Pr(s);case "e":return Mr(s);case "nw":return Or(s);case "ne":return Ar(s);case "sw":return Lr(s);case "se":return $r(s);default:return s.rect}}function oi(r,[s,e]){return r.x<=s&&s<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}function ni(r,s){return r.x>=s.x&&r.y>=s.y&&r.x+r.width<=s.x+s.width&&r.y+r.height<=s.y+s.height}function ai(r,s){return Math.abs(r.width/r.height-s)<.1}function le({width:r,height:s},e){let t=e/90%2!==0;return {width:t?s:r,height:t?r:s}}function zn(r,s,e){let t=r/s,i,o;t>e?(i=Math.round(s*e),o=s):(i=r,o=Math.round(r/e));let n=Math.round((r-i)/2),a=Math.round((s-o)/2);return n+i>r&&(i=r-n),a+o>s&&(o=s-a),{x:n,y:a,width:i,height:o}}function ce(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function Y(r,s,e){return Math.min(Math.max(r,s),e)}var ct=class extends v{constructor(){super(...arguments);this._backdropMaskId=`uc-backdrop-mask-${G.generateFastUid()}`;this._guidesHidden=false;this._draggingValue=false;this._svgRef=createRef();this._svgReady=false;this._pendingMaskHref=null;this._handlePointerUp=e=>{this._updateCursor(),this._dragging&&(e.stopPropagation(),e.preventDefault(),this._dragging=false);};this._handlePointerMove=e=>{if(!this._dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this._svgElement;if(!t)return;let{x:i,y:o}=t.getBoundingClientRect(),n=e.x-i,a=e.y-o,l=n-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:p}=this._draggingThumb,u=this._calcCropBox(p,[l,c]);u&&(this.$["*cropBox"]=u);};this._handleSvgPointerMove=e=>{if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(!i||this._shouldThumbBeDisabled(i.direction))return false;let n=i.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return oi(a,[e.x,e.y])});this._hoverThumb=t,this._updateCursor();};}get _svgElement(){return this._svgRef.value??null}get _dragging(){return this._draggingValue}set _dragging(e){this._draggingValue!==e&&(this._draggingValue=e,this._applyGuidesDragState());}_applyGuidesDragState(){this._frameGuides&&this._frameGuides.setAttribute("class",E({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&this._draggingValue,"uc-guides--semi-hidden":!this._guidesHidden&&!this._draggingValue}));}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return false;if(e===""&&t.height<=m&&t.width<=m)return true;let i=t.height<=m&&(e.includes("n")||e.includes("s")),o=t.width<=m&&(e.includes("e")||e.includes("w"));return i||o}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:o,height:n}=e,a=this._svgElement;if(!a)return;let l=x("mask",{id:this._backdropMaskId}),c=x("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=x("rect",{x:t,y:i,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(p);let u=x("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this._backdropMaskId})`});a.appendChild(u),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=p;}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block");}));}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:o,height:n}=e;this._backdropMaskInner&&X(this._backdropMaskInner,{x:t,y:i,width:o,height:n});}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{direction:i,pathNode:o,interactionNode:n,groupNode:a}=t,l=i==="",c=i.length===2,{x:p,y:u,width:h,height:f}=e;if(l)X(n,{x:p,y:u,width:h,height:f});else {let C=Y(Math.min(h,f)/82/2,0,1),I=c?ei(e,i,C):ti(e,i,C),R=I.center;if(!R)continue;let Ee=Math.max(lt*Y(Math.min(h,f)/lt/3,0,1),Jt);X(n,{x:R[0]-Ee,y:R[1]-Ee,width:Ee*2,height:Ee*2}),X(o,{d:I.d});}let g=this._shouldThumbBeDisabled(i);a.setAttribute("class",E("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}X(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1});}}_createThumb(e,t){let i=x("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let o=x("rect",{fill:"transparent"}),n=x("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(n),i.appendChild(o),e[t]={direction:t,pathNode:n,interactionNode:o,groupNode:i},t===""&&(i.style.cursor="move"),o.addEventListener("pointerdown",this._handlePointerDown.bind(this,t));}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let o=`${["n","","s"][t]}${["w","","e"][i]}`;o!==""&&this._createThumb(e,o);}return this._createThumb(e,""),e}_createGuides(){let e=x("svg"),t=x("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let o=x("line",{x1:`${ye*i}%`,y1:"0%",x2:`${ye*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}for(let i=1;i<=2;i++){let o=x("line",{x1:"0%",y1:`${ye*i}%`,x2:"100%",y2:`${ye*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this._svgElement;if(!e)return;let t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let o=this._createThumbs();for(let{groupNode:n}of Object.values(o))t.appendChild(n);e.appendChild(t),this._frameThumbs=o,this._frameGuides=i,this._applyGuidesDragState();}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(!i||this._shouldThumbBeDisabled(e))return;let o=this.$["*cropBox"],n=this._svgElement;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=t.x-a,p=t.y-l;this._dragging=true,this._draggingThumb=i,this._dragStartPoint=[c,p],this._dragStartCrop={...o};}_calcCropBox(e,t){let[i,o]=t,n=this.$["*imageBox"],a=this._dragStartCrop??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(e===""?a=ri({rect:a,delta:[i,o],imageBox:n}):a=si({rect:a,delta:[i,o],direction:e,aspectRatio:c,imageBox:n}),!Object.values(a).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return ae(ce(a),n)}_updateCursor(){let e=this._hoverThumb,t=this._svgElement;t&&(t.style.cursor=e?ii(e.direction):"initial");}_createMask(e){if(this._frameImage){this._frameImage.setAttribute("href",e);return}let t=this._svgElement;if(!t){this._pendingMaskHref=e;return}this._pendingMaskHref=null;let i=document.createDocumentFragment(),o=x("image",{href:e});o.setAttribute("class","uc-cloud-mask"),i.appendChild(o),t.appendChild(i),this._frameImage=o;}_updateMask(){let e=this.$["*cropBox"];if(!e||!this._frameImage)return;let{x:t,y:i,width:o,height:n}=e;X(this._frameImage,{x:t,y:i,height:n,width:o});}_render(){this._svgReady&&(this._updateBackdrop(),this._updateFrame(),this._updateMask());}toggleThumbs(e){if(this._frameThumbs)for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{groupNode:i}=t;i.setAttribute("class",E("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._resizeBackdrop(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();});}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=m||e.width<=m,this._applyGuidesDragState(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();}));}),this.subConfigValue("cloudImageEditorMaskHref",e=>{e&&this._createMask(e);}),document.addEventListener("pointermove",this._handlePointerMove,true),document.addEventListener("pointerup",this._handlePointerUp,true);}firstUpdated(e){super.firstUpdated(e),this._initializeSvg();}_initializeSvg(){let e=this._svgElement;if(!(!e||this._svgReady)){if(this._createBackdrop(),this._createFrame(),this._svgReady=true,e.addEventListener("pointermove",this._handleSvgPointerMove,true),this._pendingMaskHref){let t=this._pendingMaskHref;this._pendingMaskHref=null,this._createMask(t);}this._render();}}disconnectedCallback(){super.disconnectedCallback(),this._svgElement?.removeEventListener("pointermove",this._handleSvgPointerMove,true),document.removeEventListener("pointermove",this._handlePointerMove,true),document.removeEventListener("pointerup",this._handlePointerUp,true);}render(){return html`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${ref(this._svgRef)}></svg>`}};a([state()],ct.prototype,"_draggingValue",2);var Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function _e(r){let s=new Image;return {promise:new Promise((i,o)=>{s.src=r,s.onload=()=>i(),s.onerror=n=>o(n);}),image:s,cancel:()=>{s.naturalWidth===0&&(s.src=Z);}}}function Te(r){let s=[];for(let o of r){let n=_e(o);s.push(n);}let e=s.map(o=>o.image);return {promise:Promise.allSettled(s.map(o=>o.promise)),images:e,cancel:()=>{s.forEach(o=>{o.cancel();});}}}var li=(r,s)=>{let e=false,t,i=0,o=((...n)=>{e?(t&&clearTimeout(t),t=setTimeout(()=>{Date.now()-i>=s&&(r(...n),i=Date.now());},Math.max(s-(Date.now()-i),0))):(r(...n),i=Date.now(),e=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{t&&clearTimeout(t);}}),o};function ci(r,s){let e={};for(let t of s){let i=r[t];(Object.hasOwn(r,t)||i!==void 0)&&(e[t]=i);}return e}function de(r,s,e){let i=window.devicePixelRatio,o=Math.min(Math.ceil(s*i),3e3),n=i>=2?"lightest":"normal";return U(r,D(Pe,W(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${se}/${oe}/uc-cloud-image-editor/`))}function Hr(r){return r?[({dimensions:e,coords:t})=>[...e,...t].every(i=>Number.isInteger(i)&&Number.isFinite(i)),({dimensions:e,coords:t})=>e.every(i=>i>0)&&t.every(i=>i>=0)].every(e=>e(r)):true}var dt=class extends v{constructor(){super();this.ctxOwner=true;this._imageSize={width:0,height:0};this._ctx=null;this._isActive=false;this._image=null;this._canvasRef=createRef();this._frameRef=createRef();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=li(()=>{!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw());},100);}firstUpdated(e){super.firstUpdated(e),this._initCanvas();}_syncTransformations(){let e=this.$["*editorTransformations"],t=ci(e,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...t};this.$["*operations"]=i;}_initCanvas(){let e=this._canvasRef.value;if(!e)return;let t=e.getContext("2d"),i=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${i}px`,e.style.height=`${o}px`,e.width=i*n,e.height=o*n,t?.scale(n,n),this._canvas=e,this._ctx=t;}_alignImage(){if(!this._isActive||!this._image)return;let e=this._image,t=this.$["*padding"],i=this.$["*operations"],{rotate:o}=i,n={width:this.offsetWidth,height:this.offsetHeight},a=le({width:e.naturalWidth,height:e.naturalHeight},o),l;if(a.width>n.width-t*2||a.height>n.height-t*2){let c=a.width/a.height,p=n.width/n.height;if(c>p){let u=n.width-t*2,h=u/c,f=0+t,g=t+(n.height-t*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-t*2,h=u*c,f=t+(n.width-t*2)/2-h/2,g=0+t;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:p}=a,u=t+(n.width-t*2)/2-c/2,h=t+(n.height-t*2)/2-p/2;l={x:u,y:h,width:c,height:p};}this.$["*imageBox"]=ce(l);}_alignCrop(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:o}=i,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=t;if(n){let{dimensions:[h,f],coords:[g,C]}=n,{width:I}=le(this._imageSize,o),R=a/I;e=ae(ce({x:l+g*R,y:c+C*R,width:h*R,height:f*R}),t);}let p=this.$["*currentAspectRatio"],u=p?p.width/p.height:void 0;if(!ni(e,t)||u&&!ai(e,u)){let h=t.width/t.height,f=t.width,g=t.height;u&&(h>u?f=Math.min(t.height*u,t.width):g=Math.min(t.width/u,t.height)),e={x:t.x+t.width/2-f/2,y:t.y+t.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=ae(ce(e),t);}_drawImage(){let e=this._ctx;if(!e)return;let t=this._image;if(!t)return;let i=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=le({width:i.width,height:i.height},l);e.save(),e.translate(i.x+i.width/2,i.y+i.height/2),e.rotate(l*Math.PI*-1/180),e.scale(n?-1:1,a?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore();}_draw(){if(!this._isActive||!this._image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage();}_animateIn({fromViewer:e}){this._image&&(this._frameRef.value?.toggleThumbs(true),this._transitionToImage(),setTimeout(()=>{this.className=E({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":false});}));}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:o}=i,{width:n,height:a}=t,{width:l,height:c}=le(this._imageSize,o),{width:p,height:u}=e,h=n/l,f=a/c;return [Y(Math.round(p/h),1,l),Y(Math.round(u/f),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:o}=i,{width:n,height:a,x:l,y:c}=t,{width:p,height:u}=le(this._imageSize,o),{x:h,y:f}=e,g=n/p,C=a/u,I=this._getCropDimensions(),R={dimensions:I,coords:[Y(Math.round((h-l)/g),0,p-I[0]),Y(Math.round((f-c)/C),0,u-I[1])]};if(!Hr(R)){console.error("Cropper is trying to create invalid crop object",{payload:R});return}if(!(I[0]===p&&I[1]===u))return R}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:i,flip:o}=e,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:i,flip:o};this.$["*editorTransformations"]=l;}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw());}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=true,await this.updateComplete,this._initCanvas(),this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{let i=this.$["*originalUrl"],o=this.$["*editorTransformations"];this._image=await this._waitForImage(i,o),this._syncTransformations(),this._handleResizeThrottled(),this._animateIn({fromViewer:t});}catch(i){console.error("Failed to activate cropper",{error:i}),this.telemetryManager.sendEventError(i,"cloud editor image. Failed to activate cropper");}this._observer=new ResizeObserver(i=>{let[o]=i;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this._isActive&&this._image&&this._handleResizeThrottled();}),this._observer.observe(this);}}deactivate({reset:e=false}={}){this._isActive&&(!e&&this._commit(),this._isActive=false,this._transitionToCrop(),this.className=E({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this._frameRef.value?.toggleThumbs(false),this.addEventListener("transitionend",this._reset,{once:true}),this._observer?.disconnect());}_transitionToCrop(){let e=this._getCropDimensions(),t=this.$["*cropBox"],i=Math.min(this.offsetWidth,e[0])/t.width,o=Math.min(this.offsetHeight,e[1])/t.height,n=Math.min(i,o),a=t.x+t.width/2,l=t.y+t.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}_transitionToImage(){let e=this.$["*cropBox"],t=e.x+e.width/2,i=e.y+e.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${i}px`;}_reset(){this._isActive||(this._image=null);}async _waitForImage(e,t){let i=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(de(e,i,t)),{promise:n,cancel:a,image:l}=_e(o),c=this._handleImageLoading(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this._cancelPreload?.(),this._cancelPreload=a,n.then(()=>l).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,l))}_handleImageLoading(e){let t="crop",i=this.$["*loadingOperations"],o=i.get(t);return o||(o=new Map,i.set(t,o)),o.get(e)||(o.set(e,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=i);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw();}),this.sub("*cropBox",()=>{this._image&&this._commitDebounced();}),this.sub("*currentAspectRatio",()=>{this._alignCrop();}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this._imageSize&&this.activate(this._imageSize,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._image&&(this._image=null);}render(){return html`<canvas class="uc-canvas" ${ref(this._canvasRef)}></canvas><uc-crop-frame ${ref(this._frameRef)}></uc-crop-frame>`}};a([state()],dt.prototype,"_image",2);function pt(r,s,e){let t=e,i=e-1,o=new Array(t);for(let n=i;n>=0;n-=1)o[n]=Math.ceil((n*s+(i-n)*r)/i);return o}function Br(r){return typeof r=="string"&&r in M}function Gr(r){let s=[];for(let e=0;e<r.length-1;e+=1){let t=r[e],i=r[e+1];typeof t=="number"&&typeof i=="number"&&s.push([t,i]);}return s}function Wr(r,s,e){let t=Gr(r).find(([n,a])=>n<=s&&s<=a);if(!t)return r.map(()=>0);let[i,o]=t;return r.map(n=>{let a=Math.abs(i-o)||1,l=Math.abs(s-i)/a;return i===n?s>e?1:1-l:o===n?s>=e?l:1:0})}function qr(r,s){return r.map((e,t)=>e<s?r.length-t:t)}function mi(r,s){let e=M[r].keypointsNumber,{range:t,zero:i}=M[r];return [...new Set([...pt(t[0],i,e+1),...pt(i,t[1],e+1),i,s])].sort((o,n)=>o-n)}var fi=class extends v{constructor(){super();this._isActive=false;this._hidden=true;this._operation="initial";this._transformations={};this._keypoints=[];this._raf=0;this._previewHostRef=createRef();this._layersHostRef=createRef();this.classList.add("uc-inactive_to_cropper"),this._addKeypointDebounced=S(async(e,t,i)=>{let o=()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(c=>c.value===i);if(o())return;let n=await this._constructKeypoint(e,i),a=new Image;a.src=n.src;let l=this._handleImageLoading(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this._keypoints,p=c.findIndex(g=>g.value>i);p===-1&&(p=c.length);let h=c[p]?.image,f=this._layersHostRef.value;!f||h&&!f.contains(h)||(c.splice(p,0,n),h?f.insertBefore(a,h):f.appendChild(a),this._update(e,i));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];i.has(t)||i.set(t,new Map);let o=i.get(t);return o&&!o.get(e)&&(o.set(e,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=i);}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString());}});}_imageSrc({url:e=this._url,filter:t=this._filter??void 0,operation:i,value:o}={}){if(!e)throw new Error("URL is not defined");let n={...this._transformations};i&&(i==="filter"?t&&typeof o=="number"&&(n.filter={name:t,amount:o}):typeof o=="number"&&(n[i]=o));let a=this.offsetWidth;return this.proxyUrl(de(e,a,n))}async _constructKeypoint(e,t){return {src:await this._imageSrc({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}set(e){let t=typeof e=="string"?parseInt(e,10):e;!Br(this._operation)||!Number.isFinite(t)||(this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t));}_update(e,t){this._operation=e,this._value=t;let{zero:i}=M[e],o=this._keypoints.map(l=>l.value),n=Wr(o,t,i),a=qr(o,i);this._keypoints.forEach((l,c)=>{let p=n[c],u=a[c];typeof p=="number"&&(l.opacity=p),typeof u=="number"&&(l.zIndex=u);}),this._flush();}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){this._previewImage=this._previewImage||this._createPreviewImage();let e=this._previewImage;e&&this._ensurePreviewAttached(e);let t=this._keypoints.map(c=>c.src),{images:i,promise:o,cancel:n}=Te(t);i.forEach(c=>{let p=this._handleImageLoading(c.src);c.addEventListener("load",p),c.addEventListener("error",p);}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0;};let a=this._operation,l=this._filter;if(await o,this._isActive&&this._isSame(a,l)){let c=this._layersHostRef.value;if(!c)return;c.replaceChildren(),this._keypoints.forEach((p,u)=>{let h=i[u];h&&(h.classList.add("uc-fader-image"),p.image=h,c.appendChild(h));}),this._flush();}}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:true}),this._previewImage.addEventListener("error",i,{once:true}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:e,filter:t,operation:i,value:o}){if(!i||typeof o!="number")return;this._cancelBatchPreload?.();let n=mi(i,o),a=await Promise.all(n.map(c=>this._imageSrc({url:e,filter:t,operation:i,value:c}))),{cancel:l}=Te(a);this._cancelBatchPreload=l;}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(this._ensurePreviewAttached(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=E({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:true}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=E({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false}));},{once:true}),t.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:e,operation:t,value:i,filter:o,fromViewer:n}){if(this._isActive=true,this._hidden=false,await this.updateComplete,this._url=e,this._operation=t??"initial",this._value=i,this._filter=o,this._fromViewer=n,typeof i!="number"&&!o){let l=await this._imageSrc({operation:t,value:i});this._setOriginalSrc(l),this._clearLayersHost();return}!t||typeof i!="number"||(this._keypoints=await Promise.all(mi(t,i).map(l=>this._constructKeypoint(t,l))),this._update(t,i),this._initNodes());}deactivate({hide:e=true}={}){this._isActive=false,this._cancelLastImages?.(),this._cancelBatchPreload?.(),e&&!this._hidden?(this._hidden=true,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=E({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this._clearLayersHost();},{once:true})):this._clearLayersHost();}_ensurePreviewAttached(e){let t=this._previewHostRef.value;t&&(t.contains(e)||t.appendChild(e));}_clearLayersHost(){this._layersHostRef.value?.replaceChildren();}render(){return html`<div class="uc-fader-preview-host" ${ref(this._previewHostRef)}></div><div class="uc-fader-layers-host" ${ref(this._layersHostRef)}></div>`}};var Q=class extends v{constructor(){super();this._thumbSize=0;this._inputRef=createRef();this._thumbRef=createRef();this._stepsRef=createRef();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this._currentValue=0;this._handleSliderInput=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&(this._setCurrentValue(t),this._emitSliderEvent("slider-input",t));};this._handleSliderChange=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&this._setCurrentValue(t);};this._handleInputFocus=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this._handleInputBlur=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}_emitSliderEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:{value:t},bubbles:true,composed:true}));}firstUpdated(e){super.firstUpdated(e),this._thumbSize=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this._syncInputValue(this._currentValue),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps(),this._updateValue(this._currentValue);}),this._observer.observe(this);let t=this._inputRef.value;t?.addEventListener("focus",this._handleInputFocus),t?.addEventListener("blur",this._handleInputBlur),window.setTimeout(()=>{this._updateValue(this._currentValue);},0);}willUpdate(e){super.willUpdate(e),e.has("defaultValue")&&this.defaultValue!==this._currentValue&&this._setCurrentValue(this.defaultValue),(e.has("min")||e.has("max"))&&this.hasUpdated&&(this._updateSteps(),this._updateValue(this._currentValue)),e.has("zero")&&this.hasUpdated&&this._updateZeroDot(this._currentValue);}_updateValue(e){this._updateZeroDot(e);let t=this.max-this.min;if(t===0)return;let{width:i}=this.getBoundingClientRect(),a=100/t*(e-this.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{let l=this._thumbRef.value;l&&(l.style.transform=`translateX(${a}px)`);});}_updateZeroDot(e){if(!this._zeroDotEl)return;let t=this.max-this.min;if(t===0)return;this._zeroDotEl.style.opacity=e===this.zero?"0":"1";let{width:i}=this.getBoundingClientRect(),a=100/t*(this.zero-this.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${a}px)`);});}_updateSteps(){let t=this._stepsRef.value;if(!t)return;let{width:i}=t.getBoundingClientRect(),o=Math.ceil(i/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this._zeroDotEl=p,t.innerHTML="",t.appendChild(a),this._stepsCount=n;}disconnectedCallback(){super.disconnectedCallback();let e=this._inputRef.value;e?.removeEventListener("focus",this._handleInputFocus),e?.removeEventListener("blur",this._handleInputBlur),this._observer?.disconnect(),this._observer=void 0;}_setCurrentValue(e){Number.isFinite(e)&&(this._currentValue=e,this.hasUpdated&&(this._syncInputValue(e),this._updateValue(e)));}_syncInputValue(e){let t=this._inputRef.value;t&&(t.value=String(e));}_extractEventValue(e){let t=e.currentTarget;if(!t)return null;let i=Number.parseInt(t.value,10);return Number.isFinite(i)?i:null}render(){return html`<div class="uc-steps" ${ref(this._stepsRef)}></div><div class="uc-thumb" ${ref(this._thumbRef)}></div><input class="uc-input" type="range" ${ref(this._inputRef)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this._currentValue)} ?disabled=${this.disabled} @input=${this._handleSliderInput} @change=${this._handleSliderChange} />`}};a([property({type:Boolean,reflect:true})],Q.prototype,"disabled",2),a([property({type:Number})],Q.prototype,"min",2),a([property({type:Number})],Q.prototype,"max",2),a([property({type:Number,attribute:false})],Q.prototype,"defaultValue",2),a([property({type:Number})],Q.prototype,"zero",2),a([state()],Q.prototype,"_currentValue",2);var $="original",mt=class extends v{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this._handleInput=e=>{let{value:t}=e.detail;this.$["*faderEl"]?.set(t),this.state={...this.state,value:t};};}setOperation(e,t){this.state={...this.state,operation:e,filter:t},this._initializeValues();let i=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];i&&o&&i.activate({url:o,operation:this.state.operation,value:this.state.filter===$?void 0:this.state.value,filter:this.state.filter===$?void 0:this.state.filter,fromViewer:false});}_initializeValues(){let e=this.state.operation,{range:t,zero:i}=M[e],[o,n]=t;this.state={...this.state,min:o,max:n,zero:i};let l=this.$["*editorTransformations"][e];if(e==="filter"){let p=Number(n),u=l;if(u){let{name:h,amount:f}=u;p=h===this.state.filter?f:n;}this.state={...this.state,value:p,defaultValue:p};return}let c=typeof l<"u"?l:i;this.state={...this.state,value:c,defaultValue:c};}apply(){let t={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===$?delete t.filter:t.filter={name:this.state.filter,amount:this.state.value}:t[this.state.operation]=this.state.value,this.$["*editorTransformations"]=t;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{e&&(this.state={...this.state,originalUrl:e});});}updated(e){if(super.updated(e),e.has("state")){let t=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=t;}}render(){return html`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this._handleInput} ></uc-slider-ui>`}};a([state()],mt.prototype,"state",2);var T=class extends v{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let e=this.active;return {"uc-active":e,"uc-not_active":!e}}_updateHostStateClasses(){let e=this.buttonClasses;for(let[t,i]of Object.entries(e))this.classList.toggle(t,i);}onClick(e){}connectedCallback(){super.connectedCallback(),this._updateHostStateClasses();}updated(e){super.updated(e),e.has("active")&&this._updateHostStateClasses();}render(){let e=this.onClick,t=this.title;return html`<button role="option" type="button" aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};a([state()],T.prototype,"active",2),a([state()],T.prototype,"title",2),a([state()],T.prototype,"icon",2),a([state()],T.prototype,"titleProp",2);var Be=12,Ge=16,ts=r=>{let s=12,e=12;return r.width/r.height>=1?(s=Be,e=Math.round(Be*r.height/r.width)):(e=Be,s=Math.round(Be*r.width/r.height)),{width:s,height:e}},vi=class extends T{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",s=>{let e=this._computeTitle(s);this.title=e,this.titleProp=e;});}onClick(){this.$["*showListAspectRatio"]=true;}_computeTitle(s){return s?s.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${s.width}:${s.height}`}):""}render(){let s=this.onClick,e=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${s} ><div class="uc-title" ?hidden=${!e}>${e}</div><uc-icon name=${this.icon}></uc-icon></button>`}},ft=class extends T{constructor(){super(...arguments);this._aspectRatio=null;}get aspectRatio(){return this._aspectRatio}set aspectRatio(e){if(this._aspectRatio===e)return;let t=this._aspectRatio;this._aspectRatio=e,this.requestUpdate("aspectRatio",t),e?this._updateAspectRatioPresentation(e):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this._aspectRatio&&this._updateAspectRatioPresentation(this._aspectRatio),this.sub("*currentAspectRatio",e=>{this.active=e&&e.id===this._aspectRatio?.id||e?.width===this._aspectRatio?.width&&e?.height===this._aspectRatio?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this._aspectRatio?.id&&(this.$["*currentAspectRatio"]=this._aspectRatio);}_updateAspectRatioPresentation(e){if(!this.isConnected)return;let t=!!e.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",t);let i=()=>{let n=t?this.l10n("custom"):`${e.width}:${e.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:t?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};i(),o(),t||this.requestUpdate();}_renderIcon(){let e=this._aspectRatio;if(!e||e.hasFreeform)return html`<uc-icon name=${this.icon}></uc-icon>`;let{width:t,height:i}=ts(e),o=(Ge-t)/2,n=(Ge-i)/2;return html`<uc-icon><svg viewBox="0 0 ${Ge} ${Ge}" aria-hidden="true" focusable="false" ><rect x=${o} y=${n} width=${t} height=${i} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let e=this.onClick,t=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} >${this._renderIcon()}<div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};a([property({attribute:false})],ft.prototype,"aspectRatio",1);function rs(r){let s=r+90;return s=s>=360?0:s,s}function ss(r,s){if(r==="rotate")return rs(typeof s=="number"?s:0);if(r==="mirror"||r==="flip")return !s;throw new Error(`Unsupported operation: ${r}`)}var gt=class extends T{constructor(){super(...arguments);this.operation=void 0;}willUpdate(e){super.willUpdate(e),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(e){if(!this.operation)return;let t=this.$["*cropperEl"],i=t.getValue(this.operation),o=ss(this.operation,i);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this.operation,next:o,prev:i}),t.setValue(this.operation,o);}};a([property({type:String})],gt.prototype,"operation",2);function pe(r){if(!r)return null;let s=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!s)return null;let[,e,t]=s;return !e||typeof t>"u"?null:{filter:e,value:Number(t)}}var ie=class extends T{constructor(){super(...arguments);this._operation="";this._filter="";this._originalUrl="";this._lastPreviewRequestId=0;this._previewImage=null;this._previewLoaded=false;this.isOriginal=false;this._iconSize=20;}get filter(){return this._filter}set filter(e){let t=e??"";if(this._filter===t)return;let i=this._filter;this._filter=t,this._operation="filter",this.isOriginal=t===$,this.icon=this.isOriginal?"original":"slider",this._iconSize=this.isOriginal?40:20,this.requestUpdate("filter",i),this.isConnected&&this._updateFilterLabels(t);}onClick(e){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=true);else {let t=this.$["*sliderEl"];t.setOperation(this._operation,this._filter),t.apply();}this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:pe(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter;}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=Number.isFinite(e)&&e>0?e:this._iconSize||32,i=window.devicePixelRatio,o=Math.ceil(i*t),n=i>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==$?{name:this._filter,amount:a}:void 0,U(this._originalUrl,D(Pe,W(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${se}/${oe}/uc-cloud-image-editor/`))}async _observerCallback(e,t){e[0]?.isIntersecting?await this._loadPreview(t):this._cancelPreload?.();}initCallback(){super.initCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e??"",this.sub("*originalUrl",t=>{this._originalUrl=t??"",!this.isOriginal&&this._originalUrl&&this.isConnected&&!this._previewImage&&(this._observer?.observe(this),this._schedulePreviewVisibilityCheck());}),this.isOriginal||(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()),this._filter&&this._updateFilterLabels(this._filter),this.sub("*currentFilter",t=>{this.active=!!(t&&t===this._filter);}),this.sub("*networkProblems",async t=>{t||(this._previewImage?await this._loadPreview():this._schedulePreviewVisibilityCheck());});}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._cancelPreload?.(),this._clearPreviewVisibilityChecks();}updated(e){super.updated(e),e.has("isOriginal")&&(this.isOriginal?this._observer?.unobserve(this):(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()));}_updateFilterLabels(e){if(!e){this.titleProp="";return}let t=this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()});this.titleProp=t;}async _loadPreview(e){if(!this.isConnected){e?.unobserve(this),this._cancelPreload?.(),this._cancelPreload=void 0;return}if(!this._originalUrl){!this._previewVisibilityCheckTimeout&&!this._previewVisibilityCheckRaf&&this._schedulePreviewVisibilityCheck();return}let t=++this._lastPreviewRequestId,i="";try{i=await this.proxyUrl(this._previewSrc());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this._previewLoaded=false,this._cancelPreload?.();let{promise:o,cancel:n}=_e(i);this._cancelPreload=()=>{n(),this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);};try{if(await o,this._lastPreviewRequestId!==t||!this.isConnected)return;this._previewImage=i,this._previewLoaded=!0,this._clearPreviewVisibilityChecks(),(e??this._observer)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this._schedulePreviewVisibilityCheck();}finally{this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);}}_schedulePreviewVisibilityCheck(){if(!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal||this.$["*networkProblems"]){this._clearPreviewVisibilityChecks();return}this._previewVisibilityCheckRaf&&cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=requestAnimationFrame(()=>{if(this._previewVisibilityCheckRaf=void 0,!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal){this._clearPreviewVisibilityChecks();return}let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,i=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(t&&e.bottom>0&&e.right>0&&e.top<o&&e.left<i){this._loadPreview();return}this._previewVisibilityCheckTimeout=window.setTimeout(()=>{this._previewVisibilityCheckTimeout=void 0,this._schedulePreviewVisibilityCheck();},500);});}_clearPreviewVisibilityChecks(){this._previewVisibilityCheckRaf&&(cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=void 0),this._previewVisibilityCheckTimeout&&(window.clearTimeout(this._previewVisibilityCheckTimeout),this._previewVisibilityCheckTimeout=void 0);}get _shouldShowPreview(){return !!(this._previewLoaded&&!this.active&&!this.isOriginal)}render(){let e=this.onClick,t={opacity:this._shouldShowPreview?"1":"0"};this._previewImage&&(t.backgroundImage=`url(${this._previewImage})`);let i={opacity:this.active||this.isOriginal?"1":"0"};return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} ><div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${styleMap(t)}></div><uc-icon class=${classMap({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${styleMap(i)} ></uc-icon></button>`}};a([state()],ie.prototype,"_previewImage",2),a([state()],ie.prototype,"_previewLoaded",2),a([state()],ie.prototype,"isOriginal",2),a([state()],ie.prototype,"_iconSize",2),a([property({type:String})],ie.prototype,"filter",1);var vt=class extends T{constructor(){super(...arguments);this._operation="";}get operation(){return this._operation}set operation(e){let t=e??"";if(this._operation===t)return;let i=this._operation;this._operation=t,this.requestUpdate("operation",i),this.isConnected&&t&&this._updateOperationMetadata(t);}_updateOperationMetadata(e){this.icon=e;let t=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()});return this.titleProp=o,o},i=()=>{let o=this.l10n(e);return this.title=o,o};t(),i();}initCallback(){super.initCallback(),this._operation&&this._updateOperationMetadata(this._operation),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=M[this._operation],i=e[this._operation],o=typeof i<"u"?i!==t:false;this.active=o;});}onClick(e){this.$["*sliderEl"]?.setOperation(this._operation),this.$["*showSlider"]=true,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:pe(this.$["*operationTooltip"])});}};a([property({type:String})],vt.prototype,"operation",1);var cs=1,wi=()=>{},bt=class extends v{constructor(){super(...arguments);this.hiddenScrollbar=false;this._handleWheel=e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;if(Math.abs(i)>cs){this.scrollLeft+=i;return}this.scrollLeft+=t;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this._handleWheel,{passive:false}),this.addEventListener("scroll",wi,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this._handleWheel),this.removeEventListener("scroll",wi),super.disconnectedCallback();}};a([property({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],bt.prototype,"hiddenScrollbar",2);var P=class extends v{constructor(){super(...arguments);this._showLoader=false;this.showMainToolbar=true;this.showSubToolbar=false;this._showTabToggles=true;this.tabList=[..._];this.activeTab=b.CROP;this._useSliderPanel=true;this._tooltipVisible=false;this._operationTooltip=null;this._tabIndicatorOffset=0;this._tabIndicatorWidth=0;this._sliderRef=createRef();this._tabIndicatorRef=createRef();this.tabToggleRefs={[b.CROP]:createRef(),[b.TUNING]:createRef(),[b.FILTERS]:createRef()};this._handleWindowResize=()=>{this._syncTabIndicator();};this._cropPresets=[];this._debouncedShowLoader=S(e=>{this._showLoader=e;},500);this._updateInfoTooltip=S(()=>{let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],i="",o=false;if(this.$["*tabId"]===b.FILTERS)if(o=true,this.$["*currentFilter"]&&e?.filter?.name===this.$["*currentFilter"]){let n=e?.filter?.amount||100;i=`${this.$["*currentFilter"]} ${n}`;}else i=this.l10n($);else if(this.showSubToolbar&&this.$["*tabId"]===b.TUNING&&t){o=true;let n=e?.[t]||M[t].zero;i=`${this.l10n(t)} ${n}`;}o&&(this.$["*operationTooltip"]=i),this._tooltipVisible=o;},0);this._subTopToolbarStyles={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this._subBottomToolbarStyles={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this._tabToggleStyles={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this._tabTogglesStyles={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":$,"*currentOperation":null,"*operationTooltip":null};this._handleCancel=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this._cancelPreload?.();let t=this.$["*on.cancel"];t?.();};this._handleApply=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let t=this.$["*on.apply"];t?.(this.$["*editorTransformations"]);};this._handleApplySlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:pe(this.$["*operationTooltip"])}),this._sliderRef.value?.apply(),this._onSliderClose();};this._handleCancelSlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this._sliderRef.value?.cancel(),this._onSliderClose();};this._handleTabClick=e=>{let i=e.currentTarget?.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(e,i),this._activateTab(i,{fromViewer:false}));};}_onSliderClose(){this.$["*showSlider"]=false,this.$["*tabId"]===b.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===b.TUNING&&(this._tooltipVisible=false);}_activateTab(e,{fromViewer:t=false,force:i=false}={}){this.$["*tabId"]!==e&&(this.$["*tabId"]=e),this._applyTabState(e,{fromViewer:t,force:i});}_applyTabState(e,{fromViewer:t,force:i=false}){if(!i&&this.activeTab===e){this._syncTabIndicator();return}this.activeTab=e;let o=this.$["*faderEl"],n=this.$["*cropperEl"];e===b.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:t})):(o?.activate({url:this.$["*originalUrl"],fromViewer:t}),n?.deactivate());for(let a of _){let l=a===e,p=this.tabToggleRefs[a]?.value;p&&(p.active=l),l&&this._syncTabIndicator();}}_syncTabIndicator(){let t=this.tabToggleRefs[this.activeTab]?.value,i=this._tabIndicatorRef.value;if(!t||!i)return;let o=t.offsetLeft,n=t.offsetWidth||Number(getComputedStyle(t).width.replace("px",""));(this._tabIndicatorOffset!==o||this._tabIndicatorWidth!==n)&&(this._tabIndicatorOffset=o,this._tabIndicatorWidth=n,i.style.transform=`translateX(${o}px)`,i.style.width=`${n}px`);}get _hasAspectRatioPicker(){return this._cropPresets.length>=3}_renderControlsByTab(e){switch(e){case b.CROP:return this._renderCropTabControls();case b.FILTERS:return this._renderFilterTabControls();case b.TUNING:return this._renderTuningTabControls();default:return []}}_renderCropTabControls(){let e=[];if(this._hasAspectRatioPicker)e.push(()=>this._renderFreeformControl());else for(let t of this._cropPresets)e.push(()=>this._renderAspectRatioControl(t));for(let t of Lt)e.push(()=>this._renderCropOperationControl(t));return this._renderControlGroup(e)}_renderFilterTabControls(){let t=[$,...At].map(i=>()=>this._renderFilterControl(i));return this._renderControlGroup(t)}_renderTuningTabControls(){let e=Ot.map(t=>()=>this._renderOperationControl(t));return this._renderControlGroup(e)}_renderControlGroup(e){return e.length?e.map(i=>i()):[]}_renderFreeformControl(){return html`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_renderAspectRatioControl(e){return html`<uc-editor-aspect-ratio-button-control .aspectRatio=${e}></uc-editor-aspect-ratio-button-control>`}_renderCropOperationControl(e){return html`<uc-editor-crop-button-control .operation=${e}></uc-editor-crop-button-control>`}_renderFilterControl(e){return html`<uc-editor-filter-control .filter=${e}></uc-editor-filter-control>`}_renderOperationControl(e){return html`<uc-editor-operation-control .operation=${e}></uc-editor-operation-control>`}_renderAspectRatioList(){return this._hasAspectRatioPicker?this._cropPresets.map(e=>this._renderAspectRatioControl(e)):[]}async _preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,t=await this.proxyUrl(de(this.$["*originalUrl"],e,this.$["*editorTransformations"]));this._cancelPreload?.();let{cancel:i}=Te([t]);this._cancelPreload=()=>{i(),this._cancelPreload=void 0;};}}initCallback(){super.initCallback();let e=this.$["*cropPresetList"]??[];this._cropPresets=[...e],this.sub("*cropPresetList",t=>{this._cropPresets=[...t??[]];}),this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",t=>{let i=t?.filter?.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i??"");}),this.sub("*currentFilter",()=>{this._updateInfoTooltip();}),this.sub("*currentOperation",()=>{this._updateInfoTooltip();}),this.sub("*tabId",t=>{this._applyTabState(t,{fromViewer:false,force:true}),this._updateInfoTooltip();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]?.setTransformations(t);}),this.sub("*loadingOperations",t=>{let i=false;for(let[,o]of t.entries()){if(i)break;for(let[,n]of o.entries())if(n){i=true;break}}this._debouncedShowLoader(i);}),this.sub("*showSlider",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",t=>{if(this.tabList=t,this._showTabToggles=t.length>1,!t.includes(this.$["*tabId"])&&t.length>0){let[i]=t;i&&this._activateTab(i,{fromViewer:false});return}this._syncTabIndicator();}),this.sub("*operationTooltip",t=>{this._operationTooltip=t;}),this._updateInfoTooltip();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._handleWindowResize);}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._syncTabIndicator();}updated(e){super.updated(e),(e.has("activeTab")||e.has("tabList"))&&this.updateComplete.then(()=>this._syncTabIndicator()),(e.has("showSubToolbar")||e.has("showMainToolbar"))&&this._assignSharedElements();}disconnectedCallback(){window.removeEventListener("resize",this._handleWindowResize),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}_assignSharedElements(){let e=this._sliderRef.value;e&&(this.$["*sliderEl"]=e);}_renderTabToggle(e){let t=this.tabList.includes(e),i=this.activeTab===e,o=this.tabList.indexOf(e),n=o>=0?styleMap({gridColumn:`${o+1}`}):nothing;return html`<uc-presence-toggle class="uc-tab-toggle" .visible=${t} .styles=${this._tabToggleStyles}><uc-btn-ui theme="tab" data-id=${e} icon=${e} role="tab" aria-controls=${`tab_${e}`} aria-selected=${i?"true":"false"} title-prop=${`a11y-editor-tab-${e}`} .active=${i} style=${n} @click=${this._handleTabClick} ${ref(this.tabToggleRefs[e])} ></uc-btn-ui></uc-presence-toggle>`}_renderTabContent(e){let t=this._renderControlsByTab(e);return html`<div id=${`tab_${e}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${t.length?t:nothing}</div></div></uc-editor-scroller></div>`}render(){let e=["uc-info-tooltip",this._tooltipVisible?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),t=this._hasAspectRatioPicker;return html`<uc-line-loader-ui .active=${this._showLoader}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${e}>${this._operationTooltip??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this._subTopToolbarStyles} ><div class="uc-tab-content-row">${_.map(i=>when(this.activeTab===i,()=>this._renderTabContent(i)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this._showTabToggles} .styles=${this._tabTogglesStyles} @initial-render=${()=>this._syncTabIndicator()} ><div class="uc-tab-toggles_indicator" ${ref(this._tabIndicatorRef)} ></div>${_.map(i=>this._renderTabToggle(i))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this._handleCancel} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this._handleApply}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this._subBottomToolbarStyles}><div class="uc-slider" ?hidden=${!this._useSliderPanel}><uc-editor-slider ${ref(this._sliderRef)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel||!t}>${t?html`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>`:nothing}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this._handleCancelSlider} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this._handleApplySlider} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};a([state()],P.prototype,"_showLoader",2),a([state()],P.prototype,"showMainToolbar",2),a([state()],P.prototype,"showSubToolbar",2),a([state()],P.prototype,"_showTabToggles",2),a([state()],P.prototype,"tabList",2),a([state()],P.prototype,"activeTab",2),a([state()],P.prototype,"_useSliderPanel",2),a([state()],P.prototype,"_tooltipVisible",2),a([state()],P.prototype,"_operationTooltip",2),a([state()],P.prototype,"_cropPresets",2);var Se=["free"],Ci=r=>{let s=me(r);if(!s||s.length===0)return [];let e=[];for(let t of s){let i=t.trim();if(!i)continue;let o=i.indexOf(":");if(o===-1&&!Se.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}let n=Number(i.slice(0,o)),a=Number(i.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Se.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}e.push({id:G.generateFastUid(),type:"aspect-ratio",width:Se.includes(i)?0:n,height:Se.includes(i)?0:a,hasFreeform:Se.includes(i)});}return e},Si=(r,s,e,t=.1)=>{let i=r/s,o=null,n=1/0;for(let a of e){let[l,c]=[a.width,a.height],p=l/c,u=Math.abs(i-p);u<n&&(n=u,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(i-c)/c>t)return null}return o};var us=r=>_.includes(r),Ei=r=>{if(!r)return _;let s=Et(r).filter(us);return s.length===0?_:s};function xi(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":_,"*tabId":b.CROP,"*on.retryNetwork":()=>{let s=r.querySelectorAll("img");for(let e of s){let t=e.src;e.src=Z,e.src=t;}r.$["*networkProblems"]=false;},"*on.apply":s=>{if(!s)return;let e=r.$["*originalUrl"];if(!e){console.warn("Original URL is null, cannot apply transformations");return}let t=D(W(s),"preview"),i=U(e,t),o={originalUrl:e,cdnUrlModifiers:t,cdnUrl:i,transformations:s};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Ii="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var ki=xe([..._]),w=class extends v{constructor(){super(...arguments);this.ctxOwner=true;this._statusMessage="";this._imageSrc=Z;this._fileType="";this._showLoader=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=ki;this._hasNetworkProblems=false;this._isInitialized=false;this._pendingInitUpdate=null;this._debouncedShowLoader=S(e=>{this._showLoader=e;},300);this._imgRef=createRef();this._cropperRef=createRef();this._faderRef=createRef();this._imgContainerRef=createRef();this._handleImageLoad=()=>{this._debouncedShowLoader(false),this._imageSrc!==Z&&(this.$["*networkProblems"]=false);};this._handleImageError=()=>{this._debouncedShowLoader(false),this.$["*networkProblems"]=true;};this._handleRetryNetwork=()=>{let e=this.$["*on.retryNetwork"];e?.();};this.init$={...this.init$,...xi(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}_scheduleInitialization(){this._isInitialized||this._pendingInitUpdate||(this._pendingInitUpdate=this.updateComplete.then(()=>{this._pendingInitUpdate=null,this._isInitialized=true;}));}initCallback(){super.initCallback(),this._syncTabListFromProp(),this._syncCropPresetState();}_assignSharedElements(){let e=this._faderRef.value;e&&(this.$["*faderEl"]=e);let t=this._cropperRef.value;t&&(this.$["*cropperEl"]=t);let i=this._imgContainerRef.value;i&&(this.$["*imgContainerEl"]=i);let o=this._imgRef.value;o&&(this.$["*imgEl"]=o);}_attachImageListeners(){let e=this._imgRef.value;e&&(e.addEventListener("load",this._handleImageLoad),e.addEventListener("error",this._handleImageError));}_detachImageListeners(){let e=this._imgRef.value;e&&(e.removeEventListener("load",this._handleImageLoad),e.removeEventListener("error",this._handleImageError));}get _imageClassName(){let e=this.$["*tabId"];return E("uc-image",{"uc-image_hidden_to_cropper":e===b.CROP,"uc-image_hidden_effects":e!==b.CROP})}_waitForSize(){return new Promise((t,i)=>{let o=window.setTimeout(()=>{i(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(o),n.disconnect(),window.setTimeout(()=>t(),0));});n.observe(this);})}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._attachImageListeners(),this.initEditor();let t=!!(this.uuid||this.cdnUrl),i=e.has("uuid")||e.has("cdnUrl");t&&!i&&this.updateImage();}disconnectedCallback(){this._detachImageListeners(),super.disconnectedCallback();}render(){let e=this._fileType??"",t=this._statusMessage??"",i=this._imageSrc||Z,o=this._showLoader,n=this._hasNetworkProblems;return html` ${unsafeSVG(Ii)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this._handleRetryNetwork}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${e}</div></div><div class="uc-image_container" ${ref(this._imgContainerRef)}><img src=${i} class=${this._imageClassName} ${ref(this._imgRef)} />${when(this._isInitialized,()=>html`<uc-editor-image-cropper ${ref(this._cropperRef)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${ref(this._faderRef)}></uc-editor-image-fader></div><div class="uc-info_pan">${t}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${when(this._isInitialized,()=>html`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(e){super.updated(e),e.has("uuid")&&this.uuid&&this.updateImage(),e.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),e.has("tabs")&&this._syncTabListFromProp(),(e.has("cropPreset")||e.has("cdnUrl"))&&this._syncCropPresetState();}_syncTabListFromProp(){let e=this.tabs||ki;this.$["*tabList"]=Ei(e);}_syncCropPresetState(){let e=Ci(this.cropPreset??""),t=null;if(this.cdnUrl){let i=tt(this.cdnUrl),o=rt(i);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;t=Si(n,a,e,.1);}}this.$["*cropPresetList"]=e,this.$["*currentAspectRatio"]=t??e?.[0]??null;}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.cdnUrl){let e=this.cdnUrl,t=ke(e),i=it(e,t);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let o=tt(e),n=rt(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let e=it(this.cfg.cdnCname,this.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===b.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let e=this.$["*originalUrl"],t=await this.proxyUrl(U(e,D("json"))),i=await fetch(t).then(a=>a.json()),{width:o,height:n}=i;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===b.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:e});}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e));}this._scheduleInitialization();}}async initEditor(){try{await this._waitForSize();}catch(e){this.isConnected&&console.error(e.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{let t=!!e;this._hasNetworkProblems=t;}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],i=D(W(e),"preview"),o=U(t,i),n={originalUrl:t,cdnUrlModifiers:i,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};a([state()],w.prototype,"_statusMessage",2),a([state()],w.prototype,"_imageSrc",2),a([state()],w.prototype,"_fileType",2),a([state()],w.prototype,"_showLoader",2),a([property({type:String,reflect:true})],w.prototype,"uuid",2),a([property({type:String,attribute:"cdn-url",reflect:true})],w.prototype,"cdnUrl",2),a([property({type:String,attribute:"crop-preset",reflect:true})],w.prototype,"cropPreset",2),a([property({type:String,reflect:true})],w.prototype,"tabs",2),a([state()],w.prototype,"_hasNetworkProblems",2),a([state()],w.prototype,"_isInitialized",2);var Pi=class extends w{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:H.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ic=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Rc=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Mi=new Set;function Pc(r){Mi.has(r)||(Mi.add(r),console.warn(r));}
|
|
8
|
-
export{P as $,Fe as A,jt as B,Bt as C,v as D,Ic as E,Rc as F,Pc as G,zn as H,Ci as I,ve as J,Z as K,_e as L,li as M,Ke as N,at as O,A as P,ct as Q,dt as R,fi as S,Q as T,mt as U,vi as V,ft as W,gt as X,ie as Y,vt as Z,bt as _,J as a,w as aa,Kt as b,Pi as ba,Ht as c,Gt as d,S as e,qt as f,G as g,Ni as h,y as i,Et as j,xe as k,D as l,U as m,it as n,me as o,zi as p,z as q,k as r,re as s,Xi as t,Yi as u,js as v,H as w,j as x,se as y,oe as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as Config}from'./chunk-GCTQN3DZ.js';export{P as BtnUi,ba as CloudImageEditor,aa as CloudImageEditorBlock,Q as CropFrame,W as EditorAspectRatioButtonControl,X as EditorCropButtonControl,Y as EditorFilterControl,V as EditorFreeformButtonControl,R as EditorImageCropper,S as EditorImageFader,Z as EditorOperationControl,_ as EditorScroller,U as EditorSlider,$ as EditorToolbar,J as Icon,O as LineLoaderUi,N as PresenceToggle,T as SliderUi}from'./chunk-NJ77GRVX.js';export{a as defineComponents}from'./chunk-BDD5ZPFI.js';import'./chunk-TVCYFFRR.js';
|