diff --git a/abstract/TypedCollection.js b/abstract/TypedCollection.js index 42eb4041a..bf9f58812 100644 --- a/abstract/TypedCollection.js +++ b/abstract/TypedCollection.js @@ -32,19 +32,19 @@ export class TypedCollection { this.__watchList = options.watchList || []; /** * @private - * @type {(list: string[], added: Set, removed: Set) => void} + * @type {Object} */ - this.__handler = options.handler || null; + this.__subsMap = Object.create(null); /** * @private - * @type {Object} + * @type {Set} */ - this.__subsMap = Object.create(null); + this.__propertyObservers = new Set(); /** * @private - * @type {Set} + * @type {Set<(list: string[], added: Set, removed: Set) => void>} */ - this.__observers = new Set(); + this.__collectionObservers = new Set(); /** * @private * @type {Set} @@ -78,7 +78,10 @@ export class TypedCollection { changeMap[propName].add(ctxId); /** @private */ this.__observeTimeout = window.setTimeout(() => { - this.__observers.forEach((handler) => { + if (Object.keys(changeMap).length === 0) { + return; + } + this.__propertyObservers.forEach((handler) => { handler({ ...changeMap }); }); changeMap = Object.create(null); @@ -96,22 +99,25 @@ export class TypedCollection { let removed = new Set(this.__removed); this.__added.clear(); this.__removed.clear(); - this.__handler?.([...this.__items], added, removed); + for (const handler of this.__collectionObservers) { + handler?.([...this.__items], added, removed); + } }); } /** @param {(list: string[], added: Set, removed: Set) => void} handler */ - setHandler(handler) { - this.__handler = handler; + observeCollection(handler) { + this.__collectionObservers.add(handler); this.notify(); - } - getHandler() { - return this.__handler; + return () => { + this.unobserveCollection(handler); + }; } - removeHandler() { - this.__handler = null; + /** @param {Function} handler */ + unobserveCollection(handler) { + this.__collectionObservers.delete(handler); } /** @@ -185,13 +191,17 @@ export class TypedCollection { } /** @param {Function} handler */ - observe(handler) { - this.__observers.add(handler); + observeProperties(handler) { + this.__propertyObservers.add(handler); + + return () => { + this.unobserveProperties(handler); + }; } /** @param {Function} handler */ - unobserve(handler) { - this.__observers.delete(handler); + unobserveProperties(handler) { + this.__propertyObservers.delete(handler); } /** @@ -219,8 +229,8 @@ export class TypedCollection { destroy() { Data.deleteCtx(this.__data); - this.__observers = null; - this.__handler = null; + this.__propertyObservers = null; + this.__collectionObservers = null; for (let id in this.__subsMap) { this.__subsMap[id].forEach((sub) => { sub.remove(); diff --git a/abstract/UploaderBlock.js b/abstract/UploaderBlock.js index e5d0fc784..e3ce66066 100644 --- a/abstract/UploaderBlock.js +++ b/abstract/UploaderBlock.js @@ -4,8 +4,8 @@ import { ActivityBlock } from './ActivityBlock.js'; import { Data } from '@symbiotejs/symbiote'; import { calculateMaxCenteredCropFrame } from '../blocks/CloudImageEditor/src/crop-utils.js'; import { parseCropPreset } from '../blocks/CloudImageEditor/src/lib/parseCropPreset.js'; -import { Modal } from '../blocks/Modal/Modal.js'; import { UploadSource } from '../blocks/utils/UploadSource.js'; +import { serializeCsv } from '../blocks/utils/comma-separated.js'; import { debounce } from '../blocks/utils/debounce.js'; import { customUserAgent } from '../blocks/utils/userAgent.js'; import { createCdnUrl, createCdnUrlModifiers } from '../utils/cdn-utils.js'; @@ -17,7 +17,6 @@ import { uploaderBlockCtx } from './CTX.js'; import { EVENT_TYPES, EventData, EventManager } from './EventManager.js'; import { TypedCollection } from './TypedCollection.js'; import { uploadEntrySchema } from './uploadEntrySchema.js'; -import { serializeCsv } from '../blocks/utils/comma-separated.js'; export class UploaderBlock extends ActivityBlock { couldBeUploadCollectionOwner = false; @@ -88,25 +87,13 @@ export class UploaderBlock extends ActivityBlock { if (this.couldBeUploadCollectionOwner && !hasUploadCollectionOwner()) { this.isUploadCollectionOwner = true; - /** - * @private - * @type {Parameters[0]} - */ - this.__uploadCollectionHandler = (entries, added, removed) => { - this._runValidators(); - - for (let entry of removed) { - entry?.getValue('abortController')?.abort(); - entry?.setValue('abortController', null); - URL.revokeObjectURL(entry?.getValue('thumbUrl')); - } - this.$['*uploadList'] = entries.map((uid) => { - return { uid }; - }); - }; - this.uploadCollection.setHandler(this.__uploadCollectionHandler); + /** @private */ + this._unobserveCollection = this.uploadCollection.observeCollection(this._handleCollectonUpdate); - this.uploadCollection.observe(this._handleCollectionUpdate); + /** @private */ + this._unobserveCollectionProperties = this.uploadCollection.observeProperties( + this._handleCollectionPropertiesUpdate + ); this.subConfigValue('maxLocalFileSizeBytes', () => this._debouncedRunValidators()); this.subConfigValue('multipleMin', () => this._debouncedRunValidators()); @@ -128,10 +115,8 @@ export class UploaderBlock extends ActivityBlock { destroyCallback() { super.destroyCallback(); if (this.isUploadCollectionOwner) { - this.uploadCollection.unobserve(this._handleCollectionUpdate); - if (this.uploadCollection.getHandler() === this.__uploadCollectionHandler) { - this.uploadCollection.removeHandler(); - } + this._unobserveCollectionProperties?.(); + this._unobserveCollection?.(); } } @@ -362,8 +347,16 @@ export class UploaderBlock extends ActivityBlock { _validateMultipleLimit(entry) { const entryIds = this.uploadCollection.items(); const entryIdx = entryIds.indexOf(entry.uid); + const multipleMin = this.cfg.multiple ? this.cfg.multipleMin : 1; const multipleMax = this.cfg.multiple ? this.cfg.multipleMax : 1; + if (multipleMin && entryIds.length < multipleMin) { + const message = this.l10n('files-count-minimum', { + count: multipleMin, + }); + return message; + } + if (multipleMax && entryIdx >= multipleMax) { const message = this.l10n('files-count-allowed', { count: multipleMax, @@ -421,11 +414,50 @@ export class UploaderBlock extends ActivityBlock { } } + /** @private */ + _flushOutputItems = debounce(() => { + const data = this.getOutputData(); + if (data.length !== this.uploadCollection.size) { + return; + } + EventManager.emit( + new EventData({ + type: EVENT_TYPES.DATA_OUTPUT, + // @ts-ignore TODO: fix this + ctx: this.ctxName, + // @ts-ignore TODO: fix this + data, + }) + ); + // @ts-ignore TODO: fix this + this.$['*outputData'] = data; + }, 100); + + /** + * @private + * @type {Parameters[0]} + */ + _handleCollectonUpdate = (entries, added, removed) => { + this._runValidators(); + + for (let entry of removed) { + entry?.getValue('abortController')?.abort(); + entry?.setValue('abortController', null); + URL.revokeObjectURL(entry?.getValue('thumbUrl')); + } + this.$['*uploadList'] = entries.map((uid) => { + return { uid }; + }); + this._flushOutputItems(); + }; + /** * @private * @param {Record} changeMap */ - _handleCollectionUpdate = (changeMap) => { + _handleCollectionPropertiesUpdate = (changeMap) => { + this._flushOutputItems(); + const uploadCollection = this.uploadCollection; const updatedEntries = [ ...new Set( @@ -611,24 +643,34 @@ export class UploaderBlock extends ActivityBlock { return options; } - /** @param {(item: import('./TypedData.js').TypedData) => Boolean} checkFn */ + /** + * @param {(item: import('./TypedData.js').TypedData) => Boolean} [checkFn] + * @returns {import('../types/exported.js').OutputFileEntry[]} + */ getOutputData(checkFn) { // @ts-ignore TODO: fix this let data = []; - let items = this.uploadCollection.findItems(checkFn); + let items = checkFn ? this.uploadCollection.findItems(checkFn) : this.uploadCollection.items(); items.forEach((itemId) => { let uploadEntryData = Data.getCtx(itemId).store; /** @type {import('@uploadcare/upload-client').UploadcareFile} */ let fileInfo = uploadEntryData.fileInfo || { name: uploadEntryData.fileName, - fileSize: uploadEntryData.fileSize, + originalFilename: uploadEntryData.fileName, + size: uploadEntryData.fileSize, isImage: uploadEntryData.isImage, mimeType: uploadEntryData.mimeType, }; let outputItem = { ...fileInfo, + file: uploadEntryData.file, + externalUrl: uploadEntryData.externalUrl, cdnUrlModifiers: uploadEntryData.cdnUrlModifiers, - cdnUrl: uploadEntryData.cdnUrl || fileInfo.cdnUrl, + cdnUrl: uploadEntryData.cdnUrl ?? fileInfo.cdnUrl ?? null, + validationErrorMessage: uploadEntryData.validationErrorMsg, + uploadError: uploadEntryData.uploadError, + isUploaded: !!uploadEntryData.uuid && !!uploadEntryData.fileInfo, + isValid: !uploadEntryData.validationErrorMsg && !uploadEntryData.uploadError, }; data.push(outputItem); }); @@ -660,49 +702,3 @@ UploaderBlock.sourceTypes = Object.freeze({ DRAW: 'draw', ...UploaderBlock.extSrcList, }); - -Object.values(EVENT_TYPES).forEach((eType) => { - const eName = EventManager.eName(eType); - const cb = debounce( - /** @param {CustomEvent} e */ - (e) => { - let outputTypes = [EVENT_TYPES.UPLOAD_FINISH, EVENT_TYPES.REMOVE, EVENT_TYPES.CLOUD_MODIFICATION]; - // @ts-ignore TODO: fix this - if (outputTypes.includes(e.detail.type)) { - // @ts-ignore TODO: fix this - let dataCtx = Data.getCtx(e.detail.ctx); - /** @type {TypedCollection} */ - let uploadCollection = dataCtx.read('uploadCollection'); - // @ts-ignore TODO: fix this - let data = []; - uploadCollection.items().forEach((id) => { - let uploadEntryData = Data.getCtx(id).store; - /** @type {import('@uploadcare/upload-client').UploadcareFile} */ - let fileInfo = uploadEntryData.fileInfo; - if (fileInfo) { - let outputItem = { - ...fileInfo, - cdnUrlModifiers: uploadEntryData.cdnUrlModifiers, - cdnUrl: uploadEntryData.cdnUrl || fileInfo.cdnUrl, - }; - data.push(outputItem); - } - }); - EventManager.emit( - new EventData({ - type: EVENT_TYPES.DATA_OUTPUT, - // @ts-ignore TODO: fix this - ctx: e.detail.ctx, - // @ts-ignore TODO: fix this - data, - }) - ); - // @ts-ignore TODO: fix this - dataCtx.pub('outputData', data); - } - }, - 0 - ); - // @ts-ignore TODO: fix this - window.addEventListener(eName, cb); -}); diff --git a/blocks/Config/normalizeConfigValue.js b/blocks/Config/normalizeConfigValue.js index 00ee7f2c5..010c87328 100644 --- a/blocks/Config/normalizeConfigValue.js +++ b/blocks/Config/normalizeConfigValue.js @@ -1,11 +1,20 @@ // @ts-check +import { initialConfig } from './initialConfig.js'; + /** @param {unknown} value */ const asString = (value) => String(value); /** @param {unknown} value */ -const asNumber = (value) => Number(value); +const asNumber = (value) => { + const number = Number(value); + if (Number.isNaN(number)) { + throw new Error(`Invalid number: "${value}"`); + } + return number; +}; /** @param {unknown} value */ export const asBoolean = (value) => { + if (typeof value === 'undefined' || value === null) return false; if (typeof value === 'boolean') return value; // for attr like multiple="true" (react will pass it as string) if (value === 'true') return true; @@ -13,14 +22,16 @@ export const asBoolean = (value) => { if (value === '') return true; // for attr like multiple="false" (react will pass it as string) if (value === 'false') return false; - return Boolean(value); + throw new Error(`Invalid boolean: "${value}"`); }; /** @param {unknown} value */ const asStore = (value) => (value === 'auto' ? value : asBoolean(value)); /** * @type {{ - * [Key in keyof import('../../types').ConfigPlainType]: (value: unknown) => import('../../types').ConfigType[Key]; + * [Key in keyof import('../../types').ConfigPlainType]: ( + * value: unknown + * ) => import('../../types').ConfigType[Key] | undefined; * }} */ const mapping = { @@ -80,5 +91,11 @@ export const normalizeConfigValue = (key, value) => { if (typeof value === 'undefined' || value === null) { return undefined; } - return mapping[key](value); + + try { + return mapping[key](value); + } catch (reason) { + console.error(`Invalid value for config key "${key}".`, reason); + return initialConfig[key]; + } }; diff --git a/blocks/DataOutput/DataOutput.js b/blocks/DataOutput/DataOutput.js index 9225c3f0a..b00691ef5 100644 --- a/blocks/DataOutput/DataOutput.js +++ b/blocks/DataOutput/DataOutput.js @@ -1,17 +1,27 @@ +// @ts-check import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { uploadFileGroup } from '@uploadcare/upload-client'; +import { applyStyles } from '@symbiotejs/symbiote'; -/** @typedef {import('@uploadcare/upload-client').UploadcareFile[]} FileList} */ +/** + * @typedef {| import('../../types/exported.js').OutputFileEntry[] + * | { + * groupData: import('@uploadcare/upload-client').GroupInfo; + * files: import('../../types/exported.js').OutputFileEntry[]; + * }} Output} + */ export class DataOutput extends UploaderBlock { processInnerHtml = true; requireCtxName = true; - init$ = { - ...this.init$, - output: null, - filesData: null, - }; + constructor() { + super(); + this.init$ = { + ...this.init$, + output: null, + }; + } get dict() { return DataOutput.dict; @@ -28,22 +38,24 @@ export class DataOutput extends UploaderBlock { this._dynamicInputsContainer = document.createElement('div'); this.appendChild(this._dynamicInputsContainer); - if (this.hasAttribute(this.dict.INPUT_REQUIRED)) { - let input = document.createElement('input'); - input.type = 'text'; - input.name = '__UPLOADCARE_VALIDATION_INPUT__'; - input.required = true; - this.appendChild(input); - this._validationInputElement = input; - } + let input = document.createElement('input'); + input.type = 'text'; + input.name = '__UPLOADCARE_VALIDATION_INPUT__'; + input.required = this.hasAttribute(this.dict.INPUT_REQUIRED); + input.tabIndex = -1; + applyStyles(input, { + opacity: 0, + height: 0, + width: 0, + }); + this.appendChild(input); + this._validationInputElement = input; } this.sub( 'output', + /** @param {Output} data */ (data) => { - if (!data) { - return; - } if (this.hasAttribute(this.dict.FIRE_EVENT_ATTR)) { this.dispatchEvent( new CustomEvent(this.dict.EVENT_NAME, { @@ -58,18 +70,32 @@ export class DataOutput extends UploaderBlock { ); } - if (this.hasAttribute(this.dict.FORM_INPUT_ATTR)) { + if (this.hasAttribute(this.dict.FORM_INPUT_ATTR) && this._dynamicInputsContainer) { this._dynamicInputsContainer.innerHTML = ''; - let values = data.groupData ? [data.groupData.cdnUrl] : data.map((file) => file.cdnUrl); + /** @type {string[]} */ + let values; + if (Array.isArray(data)) { + values = data.map((file) => /** @type {string} */ (file.cdnUrl)); + } else if (data?.groupData) { + values = [data.groupData.cdnUrl]; + } else { + values = []; + } for (let value of values) { let input = document.createElement('input'); input.type = 'hidden'; input.name = this.getAttribute(this.dict.INPUT_NAME_ATTR) || this.ctxName; - input.value = value; + input.value = value ?? ''; this._dynamicInputsContainer.appendChild(input); } - if (this.hasAttribute(this.dict.INPUT_REQUIRED)) { + if (this._validationInputElement) { this._validationInputElement.value = values.length ? '__VALUE__' : ''; + const msg = this.$['*message']; + if (msg?.isError) { + this._validationInputElement.setCustomValidity(`${msg.caption}. ${msg.text}`); + } else { + this._validationInputElement.setCustomValidity(''); + } } } @@ -82,21 +108,26 @@ export class DataOutput extends UploaderBlock { this.sub( this.dict.SRC_CTX_KEY, - async (/** @type {FileList} */ data) => { - if (!data) { + async (/** @type {import('../../types/exported.js').OutputFileEntry[]} */ data) => { + if (!data || !data.length) { this.$.output = null; - this.$.filesData = null; return; } - this.$.filesData = data; - if (this.cfg.groupOutput || this.hasAttribute(this.dict.GROUP_ATTR)) { + const allUploaded = data.every((item) => item.isUploaded); + if (allUploaded && (this.cfg.groupOutput || this.hasAttribute(this.dict.GROUP_ATTR))) { let uuidList = data.map((fileDesc) => { - return fileDesc.uuid; + return fileDesc.uuid + (fileDesc.cdnUrlModifiers ? `/${fileDesc.cdnUrlModifiers}` : ''); }); + const validationOk = data.every((item) => item.isValid); + if (!validationOk) { + this.$.output = { + groupData: undefined, + files: data, + }; + return; + } const uploadClientOptions = await this.getUploadClientOptions(); - let resp = await uploadFileGroup(uuidList, { - ...uploadClientOptions, - }); + const resp = await uploadFileGroup(uuidList, uploadClientOptions); this.$.output = { groupData: resp, files: data, diff --git a/blocks/ProgressBarCommon/ProgressBarCommon.js b/blocks/ProgressBarCommon/ProgressBarCommon.js index ceb2342f3..f0c190678 100644 --- a/blocks/ProgressBarCommon/ProgressBarCommon.js +++ b/blocks/ProgressBarCommon/ProgressBarCommon.js @@ -12,7 +12,8 @@ export class ProgressBarCommon extends UploaderBlock { initCallback() { super.initCallback(); - this.uploadCollection.observe(() => { + /** @private */ + this._unobserveCollection = this.uploadCollection.observeProperties(() => { let anyUploading = this.uploadCollection.items().some((id) => { let item = this.uploadCollection.read(id); return item.getValue('isUploading'); @@ -33,6 +34,12 @@ export class ProgressBarCommon extends UploaderBlock { this.$.value = progress; }); } + + destroyCallback() { + super.destroyCallback(); + + this._unobserveCollection?.(); + } } ProgressBarCommon.template = /* HTML */ ` diff --git a/blocks/UploadList/UploadList.js b/blocks/UploadList/UploadList.js index ff4a8512f..5970b85ea 100644 --- a/blocks/UploadList/UploadList.js +++ b/blocks/UploadList/UploadList.js @@ -222,7 +222,7 @@ export class UploadList extends UploaderBlock { // TODO: could be performance issue on many files // there is no need to update buttons state on every progress tick - this.uploadCollection.observe(this._debouncedHandleCollectionUpdate); + this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate); this.sub('*uploadList', (list) => { this._debouncedHandleCollectionUpdate(); @@ -244,7 +244,7 @@ export class UploadList extends UploaderBlock { destroyCallback() { super.destroyCallback(); - this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate); + this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate); } } diff --git a/blocks/test/form.htm b/blocks/test/form.htm new file mode 100644 index 000000000..aa7e973f6 --- /dev/null +++ b/blocks/test/form.htm @@ -0,0 +1,46 @@ + + + + + + + + + + + + +
+ + + +
+
+ +
diff --git a/blocks/themes/lr-basic/l10n.css b/blocks/themes/lr-basic/l10n.css index b2b5b18ef..8fa2f26ea 100644 --- a/blocks/themes/lr-basic/l10n.css +++ b/blocks/themes/lr-basic/l10n.css @@ -97,6 +97,7 @@ --l10n-files-count-limit-error-title: 'Files count limit overflow'; --l10n-files-count-limit-error-too-few: 'You’ve chosen {{total}}. At least {{min}} required.'; --l10n-files-count-limit-error-too-many: 'You’ve chosen too many files. {{max}} is maximum.'; + --l10n-files-count-minimum: 'At least {{count}} files are required'; --l10n-files-count-allowed: 'Only {{count}} files are allowed'; --l10n-files-max-size-limit-error: 'File is too big. Max file size is {{maxFileSize}}.'; diff --git a/package-lock.json b/package-lock.json index b809eac85..e337b141f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@symbiotejs/symbiote": "^1.11.7", - "@uploadcare/upload-client": "^6.6.1" + "@uploadcare/upload-client": "^6.7.0" }, "devDependencies": { "@babel/eslint-parser": "^7.21.3", @@ -3045,9 +3045,9 @@ } }, "node_modules/@uploadcare/upload-client": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/@uploadcare/upload-client/-/upload-client-6.6.1.tgz", - "integrity": "sha512-bUePLdFBmuu6gTc1vWwo9Mq9dIWznnY5GY/FqLnWQTsP9/4Ht2hF/CZ8b4oFGipEda1DURcc7XrdTZxywBparQ==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@uploadcare/upload-client/-/upload-client-6.7.0.tgz", + "integrity": "sha512-C0wQnhFnqNAttpY4KnQjkQ49AQgHMhRCbw9EvyByRUtIJUPCYTpbybZSslPy0eS2WADCW1BnJtocWF/V+aa/iw==", "dependencies": { "form-data": "^4.0.0", "ws": "^8.2.3" @@ -15113,9 +15113,9 @@ } }, "@uploadcare/upload-client": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/@uploadcare/upload-client/-/upload-client-6.6.1.tgz", - "integrity": "sha512-bUePLdFBmuu6gTc1vWwo9Mq9dIWznnY5GY/FqLnWQTsP9/4Ht2hF/CZ8b4oFGipEda1DURcc7XrdTZxywBparQ==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@uploadcare/upload-client/-/upload-client-6.7.0.tgz", + "integrity": "sha512-C0wQnhFnqNAttpY4KnQjkQ49AQgHMhRCbw9EvyByRUtIJUPCYTpbybZSslPy0eS2WADCW1BnJtocWF/V+aa/iw==", "requires": { "form-data": "^4.0.0", "ws": "^8.2.3" diff --git a/package.json b/package.json index aa1a279a6..09bebf623 100644 --- a/package.json +++ b/package.json @@ -131,6 +131,6 @@ "license": "MIT", "dependencies": { "@symbiotejs/symbiote": "^1.11.7", - "@uploadcare/upload-client": "^6.6.1" + "@uploadcare/upload-client": "^6.7.0" } } diff --git a/types/exported.d.ts b/types/exported.d.ts index ffb34c76f..a2ea1f724 100644 --- a/types/exported.d.ts +++ b/types/exported.d.ts @@ -1,3 +1,5 @@ +import { UploadcareFile } from '@uploadcare/upload-client'; + export type Metadata = import('@uploadcare/upload-client').Metadata; export type MetadataCallback = () => Promise; export type ConfigType = { @@ -55,4 +57,17 @@ export type KebabCaseKeys> = { [Key in keyof T export type LowerCase = Lowercase; export type LowerCaseKeys> = { [Key in keyof T as Lowercase]: T[Key] }; +type requiredFileInfoFields = 'name' | 'size' | 'isImage' | 'mimeType'; + +export type OutputFileEntry = Pick & + Partial> & { + cdnUrlModifiers: string | null; + validationErrorMessage: string | null; + uploadError: Error | null; + file: File | Blob | null; + externalUrl: string | null; + isValid: boolean; + isUploaded: boolean; + }; + export {}; diff --git a/web/blocks.iife.min.js b/web/blocks.iife.min.js index 3c18fc1e9..7b0cdce2c 100644 --- a/web/blocks.iife.min.js +++ b/web/blocks.iife.min.js @@ -23,5 +23,5 @@ * SOFTWARE. * */ -"use strict";var LR=(()=>{var Fe=Object.defineProperty;var Wr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var qr=Object.prototype.hasOwnProperty;var Gr=(s,i,t)=>i in s?Fe(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var l=(s,i)=>Fe(s,"name",{value:i,configurable:!0});var Kr=(s,i)=>{for(var t in i)Fe(s,t,{get:i[t],enumerable:!0})},Yr=(s,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Xr(i))!qr.call(s,r)&&r!==t&&Fe(s,r,{get:()=>i[r],enumerable:!(e=Wr(i,r))||e.enumerable});return s};var Zr=s=>Yr(Fe({},"__esModule",{value:!0}),s);var u=(s,i,t)=>(Gr(s,typeof i!="symbol"?i+"":i,t),t),ji=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var z=(s,i,t)=>(ji(s,i,"read from private field"),t?t.call(s):i.get(s)),Rt=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},Ve=(s,i,t,e)=>(ji(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var gi=(s,i,t)=>(ji(s,i,"access private method"),t);var ll={};Kr(ll,{ActivityBlock:()=>b,ActivityHeader:()=>pi,BaseComponent:()=>Pt,Block:()=>y,CameraSource:()=>ye,CloudImageEditor:()=>mi,CloudImageEditorActivity:()=>di,CloudImageEditorBlock:()=>rt,Config:()=>pe,ConfirmationDialog:()=>Ce,Copyright:()=>Pe,CropFrame:()=>xe,Data:()=>$,DataOutput:()=>Lt,DropArea:()=>qt,EditorCropButtonControl:()=>Zt,EditorFilterControl:()=>It,EditorImageCropper:()=>$e,EditorImageFader:()=>ui,EditorOperationControl:()=>Jt,EditorScroller:()=>Se,EditorSlider:()=>Ee,EditorToolbar:()=>ke,ExternalSource:()=>Ue,FileItem:()=>nt,FilePreview:()=>Kt,FileUploaderInline:()=>De,FileUploaderMinimal:()=>Ne,FileUploaderRegular:()=>Me,Icon:()=>Ht,Img:()=>ii,LineLoaderUi:()=>Ie,LrBtnUi:()=>Qt,MessageBox:()=>ge,Modal:()=>Vt,PACKAGE_NAME:()=>ls,PACKAGE_VERSION:()=>as,PresenceToggle:()=>Oe,ProgressBar:()=>Te,ProgressBarCommon:()=>we,Select:()=>Re,ShadowWrapper:()=>ee,SimpleBtn:()=>Xt,SliderUi:()=>Le,SourceBtn:()=>Gt,SourceList:()=>ri,StartFrom:()=>si,Tabs:()=>te,UploadCtxProvider:()=>li,UploadDetails:()=>ve,UploadList:()=>be,UploaderBlock:()=>v,UrlSource:()=>_e,Video:()=>tt,connectBlocksFrom:()=>jr,registerBlocks:()=>Bi,shadowed:()=>fi,toKebabCase:()=>ot});var Jr=Object.defineProperty,Qr=l((s,i,t)=>i in s?Jr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,"__defNormalProp"),Wi=l((s,i,t)=>(Qr(s,typeof i!="symbol"?i+"":i,t),t),"__publicField");function tn(s){let i=l(t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}},"clone");return i(s)}l(tn,"cloneObj");var $=l(class{constructor(s){s.constructor===Object?this.store=tn(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}},"Data");$.globalStore=new Map;var w=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),_s="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",en=_s.length-1,ze=l(class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{ai&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}l(sn,"kebabToCamel");function rn(s,i){[...s.querySelectorAll(`[${w.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(w.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=l(class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}},"itemClass");let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(w.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let a=[...t.children],c,h=l(d=>{d.forEach((f,g)=>{if(a[g])if(a[g].set$)setTimeout(()=>{a[g].set$(f)});else for(let m in f)a[g][m]=f[m];else{c||(c=new DocumentFragment);let m=new r;Object.assign(m.init$,f),c.appendChild(m)}}),c&&t.appendChild(c);let p=a.slice(d.length,a.length);for(let f of p)f.remove()},"fillItems");if(o.constructor===Array)h(o);else if(o.constructor===Object){let d=[];for(let p in o){let f=o[p];Object.defineProperty(f,"_KEY_",{value:p,enumerable:!0}),d.push(f)}h(d)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(w.REPEAT_ATTR),t.removeAttribute(w.REPEAT_ITEM_TAG_ATTR)})}l(rn,"repeatProcessor");var gs="__default__";function nn(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||gs;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=gs;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}l(nn,"slotProcessor");function on(s,i){[...s.querySelectorAll(`[${w.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(w.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(w.EL_REF_ATTR)})}l(on,"refProcessor");function ln(s,i){[...s.querySelectorAll(`[${w.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(w.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=sn(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(d=>d.trim()),a=o[0],c;a.indexOf(w.ATTR_BIND_PRFX)===0&&(c=!0,a=a.replace(w.ATTR_BIND_PRFX,""));let h=o[1].split(",").map(d=>d.trim());for(let d of h){let p;d.startsWith("!!")?(p="double",d=d.replace("!!","")):d.startsWith("!")&&(p="single",d=d.replace("!","")),i.sub(d,f=>{p==="double"?f=!!f:p==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):ys(t,a,f)||(t[w.SET_LATER_KEY]||(t[w.SET_LATER_KEY]=Object.create(null)),t[w.SET_LATER_KEY][a]=f)})}}),t.removeAttribute(w.BIND_ATTR)})}l(ln,"domSetProcessor");var bi="{{",Be="}}",an="skip-text";function cn(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(an))&&r.textContent.includes(bi)&&r.textContent.includes(Be)&&1}});for(;i=e.nextNode();)t.push(i);return t}l(cn,"getTextNodesWithTokens");var hn=l(function(s,i){cn(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(Be);)e.textContent.startsWith(bi)?(n=e.textContent.indexOf(Be)+Be.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(bi),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let a=o.textContent.replace(bi,"").replace(Be,"");o.textContent="",i.sub(a,c=>{o.textContent=c})})})},"txtNodesProcessor"),un=[rn,nn,on,ln,hn],_i="'",se='"',dn=/\\([0-9a-fA-F]{1,6} ?)/g;function pn(s){return(s[0]===se||s[0]===_i)&&(s[s.length-1]===se||s[s.length-1]===_i)}l(pn,"hasLeadingTrailingQuotes");function fn(s){return(s[0]===se||s[0]===_i)&&(s=s.slice(1)),(s[s.length-1]===se||s[s.length-1]===_i)&&(s=s.slice(0,-1)),s}l(fn,"trimQuotes");function mn(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ -`,"\\n"),i=mn(i),i=se+i+se);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}l(gn,"parseCssPropertyValue");var bs=0,ie=null,bt=null,xt=l(class extends HTMLElement{constructor(){super(),Wi(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return xt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(w.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=l(()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=ze.generate(),this.style.setProperty(w.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(w.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(w.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(w.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(w.EXT_DATA_CTX_PRFX,"");else if(s.includes(w.NAMED_DATA_CTX_SPLTR)){let r=s.split(w.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=l(n=>{this.isConnected&&i(n)},"subCb"),r=xt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=xt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=xt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=xt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=xt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=xt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(w.CTX_OWNER_ATTR)&&this.getAttribute(w.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(w.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(w.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(w.NAMED_DATA_CTX_SPLTR)){let t=i.split(w.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(w.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(w.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[w.SET_LATER_KEY]){for(let t in this[w.SET_LATER_KEY])ys(this,t,this[w.SET_LATER_KEY][t]);delete this[w.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of un)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${w.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(w.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);bt==null||bt.delete(this.updateCssData),bt!=null&&bt.size||(ie==null||ie.disconnect(),ie=null,bt=null)},100)))}static reg(s,i=!1){s||(bs++,s=`${w.AUTO_TAG_PRFX}-${bs}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=gn(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){bt||(bt=new Set),bt.add(this.updateCssData),ie||(ie=new MutationObserver(s=>{s[0].type==="attributes"&&bt.forEach(i=>{i()})}),ie.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},"_BaseComponent"),Pt=xt;Wi(Pt,"template");var Hi=l(class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(Hi.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),Hi.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},"AppRouter");Hi.appMap=Object.create(null);function bn(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}l(bn,"applyStyles");function _n(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}l(_n,"applyAttributes");function je(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&_n(i,s.attributes),s.styles&&bn(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=je(t);i.appendChild(e)}),i}l(je,"create");var vs="idb-store-ready",yn="symbiote-db",vn="symbiote-idb-update_",Cn=l(class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(vs,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return vn+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,a)=>{n.onsuccess=c=>{t||this._notifySubscribers(s),o(c.target.result)},n.onerror=c=>{a(c)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Cs.clear(this.name)}},"DbInstance"),Cs=l(class{static get readyEventName(){return vs}static open(s=yn,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new Cn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}},"IDB");Wi(Cs,"_reg",Object.create(null));function k(s,i){let t,e=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)},"debounced");return e.cancel=()=>{clearTimeout(t)},e}l(k,"debounce");var wn="--uploadcare-blocks-window-height",yi="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Xi(){return typeof window[yi]=="undefined"?!1:!!window[yi]}l(Xi,"getIsWindowHeightTracked");function ws(){if(Xi())return;let s=l(()=>{document.documentElement.style.setProperty(wn,`${window.innerHeight}px`),window[yi]=!0},"callback"),i=k(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[yi]=!1,window.removeEventListener("resize",i)}}l(ws,"createWindowHeightTracker");var Tn=l(s=>s,"DEFAULT_TRANSFORMER"),qi="{{",xs="}}",Ts="plural:";function He(s,i,t={}){var o;let{openToken:e=qi,closeToken:r=xs,transform:n=Tn}=t;for(let a in i){let c=(o=i[a])==null?void 0:o.toString();s=s.replaceAll(e+a+r,typeof c=="string"?n(c):c)}return s}l(He,"applyTemplateData");function Es(s){let i=[],t=s.indexOf(qi);for(;t!==-1;){let e=s.indexOf(xs,t),r=s.substring(t+2,e);if(r.startsWith(Ts)){let n=s.substring(t+2,e).replace(Ts,""),o=n.substring(0,n.indexOf("(")),a=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:a})}t=s.indexOf(qi,e)}return i}l(Es,"getPluralObjects");function As(s){return Object.prototype.toString.call(s)==="[object Object]"}l(As,"isObject");var xn=/\W|_/g;function En(s){return s.split(xn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}l(En,"camelizeString");function $s(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>Ct(t,{ignoreKeys:i})):s}l($s,"camelizeArrayItems");function Ct(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return $s(s,{ignoreKeys:i});if(!As(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}As(r)?r=Ct(r,{ignoreKeys:i}):Array.isArray(r)&&(r=$s(r,{ignoreKeys:i})),t[En(e)]=r}return t}l(Ct,"camelizeKeys");var An=l(s=>new Promise(i=>setTimeout(i,s)),"delay");function Zi({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),a=[n,r].filter(Boolean).join("; ");return`${o} (${a})`}l(Zi,"getUserAgent$1");var $n={factor:2,time:100};function Sn(s,i=$n){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l(a=>An(a!=null?a:n).then(()=>(t+=1,e(r))),"retry")})}return l(e,"runAttempt"),e(s)}l(Sn,"retrier");var Dt=class extends Error{constructor(t){super();u(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,Dt.prototype),this.originalProgressEvent=t}};l(Dt,"UploadcareNetworkError");var xi=l((s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},"onCancel"),_t=class extends Error{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);Object.setPrototypeOf(this,_t.prototype)}};l(_t,"CancelError");var kn=500,ks=l(({check:s,interval:i=kn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,a;xi(e,()=>{o&&clearTimeout(o),n(new _t("Poll cancelled"))}),t&&(a=setTimeout(()=>{o&&clearTimeout(o),n(new _t("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(e)).then(h=>{h?(a&&clearTimeout(a),r(h)):o=setTimeout(c,i)}).catch(h=>{a&&clearTimeout(a),n(h)})}catch(h){a&&clearTimeout(a),n(h)}},"tick");o=setTimeout(c,0)}),"poll"),A={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},Ei="application/octet-stream",Is="original",Et=l(({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,a)=>{let c=new XMLHttpRequest,h=(s==null?void 0:s.toUpperCase())||"GET",d=!1;c.open(h,i,!0),e&&Object.entries(e).forEach(p=>{let[f,g]=p;typeof g!="undefined"&&!Array.isArray(g)&&c.setRequestHeader(f,g)}),c.responseType="text",xi(r,()=>{d=!0,c.abort(),a(new _t)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let p={method:h,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function(S){let E=S.split(": "),x=E.shift(),T=E.join(": ");x&&typeof x!="undefined"&&(g[x]=T)});let m=c.response,_=c.status;o({request:p,data:m,headers:g,status:_})}},c.onerror=p=>{d||a(new Dt(p))},n&&typeof n=="function"&&(c.upload.onprogress=p=>{p.lengthComputable?n({isComputable:!0,value:p.loaded/p.total}):n({isComputable:!1})}),t?c.send(t):c.send()}),"request");function In(s,...i){return s}l(In,"identity");var On=l(({name:s})=>s?[s]:[],"getFileOptions"),Ln=In,Un=l(()=>new FormData,"getFormData"),Os=l(s=>!1,"isBuffer"),Ai=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),$i=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),Si=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),Xe=l(s=>Ai(s)||$i(s)||Os()||Si(s),"isFileData"),Rn=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Pn=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),Mn=l(s=>!!s&&typeof s=="object"&&"data"in s&&Xe(s.data),"isFileValue");function Nn(s,i,t){if(Mn(t)){let{name:e,contentType:r}=t,n=Ln(t.data,e,r!=null?r:Ei),o=On({name:e,contentType:r});s.push([i,n,...o])}else if(Pn(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else Rn(t)&&t&&s.push([i,t.toString()])}l(Nn,"collectParams");function Dn(s){let i=[];for(let[t,e]of Object.entries(s))Nn(i,t,e);return i}l(Dn,"getFormDataParams");function Ji(s){let i=Un(),t=Dn(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}l(Ji,"buildFormData");var R=class extends Error{constructor(t,e,r,n,o){super();u(this,"isCancel");u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,R.prototype)}};l(R,"UploadClientError");var Fn=l(s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),vt=l((s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fn(t)),e.toString()},"getUrl"),Vn="6.6.1",Bn="UploadcareUploadClient",zn=Vn;function Ft(s){return Zi({libraryName:Bn,libraryVersion:zn,...s})}l(Ft,"getUserAgent");var jn="RequestThrottledError",Ss=15e3,Hn=1e3;function Wn(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return Ss;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Ss}l(Wn,"getTimeoutFromThrottledRequest");function At(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Sn(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===jn&&r{let i="";return(Ai(s)||$i(s)||Si(s))&&(i=s.type),i||Ei},"getContentType"),Us=l(s=>{let i="";return $i(s)&&s.name?i=s.name:Ai(s)||Os()?i="":Si(s)&&s.name&&(i=s.name),i||Is},"getFileName");function Qi(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(Qi,"getStoreValue");function Xn(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=A.baseURL,secureSignature:n,secureExpire:o,store:a,signal:c,onProgress:h,source:d="local",integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:_}){return At(()=>Et({method:"POST",url:vt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:p,userAgent:f})},data:Ji({file:{data:s,name:t||Us(s),contentType:e||Ls(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Qi(a),signature:n,expire:o,source:d,metadata:_}),signal:c,onProgress:h}).then(({data:S,headers:E,request:x})=>{let T=Ct(JSON.parse(S));if("error"in T)throw new R(T.error.content,T.error.errorCode,x,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(Xn,"base");var Yi;(function(s){s.Token="token",s.FileInfo="file_info"})(Yi||(Yi={}));function qn(s,{publicKey:i,baseURL:t=A.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,source:h="url",signal:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:_}){return At(()=>Et({method:"POST",headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:p,userAgent:f})},url:vt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Qi(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:a,expire:c,source:h,metadata:_}),signal:d}).then(({data:S,headers:E,request:x})=>{let T=Ct(JSON.parse(S));if("error"in T)throw new R(T.error.content,T.error.errorCode,x,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(qn,"fromUrl");var q;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(q||(q={}));var Gn=l(s=>"status"in s&&s.status===q.Error,"isErrorResponse");function Kn(s,{publicKey:i,baseURL:t=A.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=A.retryNetworkErrorMaxTimes}={}){return At(()=>Et({method:"GET",headers:i?{"X-UC-User-Agent":Ft({publicKey:i,integration:r,userAgent:n})}:void 0,url:vt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:c,headers:h,request:d})=>{let p=Ct(JSON.parse(c));if("error"in p&&!Gn(p))throw new R(p.error.content,void 0,d,p,h);return p}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:o})}l(Kn,"fromUrlStatus");function Yn(s,{publicKey:i,baseURL:t=A.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:a,integration:c,userAgent:h,retryThrottledRequestMaxTimes:d=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=A.retryNetworkErrorMaxTimes}){return At(()=>Et({method:"POST",headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:c,userAgent:h})},url:vt(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:a}),signal:o}).then(({data:f,headers:g,request:m})=>{let _=Ct(JSON.parse(f));if("error"in _)throw new R(_.error.content,_.error.errorCode,m,_,g);return _}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:d})}l(Yn,"group");function Rs(s,{publicKey:i,baseURL:t=A.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=A.retryNetworkErrorMaxTimes}){return At(()=>Et({method:"GET",headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:n,userAgent:o})},url:vt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:h,headers:d,request:p})=>{let f=Ct(JSON.parse(h));if("error"in f)throw new R(f.error.content,f.error.errorCode,p,f,d);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Rs,"info");function Zn(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=A.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:a,store:c,signal:h,source:d="local",integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:_}){return At(()=>Et({method:"POST",url:vt(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:p,userAgent:f})},data:Ji({filename:e||Is,size:s,content_type:t||Ei,part_size:r,UPLOADCARE_STORE:Qi(c),UPLOADCARE_PUB_KEY:i,signature:o,expire:a,source:d,metadata:_}),signal:h}).then(({data:S,headers:E,request:x})=>{let T=Ct(JSON.parse(S));if("error"in T)throw new R(T.error.content,T.error.errorCode,x,T,E);return T.parts=Object.keys(T.parts).map(W=>T.parts[W]),T}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})}l(Zn,"multipartStart");function Jn(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=A.retryNetworkErrorMaxTimes}){return At(()=>Et({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||Ei}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}l(Jn,"multipartUpload");function Qn(s,{publicKey:i,baseURL:t=A.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=A.retryNetworkErrorMaxTimes}){return At(()=>Et({method:"POST",url:vt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ft({publicKey:i,integration:n,userAgent:o})},data:Ji({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:h,headers:d,request:p})=>{let f=Ct(JSON.parse(h));if("error"in f)throw new R(f.error.content,f.error.errorCode,p,f,d);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Qn,"multipartComplete");function ts({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,signal:c,onProgress:h}){return ks({check:d=>Rs(s,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a}).then(p=>p.isReady?p:(h&&h({isComputable:!0,value:1}),!1)),signal:c})}l(ts,"isReadyPoll");var yt=class{constructor(i,{baseCDN:t=A.baseCDN,fileName:e}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);let{uuid:r,s3Bucket:n}=i,o=vt(t,`${r}/`),a=n?vt(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=a}};l(yt,"UploadcareFile");var to=l((s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:a,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,baseCDN:_,metadata:S})=>Xn(s,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:S}).then(({file:E})=>ts({file:E,publicKey:i,baseURL:e,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:h,signal:c})).then(E=>new yt(E,{baseCDN:_})),"uploadDirect"),eo=l((s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:d,baseCDN:p})=>Rs(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:d}).then(f=>new yt(f,{baseCDN:p,fileName:t})).then(f=>(n&&n({isComputable:!0,value:1}),f)),"uploadFromUploaded"),io=l((s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=l(o=>()=>{e=o,r.forEach((a,c)=>c!==o&&a.abort())},"createStopRaceCallback");return xi(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,a)=>{let c=n(a);return Promise.resolve().then(()=>o({stopRace:c,signal:r[a].signal})).then(h=>(c(),h)).catch(h=>(t=h,null))})).then(o=>{if(e===null)throw t;return o[e]})},"race"),so=window.WebSocket,vi=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}};l(vi,"Events");var ro=l((s,i)=>s==="success"?{status:q.Success,...i}:s==="progress"?{status:q.Progress,...i}:{status:q.Error,...i},"response"),Ci=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new vi);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new so(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,ro(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}};l(Ci,"Pusher");var Gi=null,es=l(s=>{if(!Gi){let i=typeof window=="undefined"?0:3e4;Gi=new Ci(s,i)}return Gi},"getPusher"),no=l(s=>{es(s).connect()},"preconnect");function oo({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:a,signal:c}){return ks({check:h=>Kn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:h}).then(d=>{switch(d.status){case q.Error:return new R(d.error,d.errorCode);case q.Waiting:return!1;case q.Unknown:return new R(`Token "${s}" was not found.`);case q.Progress:return a&&(d.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:d.done/d.total})),!1;case q.Success:return a&&a({isComputable:!0,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:c})}l(oo,"pollStrategy");var lo=l(({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=es(i),a=o.onError(n),c=l(()=>{a(),o.unsubscribe(s)},"destroy");xi(t,()=>{c(),n(new _t("pusher cancelled"))}),o.subscribe(s,h=>{switch(h.status){case q.Progress:{e&&(h.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:h.done/h.total}));break}case q.Success:{c(),e&&e({isComputable:!0,value:h.done/h.total}),r(h);break}case q.Error:c(),n(new R(h.msg,h.error_code))}})}),"pushStrategy"),ao=l((s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,store:h,signal:d,onProgress:p,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,pusherKey:S=A.pusherKey,metadata:E})=>Promise.resolve(no(S)).then(()=>qn(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,store:h,signal:d,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,metadata:E})).catch(x=>{let T=es(S);return T==null||T.disconnect(),Promise.reject(x)}).then(x=>x.type===Yi.FileInfo?x:io([({signal:T})=>oo({token:x.token,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:p,signal:T}),({signal:T})=>lo({token:x.token,pusherKey:S,signal:T,onProgress:p})],{signal:d})).then(x=>{if(x instanceof R)throw x;return x}).then(x=>ts({file:x.uuid,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:p,signal:d})).then(x=>new yt(x,{baseCDN:r})),"uploadFromUrl"),Ki=new WeakMap,co=l(async s=>{if(Ki.has(s))return Ki.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ki.set(s,i),i},"getBlobFromReactNativeAsset"),Ps=l(async s=>{if($i(s)||Ai(s))return s.size;if(Si(s))return(await co(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),ho=l((s,i=A.multipartMinFileSize)=>s>=i,"isMultipart"),Ms=l(s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!Xe(s)&&t.test(s)},"isUuid"),Ns=l(s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!Xe(s)&&t.test(s)},"isUrl"),uo=l((s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,a=[...i],c=l(()=>{let h=i.length-a.length,d=a.shift();d&&d().then(p=>{n||(r[h]=p,o-=1,o?c():t(r))}).catch(p=>{n=!0,e(p)})},"run");for(let h=0;h{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},"sliceChunk"),fo=l(async(s,i,t)=>e=>po(s,e,i,t),"prepareChunks"),mo=l((s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>Jn(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),go=l(async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:a,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,contentType:_,multipartChunkSize:S=A.multipartChunkSize,maxConcurrentRequests:E=A.maxConcurrentRequests,baseCDN:x,metadata:T})=>{let W=e!=null?e:await Ps(s),ft,Ut=l((M,et)=>{if(!h)return;ft||(ft=Array(M).fill(0));let mt=l(X=>X.reduce((gt,zi)=>gt+zi,0),"sum");return X=>{X.isComputable&&(ft[et]=X.value,h({isComputable:!0,value:mt(ft)/M}))}},"createProgressHandler");return _||(_=Ls(s)),Zn(W,{publicKey:i,contentType:_,fileName:t||Us(s),baseURL:r,secureSignature:n,secureExpire:o,store:a,signal:c,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:T}).then(async({uuid:M,parts:et})=>{let mt=await fo(s,W,S);return Promise.all([M,uo(E,et.map((X,gt)=>()=>mo(mt(gt),X,{publicKey:i,contentType:_,onProgress:Ut(et.length,gt),signal:c,integration:p,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})))])}).then(([M])=>Qn(M,{publicKey:i,baseURL:r,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})).then(M=>M.isReady?M:ts({file:M.uuid,publicKey:i,baseURL:r,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:h,signal:c})).then(M=>new yt(M,{baseCDN:x}))},"uploadMultipart");async function is(s,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartMinFileSize:_,multipartChunkSize:S,maxConcurrentRequests:E,baseCDN:x=A.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:W,pusherKey:ft,metadata:Ut}){if(Xe(s)){let M=await Ps(s);return ho(M,_)?go(s,{publicKey:i,contentType:m,multipartChunkSize:S,fileSize:M,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x,metadata:Ut}):to(s,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x,metadata:Ut})}if(Ns(s))return ao(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:x,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:W,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,pusherKey:ft,metadata:Ut});if(Ms(s))return eo(s,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x});throw new TypeError(`File uploading from "${s}" is not supported`)}l(is,"uploadFile");var wi=class{constructor(i,t){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount,this.totalSize=Object.values(i.files).reduce((e,r)=>e+r.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(i.files).filter(e=>e.isImage).length,this.cdnUrl=i.cdnUrl,this.files=t,this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}};l(wi,"UploadcareGroup");var bo=l(s=>{for(let i of s)if(!Xe(i))return!1;return!0},"isFileDataArray"),_o=l(s=>{for(let i of s)if(!Ms(i))return!1;return!0},"isUuidArray"),yo=l(s=>{for(let i of s)if(!Ns(i))return!1;return!0},"isUrlArray");function Ds(s,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_=A.multipartChunkSize,baseCDN:S=A.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:x,jsonpCallback:T}){if(!bo(s)&&!yo(s)&&!_o(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let W,ft=!0,Ut=s.length,M=l((et,mt)=>{if(!c)return;W||(W=Array(et).fill(0));let X=l(gt=>gt.reduce((zi,Hr)=>zi+Hr)/et,"normalize");return gt=>{if(!gt.isComputable||!ft){ft=!1,c({isComputable:!1});return}W[mt]=gt.value,c({isComputable:!0,value:X(W)})}},"createProgressHandler");return Promise.all(s.map((et,mt)=>is(et,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:M(Ut,mt),source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_,baseCDN:S,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:x}))).then(et=>{let mt=et.map(X=>X.uuid);return Yn(mt,{publicKey:i,baseURL:e,jsonpCallback:T,secureSignature:r,secureExpire:n,signal:a,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(X=>new wi(X,et)).then(X=>(c&&c({isComputable:!0,value:1}),X))})}l(Ds,"uploadFileGroup");var Mt,re,Nt,ne,oe,le,Ti,We=class{constructor(i){Rt(this,le);Rt(this,Mt,1);Rt(this,re,[]);Rt(this,Nt,0);Rt(this,ne,new WeakMap);Rt(this,oe,new WeakMap);Ve(this,Mt,i)}add(i){return new Promise((t,e)=>{z(this,ne).set(i,t),z(this,oe).set(i,e),z(this,re).push(i),gi(this,le,Ti).call(this)})}get pending(){return z(this,re).length}get running(){return z(this,Nt)}set concurrency(i){Ve(this,Mt,i),gi(this,le,Ti).call(this)}get concurrency(){return z(this,Mt)}};l(We,"Queue"),Mt=new WeakMap,re=new WeakMap,Nt=new WeakMap,ne=new WeakMap,oe=new WeakMap,le=new WeakSet,Ti=l(function(){let i=z(this,Mt)-z(this,Nt);for(let t=0;t{z(this,ne).delete(e),z(this,oe).delete(e),Ve(this,Nt,z(this,Nt)-1),gi(this,le,Ti).call(this)}).then(o=>r(o)).catch(o=>n(o))}},"#run");var ss=l(()=>({"*blocksRegistry":new Set}),"blockCtx"),rs=l(s=>({...ss(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),"activityBlockCtx"),ki=l(s=>({...rs(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new We(1)}),"uploaderBlockCtx");function Fs(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}l(Fs,"l10nProcessor");var G=l(s=>`*cfg/${s}`,"sharedConfigKey");var ot=l(s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var Vs=new Set;function Ii(s){Vs.has(s)||(Vs.add(s),console.warn(s))}l(Ii,"warnOnce");var Oi=l((s,i)=>new Intl.PluralRules(s).select(i),"getPluralForm");var Li=l(({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{c.disconnect(),e()},r),o=l(h=>{let d=s.getAttribute(i);h.type==="attributes"&&h.attributeName===i&&d!==null&&(clearTimeout(n),c.disconnect(),t(d))},"handleMutation"),a=s.getAttribute(i);a!==null&&(clearTimeout(n),t(a));let c=new MutationObserver(h=>{let d=h[h.length-1];o(d)});c.observe(s,{attributes:!0,attributeFilter:[i]})},"waitForAttribute");var ns="lr-",y=class extends Pt{constructor(){super();u(this,"requireCtxName",!1);u(this,"allowCustomTemplate",!0);u(this,"init$",ss());u(this,"updateCtxCssData",l(()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()},"updateCtxCssData"));this.activityType=null,this.addTemplateProcessor(Fs),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=Es(r);for(let a of n)e[a.variable]=this.pluralize(a.pluralKey,Number(e[a.countVariable]));return He(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=Oi(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${ns}${t}`,!0),Xi()||(this._destroyInnerHeightTracker=ws()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Li({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=l(h=>this.getCssData("--l10n-unit-"+h.toLowerCase(),!0)||h,"getUnit");if(t===0)return`0 ${n(r[0])}`;let o=1024,a=e<0?0:e,c=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**c).toFixed(a))+" "+n(r[c])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?He(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=G(r);return this.$[o]=n,!0},get:(e,r)=>{let n=G(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Ii("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${ot(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(G(t));r.ctx.has(r.name)?this.sub(G(t),e):(this.bindCssData(`--cfg-${ot(t)}`),this.sub(`--cfg-${ot(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(ns)?t:ns+t)}};l(y,"Block"),u(y,"StateConsumerScope",null),u(y,"className","");var Vt=class extends y{constructor(){super();u(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));u(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));u(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));u(this,"_handleDialogPointerUp",l(t=>{t.target===this.ref.dialog&&this._closeDialog()},"_handleDialogPointerUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};l(Vt,"Modal"),u(Vt,"StateConsumerScope","modal");Vt.template=``;var Bs="active",qe="___ACTIVITY_IS_ACTIVE___",lt=class extends y{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",rs(this));u(this,"_debouncedHistoryFlush",k(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=lt._activityRegistry[this.activityKey];this[qe]=!1,this.removeAttribute(Bs),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=lt._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[qe]=!0,this.setAttribute(Bs,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[qe]?this._deactivate():this.activityType===t&&!this[qe]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!lt._activityRegistry[this.activityKey]}get isActivityActive(){return this[qe]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;lt._activityRegistry||(lt._activityRegistry=Object.create(null)),lt._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),lt._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(lt._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},b=lt;l(b,"ActivityBlock"),u(b,"_activityRegistry",Object.create(null));b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Ge=33.333333333333336,C=1,os=24,zs=6;function Bt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}l(Bt,"setSvgNodeAttrs");function it(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Bt(t,i),t}l(it,"createSvgNode");function js(s,i,t){let{x:e,y:r,width:n,height:o}=s,a=i.includes("w")?0:1,c=i.includes("n")?0:1,h=[-1,1][a],d=[-1,1][c],p=[e+a*n+1.5*h,r+c*o+1.5*d-24*t*d],f=[e+a*n+1.5*h,r+c*o+1.5*d],g=[e+a*n-24*t*h+1.5*h,r+c*o+1.5*d];return{d:`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}l(js,"cornerPath");function Hs(s,i,t){let{x:e,y:r,width:n,height:o}=s,a=["n","s"].includes(i)?.5:{w:0,e:1}[i],c=["w","e"].includes(i)?.5:{n:0,s:1}[i],h=[-1,1][a],d=[-1,1][c],p,f;["n","s"].includes(i)?(p=[e+a*n-34*t/2,r+c*o+1.5*d],f=[e+a*n+34*t/2,r+c*o+1.5*d]):(p=[e+a*n+1.5*h,r+c*o-34*t/2],f=[e+a*n+1.5*h,r+c*o+34*t/2]);let g=`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]}`,m=[f[0]-(f[0]-p[0])/2,f[1]-(f[1]-p[1])/2];return{d:g,center:m}}l(Hs,"sidePath");function Ws(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Ws,"thumbCursor");function Xs({rect:s,delta:[i,t],imageBox:e}){return ce({...s,x:s.x+i,y:s.y+t},e)}l(Xs,"moveRect");function ce(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}l(ce,"constraintRect");function vo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:a}=s;n+=r,a-=r,t&&(o=a*t);let c=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,a=s.y+s.height-n,t&&(o=a*t,c=s.x+s.width/2-o/2)),c<=e.x&&(c=e.x,n=s.y+s.height-a),c+o>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-c,t&&(a=o/t),n=s.y+s.height-a),a=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(o=a*t),n=s.x+s.width-o),a=e.y+e.height&&(a=e.y+e.height-n,t&&(o=a*t),c=s.x+s.width/2-o/2),c<=e.x&&(c=e.x,n=s.y),c+o>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-c,t&&(a=o/t),n=s.y),a=e.x+e.width&&(o=e.x+e.width-n,t&&(a=o/t),c=s.y+s.height/2-a/2),c<=e.y&&(c=e.y,n=s.x),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(o=a*t),n=s.x),at?(n=c/t-h,h+=n,a-=n,a<=e.y&&(h=h-(e.y-a),c=h*t,o=s.x+s.width-c,a=e.y)):t&&(r=h*t-c,c=c+r,o-=r,o<=e.x&&(c=c-(e.x-o),h=c/t,o=e.x,a=s.y+s.height-h)),he.x+e.width&&(r=e.x+e.width-o-c),a+nt?(n=c/t-h,h+=n,a-=n,a<=e.y&&(h=h-(e.y-a),c=h*t,o=s.x,a=e.y)):t&&(r=h*t-c,c+=r,o+c>=e.x+e.width&&(c=e.x+e.width-o,h=c/t,o=e.x+e.width-c,a=s.y+s.height-h)),he.y+e.height&&(n=e.y+e.height-a-h),o+=r,c-=r,h+=n,t&&Math.abs(c/h)>t?(n=c/t-h,h+=n,a+h>=e.y+e.height&&(h=e.y+e.height-a,c=h*t,o=s.x+s.width-c,a=e.y+e.height-h)):t&&(r=h*t-c,c+=r,o-=r,o<=e.x&&(c=c-(e.x-o),h=c/t,o=e.x,a=s.y)),he.x+e.width&&(r=e.x+e.width-o-c),a+h+n>e.y+e.height&&(n=e.y+e.height-a-h),c+=r,h+=n,t&&Math.abs(c/h)>t?(n=c/t-h,h+=n,a+h>=e.y+e.height&&(h=e.y+e.height-a,c=h*t,o=s.x,a=e.y+e.height-h)):t&&(r=h*t-c,c+=r,o+c>=e.x+e.width&&(c=e.x+e.width-o,h=c/t,o=e.x+e.width-c,a=s.y)),h=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}l(Ks,"isRectInsideRect");function Ys(s,i){return Math.abs(s.width/s.height-i)<.1}l(Ys,"isRectMatchesAspectRatio");function he({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}l(he,"rotateSize");function Zs(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),a=Math.round((i-n)/2);return o+r>s&&(r=s-o),a+n>i&&(n=i-a),{x:o,y:a,width:r,height:n}}l(Zs,"calculateMaxCenteredCropFrame");function ue(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(ue,"roundRect");function $t(s,i,t){return Math.min(Math.max(s,i),t)}l($t,"clamp");var Ri=l(s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]},"parseCropPreset");var st=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var ls="blocks",as="0.27.6";function Js(s){return Zi({...s,libraryName:ls,libraryVersion:as})}l(Js,"customUserAgent");var Qs=l(s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Pi=l((...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Qs(i)).join("/-/"),"joinCdnOperations"),N=l((...s)=>{let i=Pi(...s);return i?`-/${i}/`:""},"createCdnUrlModifiers");function tr(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}l(tr,"extractFilename");function er(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}l(er,"extractUuid");function ir(s){let i=sr(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Qs(n))}l(ir,"extractOperations");function sr(s){let i=new URL(s),t=tr(s),e=rr(t)?nr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}l(sr,"trimFilename");function rr(s){return s.startsWith("http")}l(rr,"isFileUrl");function nr(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}l(nr,"splitFileUrl");var O=l((s,i,t)=>{let e=new URL(sr(s));if(t=t||tr(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),rr(t)){let r=nr(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},"createCdnUrl"),St=l((s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()},"createOriginalUrl");var D=l((s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var Ke=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],cs=l(s=>s?s.filter(i=>typeof i=="string").map(i=>D(i)).flat():[],"mergeFileTypes"),hs=l((s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),or=l((s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),Ye=l(s=>{let i=s==null?void 0:s.type;return i?hs(i,Ke):!1},"fileIsImage");var ct=1e3,zt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ze=l(s=>Math.ceil(s*100)/100,"round"),lr=l((s,i=zt.AUTO)=>{let t=i===zt.AUTO;if(i===zt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))},"dispatch");if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};l(L,"EventManager"),u(L,"_timeoutStore",Object.create(null));var ar="[Typed State] Wrong property name: ",So="[Typed State] Wrong property type: ",Je=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||ze.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(ar+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(So+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(ar+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};l(Je,"TypedData");var Qe=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||ze.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__handler=i.handler||null,this.__subsMap=Object.create(null),this.__observers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{this.__observers.forEach(n=>{n({...t})}),t=Object.create(null)})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{var e;let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear(),(e=this.__handler)==null||e.call(this,[...this.__items],i,t)})}setHandler(i){this.__handler=i,this.notify()}getHandler(){return this.__handler}removeHandler(){this.__handler=null}add(i){let t=new Je(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observe(i){this.__observers.add(i)}unobserve(i){this.__observers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__observers=null,this.__handler=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};l(Qe,"TypedCollection");var cr=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:yt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var hr=l(s=>s?s.split(",").map(i=>i.trim()):[],"deserealizeCsv"),jt=l(s=>s?s.join(","):"","serializeCsv");var v=class extends b{constructor(){super(...arguments);u(this,"couldBeUploadCollectionOwner",!1);u(this,"isUploadCollectionOwner",!1);u(this,"init$",ki(this));u(this,"__initialUploadMetadata",null);u(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);u(this,"_debouncedRunValidators",k(this._runValidators.bind(this),100));u(this,"_handleCollectionUpdate",l(t=>{let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(c=>!c.getValue("uploadError"));o.forEach(c=>{n+=e.readProp(c,"uploadProgress")});let a=Math.round(n/o.length);this.$["*commonProgress"]=a,L.emit(new F({type:P.UPLOAD_PROGRESS,ctx:this.ctxName,data:a}),void 0,a===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(a=>!!a.getValue("fileInfo")),o=e.findItems(a=>!!a.getValue("uploadError")||!!a.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let a=this.getOutputData(c=>!!c.getValue("fileInfo")&&!c.getValue("silentUpload"));a.length>0&&L.emit(new F({type:P.UPLOAD_FINISH,ctx:this.ctxName,data:a}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{L.emit(new F({type:P.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{L.emit(new F({type:P.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{L.emit(new F({type:P.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})},"_handleCollectionUpdate"))}setUploadMetadata(t){Ii("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Qe({typedSchema:cr,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=l(()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1),"hasUploadCollectionOwner");this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this.__uploadCollectionHandler=(e,r,n)=>{var o;this._runValidators();for(let a of n)(o=a==null?void 0:a.getValue("abortController"))==null||o.abort(),a==null||a.setValue("abortController",null),URL.revokeObjectURL(a==null?void 0:a.getValue("thumbUrl"));this.$["*uploadList"]=e.map(a=>({uid:a}))},this.uploadCollection.setHandler(this.__uploadCollectionHandler),this.uploadCollection.observe(this._handleCollectionUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){super.destroyCallback(),this.isUploadCollectionOwner&&(this.uploadCollection.unobserve(this._handleCollectionUpdate),this.uploadCollection.getHandler()===this.__uploadCollectionHandler&&this.uploadCollection.removeHandler())}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:st.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:st.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:Ye(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:st.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:Ye(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=jt(cs([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?Ke:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=jt(Ke)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:st.LOCAL})),this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=D(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":b.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":b.activities.START_FROM}),this.setOrAddState("*modalActive",!0);L.emit(new F({type:P.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),L.emit(new F({type:P.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=cs([...e?Ke:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),a=t.getValue("fileName");if(!o||!a)return;let c=hs(o,n),h=or(a,n);if(!c&&!h)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:lr(e)})}_validateMultipleLimit(t){let r=this.uploadCollection.items().indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&r>=n)return this.l10n("files-count-allowed",{count:n})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=Ri(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:a,height:c}=o.imageInfo,h=e.width/e.height,d=Zs(a,c,h),p=N(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:p,cdnUrl:O(n.getValue("cdnUrl"),p)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Js,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return this.uploadCollection.findItems(t).forEach(n=>{let o=$.getCtx(n).store,a=o.fileInfo||{name:o.fileName,fileSize:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},c={...a,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl||a.cdnUrl};e.push(c)}),e}};l(v,"UploaderBlock");v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});Object.values(P).forEach(s=>{let i=L.eName(s),t=k(e=>{if([P.UPLOAD_FINISH,P.REMOVE,P.CLOUD_MODIFICATION].includes(e.detail.type)){let n=$.getCtx(e.detail.ctx),o=n.read("uploadCollection"),a=[];o.items().forEach(c=>{let h=$.getCtx(c).store,d=h.fileInfo;if(d){let p={...d,cdnUrlModifiers:h.cdnUrlModifiers,cdnUrl:h.cdnUrl||d.cdnUrl};a.push(p)}}),L.emit(new F({type:P.DATA_OUTPUT,ctx:e.detail.ctx,data:a})),n.pub("outputData",a)}},0);window.addEventListener(i,t)});var J={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function ko(s,i){if(typeof i=="number")return J[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&J[s]!==i?`${s}`:"";if(s==="filter"){if(!i||J[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}l(ko,"transformationToStr");var dr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function kt(s){return Pi(...dr.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return ko(i,t)}).filter(i=>!!i))}l(kt,"transformationsToOperations");var Mi=Pi("format/auto","progressive/yes"),wt=l(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),ur=l(()=>!0,"asBoolean"),Io=l(([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),"asFilter"),Oo=l(([s,i])=>({dimensions:D(s,"x").map(Number),coords:D(i).map(Number)}),"asCrop"),Lo={enhance:wt,brightness:wt,exposure:wt,gamma:wt,contrast:wt,saturation:wt,vibrance:wt,warmth:wt,filter:Io,mirror:ur,flip:ur,rotate:wt,crop:Oo};function pr(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!dr.includes(e))continue;let n=Lo[e],o=n(r);i[e]=o}return i}l(pr,"operationsToTransformations");var V=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),K=[V.CROP,V.TUNING,V.FILTERS],fr=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],mr=["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"],gr=["rotate","mirror","flip"],ht=Object.freeze({brightness:{zero:J.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:J.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:J.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:J.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:J.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:J.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:J.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:J.enhance,range:[0,100],keypointsNumber:1},filter:{zero:J.filter,range:[0,100],keypointsNumber:1}});var Uo="https://ucarecdn.com",Ro="https://upload.uploadcare.com",Po="https://social.uploadcare.com",de={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:jt(K),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Uo,baseUrl:Ro,socialBaseUrl:Po,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var Y=l(s=>String(s),"asString"),ut=l(s=>Number(s),"asNumber"),I=l(s=>typeof s=="boolean"?s:s==="true"||s===""?!0:s==="false"?!1:!!s,"asBoolean"),Mo=l(s=>s==="auto"?s:I(s),"asStore"),No={pubkey:Y,multiple:I,multipleMin:ut,multipleMax:ut,confirmUpload:I,imgOnly:I,accept:Y,externalSourcesPreferredTypes:Y,store:Mo,cameraMirror:I,sourceList:Y,maxLocalFileSizeBytes:ut,thumbSize:ut,showEmptyList:I,useLocalImageEditor:I,useCloudImageEditor:I,cloudImageEditorTabs:Y,removeCopyright:I,cropPreset:Y,modalScrollLock:I,modalBackdropStrokes:I,sourceListWrap:I,remoteTabSessionKey:Y,cdnCname:Y,baseUrl:Y,socialBaseUrl:Y,secureSignature:Y,secureExpire:Y,secureDeliveryProxy:Y,retryThrottledRequestMaxTimes:ut,multipartMinFileSize:ut,multipartChunkSize:ut,maxConcurrentRequests:ut,multipartMaxConcurrentRequests:ut,multipartMaxAttempts:ut,checkForUrlDuplicates:I,saveUrlForRecurrentUploads:I,groupOutput:I,userAgentIntegration:Y},br=l((s,i)=>{if(!(typeof i=="undefined"||i===null))return No[s](i)},"normalizeConfigValue");var Ni=Object.keys(de),Do=["metadata"],Fo=l(s=>Do.includes(s),"isComplexKey"),Di=Ni.filter(s=>!Fo(s)),Vo={...Object.fromEntries(Di.map(s=>[ot(s),s])),...Object.fromEntries(Di.map(s=>[s.toLowerCase(),s]))},Bo={...Object.fromEntries(Ni.map(s=>[ot(s),G(s)])),...Object.fromEntries(Ni.map(s=>[s.toLowerCase(),G(s)]))},pe=class extends y{constructor(){super();u(this,"ctxOwner",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(de).map(([t,e])=>[G(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of Di)this.sub(G(e),r=>{r!==de[e]&&(t[e]=r)},!1);for(let e of Ni){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,Di.includes(e)){let o=[...new Set([ot(e),e.toLowerCase()])];for(let a of o)typeof n=="undefined"||n===null?this.removeAttribute(a):this.setAttribute(a,n.toString())}this.$[G(e)]!==n&&(typeof n=="undefined"||n===null?this.$[G(e)]=de[e]:this.$[G(e)]=n)},get:()=>this.$[G(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Vo[t],o=br(n,r),a=o!=null?o:de[n],c=this;c[n]=a}};l(pe,"Config");pe.bindAttributes(Bo);var Ht=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};l(Ht,"Icon");Ht.template=``;Ht.bindAttributes({name:"name",size:"size"});var zo="https://ucarecdn.com",Wt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:zo},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var _r=l(s=>[...new Set(s)],"uniqueArray");var ti="--lr-img-",yr="unresolved",fe=2,me=3,vr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),wr=Object.create(null),Cr;for(let s in Wt)wr[ti+s]=((Cr=Wt[s])==null?void 0:Cr.default)||"";var ei=class extends Pt{constructor(){super(...arguments);u(this,"cssInit$",wr)}$$(t){return this.$[ti+t]}set$$(t){for(let e in t)this.$[ti+e]=t[e]}sub$$(t,e){this.sub(ti+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!vr&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return N(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Wt.format.default}`,`quality/${this.$$("quality")||Wt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(vr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return O(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(O(St(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(O(St(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(O(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(O(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?He(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),a=r?"":e*Math.round(n.height);return o||a?`${o||""}x${a||""}`:null}_setupEventProxy(t){let e=l(n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},"proxifyEvent"),r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(yr,""),this.img.onload=()=>{this.img.removeAttribute(yr)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Wt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?_r(D(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*fe+"x")}") ${n*fe}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*me+"x")}") ${n*me}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,fe))}") ${fe}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,me))}") ${me}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*fe+"x")+` ${e*fe}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*me+"x")+` ${e*me}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Wt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[ti+t]=r})}};l(ei,"ImgBase");var ii=class extends ei{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};l(ii,"Img");var Xt=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=I(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};l(Xt,"SimpleBtn");Xt.template=``;Xt.bindAttributes({dropzone:null});var si=class extends b{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(si,"StartFrom");function jo(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=l(r=>{r.type!=="loadend"&&t.abort(),i(!1)},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}l(jo,"checkIsDirectory");function Ho(s,i){return new Promise(t=>{let e=0,r=[],n=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(e++,a.file(c=>{e--;let h=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:h,fullPath:a.fullPath}),e===0&&t(r)})):a.isDirectory&&o(a.createReader())},"readEntry"),o=l(a=>{e++,a.readEntries(c=>{e--;for(let h of c)n(h);e===0&&t(r)})},"readReaderContent");n(s)})}l(Ho,"readEntryContentAsync");function Tr(s){let i=[],t=[];for(let e=0;e{c&&i.push(...c)}));continue}let o=r.getAsFile();o&&t.push(jo(o).then(a=>{a||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}l(Tr,"getDropItems");var j={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},xr=["focus"],Wo=100,us=new Map;function Xo(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}l(Xo,"distance");function ds(s){let i=0,t=document.body,e=new Set,r=l(m=>e.add(m),"handleSwitch"),n=j.INACTIVE,o=l(m=>{s.shouldIgnore()&&m!==j.INACTIVE||(n!==m&&e.forEach(_=>_(m)),n=m)},"setState"),a=l(()=>i>0,"isDragging");r(m=>s.onChange(m));let c=l(()=>{i=0,o(j.INACTIVE)},"onResetEvent"),h=l(()=>{i+=1,n===j.INACTIVE&&o(j.ACTIVE)},"onDragEnter"),d=l(()=>{i-=1,a()||o(j.INACTIVE)},"onDragLeave"),p=l(m=>{m.preventDefault(),i=0,o(j.INACTIVE)},"onDrop"),f=l(m=>{if(s.shouldIgnore())return;a()||(i+=1);let _=[m.x,m.y],S=s.element.getBoundingClientRect(),E=Math.floor(Xo(_,S)),x=E{if(s.shouldIgnore())return;m.preventDefault();let _=await Tr(m.dataTransfer);s.onItems(_),o(j.INACTIVE)},"onElementDrop");return t.addEventListener("drop",p),t.addEventListener("dragleave",d),t.addEventListener("dragenter",h),t.addEventListener("dragover",f),s.element.addEventListener("drop",g),xr.forEach(m=>{window.addEventListener(m,c)}),()=>{us.delete(s.element),t.removeEventListener("drop",p),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",h),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",g),xr.forEach(m=>{window.removeEventListener(m,c)})}}l(ds,"addDropzone");var qt=class extends v{constructor(){super(),this.init$={...this.init$,state:j.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!I(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:I(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:I(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:I(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=ds({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:st.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:st.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=ds({element:i,onChange:t=>{var r;let e=(r=Object.entries(j).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(j).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=D(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};l(qt,"DropArea");qt.template=`
{{text}}
`;qt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var qo="src-type-",Gt=class extends v{constructor(){super(...arguments);u(this,"_registeredTypes",{});u(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:b.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:b.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:a,activityParams:c={}}=e;this.applyL10nKey("src-type",`${qo}${r}`),this.$.iconName=n,this.onclick=h=>{(a?a(h):!!o)&&this.set$({"*currentActivityParams":c,"*currentActivity":o})}}};l(Gt,"SourceBtn");Gt.template=`
`;Gt.bindAttributes({type:null});var ri=class extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=D(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};l(ri,"SourceList");function Er(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}l(Er,"createSvgBlobUrl");function Ar(s="#fff",i="rgba(0, 0, 0, .1)"){return Er(``)}l(Ar,"checkerboardCssBg");function ni(s="hsl(209, 21%, 65%)",i=32,t=32){return Er(``)}l(ni,"fileCssBg");function $r(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(h=>{if(!h){a();return}let d=URL.createObjectURL(h);o(d)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),n}l($r,"generateThumb");var H=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),nt=class extends v{constructor(){super();u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",k(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",k(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:H.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===b.activities.DETAILS)?this.$["*currentActivity"]=b.activities.DETAILS:this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);L.emit(new F({type:P.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=H.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=H.FAILED:t.getValue("validationMultipleLimitMsg")?e=H.LIMIT_OVERFLOW:t.getValue("isUploading")?e=H.UPLOADING:t.getValue("fileInfo")&&(e=H.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(O(St(this.cfg.cdnCname,this._entry.getValue("uuid")),N(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await $r(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",ni(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",ni(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{nt.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),nt.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===H.FAILED,isLimitOverflow:t===H.LIMIT_OVERFLOW,isUploading:t===H.UPLOADING,isFinished:t===H.FINISHED,progressVisible:t===H.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===H.FAILED||t===H.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===H.FINISHED&&(this.$.badgeIcon="badge-success"),t===H.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),nt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,a;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(c=>!c.getValue("fileInfo"));L.emit(new F({type:P.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let c=new AbortController;t.setValue("abortController",c);let h=l(async()=>{let p=await this.getUploadClientOptions();return is(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...p,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:f=>{if(f.isComputable){let g=f.value*100;t.setValue("uploadProgress",g)}this.$.progressUnknown=!f.isComputable},signal:c.signal})},"uploadTask"),d=await this.$["*uploadQueue"].add(h);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(a=(o=(n=d.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?a:d.mimeType,uuid:d.uuid,cdnUrl:d.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(c){console.warn("Upload error",c),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),c instanceof R?c.isCancel||t.setValue("uploadError",c):t.setValue("uploadError",new Error("Unexpected error"))}}};l(nt,"FileItem");nt.template=`
{{itemName}}{{errorText}}
`;nt.activeInstances=new Set;var oi=class{constructor(){u(this,"caption","");u(this,"text","");u(this,"iconName","");u(this,"isError",!1)}};l(oi,"UiMessage");var ge=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};l(ge,"MessageBox");ge.template=`
{{captionTxt}}
{{msgTxt}}
`;var be=class extends v{constructor(){super();u(this,"couldBeUploadCollectionOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",b.activities.UPLOAD_LIST);u(this,"_debouncedHandleCollectionUpdate",k(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));L.emit(new F({type:P.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var d,p;let t=!!this.cfg.multiple,e=t?(d=this.cfg.multipleMin)!=null?d:0:1,r=t?(p=this.cfg.multipleMax)!=null?p:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!a,tooFew:o,tooMany:a,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new oi,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let g of t){let m=this.uploadCollection.read(g);m.getValue("fileInfo")&&!m.getValue("validationErrorMsg")&&(r.succeed+=1),m.getValue("isUploading")&&(r.uploading+=1),(m.getValue("validationErrorMsg")||m.getValue("uploadError"))&&(r.failed+=1),m.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:a}=this._validateFilesCount(),c=r.failed===0&&r.limitOverflow===0,h=!1,d=!1,p=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?h=!0:(d=!0,p=r.total===r.succeed&&n&&c),this.set$({doneBtnVisible:d,doneBtnEnabled:p,uploadBtnVisible:h,addMoreBtnEnabled:r.total===0||!o&&!a,addMoreBtnVisible:!a||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=l(r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})},"localizedText");return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observe(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate)}};l(be,"UploadList");be.template=`{{headerText}}
`;var _e=class extends v{constructor(){super(...arguments);u(this,"activityType",b.activities.URL);u(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:st.URL_TAB}),this.$["*currentActivity"]=b.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(_e,"UrlSource");_e.template=`
`;var ps=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var ye=class extends v{constructor(){super(...arguments);u(this,"activityType",b.activities.CAMERA);u(this,"_unsubPermissions",null);u(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:ps(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});u(this,"_onActivate",l(()=>{ps()&&this._subscribePermissions(),this._capture()},"_onActivate"));u(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));u(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));u(this,"_setPermissionsState",k(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:st.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};l(ye,"CameraSource");ye.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var li=class extends v{constructor(){super(...arguments);u(this,"requireCtxName",!0)}};l(li,"UploadCtxProvider");var ve=class extends v{constructor(){super(...arguments);u(this,"activityType",b.activities.DETAILS);u(this,"pauseRender",!0);u(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=ni(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=Ye(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=l((n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))},"tmpSub");r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let a=O(n,N("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(a))}})})}};l(ve,"UploadDetails");ve.template=`
{{fileSize}}
{{errorTxt}}
`;var Fi=class{constructor(){u(this,"captionL10nStr","confirm-your-action");u(this,"messageL10Str","are-you-sure");u(this,"confirmL10nStr","yes");u(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}};l(Fi,"UiConfirmation");var Ce=class extends b{constructor(){super(...arguments);u(this,"activityType",b.activities.CONFIRMATION);u(this,"_defaults",new Fi);u(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":b.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};l(Ce,"ConfirmationDialog");Ce.template=`{{activityCaption}}
{{messageTxt}}
`;var we=class extends v{constructor(){super(...arguments);u(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this.uploadCollection.observe(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}};l(we,"ProgressBarCommon");we.template=``;var Te=class extends y{constructor(){super(...arguments);u(this,"_value",0);u(this,"_unknownMode",!1);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};l(Te,"ProgressBar");Te.template='
';var Q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var Kt=class extends y{constructor(){super();u(this,"init$",{...this.init$,checkerboard:!1,src:Q})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${Ar()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=Q}};l(Kt,"FilePreview");Kt.template='';Kt.bindAttributes({checkerboard:"checkerboard"});var Sr="--cfg-ctx-name",U=class extends y{get cfgCssCtxName(){return this.getCssData(Sr,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(Sr,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};l(U,"CloudImageEditorBase");function kr(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}l(kr,"normalize");function B(...s){let i=kr(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}l(B,"classNames");function Ir(s,...i){let t=kr(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}l(Ir,"applyClassNames");var Or=l(s=>{if(!s)return K;let i=hr(s).filter(t=>K.includes(t));return i.length===0?K:i},"parseTabs");function Lr(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":K,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:Q,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:jt(K),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Q,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=N(kt(i),"preview"),r=O(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(Lr,"initState");var Ur=`
Network error
{{fileType}}
{{msg}}
`;var rt=class extends U{constructor(){super();u(this,"_debouncedShowLoader",k(this._showLoader.bind(this),300));this.init$={...this.init$,...Lr(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===V.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=er(this.$.cdnUrl);this.$["*originalUrl"]=St(this.$.cdnUrl,t);let e=ir(this.$.cdnUrl),r=pr(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=St(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=O(this.$["*originalUrl"],N("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===V.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==Q&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||Q)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Ri(t)}),this.sub("tabs",t=>{this.$["*tabList"]=Or(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=B("image",{image_hidden_to_cropper:t===V.CROP,image_hidden_effects:t!==V.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=N(kt(t),"preview"),n=O(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(rt,"CloudImageEditorBlock"),u(rt,"className","cloud-image-editor");rt.template=Ur;rt.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var xe=class extends U{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=C&&t.width<=C)return!0;let e=t.height<=C&&(i.includes("n")||i.includes("s")),r=t.width<=C&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],a=it("mask",{id:"backdrop-mask"}),c=it("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),h=it("rect",{x:t,y:e,width:r,height:n,fill:"black"});a.appendChild(c),a.appendChild(h);let d=it("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(d),o.appendChild(a),this._backdropMask=a,this._backdropMaskInner=h}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Bt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,a=e==="",c=e.length===2,{x:h,y:d,width:p,height:f}=i;if(a){let m={x:h+p/3,y:d+f/3,width:p/3,height:f/3};Bt(n,m)}else{let m=$t(Math.min(p,f)/(24*2+34)/2,0,1),{d:_,center:S}=c?js(i,e,m):Hs(i,e,m),E=Math.max(os*$t(Math.min(p,f)/os/3,0,1),zs);Bt(n,{x:S[0]-E,y:S[1]-E,width:E*2,height:E*2}),Bt(r,{d:_})}let g=this._shouldThumbBeDisabled(e);o.setAttribute("class",B("thumb",{"thumb--hidden":g,"thumb--visible":!g}))}Bt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=it("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=it("rect",{fill:"transparent"}),a=it("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(a),n.appendChild(o),i[r]={direction:r,pathNode:a,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=it("svg"),t=it("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=it("line",{x1:`${Ge*e}%`,y1:"0%",x2:`${Ge*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=it("line",{x1:"0%",y1:`${Ge*e}%`,x2:"100%",y2:`${Ge*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-n,c=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,a=n-this._dragStartPoint[0],c=o-this._dragStartPoint[1],{direction:h}=this._draggingThumb,d=this._calcCropBox(h,[a,c]);d&&(this.$["*cropBox"]=d)}_calcCropBox(i,t){var h,d;let[e,r]=t,n=this.$["*imageBox"],o=(h=this._dragStartCrop)!=null?h:this.$["*cropBox"],a=(d=this.$["*cropPresetList"])==null?void 0:d[0],c=a?a.width/a.height:void 0;if(i===""?o=Xs({rect:o,delta:[e,r],imageBox:n}):o=qs({rect:o,delta:[e,r],direction:i,aspectRatio:c,imageBox:n}),!Object.values(o).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return ce(ue(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Gs(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Ws(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",B("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=C||i.width<=C,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",B({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(xe,"CropFrame");xe.template='';var dt=class extends U{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=B({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(dt,"EditorButtonControl");dt.template=`
{{title}}
`;function Ko(s){let i=s+90;return i=i>=360?0:i,i}l(Ko,"nextAngle");function Yo(s,i){return s==="rotate"?Ko(i):["mirror","flip"].includes(s)?!i:null}l(Yo,"nextValue");var Zt=class extends dt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=Yo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};l(Zt,"EditorCropButtonControl");var ai={FILTER:"filter",COLOR_OPERATION:"color_operation"},pt="original",Ee=class extends U{constructor(){super(...arguments);u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?ai.FILTER:ai.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===pt?void 0:this.$.value,filter:this._filter===pt?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ht[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===ai.FILTER){let a=n;if(o){let{name:c,amount:h}=o;a=c===this._filter?h:n}this.$.value=a,this.$.defaultValue=a}if(this._controlType===ai.COLOR_OPERATION){let a=typeof o!="undefined"?o:e;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===ai.FILTER?this._filter===pt?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};l(Ee,"EditorSlider");Ee.template=``;function ci(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:l(()=>{i.naturalWidth===0&&(i.src=Q)},"cancel")}}l(ci,"preloadImage");function hi(s){let i=[];for(let n of s){let o=ci(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:l(()=>{i.forEach(n=>{n.cancel()})},"cancel")}}l(hi,"batchPreloadImages");var It=class extends dt{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==pt?{name:this._filter,amount:o}:void 0,O(this._originalUrl,N(Mi,kt(a),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:a,cancel:c}=ci(n);this._cancelPreload=c,a.catch(h=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:h})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===pt,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};l(It,"EditorFilterControl");It.template=`
`;var Jt=class extends dt{constructor(){super(...arguments);u(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ht[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};l(Jt,"EditorOperationControl");var Rr=l((s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}},"throttle");function Pr(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}l(Pr,"pick");function Ae(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return O(s,N(Mi,kt(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}l(Ae,"viewerImageSrc");function Zo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}l(Zo,"validateCrop");var $e=class extends U{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=k(this._commit.bind(this),300),this._handleResizeThrottled=Rr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=Pr(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=he({width:i.naturalWidth,height:i.naturalHeight},r),a;if(o.width>n.width-t*2||o.height>n.height-t*2){let c=o.width/o.height,h=n.width/n.height;if(c>h){let d=n.width-t*2,p=d/c,f=0+t,g=t+(n.height-t*2)/2-p/2;a={x:f,y:g,width:d,height:p}}else{let d=n.height-t*2,p=d*c,f=t+(n.width-t*2)/2-p/2,g=0+t;a={x:f,y:g,width:p,height:d}}}else{let{width:c,height:h}=o,d=t+(n.width-t*2)/2-c/2,p=t+(n.height-t*2)/2-h/2;a={x:d,y:p,width:c,height:h}}this.$["*imageBox"]=ue(a)}_alignCrop(){var p;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[f,g],coords:[m,_]}=n,{width:S}=he(this._imageSize,r),E=o/S;i=ce(ue({x:a+m*E,y:c+_*E,width:f*E,height:g*E}),this.$["*imageBox"])}let h=(p=this.$["*cropPresetList"])==null?void 0:p[0],d=h?h.width/h.height:void 0;if(!Ks(i,t)||d&&!Ys(i,d)){let f=t.width/t.height,g=t.width,m=t.height;d&&(f>d?g=Math.min(t.height*d,t.width):m=Math.min(t.width/d,t.height)),i={x:t.x+t.width/2-g/2,y:t.y+t.height/2-m/2,width:g,height:m}}this.$["*cropBox"]=ce(ue(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:a}=r,c=he({width:e.width,height:e.height},a);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(a*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=B({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:a,height:c}=he(this._imageSize,r),{width:h,height:d}=i,p=n/a,f=o/c;return[$t(Math.round(h/p),1,a),$t(Math.round(d/f),1,c)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:a,y:c}=t,{width:h,height:d}=he(this._imageSize,r),{x:p,y:f}=i,g=n/h,m=o/d,_=this._getCropDimensions(),S={dimensions:_,coords:[$t(Math.round((p-a)/g),0,h-_[0]),$t(Math.round((f-c)/m),0,d-_[1])]};if(!Zo(S)){console.error("Cropper is trying to create invalid crop object",{payload:S});return}if(!(_[0]===h&&_[1]===d))return S}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=a}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=B({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(Ae(i,e,t)),{promise:n,cancel:o,image:a}=ci(r),c=this._handleImageLoading(r);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>a).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(a)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};l($e,"EditorImageCropper");$e.template=``;function fs(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}l(fs,"linspace");function Jo(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}l(Qo,"calculateOpacities");function tl(s,i){return s.map((t,e)=>tn-o)}l(Mr,"keypointsRange");var ui=class extends U{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=k(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(Ae(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=l(()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(c=>c.value===e),"shouldSkip");if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let a=this._handleImageLoading(n.src);o.addEventListener("load",a,{once:!0}),o.addEventListener("error",a,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let c=this._keypoints,h=c.findIndex(p=>p.value>e),d=h{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ht[i],r=this._keypoints.map(a=>a.value),n=Qo(r,t,e),o=tl(r,e);for(let[a,c]of Object.entries(this._keypoints))c.opacity=n[a],c.zIndex=o[a];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(h=>h.src),{images:r,promise:n,cancel:o}=hi(e);r.forEach(h=>{let d=this._handleImageLoading(h.src);h.addEventListener("load",d),h.addEventListener("error",d)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await n,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((h,d)=>{let p=r[d];p.classList.add("fader-image"),h.image=p,this._container.appendChild(p)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Mr(e,r).map(c=>this._imageSrc({url:i,filter:t,operation:e,value:c})),{cancel:a}=hi(o);this._cancelBatchPreload=a}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=B({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=B({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let a=this._imageSrc({operation:t,value:e});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=Mr(t,e).map(a=>this._constructKeypoint(t,a)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=B({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(ui,"EditorImageFader");var el=1,Se=class extends U{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>el?this.scrollLeft+=e:this.scrollLeft+=t})}};l(Se,"EditorScroller");Se.template=" ";function il(s){return``}l(il,"renderTabToggle");function sl(s){return`
`}l(sl,"renderTabContent");var ke=class extends U{constructor(){super();u(this,"_updateInfoTooltip",k(()=>{var o,a;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===V.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+c}else r=this.l10n(pt);else if(this.$["*tabId"]===V.TUNING&&e){n=!0;let c=(t==null?void 0:t[e])||ht[e].zero;r=e+" "+c}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":pt,"*currentOperation":null,"*tabId":V.CROP,showLoader:!1,filters:mr,colorOperations:fr,cropOperations:gr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=k(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===V.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new Jt;return e.operation=t,e}_createFilterControl(t){let e=new It;return e.filter=t,e}_createToggleControl(t){let e=new Zt;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===V.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===V.FILTERS?[pt,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===V.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===V.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of K){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(Ae(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=hi([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of K){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(ke,"EditorToolbar");ke.template=`
{{*operationTooltip}}
${K.map(sl).join("")}
${K.map(il).join("")}
`;var Qt=class extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return B("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(Qt,"LrBtnUi");Qt.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Qt.template=`
{{text}}
`;var Ie=class extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(Ie,"LineLoaderUi");Ie.template=`
`;var Vi={transition:"transition",visible:"visible",hidden:"hidden"},Oe=class extends y{constructor(){super(),this._visible=!1,this._visibleStyle=Vi.visible,this._hiddenStyle=Vi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Ir(this,{[Vi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(Vi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};l(Oe,"PresenceToggle");Oe.template=" ";var Le=class extends y{constructor(){super();u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let a=document.createDocumentFragment(),c=document.createElement("div"),h=document.createElement("div");c.className="minor-step",h.className="border-step",a.appendChild(h);for(let p=0;p
`;var di=class extends v{constructor(){super();u(this,"activityType",b.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new rt,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(di,"CloudImageEditorActivity");var rl=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Nr=l(function(s,i="i"){let t=s.split("*").map(rl);return new RegExp("^"+t.join(".+")+"$",i)},"wildcardRegexp");var nl=l(s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,a)=>{let c=r[a];return o+`${a}: ${c};`},"");return t+`${e}{${n}}`},""),"styleToCss");function Dr({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return nl({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}l(Dr,"buildStyles");var Ot={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in Ot){let t=Ot[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Fr=l(function(s,i,t){s in Ot||(Ot[s]=[]),Ot[s].push([i,t])},"registerMessage"),Vr=l(function(s,i){s in Ot&&(Ot[s]=Ot[s].filter(t=>t[0]!==i))},"unregisterMessage");function Br(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}l(Br,"queryString");var Ue=class extends v{constructor(){super();u(this,"activityType",b.activities.EXTERNAL);u(this,"_iframe",null);u(this,"updateCssData",l(()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())},"updateCssData"));u(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=b.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=D(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=Nr(r);for(let[o,a]of Object.entries(t.alternatives))if(n.test(o))return a}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Dr(t)})}remoteUrl(){var a,c;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((c=(a=this.getCssData("--l10n-locale-name"))==null?void 0:a.split("-"))==null?void 0:c[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Br(n),o.toString()}mountIframe(){let t=je({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Fr("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Vr("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(Ue,"ExternalSource");Ue.template=`
{{activityCaption}}
{{counter}}
`;var te=class extends y{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;D(i).forEach(e=>{let r=je({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};l(te,"Tabs");te.bindAttributes({"tab-list":null,default:null});te.template=`
`;var Lt=class extends v{constructor(){super(...arguments);u(this,"processInnerHtml",!0);u(this,"requireCtxName",!0);u(this,"init$",{...this.init$,output:null,filesData:null})}get dict(){return Lt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer),this.hasAttribute(this.dict.INPUT_REQUIRED))){let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=!0,this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(t){if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer.innerHTML="";let e=t.groupData?[t.groupData.cdnUrl]:t.map(r=>r.cdnUrl);for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r,this._dynamicInputsContainer.appendChild(n)}this.hasAttribute(this.dict.INPUT_REQUIRED)&&(this._validationInputElement.value=e.length?"__VALUE__":"")}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)}},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t){this.$.output=null,this.$.filesData=null;return}if(this.$.filesData=t,this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR)){let e=t.map(o=>o.uuid),r=await this.getUploadClientOptions(),n=await Ds(e,{...r});this.$.output={groupData:n,files:t}}else this.$.output=t},!1)}};l(Lt,"DataOutput");Lt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var pi=class extends b{};l(pi,"ActivityHeader");var Re=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};l(Re,"Select");Re.template=``;var Z={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},zr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},tt=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,src:"",ppIcon:Z.PLAY,fsIcon:Z.FS_ON,volIcon:Z.VOL_ON,capIcon:Z.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?zr.exitFullscreen():zr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===Z.CAP_OFF?(this.$.capIcon=Z.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(tt.is+":captions","1")):(this.$.capIcon=Z.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(tt.is+":captions"))}toggleSound(){this.$.volIcon===Z.VOL_ON?(this.$.volIcon=Z.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=Z.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(tt.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(tt.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=Z.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=Z.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=Z.FS_OFF:this.$.fsIcon=Z.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(tt.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};l(tt,"Video");tt.template=`
{{currentTime}} / {{totalTime}}
`;tt.bindAttributes({video:"video",src:"src"});var ol="css-src";function fi(s){return class extends s{constructor(){super(...arguments);u(this,"renderShadow",!0);u(this,"pauseRender",!0);u(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Li({element:this,attribute:ol,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}l(fi,"shadowed");var ee=class extends fi(y){};l(ee,"ShadowWrapper");var Pe=class extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};l(Pe,"Copyright"),u(Pe,"template",`Powered by Uploadcare`);var Tt=class extends ee{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",ki(this));u(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};l(Tt,"SolutionBlock");var Me=class extends Tt{};l(Me,"FileUploaderRegular");Me.template=``;var Ne=class extends Tt{constructor(){super(...arguments);u(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=b.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};l(Ne,"FileUploaderMinimal");Ne.template=``;var De=class extends Tt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||b.activities.START_FROM)&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)})}};l(De,"FileUploaderInline");De.template=``;var mi=class extends fi(rt){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};l(mi,"CloudImageEditor");function Bi(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}l(Bi,"registerBlocks");var ms="LR";async function jr(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[ms]){t(window[ms]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[ms];i&&Bi(n),t(n)},document.head.appendChild(r)})}l(jr,"connectBlocksFrom");return Zr(ll);})(); \ No newline at end of file +"use strict";var LR=(()=>{var Le=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Mr=Object.prototype.hasOwnProperty;var Nr=(s,i,t)=>i in s?Le(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var l=(s,i)=>Le(s,"name",{value:i,configurable:!0});var Dr=(s,i)=>{for(var t in i)Le(s,t,{get:i[t],enumerable:!0})},Fr=(s,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Pr(i))!Mr.call(s,r)&&r!==t&&Le(s,r,{get:()=>i[r],enumerable:!(e=Rr(i,r))||e.enumerable});return s};var Vr=s=>Fr(Le({},"__esModule",{value:!0}),s);var u=(s,i,t)=>(Nr(s,typeof i!="symbol"?i+"":i,t),t);var Yo={};Dr(Yo,{ActivityBlock:()=>_,ActivityHeader:()=>ri,BaseComponent:()=>Rt,Block:()=>y,CameraSource:()=>de,CloudImageEditor:()=>oi,CloudImageEditorActivity:()=>si,CloudImageEditorBlock:()=>it,Config:()=>oe,ConfirmationDialog:()=>fe,Copyright:()=>Se,CropFrame:()=>_e,Data:()=>S,DataOutput:()=>Lt,DropArea:()=>Ht,EditorCropButtonControl:()=>Gt,EditorFilterControl:()=>It,EditorImageCropper:()=>ve,EditorImageFader:()=>ii,EditorOperationControl:()=>Kt,EditorScroller:()=>Ce,EditorSlider:()=>be,EditorToolbar:()=>we,ExternalSource:()=>Ae,FileItem:()=>rt,FilePreview:()=>Xt,FileUploaderInline:()=>Oe,FileUploaderMinimal:()=>Ie,FileUploaderRegular:()=>ke,Icon:()=>Bt,Img:()=>qe,LineLoaderUi:()=>Te,LrBtnUi:()=>Yt,MessageBox:()=>ce,Modal:()=>Nt,PACKAGE_NAME:()=>Zi,PACKAGE_VERSION:()=>Ji,PresenceToggle:()=>xe,ProgressBar:()=>ge,ProgressBarCommon:()=>me,Select:()=>$e,ShadowWrapper:()=>Jt,SimpleBtn:()=>jt,SliderUi:()=>Ee,SourceBtn:()=>Wt,SourceList:()=>Ke,StartFrom:()=>Ge,Tabs:()=>Zt,UploadCtxProvider:()=>Je,UploadDetails:()=>pe,UploadList:()=>he,UploaderBlock:()=>v,UrlSource:()=>ue,Video:()=>Q,connectBlocksFrom:()=>Lr,registerBlocks:()=>Ii,shadowed:()=>ni,toKebabCase:()=>lt});var Br=Object.defineProperty,zr=l((s,i,t)=>i in s?Br(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,"__defNormalProp"),Ui=l((s,i,t)=>(zr(s,typeof i!="symbol"?i+"":i,t),t),"__publicField");function jr(s){let i=l(t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}},"clone");return i(s)}l(jr,"cloneObj");var S=l(class{constructor(s){s.constructor===Object?this.store=jr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?(S.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){S.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?(S.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=S.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new S(s),S.globalStore.set(i,t)),t}static deleteCtx(s){S.globalStore.delete(s)}static getCtx(s,i=!0){return S.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}},"Data");S.globalStore=new Map;var w=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),as="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Hr=as.length-1,Re=l(class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{ai&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}l(Wr,"kebabToCamel");function Xr(s,i){[...s.querySelectorAll(`[${w.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(w.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=l(class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}},"itemClass");let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(w.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let a=[...t.children],c,h=l(d=>{d.forEach((f,g)=>{if(a[g])if(a[g].set$)setTimeout(()=>{a[g].set$(f)});else for(let m in f)a[g][m]=f[m];else{c||(c=new DocumentFragment);let m=new r;Object.assign(m.init$,f),c.appendChild(m)}}),c&&t.appendChild(c);let p=a.slice(d.length,a.length);for(let f of p)f.remove()},"fillItems");if(o.constructor===Array)h(o);else if(o.constructor===Object){let d=[];for(let p in o){let f=o[p];Object.defineProperty(f,"_KEY_",{value:p,enumerable:!0}),d.push(f)}h(d)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(w.REPEAT_ATTR),t.removeAttribute(w.REPEAT_ITEM_TAG_ATTR)})}l(Xr,"repeatProcessor");var os="__default__";function qr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||os;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=os;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}l(qr,"slotProcessor");function Gr(s,i){[...s.querySelectorAll(`[${w.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(w.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(w.EL_REF_ATTR)})}l(Gr,"refProcessor");function Kr(s,i){[...s.querySelectorAll(`[${w.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(w.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Wr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(d=>d.trim()),a=o[0],c;a.indexOf(w.ATTR_BIND_PRFX)===0&&(c=!0,a=a.replace(w.ATTR_BIND_PRFX,""));let h=o[1].split(",").map(d=>d.trim());for(let d of h){let p;d.startsWith("!!")?(p="double",d=d.replace("!!","")):d.startsWith("!")&&(p="single",d=d.replace("!","")),i.sub(d,f=>{p==="double"?f=!!f:p==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):cs(t,a,f)||(t[w.SET_LATER_KEY]||(t[w.SET_LATER_KEY]=Object.create(null)),t[w.SET_LATER_KEY][a]=f)})}}),t.removeAttribute(w.BIND_ATTR)})}l(Kr,"domSetProcessor");var li="{{",Ue="}}",Yr="skip-text";function Zr(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(Yr))&&r.textContent.includes(li)&&r.textContent.includes(Ue)&&1}});for(;i=e.nextNode();)t.push(i);return t}l(Zr,"getTextNodesWithTokens");var Jr=l(function(s,i){Zr(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(Ue);)e.textContent.startsWith(li)?(n=e.textContent.indexOf(Ue)+Ue.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(li),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let a=o.textContent.replace(li,"").replace(Ue,"");o.textContent="",i.sub(a,c=>{o.textContent=c})})})},"txtNodesProcessor"),Qr=[Xr,qr,Gr,Kr,Jr],ai="'",te='"',tn=/\\([0-9a-fA-F]{1,6} ?)/g;function en(s){return(s[0]===te||s[0]===ai)&&(s[s.length-1]===te||s[s.length-1]===ai)}l(en,"hasLeadingTrailingQuotes");function sn(s){return(s[0]===te||s[0]===ai)&&(s=s.slice(1)),(s[s.length-1]===te||s[s.length-1]===ai)&&(s=s.slice(0,-1)),s}l(sn,"trimQuotes");function rn(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ +`,"\\n"),i=rn(i),i=te+i+te);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}l(nn,"parseCssPropertyValue");var ls=0,Qt=null,_t=null,Tt=l(class extends HTMLElement{constructor(){super(),Ui(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return Tt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(w.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=l(()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Re.generate(),this.style.setProperty(w.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(w.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(w.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=S.registerCtx({},this)),this.__localCtx}get nodeCtx(){return S.getCtx(this.ctxName,!1)||S.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(w.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(w.EXT_DATA_CTX_PRFX,"");else if(s.includes(w.NAMED_DATA_CTX_SPLTR)){let r=s.split(w.NAMED_DATA_CTX_SPLTR);t=S.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=l(n=>{this.isConnected&&i(n)},"subCb"),r=Tt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=Tt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=Tt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=Tt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=Tt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=Tt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(w.CTX_OWNER_ATTR)&&this.getAttribute(w.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(w.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(w.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(w.NAMED_DATA_CTX_SPLTR)){let t=i.split(w.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=S.getCtx(e,!1);n||(n=S.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(w.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(w.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[w.SET_LATER_KEY]){for(let t in this[w.SET_LATER_KEY])cs(this,t,this[w.SET_LATER_KEY][t]);delete this[w.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Qr)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${w.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(w.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);_t==null||_t.delete(this.updateCssData),_t!=null&&_t.size||(Qt==null||Qt.disconnect(),Qt=null,_t=null)},100)))}static reg(s,i=!1){s||(ls++,s=`${w.AUTO_TAG_PRFX}-${ls}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=nn(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){_t||(_t=new Set),_t.add(this.updateCssData),Qt||(Qt=new MutationObserver(s=>{s[0].type==="attributes"&&_t.forEach(i=>{i()})}),Qt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},"_BaseComponent"),Rt=Tt;Ui(Rt,"template");var Li=l(class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(Li.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=S.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),Li.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},"AppRouter");Li.appMap=Object.create(null);function Ri(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}l(Ri,"applyStyles");function on(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}l(on,"applyAttributes");function Pe(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&on(i,s.attributes),s.styles&&Ri(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=Pe(t);i.appendChild(e)}),i}l(Pe,"create");var hs="idb-store-ready",ln="symbiote-db",an="symbiote-idb-update_",cn=l(class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(hs,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return an+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,a)=>{n.onsuccess=c=>{t||this._notifySubscribers(s),o(c.target.result)},n.onerror=c=>{a(c)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,us.clear(this.name)}},"DbInstance"),us=l(class{static get readyEventName(){return hs}static open(s=ln,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new cn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}},"IDB");Ui(us,"_reg",Object.create(null));function k(s,i){let t,e=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)},"debounced");return e.cancel=()=>{clearTimeout(t)},e}l(k,"debounce");var hn="--uploadcare-blocks-window-height",ci="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Pi(){return typeof window[ci]=="undefined"?!1:!!window[ci]}l(Pi,"getIsWindowHeightTracked");function ds(){if(Pi())return;let s=l(()=>{document.documentElement.style.setProperty(hn,`${window.innerHeight}px`),window[ci]=!0},"callback"),i=k(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[ci]=!1,window.removeEventListener("resize",i)}}l(ds,"createWindowHeightTracker");var un=l(s=>s,"DEFAULT_TRANSFORMER"),Mi="{{",fs="}}",ps="plural:";function Me(s,i,t={}){var o;let{openToken:e=Mi,closeToken:r=fs,transform:n=un}=t;for(let a in i){let c=(o=i[a])==null?void 0:o.toString();s=s.replaceAll(e+a+r,typeof c=="string"?n(c):c)}return s}l(Me,"applyTemplateData");function ms(s){let i=[],t=s.indexOf(Mi);for(;t!==-1;){let e=s.indexOf(fs,t),r=s.substring(t+2,e);if(r.startsWith(ps)){let n=s.substring(t+2,e).replace(ps,""),o=n.substring(0,n.indexOf("(")),a=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:a})}t=s.indexOf(Mi,e)}return i}l(ms,"getPluralObjects");function gs(s){return Object.prototype.toString.call(s)==="[object Object]"}l(gs,"isObject");var dn=/\W|_/g;function pn(s){return s.split(dn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}l(pn,"camelizeString");function _s(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>vt(t,{ignoreKeys:i})):s}l(_s,"camelizeArrayItems");function vt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return _s(s,{ignoreKeys:i});if(!gs(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}gs(r)?r=vt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=_s(r,{ignoreKeys:i})),t[pn(e)]=r}return t}l(vt,"camelizeKeys");var fn=l(s=>new Promise(i=>setTimeout(i,s)),"delay");function Vi({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),a=[n,r].filter(Boolean).join("; ");return`${o} (${a})`}l(Vi,"getUserAgent$1");var mn={factor:2,time:100};function gn(s,i=mn){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l(a=>fn(a!=null?a:n).then(()=>(t+=1,e(r))),"retry")})}return l(e,"runAttempt"),e(s)}l(gn,"retrier");var Pt=class extends Error{constructor(t){super();u(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,Pt.prototype),this.originalProgressEvent=t}};l(Pt,"UploadcareNetworkError");var pi=l((s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},"onCancel"),bt=class extends Error{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);Object.setPrototypeOf(this,bt.prototype)}};l(bt,"CancelError");var _n=500,ys=l(({check:s,interval:i=_n,timeout:t,signal:e})=>new Promise((r,n)=>{let o,a;pi(e,()=>{o&&clearTimeout(o),n(new bt("Poll cancelled"))}),t&&(a=setTimeout(()=>{o&&clearTimeout(o),n(new bt("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(e)).then(h=>{h?(a&&clearTimeout(a),r(h)):o=setTimeout(c,i)}).catch(h=>{a&&clearTimeout(a),n(h)})}catch(h){a&&clearTimeout(a),n(h)}},"tick");o=setTimeout(c,0)}),"poll"),A={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},fi="application/octet-stream",vs="original",xt=l(({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,a)=>{let c=new XMLHttpRequest,h=(s==null?void 0:s.toUpperCase())||"GET",d=!1;c.open(h,i,!0),e&&Object.entries(e).forEach(p=>{let[f,g]=p;typeof g!="undefined"&&!Array.isArray(g)&&c.setRequestHeader(f,g)}),c.responseType="text",pi(r,()=>{d=!0,c.abort(),a(new bt)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let p={method:h,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function($){let E=$.split(": "),x=E.shift(),T=E.join(": ");x&&typeof x!="undefined"&&(g[x]=T)});let m=c.response,b=c.status;o({request:p,data:m,headers:g,status:b})}},c.onerror=p=>{d||a(new Pt(p))},n&&typeof n=="function"&&(c.upload.onprogress=p=>{p.lengthComputable?n({isComputable:!0,value:p.loaded/p.total}):n({isComputable:!1})}),t?c.send(t):c.send()}),"request");function bn(s,...i){return s}l(bn,"identity");var yn=l(({name:s})=>s?[s]:[],"getFileOptions"),vn=bn,Cn=l(()=>new FormData,"getFormData"),Cs=l(s=>!1,"isBuffer"),mi=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),gi=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),_i=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),ee=l(s=>mi(s)||gi(s)||Cs()||_i(s),"isFileData"),wn=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Tn=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),xn=l(s=>!!s&&typeof s=="object"&&"data"in s&&ee(s.data),"isFileValue");function En(s,i,t){if(xn(t)){let{name:e,contentType:r}=t,n=vn(t.data,e,r!=null?r:fi),o=yn({name:e,contentType:r});s.push([i,n,...o])}else if(Tn(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else wn(t)&&t&&s.push([i,t.toString()])}l(En,"collectParams");function An(s){let i=[];for(let[t,e]of Object.entries(s))En(i,t,e);return i}l(An,"getFormDataParams");function Bi(s){let i=Cn(),t=An(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}l(Bi,"buildFormData");var U=class extends Error{constructor(t,e,r,n,o){super();u(this,"isCancel");u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,U.prototype)}};l(U,"UploadClientError");var $n=l(s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),yt=l((s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=$n(t)),e.toString()},"getUrl"),Sn="6.7.0",kn="UploadcareUploadClient",In=Sn;function Mt(s){return Vi({libraryName:kn,libraryVersion:In,...s})}l(Mt,"getUserAgent");var On="RequestThrottledError",bs=15e3,Ln=1e3;function Un(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return bs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:bs}l(Un,"getTimeoutFromThrottledRequest");function Et(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return gn(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===On&&r{let i="";return(mi(s)||gi(s)||_i(s))&&(i=s.type),i||fi},"getContentType"),Ts=l(s=>{let i="";return gi(s)&&s.name?i=s.name:mi(s)||Cs()?i="":_i(s)&&s.name&&(i=s.name),i||vs},"getFileName");function zi(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(zi,"getStoreValue");function Rn(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=A.baseURL,secureSignature:n,secureExpire:o,store:a,signal:c,onProgress:h,source:d="local",integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:b}){return Et(()=>xt({method:"POST",url:yt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:p,userAgent:f})},data:Bi({file:{data:s,name:t||Ts(s),contentType:e||ws(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:zi(a),signature:n,expire:o,source:d,metadata:b}),signal:c,onProgress:h}).then(({data:$,headers:E,request:x})=>{let T=vt(JSON.parse($));if("error"in T)throw new U(T.error.content,T.error.errorCode,x,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(Rn,"base");var Fi;(function(s){s.Token="token",s.FileInfo="file_info"})(Fi||(Fi={}));function Pn(s,{publicKey:i,baseURL:t=A.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,source:h="url",signal:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:b}){return Et(()=>xt({method:"POST",headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:p,userAgent:f})},url:yt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:zi(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:a,expire:c,source:h,metadata:b}),signal:d}).then(({data:$,headers:E,request:x})=>{let T=vt(JSON.parse($));if("error"in T)throw new U(T.error.content,T.error.errorCode,x,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(Pn,"fromUrl");var W;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(W||(W={}));var Mn=l(s=>"status"in s&&s.status===W.Error,"isErrorResponse");function Nn(s,{publicKey:i,baseURL:t=A.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=A.retryNetworkErrorMaxTimes}={}){return Et(()=>xt({method:"GET",headers:i?{"X-UC-User-Agent":Mt({publicKey:i,integration:r,userAgent:n})}:void 0,url:yt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:c,headers:h,request:d})=>{let p=vt(JSON.parse(c));if("error"in p&&!Mn(p))throw new U(p.error.content,void 0,d,p,h);return p}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:o})}l(Nn,"fromUrlStatus");function Dn(s,{publicKey:i,baseURL:t=A.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:a,integration:c,userAgent:h,retryThrottledRequestMaxTimes:d=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=A.retryNetworkErrorMaxTimes}){return Et(()=>xt({method:"POST",headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:c,userAgent:h})},url:yt(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:a}),signal:o}).then(({data:f,headers:g,request:m})=>{let b=vt(JSON.parse(f));if("error"in b)throw new U(b.error.content,b.error.errorCode,m,b,g);return b}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:d})}l(Dn,"group");function xs(s,{publicKey:i,baseURL:t=A.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=A.retryNetworkErrorMaxTimes}){return Et(()=>xt({method:"GET",headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:n,userAgent:o})},url:yt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:h,headers:d,request:p})=>{let f=vt(JSON.parse(h));if("error"in f)throw new U(f.error.content,f.error.errorCode,p,f,d);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(xs,"info");function Fn(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=A.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:a,store:c,signal:h,source:d="local",integration:p,userAgent:f,retryThrottledRequestMaxTimes:g=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=A.retryNetworkErrorMaxTimes,metadata:b}){return Et(()=>xt({method:"POST",url:yt(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:p,userAgent:f})},data:Bi({filename:e||vs,size:s,content_type:t||fi,part_size:r,UPLOADCARE_STORE:zi(c),UPLOADCARE_PUB_KEY:i,signature:o,expire:a,source:d,metadata:b}),signal:h}).then(({data:$,headers:E,request:x})=>{let T=vt(JSON.parse($));if("error"in T)throw new U(T.error.content,T.error.errorCode,x,T,E);return T.parts=Object.keys(T.parts).map(j=>T.parts[j]),T}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})}l(Fn,"multipartStart");function Vn(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=A.retryNetworkErrorMaxTimes}){return Et(()=>xt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||fi}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}l(Vn,"multipartUpload");function Bn(s,{publicKey:i,baseURL:t=A.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=A.retryNetworkErrorMaxTimes}){return Et(()=>xt({method:"POST",url:yt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Mt({publicKey:i,integration:n,userAgent:o})},data:Bi({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:h,headers:d,request:p})=>{let f=vt(JSON.parse(h));if("error"in f)throw new U(f.error.content,f.error.errorCode,p,f,d);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Bn,"multipartComplete");function ji({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,signal:c,onProgress:h}){return ys({check:d=>xs(s,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a}).then(p=>p.isReady?p:(h&&h({isComputable:!0,value:1}),!1)),signal:c})}l(ji,"isReadyPoll");function zn(s){return"defaultEffects"in s}l(zn,"isGroupFileInfo");var ot=class{constructor(i,{baseCDN:t=A.baseCDN,fileName:e}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:r,s3Bucket:n}=i,o=yt(t,`${r}/`),a=n?yt(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=a,zn(i)&&(this.defaultEffects=i.defaultEffects)}};l(ot,"UploadcareFile");var jn=l((s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:a,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,baseCDN:b,metadata:$})=>Rn(s,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:$}).then(({file:E})=>ji({file:E,publicKey:i,baseURL:e,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:h,signal:c})).then(E=>new ot(E,{baseCDN:b})),"uploadDirect"),Hn=l((s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:d,baseCDN:p})=>xs(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:d}).then(f=>new ot(f,{baseCDN:p,fileName:t})).then(f=>(n&&n({isComputable:!0,value:1}),f)),"uploadFromUploaded"),Wn=l((s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=l(o=>()=>{e=o,r.forEach((a,c)=>c!==o&&a.abort())},"createStopRaceCallback");return pi(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,a)=>{let c=n(a);return Promise.resolve().then(()=>o({stopRace:c,signal:r[a].signal})).then(h=>(c(),h)).catch(h=>(t=h,null))})).then(o=>{if(e===null)throw t;return o[e]})},"race"),Xn=window.WebSocket,hi=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}};l(hi,"Events");var qn=l((s,i)=>s==="success"?{status:W.Success,...i}:s==="progress"?{status:W.Progress,...i}:{status:W.Error,...i},"response"),ui=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new hi);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Xn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,qn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}};l(ui,"Pusher");var Ni=null,Hi=l(s=>{if(!Ni){let i=typeof window=="undefined"?0:3e4;Ni=new ui(s,i)}return Ni},"getPusher"),Gn=l(s=>{Hi(s).connect()},"preconnect");function Kn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:a,signal:c}){return ys({check:h=>Nn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:h}).then(d=>{switch(d.status){case W.Error:return new U(d.error,d.errorCode);case W.Waiting:return!1;case W.Unknown:return new U(`Token "${s}" was not found.`);case W.Progress:return a&&(d.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:d.done/d.total})),!1;case W.Success:return a&&a({isComputable:!0,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:c})}l(Kn,"pollStrategy");var Yn=l(({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=Hi(i),a=o.onError(n),c=l(()=>{a(),o.unsubscribe(s)},"destroy");pi(t,()=>{c(),n(new bt("pusher cancelled"))}),o.subscribe(s,h=>{switch(h.status){case W.Progress:{e&&(h.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:h.done/h.total}));break}case W.Success:{c(),e&&e({isComputable:!0,value:h.done/h.total}),r(h);break}case W.Error:c(),n(new U(h.msg,h.error_code))}})}),"pushStrategy"),Zn=l((s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,store:h,signal:d,onProgress:p,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:b,pusherKey:$=A.pusherKey,metadata:E})=>Promise.resolve(Gn($)).then(()=>Pn(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:a,secureExpire:c,store:h,signal:d,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:b,metadata:E})).catch(x=>{let T=Hi($);return T==null||T.disconnect(),Promise.reject(x)}).then(x=>x.type===Fi.FileInfo?x:Wn([({signal:T})=>Kn({token:x.token,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:b,onProgress:p,signal:T}),({signal:T})=>Yn({token:x.token,pusherKey:$,signal:T,onProgress:p})],{signal:d})).then(x=>{if(x instanceof U)throw x;return x}).then(x=>ji({file:x.uuid,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:b,onProgress:p,signal:d})).then(x=>new ot(x,{baseCDN:r})),"uploadFromUrl"),Di=new WeakMap,Jn=l(async s=>{if(Di.has(s))return Di.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Di.set(s,i),i},"getBlobFromReactNativeAsset"),Es=l(async s=>{if(gi(s)||mi(s))return s.size;if(_i(s))return(await Jn(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Qn=l((s,i=A.multipartMinFileSize)=>s>=i,"isMultipart"),As=l(s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ee(s)&&t.test(s)},"isUuid"),Wi=l(s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ee(s)&&t.test(s)},"isUrl"),to=l((s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,a=[...i],c=l(()=>{let h=i.length-a.length,d=a.shift();d&&d().then(p=>{n||(r[h]=p,o-=1,o?c():t(r))}).catch(p=>{n=!0,e(p)})},"run");for(let h=0;h{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},"sliceChunk"),io=l(async(s,i,t)=>e=>eo(s,e,i,t),"prepareChunks"),so=l((s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>Vn(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),ro=l(async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:a,signal:c,onProgress:h,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,contentType:b,multipartChunkSize:$=A.multipartChunkSize,maxConcurrentRequests:E=A.maxConcurrentRequests,baseCDN:x,metadata:T})=>{let j=e!=null?e:await Es(s),mt,Ut=l((P,H)=>{if(!h)return;mt||(mt=Array(P).fill(0));let st=l(nt=>nt.reduce((gt,Oi)=>gt+Oi,0),"sum");return nt=>{nt.isComputable&&(mt[H]=nt.value,h({isComputable:!0,value:st(mt)/P}))}},"createProgressHandler");return b||(b=ws(s)),Fn(j,{publicKey:i,contentType:b,fileName:t||Ts(s),baseURL:r,secureSignature:n,secureExpire:o,store:a,signal:c,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:T}).then(async({uuid:P,parts:H})=>{let st=await io(s,j,$);return Promise.all([P,to(E,H.map((nt,gt)=>()=>so(st(gt),nt,{publicKey:i,contentType:b,onProgress:Ut(H.length,gt),signal:c,integration:p,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})))])}).then(([P])=>Bn(P,{publicKey:i,baseURL:r,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})).then(P=>P.isReady?P:ji({file:P.uuid,publicKey:i,baseURL:r,source:d,integration:p,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:h,signal:c})).then(P=>new ot(P,{baseCDN:x}))},"uploadMultipart");async function Xi(s,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartMinFileSize:b,multipartChunkSize:$,maxConcurrentRequests:E,baseCDN:x=A.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:j,pusherKey:mt,metadata:Ut}){if(ee(s)){let P=await Es(s);return Qn(P,b)?ro(s,{publicKey:i,contentType:m,multipartChunkSize:$,fileSize:P,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x,metadata:Ut}):jn(s,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x,metadata:Ut})}if(Wi(s))return Zn(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:x,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:j,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,pusherKey:mt,metadata:Ut});if(As(s))return Hn(s,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:x});throw new TypeError(`File uploading from "${s}" is not supported`)}l(Xi,"uploadFile");var di=class{constructor(i,{baseCDN:t=A.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,n)=>r+n.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new ot(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}};l(di,"UploadcareGroup");var no=l(s=>{for(let i of s)if(!ee(i))return!1;return!0},"isFileDataArray"),oo=l(s=>{for(let i of s)if(!As(i))return!1;return!0},"isUuidArray"),lo=l(s=>{for(let i of s)if(!Wi(i))return!1;return!0},"isUrlArray");function $s(s,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:b=A.multipartChunkSize,baseCDN:$=A.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:x,jsonpCallback:T}){if(!no(s)&&!lo(s)&&!oo(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let j,mt=!0,Ut=s.length,P=l((H,st)=>{if(!c)return;j||(j=Array(H).fill(0));let nt=l(gt=>gt.reduce((Oi,Ur)=>Oi+Ur)/H,"normalize");return gt=>{if(!gt.isComputable||!mt){mt=!1,c({isComputable:!1});return}j[st]=gt.value,c({isComputable:!0,value:nt(j)})}},"createProgressHandler");return Promise.all(s.map((H,st)=>ee(H)||Wi(H)?Xi(H,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:P(Ut,st),source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:b,baseCDN:$,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:x}).then(nt=>nt.uuid):H)).then(H=>Dn(H,{publicKey:i,baseURL:e,jsonpCallback:T,secureSignature:r,secureExpire:n,signal:a,source:h,integration:d,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(st=>new di(st,{baseCDN:$})).then(st=>(c&&c({isComputable:!0,value:1}),st)))}l($s,"uploadFileGroup");var Ne=class{constructor(i){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(o=>r(o)).catch(o=>n(o))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};l(Ne,"Queue");var qi=l(()=>({"*blocksRegistry":new Set}),"blockCtx"),Gi=l(s=>({...qi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),"activityBlockCtx"),bi=l(s=>({...Gi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Ne(1)}),"uploaderBlockCtx");function Ss(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}l(Ss,"l10nProcessor");var X=l(s=>`*cfg/${s}`,"sharedConfigKey");var lt=l(s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var ks=new Set;function yi(s){ks.has(s)||(ks.add(s),console.warn(s))}l(yi,"warnOnce");var vi=l((s,i)=>new Intl.PluralRules(s).select(i),"getPluralForm");var Ci=l(({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{c.disconnect(),e()},r),o=l(h=>{let d=s.getAttribute(i);h.type==="attributes"&&h.attributeName===i&&d!==null&&(clearTimeout(n),c.disconnect(),t(d))},"handleMutation"),a=s.getAttribute(i);a!==null&&(clearTimeout(n),t(a));let c=new MutationObserver(h=>{let d=h[h.length-1];o(d)});c.observe(s,{attributes:!0,attributeFilter:[i]})},"waitForAttribute");var Ki="lr-",y=class extends Rt{constructor(){super();u(this,"requireCtxName",!1);u(this,"allowCustomTemplate",!0);u(this,"init$",qi());u(this,"updateCtxCssData",l(()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()},"updateCtxCssData"));this.activityType=null,this.addTemplateProcessor(Ss),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=ms(r);for(let a of n)e[a.variable]=this.pluralize(a.pluralKey,Number(e[a.countVariable]));return Me(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=vi(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ki}${t}`,!0),Pi()||(this._destroyInnerHeightTracker=ds()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Ci({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=l(h=>this.getCssData("--l10n-unit-"+h.toLowerCase(),!0)||h,"getUnit");if(t===0)return`0 ${n(r[0])}`;let o=1024,a=e<0?0:e,c=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**c).toFixed(a))+" "+n(r[c])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?Me(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=X(r);return this.$[o]=n,!0},get:(e,r)=>{let n=X(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(yi("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${lt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(X(t));r.ctx.has(r.name)?this.sub(X(t),e):(this.bindCssData(`--cfg-${lt(t)}`),this.sub(`--cfg-${lt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ki)?t:Ki+t)}};l(y,"Block"),u(y,"StateConsumerScope",null),u(y,"className","");var Nt=class extends y{constructor(){super();u(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));u(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));u(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));u(this,"_handleDialogPointerUp",l(t=>{t.target===this.ref.dialog&&this._closeDialog()},"_handleDialogPointerUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};l(Nt,"Modal"),u(Nt,"StateConsumerScope","modal");Nt.template=``;var Is="active",De="___ACTIVITY_IS_ACTIVE___",at=class extends y{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",Gi(this));u(this,"_debouncedHistoryFlush",k(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=at._activityRegistry[this.activityKey];this[De]=!1,this.removeAttribute(Is),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=at._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[De]=!0,this.setAttribute(Is,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[De]?this._deactivate():this.activityType===t&&!this[De]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!at._activityRegistry[this.activityKey]}get isActivityActive(){return this[De]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;at._activityRegistry||(at._activityRegistry=Object.create(null)),at._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),at._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(at._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},_=at;l(_,"ActivityBlock"),u(_,"_activityRegistry",Object.create(null));_.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Fe=33.333333333333336,C=1,Yi=24,Os=6;function Dt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}l(Dt,"setSvgNodeAttrs");function tt(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Dt(t,i),t}l(tt,"createSvgNode");function Ls(s,i,t){let{x:e,y:r,width:n,height:o}=s,a=i.includes("w")?0:1,c=i.includes("n")?0:1,h=[-1,1][a],d=[-1,1][c],p=[e+a*n+1.5*h,r+c*o+1.5*d-24*t*d],f=[e+a*n+1.5*h,r+c*o+1.5*d],g=[e+a*n-24*t*h+1.5*h,r+c*o+1.5*d];return{d:`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}l(Ls,"cornerPath");function Us(s,i,t){let{x:e,y:r,width:n,height:o}=s,a=["n","s"].includes(i)?.5:{w:0,e:1}[i],c=["w","e"].includes(i)?.5:{n:0,s:1}[i],h=[-1,1][a],d=[-1,1][c],p,f;["n","s"].includes(i)?(p=[e+a*n-34*t/2,r+c*o+1.5*d],f=[e+a*n+34*t/2,r+c*o+1.5*d]):(p=[e+a*n+1.5*h,r+c*o-34*t/2],f=[e+a*n+1.5*h,r+c*o+34*t/2]);let g=`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]}`,m=[f[0]-(f[0]-p[0])/2,f[1]-(f[1]-p[1])/2];return{d:g,center:m}}l(Us,"sidePath");function Rs(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Rs,"thumbCursor");function Ps({rect:s,delta:[i,t],imageBox:e}){return se({...s,x:s.x+i,y:s.y+t},e)}l(Ps,"moveRect");function se(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}l(se,"constraintRect");function ao({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:a}=s;n+=r,a-=r,t&&(o=a*t);let c=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,a=s.y+s.height-n,t&&(o=a*t,c=s.x+s.width/2-o/2)),c<=e.x&&(c=e.x,n=s.y+s.height-a),c+o>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-c,t&&(a=o/t),n=s.y+s.height-a),a=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(o=a*t),n=s.x+s.width-o),a=e.y+e.height&&(a=e.y+e.height-n,t&&(o=a*t),c=s.x+s.width/2-o/2),c<=e.x&&(c=e.x,n=s.y),c+o>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-c,t&&(a=o/t),n=s.y),a=e.x+e.width&&(o=e.x+e.width-n,t&&(a=o/t),c=s.y+s.height/2-a/2),c<=e.y&&(c=e.y,n=s.x),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(o=a*t),n=s.x),at?(n=c/t-h,h+=n,a-=n,a<=e.y&&(h=h-(e.y-a),c=h*t,o=s.x+s.width-c,a=e.y)):t&&(r=h*t-c,c=c+r,o-=r,o<=e.x&&(c=c-(e.x-o),h=c/t,o=e.x,a=s.y+s.height-h)),he.x+e.width&&(r=e.x+e.width-o-c),a+nt?(n=c/t-h,h+=n,a-=n,a<=e.y&&(h=h-(e.y-a),c=h*t,o=s.x,a=e.y)):t&&(r=h*t-c,c+=r,o+c>=e.x+e.width&&(c=e.x+e.width-o,h=c/t,o=e.x+e.width-c,a=s.y+s.height-h)),he.y+e.height&&(n=e.y+e.height-a-h),o+=r,c-=r,h+=n,t&&Math.abs(c/h)>t?(n=c/t-h,h+=n,a+h>=e.y+e.height&&(h=e.y+e.height-a,c=h*t,o=s.x+s.width-c,a=e.y+e.height-h)):t&&(r=h*t-c,c+=r,o-=r,o<=e.x&&(c=c-(e.x-o),h=c/t,o=e.x,a=s.y)),he.x+e.width&&(r=e.x+e.width-o-c),a+h+n>e.y+e.height&&(n=e.y+e.height-a-h),c+=r,h+=n,t&&Math.abs(c/h)>t?(n=c/t-h,h+=n,a+h>=e.y+e.height&&(h=e.y+e.height-a,c=h*t,o=s.x,a=e.y+e.height-h)):t&&(r=h*t-c,c+=r,o+c>=e.x+e.width&&(c=e.x+e.width-o,h=c/t,o=e.x+e.width-c,a=s.y)),h=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}l(Ds,"isRectInsideRect");function Fs(s,i){return Math.abs(s.width/s.height-i)<.1}l(Fs,"isRectMatchesAspectRatio");function re({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}l(re,"rotateSize");function Vs(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),a=Math.round((i-n)/2);return o+r>s&&(r=s-o),a+n>i&&(n=i-a),{x:o,y:a,width:r,height:n}}l(Vs,"calculateMaxCenteredCropFrame");function ne(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(ne,"roundRect");function At(s,i,t){return Math.min(Math.max(s,i),t)}l(At,"clamp");var Ti=l(s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]},"parseCropPreset");var et=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Bs=l(s=>s?s.split(",").map(i=>i.trim()):[],"deserealizeCsv"),Ft=l(s=>s?s.join(","):"","serializeCsv");var Zi="blocks",Ji="0.27.6";function zs(s){return Vi({...s,libraryName:Zi,libraryVersion:Ji})}l(zs,"customUserAgent");var js=l(s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),xi=l((...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>js(i)).join("/-/"),"joinCdnOperations"),M=l((...s)=>{let i=xi(...s);return i?`-/${i}/`:""},"createCdnUrlModifiers");function Hs(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}l(Hs,"extractFilename");function Ws(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}l(Ws,"extractUuid");function Xs(s){let i=qs(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>js(n))}l(Xs,"extractOperations");function qs(s){let i=new URL(s),t=Hs(s),e=Gs(t)?Ks(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}l(qs,"trimFilename");function Gs(s){return s.startsWith("http")}l(Gs,"isFileUrl");function Ks(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}l(Ks,"splitFileUrl");var O=l((s,i,t)=>{let e=new URL(qs(s));if(t=t||Hs(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Gs(t)){let r=Ks(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},"createCdnUrl"),$t=l((s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()},"createOriginalUrl");var N=l((s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var Ve=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Qi=l(s=>s?s.filter(i=>typeof i=="string").map(i=>N(i)).flat():[],"mergeFileTypes"),ts=l((s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),Ys=l((s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),Be=l(s=>{let i=s==null?void 0:s.type;return i?ts(i,Ve):!1},"fileIsImage");var ht=1e3,Vt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),ze=l(s=>Math.ceil(s*100)/100,"round"),Zs=l((s,i=Vt.AUTO)=>{let t=i===Vt.AUTO;if(i===Vt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))},"dispatch");if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};l(R,"EventManager"),u(R,"_timeoutStore",Object.create(null));var Js="[Typed State] Wrong property name: ",_o="[Typed State] Wrong property type: ",je=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||Re.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=S.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Js+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(_o+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Js+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){S.deleteCtx(this.__ctxId)}};l(je,"TypedData");var He=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||Re.generate(),this.__data=S.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){this.__collectionObservers.delete(i)}add(i){let t=new je(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){this.__propertyObservers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){S.deleteCtx(this.__data),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};l(He,"TypedCollection");var Qs=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:ot,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var v=class extends _{constructor(){super(...arguments);u(this,"couldBeUploadCollectionOwner",!1);u(this,"isUploadCollectionOwner",!1);u(this,"init$",bi(this));u(this,"__initialUploadMetadata",null);u(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);u(this,"_debouncedRunValidators",k(this._runValidators.bind(this),100));u(this,"_flushOutputItems",k(()=>{let t=this.getOutputData();t.length===this.uploadCollection.size&&(R.emit(new D({type:q.DATA_OUTPUT,ctx:this.ctxName,data:t})),this.$["*outputData"]=t)},100));u(this,"_handleCollectonUpdate",l((t,e,r)=>{var n;this._runValidators();for(let o of r)(n=o==null?void 0:o.getValue("abortController"))==null||n.abort(),o==null||o.setValue("abortController",null),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl"));this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushOutputItems()},"_handleCollectonUpdate"));u(this,"_handleCollectionPropertiesUpdate",l(t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(c=>!c.getValue("uploadError"));o.forEach(c=>{n+=e.readProp(c,"uploadProgress")});let a=Math.round(n/o.length);this.$["*commonProgress"]=a,R.emit(new D({type:q.UPLOAD_PROGRESS,ctx:this.ctxName,data:a}),void 0,a===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(a=>!!a.getValue("fileInfo")),o=e.findItems(a=>!!a.getValue("uploadError")||!!a.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let a=this.getOutputData(c=>!!c.getValue("fileInfo")&&!c.getValue("silentUpload"));a.length>0&&R.emit(new D({type:q.UPLOAD_FINISH,ctx:this.ctxName,data:a}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{R.emit(new D({type:q.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{R.emit(new D({type:q.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{R.emit(new D({type:q.CLOUD_MODIFICATION,ctx:this.ctxName,data:S.getCtx(o).store}),void 0,!1)})},"_handleCollectionPropertiesUpdate"))}setUploadMetadata(t){yi("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new He({typedSchema:Qs,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=l(()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1),"hasUploadCollectionOwner");this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectonUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){var t,e;super.destroyCallback(),this.isUploadCollectionOwner&&((t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this))}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:Be(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:et.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:Be(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Ft(Qi([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?Ve:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Ft(Ve)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:et.LOCAL})),this.$["*currentActivity"]=_.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=N(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=_.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":_.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":_.activities.START_FROM}),this.setOrAddState("*modalActive",!0);R.emit(new D({type:q.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),R.emit(new D({type:q.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Qi([...e?Ve:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),a=t.getValue("fileName");if(!o||!a)return;let c=ts(o,n),h=Ys(a,n);if(!c&&!h)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:Zs(e)})}_validateMultipleLimit(t){let e=this.uploadCollection.items(),r=e.indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMin:1,o=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&e.length=o)return this.l10n("files-count-allowed",{count:o})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=Ti(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:a,height:c}=o.imageInfo,h=e.width/e.height,d=Vs(a,c,h),p=M(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:p,cdnUrl:O(n.getValue("cdnUrl"),p)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===_.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:zs,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return(t?this.uploadCollection.findItems(t):this.uploadCollection.items()).forEach(n=>{var h,d;let o=S.getCtx(n).store,a=o.fileInfo||{name:o.fileName,originalFilename:o.fileName,size:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},c={...a,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:(d=(h=o.cdnUrl)!=null?h:a.cdnUrl)!=null?d:null,validationErrorMessage:o.validationErrorMsg,uploadError:o.uploadError,isUploaded:!!o.uuid&&!!o.fileInfo,isValid:!o.validationErrorMsg&&!o.uploadError};e.push(c)}),e}};l(v,"UploaderBlock");v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});var Z={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function bo(s,i){if(typeof i=="number")return Z[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Z[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Z[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}l(bo,"transformationToStr");var er=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function St(s){return xi(...er.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return bo(i,t)}).filter(i=>!!i))}l(St,"transformationsToOperations");var Ei=xi("format/auto","progressive/yes"),Ct=l(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),tr=l(()=>!0,"asBoolean"),yo=l(([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),"asFilter"),vo=l(([s,i])=>({dimensions:N(s,"x").map(Number),coords:N(i).map(Number)}),"asCrop"),Co={enhance:Ct,brightness:Ct,exposure:Ct,gamma:Ct,contrast:Ct,saturation:Ct,vibrance:Ct,warmth:Ct,filter:yo,mirror:tr,flip:tr,rotate:Ct,crop:vo};function ir(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!er.includes(e))continue;let n=Co[e],o=n(r);i[e]=o}return i}l(ir,"operationsToTransformations");var F=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),G=[F.CROP,F.TUNING,F.FILTERS],sr=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],rr=["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"],nr=["rotate","mirror","flip"],ut=Object.freeze({brightness:{zero:Z.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Z.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Z.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Z.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Z.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Z.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Z.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Z.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Z.filter,range:[0,100],keypointsNumber:1}});var wo="https://ucarecdn.com",To="https://upload.uploadcare.com",xo="https://social.uploadcare.com",kt={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Ft(G),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:wo,baseUrl:To,socialBaseUrl:xo,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var K=l(s=>String(s),"asString"),dt=l(s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},"asNumber"),I=l(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),Eo=l(s=>s==="auto"?s:I(s),"asStore"),Ao={pubkey:K,multiple:I,multipleMin:dt,multipleMax:dt,confirmUpload:I,imgOnly:I,accept:K,externalSourcesPreferredTypes:K,store:Eo,cameraMirror:I,sourceList:K,maxLocalFileSizeBytes:dt,thumbSize:dt,showEmptyList:I,useLocalImageEditor:I,useCloudImageEditor:I,cloudImageEditorTabs:K,removeCopyright:I,cropPreset:K,modalScrollLock:I,modalBackdropStrokes:I,sourceListWrap:I,remoteTabSessionKey:K,cdnCname:K,baseUrl:K,socialBaseUrl:K,secureSignature:K,secureExpire:K,secureDeliveryProxy:K,retryThrottledRequestMaxTimes:dt,multipartMinFileSize:dt,multipartChunkSize:dt,maxConcurrentRequests:dt,multipartMaxConcurrentRequests:dt,multipartMaxAttempts:dt,checkForUrlDuplicates:I,saveUrlForRecurrentUploads:I,groupOutput:I,userAgentIntegration:K},or=l((s,i)=>{if(!(typeof i=="undefined"||i===null))try{return Ao[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),kt[s]}},"normalizeConfigValue");var Ai=Object.keys(kt),$o=["metadata"],So=l(s=>$o.includes(s),"isComplexKey"),$i=Ai.filter(s=>!So(s)),ko={...Object.fromEntries($i.map(s=>[lt(s),s])),...Object.fromEntries($i.map(s=>[s.toLowerCase(),s]))},Io={...Object.fromEntries(Ai.map(s=>[lt(s),X(s)])),...Object.fromEntries(Ai.map(s=>[s.toLowerCase(),X(s)]))},oe=class extends y{constructor(){super();u(this,"ctxOwner",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(kt).map(([t,e])=>[X(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of $i)this.sub(X(e),r=>{r!==kt[e]&&(t[e]=r)},!1);for(let e of Ai){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,$i.includes(e)){let o=[...new Set([lt(e),e.toLowerCase()])];for(let a of o)typeof n=="undefined"||n===null?this.removeAttribute(a):this.setAttribute(a,n.toString())}this.$[X(e)]!==n&&(typeof n=="undefined"||n===null?this.$[X(e)]=kt[e]:this.$[X(e)]=n)},get:()=>this.$[X(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=ko[t],o=or(n,r),a=o!=null?o:kt[n],c=this;c[n]=a}};l(oe,"Config");oe.bindAttributes(Io);var Bt=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};l(Bt,"Icon");Bt.template=``;Bt.bindAttributes({name:"name",size:"size"});var Oo="https://ucarecdn.com",zt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Oo},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var lr=l(s=>[...new Set(s)],"uniqueArray");var We="--lr-img-",ar="unresolved",le=2,ae=3,cr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ur=Object.create(null),hr;for(let s in zt)ur[We+s]=((hr=zt[s])==null?void 0:hr.default)||"";var Xe=class extends Rt{constructor(){super(...arguments);u(this,"cssInit$",ur)}$$(t){return this.$[We+t]}set$$(t){for(let e in t)this.$[We+e]=t[e]}sub$$(t,e){this.sub(We+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!cr&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return M(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||zt.format.default}`,`quality/${this.$$("quality")||zt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(cr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return O(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(O($t(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(O($t(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(O(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(O(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Me(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),a=r?"":e*Math.round(n.height);return o||a?`${o||""}x${a||""}`:null}_setupEventProxy(t){let e=l(n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},"proxifyEvent"),r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(ar,""),this.img.onload=()=>{this.img.removeAttribute(ar)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{zt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?lr(N(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*le+"x")}") ${n*le}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*ae+"x")}") ${n*ae}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,le))}") ${le}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,ae))}") ${ae}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*le+"x")+` ${e*le}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*ae+"x")+` ${e*ae}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(zt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[We+t]=r})}};l(Xe,"ImgBase");var qe=class extends Xe{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};l(qe,"Img");var jt=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=I(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};l(jt,"SimpleBtn");jt.template=``;jt.bindAttributes({dropzone:null});var Ge=class extends _{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(Ge,"StartFrom");function Lo(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=l(r=>{r.type!=="loadend"&&t.abort(),i(!1)},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}l(Lo,"checkIsDirectory");function Uo(s,i){return new Promise(t=>{let e=0,r=[],n=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(e++,a.file(c=>{e--;let h=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:h,fullPath:a.fullPath}),e===0&&t(r)})):a.isDirectory&&o(a.createReader())},"readEntry"),o=l(a=>{e++,a.readEntries(c=>{e--;for(let h of c)n(h);e===0&&t(r)})},"readReaderContent");n(s)})}l(Uo,"readEntryContentAsync");function dr(s){let i=[],t=[];for(let e=0;e{c&&i.push(...c)}));continue}let o=r.getAsFile();o&&t.push(Lo(o).then(a=>{a||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}l(dr,"getDropItems");var B={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},pr=["focus"],Ro=100,es=new Map;function Po(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}l(Po,"distance");function is(s){let i=0,t=document.body,e=new Set,r=l(m=>e.add(m),"handleSwitch"),n=B.INACTIVE,o=l(m=>{s.shouldIgnore()&&m!==B.INACTIVE||(n!==m&&e.forEach(b=>b(m)),n=m)},"setState"),a=l(()=>i>0,"isDragging");r(m=>s.onChange(m));let c=l(()=>{i=0,o(B.INACTIVE)},"onResetEvent"),h=l(()=>{i+=1,n===B.INACTIVE&&o(B.ACTIVE)},"onDragEnter"),d=l(()=>{i-=1,a()||o(B.INACTIVE)},"onDragLeave"),p=l(m=>{m.preventDefault(),i=0,o(B.INACTIVE)},"onDrop"),f=l(m=>{if(s.shouldIgnore())return;a()||(i+=1);let b=[m.x,m.y],$=s.element.getBoundingClientRect(),E=Math.floor(Po(b,$)),x=E{if(s.shouldIgnore())return;m.preventDefault();let b=await dr(m.dataTransfer);s.onItems(b),o(B.INACTIVE)},"onElementDrop");return t.addEventListener("drop",p),t.addEventListener("dragleave",d),t.addEventListener("dragenter",h),t.addEventListener("dragover",f),s.element.addEventListener("drop",g),pr.forEach(m=>{window.addEventListener(m,c)}),()=>{es.delete(s.element),t.removeEventListener("drop",p),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",h),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",g),pr.forEach(m=>{window.removeEventListener(m,c)})}}l(is,"addDropzone");var Ht=class extends v{constructor(){super(),this.init$={...this.init$,state:B.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!I(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:I(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:I(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:I(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=is({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:et.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:et.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":_.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=is({element:i,onChange:t=>{var r;let e=(r=Object.entries(B).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(B).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=N(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};l(Ht,"DropArea");Ht.template=`
{{text}}
`;Ht.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Mo="src-type-",Wt=class extends v{constructor(){super(...arguments);u(this,"_registeredTypes",{});u(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:_.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:_.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:_.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:_.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:a,activityParams:c={}}=e;this.applyL10nKey("src-type",`${Mo}${r}`),this.$.iconName=n,this.onclick=h=>{(a?a(h):!!o)&&this.set$({"*currentActivityParams":c,"*currentActivity":o})}}};l(Wt,"SourceBtn");Wt.template=`
`;Wt.bindAttributes({type:null});var Ke=class extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=N(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};l(Ke,"SourceList");function fr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}l(fr,"createSvgBlobUrl");function mr(s="#fff",i="rgba(0, 0, 0, .1)"){return fr(``)}l(mr,"checkerboardCssBg");function Ye(s="hsl(209, 21%, 65%)",i=32,t=32){return fr(``)}l(Ye,"fileCssBg");function gr(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(h=>{if(!h){a();return}let d=URL.createObjectURL(h);o(d)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),n}l(gr,"generateThumb");var z=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),rt=class extends v{constructor(){super();u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",k(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",k(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:z.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===_.activities.DETAILS)?this.$["*currentActivity"]=_.activities.DETAILS:this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);R.emit(new D({type:q.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=z.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=z.FAILED:t.getValue("validationMultipleLimitMsg")?e=z.LIMIT_OVERFLOW:t.getValue("isUploading")?e=z.UPLOADING:t.getValue("fileInfo")&&(e=z.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(O($t(this.cfg.cdnCname,this._entry.getValue("uuid")),M(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await gr(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ye(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ye(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{rt.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),rt.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===z.FAILED,isLimitOverflow:t===z.LIMIT_OVERFLOW,isUploading:t===z.UPLOADING,isFinished:t===z.FINISHED,progressVisible:t===z.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===z.FAILED||t===z.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===z.FINISHED&&(this.$.badgeIcon="badge-success"),t===z.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),rt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,a;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(c=>!c.getValue("fileInfo"));R.emit(new D({type:q.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let c=new AbortController;t.setValue("abortController",c);let h=l(async()=>{let p=await this.getUploadClientOptions();return Xi(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...p,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:f=>{if(f.isComputable){let g=f.value*100;t.setValue("uploadProgress",g)}this.$.progressUnknown=!f.isComputable},signal:c.signal})},"uploadTask"),d=await this.$["*uploadQueue"].add(h);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(a=(o=(n=d.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?a:d.mimeType,uuid:d.uuid,cdnUrl:d.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(c){console.warn("Upload error",c),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),c instanceof U?c.isCancel||t.setValue("uploadError",c):t.setValue("uploadError",new Error("Unexpected error"))}}};l(rt,"FileItem");rt.template=`
{{itemName}}{{errorText}}
`;rt.activeInstances=new Set;var Ze=class{constructor(){u(this,"caption","");u(this,"text","");u(this,"iconName","");u(this,"isError",!1)}};l(Ze,"UiMessage");var ce=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};l(ce,"MessageBox");ce.template=`
{{captionTxt}}
{{msgTxt}}
`;var he=class extends v{constructor(){super();u(this,"couldBeUploadCollectionOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",_.activities.UPLOAD_LIST);u(this,"_debouncedHandleCollectionUpdate",k(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));R.emit(new D({type:q.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var d,p;let t=!!this.cfg.multiple,e=t?(d=this.cfg.multipleMin)!=null?d:0:1,r=t?(p=this.cfg.multipleMax)!=null?p:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!a,tooFew:o,tooMany:a,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new Ze,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let g of t){let m=this.uploadCollection.read(g);m.getValue("fileInfo")&&!m.getValue("validationErrorMsg")&&(r.succeed+=1),m.getValue("isUploading")&&(r.uploading+=1),(m.getValue("validationErrorMsg")||m.getValue("uploadError"))&&(r.failed+=1),m.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:a}=this._validateFilesCount(),c=r.failed===0&&r.limitOverflow===0,h=!1,d=!1,p=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?h=!0:(d=!0,p=r.total===r.succeed&&n&&c),this.set$({doneBtnVisible:d,doneBtnEnabled:p,uploadBtnVisible:h,addMoreBtnEnabled:r.total===0||!o&&!a,addMoreBtnVisible:!a||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=l(r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})},"localizedText");return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate)}};l(he,"UploadList");he.template=`{{headerText}}
`;var ue=class extends v{constructor(){super(...arguments);u(this,"activityType",_.activities.URL);u(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:et.URL_TAB}),this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(ue,"UrlSource");ue.template=`
`;var ss=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var de=class extends v{constructor(){super(...arguments);u(this,"activityType",_.activities.CAMERA);u(this,"_unsubPermissions",null);u(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:ss(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});u(this,"_onActivate",l(()=>{ss()&&this._subscribePermissions(),this._capture()},"_onActivate"));u(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));u(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));u(this,"_setPermissionsState",k(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:et.CAMERA}),this.set$({"*currentActivity":_.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};l(de,"CameraSource");de.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var Je=class extends v{constructor(){super(...arguments);u(this,"requireCtxName",!0)}};l(Je,"UploadCtxProvider");var pe=class extends v{constructor(){super(...arguments);u(this,"activityType",_.activities.DETAILS);u(this,"pauseRender",!0);u(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=_.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=Ye(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=Be(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=l((n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))},"tmpSub");r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let a=O(n,M("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(a))}})})}};l(pe,"UploadDetails");pe.template=`
{{fileSize}}
{{errorTxt}}
`;var Si=class{constructor(){u(this,"captionL10nStr","confirm-your-action");u(this,"messageL10Str","are-you-sure");u(this,"confirmL10nStr","yes");u(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}};l(Si,"UiConfirmation");var fe=class extends _{constructor(){super(...arguments);u(this,"activityType",_.activities.CONFIRMATION);u(this,"_defaults",new Si);u(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":_.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};l(fe,"ConfirmationDialog");fe.template=`{{activityCaption}}
{{messageTxt}}
`;var me=class extends v{constructor(){super(...arguments);u(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};l(me,"ProgressBarCommon");me.template=``;var ge=class extends y{constructor(){super(...arguments);u(this,"_value",0);u(this,"_unknownMode",!1);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};l(ge,"ProgressBar");ge.template='
';var J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var Xt=class extends y{constructor(){super();u(this,"init$",{...this.init$,checkerboard:!1,src:J})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${mr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=J}};l(Xt,"FilePreview");Xt.template='';Xt.bindAttributes({checkerboard:"checkerboard"});var _r="--cfg-ctx-name",L=class extends y{get cfgCssCtxName(){return this.getCssData(_r,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(_r,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:S.getCtx(this.cfgCtxName)}}};l(L,"CloudImageEditorBase");function br(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}l(br,"normalize");function V(...s){let i=br(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}l(V,"classNames");function yr(s,...i){let t=br(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}l(yr,"applyClassNames");var vr=l(s=>{if(!s)return G;let i=Bs(s).filter(t=>G.includes(t));return i.length===0?G:i},"parseTabs");function Cr(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":G,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:J,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Ft(G),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=J,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=M(St(i),"preview"),r=O(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(Cr,"initState");var wr=`
Network error
{{fileType}}
{{msg}}
`;var it=class extends L{constructor(){super();u(this,"_debouncedShowLoader",k(this._showLoader.bind(this),300));this.init$={...this.init$,...Cr(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===F.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=Ws(this.$.cdnUrl);this.$["*originalUrl"]=$t(this.$.cdnUrl,t);let e=Xs(this.$.cdnUrl),r=ir(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=$t(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=O(this.$["*originalUrl"],M("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===F.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==J&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||J)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Ti(t)}),this.sub("tabs",t=>{this.$["*tabList"]=vr(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=V("image",{image_hidden_to_cropper:t===F.CROP,image_hidden_effects:t!==F.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=M(St(t),"preview"),n=O(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(it,"CloudImageEditorBlock"),u(it,"className","cloud-image-editor");it.template=wr;it.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var _e=class extends L{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=C&&t.width<=C)return!0;let e=t.height<=C&&(i.includes("n")||i.includes("s")),r=t.width<=C&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],a=tt("mask",{id:"backdrop-mask"}),c=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),h=tt("rect",{x:t,y:e,width:r,height:n,fill:"black"});a.appendChild(c),a.appendChild(h);let d=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(d),o.appendChild(a),this._backdropMask=a,this._backdropMaskInner=h}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Dt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,a=e==="",c=e.length===2,{x:h,y:d,width:p,height:f}=i;if(a){let m={x:h+p/3,y:d+f/3,width:p/3,height:f/3};Dt(n,m)}else{let m=At(Math.min(p,f)/(24*2+34)/2,0,1),{d:b,center:$}=c?Ls(i,e,m):Us(i,e,m),E=Math.max(Yi*At(Math.min(p,f)/Yi/3,0,1),Os);Dt(n,{x:$[0]-E,y:$[1]-E,width:E*2,height:E*2}),Dt(r,{d:b})}let g=this._shouldThumbBeDisabled(e);o.setAttribute("class",V("thumb",{"thumb--hidden":g,"thumb--visible":!g}))}Dt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=tt("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=tt("rect",{fill:"transparent"}),a=tt("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(a),n.appendChild(o),i[r]={direction:r,pathNode:a,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=tt("svg"),t=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=tt("line",{x1:`${Fe*e}%`,y1:"0%",x2:`${Fe*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=tt("line",{x1:"0%",y1:`${Fe*e}%`,x2:"100%",y2:`${Fe*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-n,c=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,a=n-this._dragStartPoint[0],c=o-this._dragStartPoint[1],{direction:h}=this._draggingThumb,d=this._calcCropBox(h,[a,c]);d&&(this.$["*cropBox"]=d)}_calcCropBox(i,t){var h,d;let[e,r]=t,n=this.$["*imageBox"],o=(h=this._dragStartCrop)!=null?h:this.$["*cropBox"],a=(d=this.$["*cropPresetList"])==null?void 0:d[0],c=a?a.width/a.height:void 0;if(i===""?o=Ps({rect:o,delta:[e,r],imageBox:n}):o=Ms({rect:o,delta:[e,r],direction:i,aspectRatio:c,imageBox:n}),!Object.values(o).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return se(ne(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Ns(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Rs(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",V("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=C||i.width<=C,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",V({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(_e,"CropFrame");_e.template='';var pt=class extends L{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=V({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(pt,"EditorButtonControl");pt.template=`
{{title}}
`;function Do(s){let i=s+90;return i=i>=360?0:i,i}l(Do,"nextAngle");function Fo(s,i){return s==="rotate"?Do(i):["mirror","flip"].includes(s)?!i:null}l(Fo,"nextValue");var Gt=class extends pt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=Fo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};l(Gt,"EditorCropButtonControl");var Qe={FILTER:"filter",COLOR_OPERATION:"color_operation"},ft="original",be=class extends L{constructor(){super(...arguments);u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?Qe.FILTER:Qe.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ft?void 0:this.$.value,filter:this._filter===ft?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ut[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===Qe.FILTER){let a=n;if(o){let{name:c,amount:h}=o;a=c===this._filter?h:n}this.$.value=a,this.$.defaultValue=a}if(this._controlType===Qe.COLOR_OPERATION){let a=typeof o!="undefined"?o:e;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===Qe.FILTER?this._filter===ft?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};l(be,"EditorSlider");be.template=``;function ti(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:l(()=>{i.naturalWidth===0&&(i.src=J)},"cancel")}}l(ti,"preloadImage");function ei(s){let i=[];for(let n of s){let o=ti(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:l(()=>{i.forEach(n=>{n.cancel()})},"cancel")}}l(ei,"batchPreloadImages");var It=class extends pt{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==ft?{name:this._filter,amount:o}:void 0,O(this._originalUrl,M(Ei,St(a),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:a,cancel:c}=ti(n);this._cancelPreload=c,a.catch(h=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:h})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ft,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};l(It,"EditorFilterControl");It.template=`
`;var Kt=class extends pt{constructor(){super(...arguments);u(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ut[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};l(Kt,"EditorOperationControl");var Tr=l((s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}},"throttle");function xr(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}l(xr,"pick");function ye(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return O(s,M(Ei,St(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}l(ye,"viewerImageSrc");function Vo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}l(Vo,"validateCrop");var ve=class extends L{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=k(this._commit.bind(this),300),this._handleResizeThrottled=Tr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=xr(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=re({width:i.naturalWidth,height:i.naturalHeight},r),a;if(o.width>n.width-t*2||o.height>n.height-t*2){let c=o.width/o.height,h=n.width/n.height;if(c>h){let d=n.width-t*2,p=d/c,f=0+t,g=t+(n.height-t*2)/2-p/2;a={x:f,y:g,width:d,height:p}}else{let d=n.height-t*2,p=d*c,f=t+(n.width-t*2)/2-p/2,g=0+t;a={x:f,y:g,width:p,height:d}}}else{let{width:c,height:h}=o,d=t+(n.width-t*2)/2-c/2,p=t+(n.height-t*2)/2-h/2;a={x:d,y:p,width:c,height:h}}this.$["*imageBox"]=ne(a)}_alignCrop(){var p;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[f,g],coords:[m,b]}=n,{width:$}=re(this._imageSize,r),E=o/$;i=se(ne({x:a+m*E,y:c+b*E,width:f*E,height:g*E}),this.$["*imageBox"])}let h=(p=this.$["*cropPresetList"])==null?void 0:p[0],d=h?h.width/h.height:void 0;if(!Ds(i,t)||d&&!Fs(i,d)){let f=t.width/t.height,g=t.width,m=t.height;d&&(f>d?g=Math.min(t.height*d,t.width):m=Math.min(t.width/d,t.height)),i={x:t.x+t.width/2-g/2,y:t.y+t.height/2-m/2,width:g,height:m}}this.$["*cropBox"]=se(ne(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:a}=r,c=re({width:e.width,height:e.height},a);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(a*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=V({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:a,height:c}=re(this._imageSize,r),{width:h,height:d}=i,p=n/a,f=o/c;return[At(Math.round(h/p),1,a),At(Math.round(d/f),1,c)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:a,y:c}=t,{width:h,height:d}=re(this._imageSize,r),{x:p,y:f}=i,g=n/h,m=o/d,b=this._getCropDimensions(),$={dimensions:b,coords:[At(Math.round((p-a)/g),0,h-b[0]),At(Math.round((f-c)/m),0,d-b[1])]};if(!Vo($)){console.error("Cropper is trying to create invalid crop object",{payload:$});return}if(!(b[0]===h&&b[1]===d))return $}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=a}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=V({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(ye(i,e,t)),{promise:n,cancel:o,image:a}=ti(r),c=this._handleImageLoading(r);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>a).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(a)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};l(ve,"EditorImageCropper");ve.template=``;function rs(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}l(rs,"linspace");function Bo(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}l(zo,"calculateOpacities");function jo(s,i){return s.map((t,e)=>tn-o)}l(Er,"keypointsRange");var ii=class extends L{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=k(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(ye(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=l(()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(c=>c.value===e),"shouldSkip");if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let a=this._handleImageLoading(n.src);o.addEventListener("load",a,{once:!0}),o.addEventListener("error",a,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let c=this._keypoints,h=c.findIndex(p=>p.value>e),d=h{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ut[i],r=this._keypoints.map(a=>a.value),n=zo(r,t,e),o=jo(r,e);for(let[a,c]of Object.entries(this._keypoints))c.opacity=n[a],c.zIndex=o[a];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(h=>h.src),{images:r,promise:n,cancel:o}=ei(e);r.forEach(h=>{let d=this._handleImageLoading(h.src);h.addEventListener("load",d),h.addEventListener("error",d)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await n,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((h,d)=>{let p=r[d];p.classList.add("fader-image"),h.image=p,this._container.appendChild(p)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Er(e,r).map(c=>this._imageSrc({url:i,filter:t,operation:e,value:c})),{cancel:a}=ei(o);this._cancelBatchPreload=a}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=V({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=V({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let a=this._imageSrc({operation:t,value:e});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=Er(t,e).map(a=>this._constructKeypoint(t,a)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=V({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(ii,"EditorImageFader");var Ho=1,Ce=class extends L{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Ho?this.scrollLeft+=e:this.scrollLeft+=t})}};l(Ce,"EditorScroller");Ce.template=" ";function Wo(s){return``}l(Wo,"renderTabToggle");function Xo(s){return`
`}l(Xo,"renderTabContent");var we=class extends L{constructor(){super();u(this,"_updateInfoTooltip",k(()=>{var o,a;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===F.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+c}else r=this.l10n(ft);else if(this.$["*tabId"]===F.TUNING&&e){n=!0;let c=(t==null?void 0:t[e])||ut[e].zero;r=e+" "+c}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ft,"*currentOperation":null,"*tabId":F.CROP,showLoader:!1,filters:rr,colorOperations:sr,cropOperations:nr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=k(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===F.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new Kt;return e.operation=t,e}_createFilterControl(t){let e=new It;return e.filter=t,e}_createToggleControl(t){let e=new Gt;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===F.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===F.FILTERS?[ft,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===F.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===F.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of G){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(ye(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=ei([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of G){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(we,"EditorToolbar");we.template=`
{{*operationTooltip}}
${G.map(Xo).join("")}
${G.map(Wo).join("")}
`;var Yt=class extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return V("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(Yt,"LrBtnUi");Yt.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Yt.template=`
{{text}}
`;var Te=class extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(Te,"LineLoaderUi");Te.template=`
`;var ki={transition:"transition",visible:"visible",hidden:"hidden"},xe=class extends y{constructor(){super(),this._visible=!1,this._visibleStyle=ki.visible,this._hiddenStyle=ki.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",yr(this,{[ki.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(ki.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};l(xe,"PresenceToggle");xe.template=" ";var Ee=class extends y{constructor(){super();u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let a=document.createDocumentFragment(),c=document.createElement("div"),h=document.createElement("div");c.className="minor-step",h.className="border-step",a.appendChild(h);for(let p=0;p
`;var si=class extends v{constructor(){super();u(this,"activityType",_.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new it,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(si,"CloudImageEditorActivity");var qo=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Ar=l(function(s,i="i"){let t=s.split("*").map(qo);return new RegExp("^"+t.join(".+")+"$",i)},"wildcardRegexp");var Go=l(s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,a)=>{let c=r[a];return o+`${a}: ${c};`},"");return t+`${e}{${n}}`},""),"styleToCss");function $r({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Go({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}l($r,"buildStyles");var Ot={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in Ot){let t=Ot[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Sr=l(function(s,i,t){s in Ot||(Ot[s]=[]),Ot[s].push([i,t])},"registerMessage"),kr=l(function(s,i){s in Ot&&(Ot[s]=Ot[s].filter(t=>t[0]!==i))},"unregisterMessage");function Ir(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}l(Ir,"queryString");var Ae=class extends v{constructor(){super();u(this,"activityType",_.activities.EXTERNAL);u(this,"_iframe",null);u(this,"updateCssData",l(()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())},"updateCssData"));u(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=_.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=N(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=Ar(r);for(let[o,a]of Object.entries(t.alternatives))if(n.test(o))return a}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:$r(t)})}remoteUrl(){var a,c;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((c=(a=this.getCssData("--l10n-locale-name"))==null?void 0:a.split("-"))==null?void 0:c[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Ir(n),o.toString()}mountIframe(){let t=Pe({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Sr("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&kr("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(Ae,"ExternalSource");Ae.template=`
{{activityCaption}}
{{counter}}
`;var Zt=class extends y{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;N(i).forEach(e=>{let r=Pe({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};l(Zt,"Tabs");Zt.bindAttributes({"tab-list":null,default:null});Zt.template=`
`;var Lt=class extends v{constructor(){super();u(this,"processInnerHtml",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,output:null}}get dict(){return Lt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer);let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=this.hasAttribute(this.dict.INPUT_REQUIRED),t.tabIndex=-1,Ri(t,{opacity:0,height:0,width:0}),this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&this._dynamicInputsContainer){this._dynamicInputsContainer.innerHTML="";let e;Array.isArray(t)?e=t.map(r=>r.cdnUrl):t!=null&&t.groupData?e=[t.groupData.cdnUrl]:e=[];for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r!=null?r:"",this._dynamicInputsContainer.appendChild(n)}if(this._validationInputElement){this._validationInputElement.value=e.length?"__VALUE__":"";let r=this.$["*message"];r!=null&&r.isError?this._validationInputElement.setCustomValidity(`${r.caption}. ${r.text}`):this._validationInputElement.setCustomValidity("")}}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t||!t.length){this.$.output=null;return}if(t.every(r=>r.isUploaded)&&(this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR))){let r=t.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:""));if(!t.every(c=>c.isValid)){this.$.output={groupData:void 0,files:t};return}let o=await this.getUploadClientOptions(),a=await $s(r,o);this.$.output={groupData:a,files:t}}else this.$.output=t},!1)}};l(Lt,"DataOutput");Lt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var ri=class extends _{};l(ri,"ActivityHeader");var $e=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};l($e,"Select");$e.template=``;var Y={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},Or={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},Q=class extends y{constructor(){super(...arguments);u(this,"init$",{...this.init$,src:"",ppIcon:Y.PLAY,fsIcon:Y.FS_ON,volIcon:Y.VOL_ON,capIcon:Y.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?Or.exitFullscreen():Or.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===Y.CAP_OFF?(this.$.capIcon=Y.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(Q.is+":captions","1")):(this.$.capIcon=Y.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(Q.is+":captions"))}toggleSound(){this.$.volIcon===Y.VOL_ON?(this.$.volIcon=Y.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=Y.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(Q.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(Q.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=Y.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=Y.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=Y.FS_OFF:this.$.fsIcon=Y.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(Q.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};l(Q,"Video");Q.template=`
{{currentTime}} / {{totalTime}}
`;Q.bindAttributes({video:"video",src:"src"});var Ko="css-src";function ni(s){return class extends s{constructor(){super(...arguments);u(this,"renderShadow",!0);u(this,"pauseRender",!0);u(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Ci({element:this,attribute:Ko,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}l(ni,"shadowed");var Jt=class extends ni(y){};l(Jt,"ShadowWrapper");var Se=class extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};l(Se,"Copyright"),u(Se,"template",`Powered by Uploadcare`);var wt=class extends Jt{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",bi(this));u(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};l(wt,"SolutionBlock");var ke=class extends wt{};l(ke,"FileUploaderRegular");ke.template=``;var Ie=class extends wt{constructor(){super(...arguments);u(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=_.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||_.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};l(Ie,"FileUploaderMinimal");Ie.template=``;var Oe=class extends wt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||_.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||_.activities.START_FROM)&&(this.$["*currentActivity"]=_.activities.UPLOAD_LIST)})}};l(Oe,"FileUploaderInline");Oe.template=``;var oi=class extends ni(it){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};l(oi,"CloudImageEditor");function Ii(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}l(Ii,"registerBlocks");var ns="LR";async function Lr(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[ns]){t(window[ns]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[ns];i&&Ii(n),t(n)},document.head.appendChild(r)})}l(Lr,"connectBlocksFrom");return Vr(Yo);})(); \ No newline at end of file diff --git a/web/blocks.min.js b/web/blocks.min.js index 608ea96b1..df97cf407 100644 --- a/web/blocks.min.js +++ b/web/blocks.min.js @@ -23,5 +23,5 @@ * SOFTWARE. * */ -var zr=Object.defineProperty;var jr=(s,i,t)=>i in s?zr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(jr(s,typeof i!="symbol"?i+"":i,t),t),Si=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var V=(s,i,t)=>(Si(s,i,"read from private field"),t?t.call(s):i.get(s)),Ot=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},re=(s,i,t,e)=>(Si(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var Oe=(s,i,t)=>(Si(s,i,"access private method"),t);var Hr=Object.defineProperty,Wr=(s,i,t)=>i in s?Hr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,Ii=(s,i,t)=>(Wr(s,typeof i!="symbol"?i+"":i,t),t);function Xr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Xr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),fs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",qr=fs.length-1,oe=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Kr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var ds="__default__";function Yr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||ds;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=ds;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Zr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Jr(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Gr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ms(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var Le="{{",ne="}}",Qr="skip-text";function tn(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(Qr))&&r.textContent.includes(Le)&&r.textContent.includes(ne)&&1}});for(;i=e.nextNode();)t.push(i);return t}var en=function(s,i){tn(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(ne);)e.textContent.startsWith(Le)?(n=e.textContent.indexOf(ne)+ne.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(Le),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(Le,"").replace(ne,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},sn=[Kr,Yr,Zr,Jr,en],Ue="'",Bt='"',rn=/\\([0-9a-fA-F]{1,6} ?)/g;function nn(s){return(s[0]===Bt||s[0]===Ue)&&(s[s.length-1]===Bt||s[s.length-1]===Ue)}function on(s){return(s[0]===Bt||s[0]===Ue)&&(s=s.slice(1)),(s[s.length-1]===Bt||s[s.length-1]===Ue)&&(s=s.slice(0,-1)),s}function ln(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ -`,"\\n"),i=ln(i),i=Bt+i+Bt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ps=0,Vt=null,pt=null,vt=class extends HTMLElement{constructor(){super(),Ii(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=oe.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ms(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of sn)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);pt==null||pt.delete(this.updateCssData),pt!=null&&pt.size||(Vt==null||Vt.disconnect(),Vt=null,pt=null)},100)))}static reg(s,i=!1){s||(ps++,s=`${C.AUTO_TAG_PRFX}-${ps}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=an(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){pt||(pt=new Set),pt.add(this.updateCssData),Vt||(Vt=new MutationObserver(s=>{s[0].type==="attributes"&&pt.forEach(i=>{i()})}),Vt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},zt=vt;Ii(zt,"template");var ki=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(ki.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),ki.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};ki.appMap=Object.create(null);function cn(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function hn(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function le(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&hn(i,s.attributes),s.styles&&cn(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=le(t);i.appendChild(e)}),i}var gs="idb-store-ready",un="symbiote-db",dn="symbiote-idb-update_",pn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(gs,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return dn+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,bs.clear(this.name)}},bs=class{static get readyEventName(){return gs}static open(s=un,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new pn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};Ii(bs,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var fn="--uploadcare-blocks-window-height",Re="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Oi(){return typeof window[Re]=="undefined"?!1:!!window[Re]}function _s(){if(Oi())return;let s=()=>{document.documentElement.style.setProperty(fn,`${window.innerHeight}px`),window[Re]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[Re]=!1,window.removeEventListener("resize",i)}}var mn=s=>s,Li="{{",vs="}}",ys="plural:";function ae(s,i,t={}){var o;let{openToken:e=Li,closeToken:r=vs,transform:n=mn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function Cs(s){let i=[],t=s.indexOf(Li);for(;t!==-1;){let e=s.indexOf(vs,t),r=s.substring(t+2,e);if(r.startsWith(ys)){let n=s.substring(t+2,e).replace(ys,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Li,e)}return i}function ws(s){return Object.prototype.toString.call(s)==="[object Object]"}var gn=/\W|_/g;function bn(s){return s.split(gn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Ts(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return Ts(s,{ignoreKeys:i});if(!ws(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ws(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Ts(r,{ignoreKeys:i})),t[bn(e)]=r}return t}var _n=s=>new Promise(i=>setTimeout(i,s));function Fi({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var yn={factor:2,time:100};function vn(s,i=yn){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>_n(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var qt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,qt.prototype),this.originalProgressEvent=t}},Ne=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},Cn=500,Es=({check:s,interval:i=Cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ne(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},De="application/octet-stream",As="original",Tt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ne(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,b=a.status;o({request:d,data:f,headers:m,status:b})}},a.onerror=d=>{u||l(new qt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function wn(s,...i){return s}var Tn=({name:s})=>s?[s]:[],xn=wn,En=()=>new FormData,$s=s=>!1,Fe=s=>typeof Blob!="undefined"&&s instanceof Blob,Ve=s=>typeof File!="undefined"&&s instanceof File,Be=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",ce=s=>Fe(s)||Ve(s)||$s()||Be(s),An=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",$n=s=>!!s&&typeof s=="object"&&!Array.isArray(s),Sn=s=>!!s&&typeof s=="object"&&"data"in s&&ce(s.data);function kn(s,i,t){if(Sn(t)){let{name:e,contentType:r}=t,n=xn(t.data,e,r!=null?r:De),o=Tn({name:e,contentType:r});s.push([i,n,...o])}else if($n(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else An(t)&&t&&s.push([i,t.toString()])}function In(s){let i=[];for(let[t,e]of Object.entries(s))kn(i,t,e);return i}function Vi(s){let i=En(),t=In(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var P=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,P.prototype)}},On=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},ft=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=On(t)),e.toString()},Ln="6.6.1",Un="UploadcareUploadClient",Rn=Ln;function Rt(s){return Fi({libraryName:Un,libraryVersion:Rn,...s})}var Pn="RequestThrottledError",xs=15e3,Mn=1e3;function Nn(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return xs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xs}function xt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return vn(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Pn&&r{let i="";return(Fe(s)||Ve(s)||Be(s))&&(i=s.type),i||De},ks=s=>{let i="";return Ve(s)&&s.name?i=s.name:Fe(s)||$s()?i="":Be(s)&&s.name&&(i=s.name),i||As};function Bi(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function Dn(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({file:{data:s,name:t||ks(s),contentType:e||Ss(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Bi(l),signature:n,expire:o,source:u,metadata:b}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var Pi;(function(s){s.Token="token",s.FileInfo="file_info"})(Pi||(Pi={}));function Fn(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Bi(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:b}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var X;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(X||(X={}));var Vn=s=>"status"in s&&s.status===X.Error;function Bn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return xt(()=>Tt({method:"GET",headers:i?{"X-UC-User-Agent":Rt({publicKey:i,integration:r,userAgent:n})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Vn(d))throw new P(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function zn(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:a,userAgent:c})},url:ft(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let b=mt(JSON.parse(p));if("error"in b)throw new P(b.error.content,b.error.errorCode,f,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function Is(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"GET",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},url:ft(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function jn(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({filename:e||As,size:s,content_type:t||De,part_size:r,UPLOADCARE_STORE:Bi(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:b}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(H=>w.parts[H]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Hn(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||De}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Wn(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},data:Vi({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function zi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Es({check:u=>Is(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}var wt=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);let{uuid:r,s3Bucket:n}=i,o=ft(t,`${r}/`),l=n?ft(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l}},Xn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:b,metadata:A})=>Dn(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>zi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new wt(x,{baseCDN:b})),qn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>Is(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new wt(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Gn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ne(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Kn=window.WebSocket,Mi=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Yn=(s,i)=>s==="success"?{status:X.Success,...i}:s==="progress"?{status:X.Progress,...i}:{status:X.Error,...i},Ni=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Mi);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Kn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Yn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Ui=null,ji=s=>{if(!Ui){let i=typeof window=="undefined"?0:3e4;Ui=new Ni(s,i)}return Ui},Zn=s=>{ji(s).connect()};function Jn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return Es({check:c=>Bn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case X.Error:return new P(u.error,u.errorCode);case X.Waiting:return!1;case X.Unknown:return new P(`Token "${s}" was not found.`);case X.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case X.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var Qn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=ji(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ne(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case X.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case X.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case X.Error:a(),n(new P(c.msg,c.error_code))}})}),to=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Zn(A)).then(()=>Fn(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,metadata:x})).catch(T=>{let w=ji(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===Pi.FileInfo?T:Gn([({signal:w})=>Jn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:w}),({signal:w})=>Qn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof P)throw T;return T}).then(T=>zi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:u})).then(T=>new wt(T,{baseCDN:r})),Ri=new WeakMap,eo=async s=>{if(Ri.has(s))return Ri.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ri.set(s,i),i},Os=async s=>{if(Ve(s)||Fe(s))return s.size;if(Be(s))return(await eo(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},io=(s,i=E.multipartMinFileSize)=>s>=i,Ls=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ce(s)&&t.test(s)},Us=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ce(s)&&t.test(s)},so=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},no=async(s,i,t)=>e=>ro(s,e,i,t),oo=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Hn(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),lo=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:b,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let H=e!=null?e:await Os(s),ht,It=(R,Q)=>{if(!c)return;ht||(ht=Array(R).fill(0));let ut=W=>W.reduce((dt,$i)=>dt+$i,0);return W=>{W.isComputable&&(ht[Q]=W.value,c({isComputable:!0,value:ut(ht)/R}))}};return b||(b=Ss(s)),jn(H,{publicKey:i,contentType:b,fileName:t||ks(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:R,parts:Q})=>{let ut=await no(s,H,A);return Promise.all([R,so(x,Q.map((W,dt)=>()=>oo(ut(dt),W,{publicKey:i,contentType:b,onProgress:It(Q.length,dt),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([R])=>Wn(R,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(R=>R.isReady?R:zi({file:R.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(R=>new wt(R,{baseCDN:T}))};async function Hi(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:b,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,pusherKey:ht,metadata:It}){if(ce(s)){let R=await Os(s);return io(R,b)?lo(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:R,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Xn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Us(s))return to(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(Ls(s))return qn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var Di=class{constructor(i,t){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount,this.totalSize=Object.values(i.files).reduce((e,r)=>e+r.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(i.files).filter(e=>e.isImage).length,this.cdnUrl=i.cdnUrl,this.files=t,this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},ao=s=>{for(let i of s)if(!ce(i))return!1;return!0},co=s=>{for(let i of s)if(!Ls(i))return!1;return!0},ho=s=>{for(let i of s)if(!Us(i))return!1;return!0};function Rs(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!ao(s)&&!ho(s)&&!co(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let H,ht=!0,It=s.length,R=(Q,ut)=>{if(!a)return;H||(H=Array(Q).fill(0));let W=dt=>dt.reduce(($i,Br)=>$i+Br)/Q;return dt=>{if(!dt.isComputable||!ht){ht=!1,a({isComputable:!1});return}H[ut]=dt.value,a({isComputable:!0,value:W(H)})}};return Promise.all(s.map((Q,ut)=>Hi(Q,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:R(It,ut),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}))).then(Q=>{let ut=Q.map(W=>W.uuid);return zn(ut,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(W=>new Di(W,Q)).then(W=>(a&&a({isComputable:!0,value:1}),W))})}var Lt,jt,Ut,Ht,Wt,Xt,Pe,Me=class{constructor(i){Ot(this,Xt);Ot(this,Lt,1);Ot(this,jt,[]);Ot(this,Ut,0);Ot(this,Ht,new WeakMap);Ot(this,Wt,new WeakMap);re(this,Lt,i)}add(i){return new Promise((t,e)=>{V(this,Ht).set(i,t),V(this,Wt).set(i,e),V(this,jt).push(i),Oe(this,Xt,Pe).call(this)})}get pending(){return V(this,jt).length}get running(){return V(this,Ut)}set concurrency(i){re(this,Lt,i),Oe(this,Xt,Pe).call(this)}get concurrency(){return V(this,Lt)}};Lt=new WeakMap,jt=new WeakMap,Ut=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Xt=new WeakSet,Pe=function(){let i=V(this,Lt)-V(this,Ut);for(let t=0;t{V(this,Ht).delete(e),V(this,Wt).delete(e),re(this,Ut,V(this,Ut)-1),Oe(this,Xt,Pe).call(this)}).then(o=>r(o)).catch(o=>n(o))}};var Wi=()=>({"*blocksRegistry":new Set}),Xi=s=>({...Wi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),ze=s=>({...Xi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Me(1)});function Ps(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var q=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Ms=new Set;function je(s){Ms.has(s)||(Ms.add(s),console.warn(s))}var He=(s,i)=>new Intl.PluralRules(s).select(i);var We=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var qi="lr-",_=class extends zt{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Wi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(Ps),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=Cs(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return ae(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=He(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${qi}${t}`,!0),Oi()||(this._destroyInnerHeightTracker=_s()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?We({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?ae(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=q(r);return this.$[o]=n,!0},get:(e,r)=>{let n=q(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(je("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(q(t));r.ctx.has(r.name)?this.sub(q(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(qi)?t:qi+t)}};h(_,"StateConsumerScope",null),h(_,"className","");var he=class extends _{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(he,"StateConsumerScope","modal");he.template=``;var Ns="active",ue="___ACTIVITY_IS_ACTIVE___",st=class extends _{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Xi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ue]=!1,this.removeAttribute(Ns),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ue]=!0,this.setAttribute(Ns,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ue]?this._deactivate():this.activityType===t&&!this[ue]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ue]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var de=33.333333333333336,y=1,Gi=24,Ds=6;function Pt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function tt(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Pt(t,i),t}function Fs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function Vs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Bs(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function zs({rect:s,delta:[i,t],imageBox:e}){return Kt({...s,x:s.x+i,y:s.y+t},e)}function Kt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function uo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Xs(s,i){return Math.abs(s.width/s.height-i)<.1}function Yt({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function qs(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Zt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function Et(s,i,t){return Math.min(Math.max(s,i),t)}var qe=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var et=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Gs="blocks",Ks="0.27.6";function Ys(s){return Fi({...s,libraryName:Gs,libraryVersion:Ks})}var Zs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ge=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Zs(i)).join("/-/"),M=(...s)=>{let i=Ge(...s);return i?`-/${i}/`:""};function Js(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function Qs(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function tr(s){let i=er(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Zs(n))}function er(s){let i=new URL(s),t=Js(s),e=ir(t)?sr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function ir(s){return s.startsWith("http")}function sr(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(er(s));if(t=t||Js(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),ir(t)){let r=sr(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},At=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var N=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var pe=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ki=s=>s?s.filter(i=>typeof i=="string").map(i=>N(i)).flat():[],Yi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),rr=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),fe=s=>{let i=s==null?void 0:s.type;return i?Yi(i,pe):!1};var nt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),me=s=>Math.ceil(s*100)/100,nr=(s,i=Mt.AUTO)=>{let t=i===Mt.AUTO;if(i===Mt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(O,"_timeoutStore",Object.create(null));var or="[Typed State] Wrong property name: ",vo="[Typed State] Wrong property type: ",Ke=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||oe.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(vo+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Ye=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||oe.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__handler=i.handler||null,this.__subsMap=Object.create(null),this.__observers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{this.__observers.forEach(n=>{n({...t})}),t=Object.create(null)})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{var e;let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear(),(e=this.__handler)==null||e.call(this,[...this.__items],i,t)})}setHandler(i){this.__handler=i,this.notify()}getHandler(){return this.__handler}removeHandler(){this.__handler=null}add(i){let t=new Ke(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observe(i){this.__observers.add(i)}unobserve(i){this.__observers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__observers=null,this.__handler=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var lr=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:wt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var ar=s=>s?s.split(",").map(i=>i.trim()):[],Nt=s=>s?s.join(","):"";var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",ze(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_handleCollectionUpdate",t=>{let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,O.emit(new B({type:L.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&O.emit(new B({type:L.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{O.emit(new B({type:L.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{O.emit(new B({type:L.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{O.emit(new B({type:L.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){je("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ye({typedSchema:lr,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this.__uploadCollectionHandler=(e,r,n)=>{var o;this._runValidators();for(let l of n)(o=l==null?void 0:l.getValue("abortController"))==null||o.abort(),l==null||l.setValue("abortController",null),URL.revokeObjectURL(l==null?void 0:l.getValue("thumbUrl"));this.$["*uploadList"]=e.map(l=>({uid:l}))},this.uploadCollection.setHandler(this.__uploadCollectionHandler),this.uploadCollection.observe(this._handleCollectionUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){super.destroyCallback(),this.isUploadCollectionOwner&&(this.uploadCollection.unobserve(this._handleCollectionUpdate),this.uploadCollection.getHandler()===this.__uploadCollectionHandler&&this.uploadCollection.removeHandler())}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:fe(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:et.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:fe(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Nt(Ki([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?pe:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Nt(pe)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:et.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=N(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);O.emit(new B({type:L.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),O.emit(new B({type:L.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Ki([...e?pe:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Yi(o,n),c=rr(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:nr(e)})}_validateMultipleLimit(t){let r=this.uploadCollection.items().indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&r>=n)return this.l10n("files-count-allowed",{count:n})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=qe(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=qs(l,a,c),d=M(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ys,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return this.uploadCollection.findItems(t).forEach(n=>{let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,fileSize:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl||l.cdnUrl};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});Object.values(L).forEach(s=>{let i=O.eName(s),t=S(e=>{if([L.UPLOAD_FINISH,L.REMOVE,L.CLOUD_MODIFICATION].includes(e.detail.type)){let n=$.getCtx(e.detail.ctx),o=n.read("uploadCollection"),l=[];o.items().forEach(a=>{let c=$.getCtx(a).store,u=c.fileInfo;if(u){let d={...u,cdnUrlModifiers:c.cdnUrlModifiers,cdnUrl:c.cdnUrl||u.cdnUrl};l.push(d)}}),O.emit(new B({type:L.DATA_OUTPUT,ctx:e.detail.ctx,data:l})),n.pub("outputData",l)}},0);window.addEventListener(i,t)});var Z={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function Co(s,i){if(typeof i=="number")return Z[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Z[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Z[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var hr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function $t(s){return Ge(...hr.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return Co(i,t)}).filter(i=>!!i))}var Ze=Ge("format/auto","progressive/yes"),bt=([s])=>typeof s!="undefined"?Number(s):void 0,cr=()=>!0,wo=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),To=([s,i])=>({dimensions:N(s,"x").map(Number),coords:N(i).map(Number)}),xo={enhance:bt,brightness:bt,exposure:bt,gamma:bt,contrast:bt,saturation:bt,vibrance:bt,warmth:bt,filter:wo,mirror:cr,flip:cr,rotate:bt,crop:To};function ur(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!hr.includes(e))continue;let n=xo[e],o=n(r);i[e]=o}return i}var D=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),G=[D.CROP,D.TUNING,D.FILTERS],dr=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],pr=["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"],fr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Z.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Z.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Z.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Z.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Z.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Z.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Z.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Z.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Z.filter,range:[0,100],keypointsNumber:1}});var Eo="https://ucarecdn.com",Ao="https://upload.uploadcare.com",$o="https://social.uploadcare.com",Jt={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Nt(G),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Eo,baseUrl:Ao,socialBaseUrl:$o,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var K=s=>String(s),lt=s=>Number(s),k=s=>typeof s=="boolean"?s:s==="true"||s===""?!0:s==="false"?!1:!!s,So=s=>s==="auto"?s:k(s),ko={pubkey:K,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:K,externalSourcesPreferredTypes:K,store:So,cameraMirror:k,sourceList:K,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:K,removeCopyright:k,cropPreset:K,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:K,cdnCname:K,baseUrl:K,socialBaseUrl:K,secureSignature:K,secureExpire:K,secureDeliveryProxy:K,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:K},mr=(s,i)=>{if(!(typeof i=="undefined"||i===null))return ko[s](i)};var Je=Object.keys(Jt),Io=["metadata"],Oo=s=>Io.includes(s),Qe=Je.filter(s=>!Oo(s)),Lo={...Object.fromEntries(Qe.map(s=>[gt(s),s])),...Object.fromEntries(Qe.map(s=>[s.toLowerCase(),s]))},Uo={...Object.fromEntries(Je.map(s=>[gt(s),q(s)])),...Object.fromEntries(Je.map(s=>[s.toLowerCase(),q(s)]))},ti=class extends _{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Jt).map(([t,e])=>[q(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of Qe)this.sub(q(e),r=>{r!==Jt[e]&&(t[e]=r)},!1);for(let e of Je){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,Qe.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[q(e)]!==n&&(typeof n=="undefined"||n===null?this.$[q(e)]=Jt[e]:this.$[q(e)]=n)},get:()=>this.$[q(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Lo[t],o=mr(n,r),l=o!=null?o:Jt[n],a=this;a[n]=l}};ti.bindAttributes(Uo);var ge=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};ge.template=``;ge.bindAttributes({name:"name",size:"size"});var Ro="https://ucarecdn.com",Dt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ro},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var gr=s=>[...new Set(s)];var be="--lr-img-",br="unresolved",Qt=2,te=3,_r=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),vr=Object.create(null),yr;for(let s in Dt)vr[be+s]=((yr=Dt[s])==null?void 0:yr.default)||"";var ei=class extends zt{constructor(){super(...arguments);h(this,"cssInit$",vr)}$$(t){return this.$[be+t]}set$$(t){for(let e in t)this.$[be+e]=t[e]}sub$$(t,e){this.sub(be+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!_r&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return M(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Dt.format.default}`,`quality/${this.$$("quality")||Dt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(_r&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?ae(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(br,""),this.img.onload=()=>{this.img.removeAttribute(br)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Dt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?gr(N(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Qt+"x")}") ${n*Qt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*te+"x")}") ${n*te}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Qt))}") ${Qt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,te))}") ${te}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Qt+"x")+` ${e*Qt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*te+"x")+` ${e*te}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Dt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[be+t]=r})}};var Zi=class extends ei{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var _e=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};_e.template=``;_e.bindAttributes({dropzone:null});var Ji=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function Po(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Mo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function Cr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(Po(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var z={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},wr=["focus"],No=100,Qi=new Map;function Do(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function ts(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=z.INACTIVE,o=f=>{s.shouldIgnore()&&f!==z.INACTIVE||(n!==f&&e.forEach(b=>b(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(z.INACTIVE)},c=()=>{i+=1,n===z.INACTIVE&&o(z.ACTIVE)},u=()=>{i-=1,l()||o(z.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(z.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let b=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor(Do(b,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let b=await Cr(f.dataTransfer);s.onItems(b),o(z.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),wr.forEach(f=>{window.addEventListener(f,a)}),()=>{Qi.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),wr.forEach(f=>{window.removeEventListener(f,a)})}}var ye=class extends v{constructor(){super(),this.init$={...this.init$,state:z.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=ts({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:et.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:et.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=ts({element:i,onChange:t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=N(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};ye.template=`
{{text}}
`;ye.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Fo="src-type-",ve=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${Fo}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ve.template=`
`;ve.bindAttributes({type:null});var es=class extends _{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=N(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function Tr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function xr(s="#fff",i="rgba(0, 0, 0, .1)"){return Tr(``)}function Ce(s="hsl(209, 21%, 65%)",i=32,t=32){return Tr(``)}function Er(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var j=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),_t=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:j.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=j.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=j.FAILED:t.getValue("validationMultipleLimitMsg")?e=j.LIMIT_OVERFLOW:t.getValue("isUploading")?e=j.UPLOADING:t.getValue("fileInfo")&&(e=j.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(At(this.cfg.cdnCname,this._entry.getValue("uuid")),M(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await Er(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{_t.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),_t.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===j.FAILED,isLimitOverflow:t===j.LIMIT_OVERFLOW,isUploading:t===j.UPLOADING,isFinished:t===j.FINISHED,progressVisible:t===j.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===j.FAILED||t===j.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===j.FINISHED&&(this.$.badgeIcon="badge-success"),t===j.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),_t.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));O.emit(new B({type:L.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Hi(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof P?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};_t.template=`
{{itemName}}{{errorText}}
`;_t.activeInstances=new Set;var ii=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},si=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};si.template=`
{{captionTxt}}
{{msgTxt}}
`;var ri=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new ii,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observe(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate)}};ri.template=`{{headerText}}
`;var ni=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:et.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};ni.template=`
`;var is=()=>typeof navigator.permissions!="undefined";var oi=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:is(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{is()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:et.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};oi.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var ss=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var li=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=Ce(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=fe(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,M("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};li.template=`
{{fileSize}}
{{errorTxt}}
`;var rs=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},ai=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new rs);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};ai.template=`{{activityCaption}}
{{messageTxt}}
`;var ci=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this.uploadCollection.observe(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}};ci.template=``;var hi=class extends _{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};hi.template='
';var J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var we=class extends _{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:J})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${xr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=J}};we.template='';we.bindAttributes({checkerboard:"checkerboard"});var Ar="--cfg-ctx-name",U=class extends _{get cfgCssCtxName(){return this.getCssData(Ar,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(Ar,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function $r(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function F(...s){let i=$r(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Sr(s,...i){let t=$r(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var kr=s=>{if(!s)return G;let i=ar(s).filter(t=>G.includes(t));return i.length===0?G:i};function Ir(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":G,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:J,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Nt(G),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=J,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=M($t(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var Or=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends U{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...Ir(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===D.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=Qs(this.$.cdnUrl);this.$["*originalUrl"]=At(this.$.cdnUrl,t);let e=tr(this.$.cdnUrl),r=ur(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=At(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],M("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===D.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==J&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||J)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=qe(t)}),this.sub("tabs",t=>{this.$["*tabList"]=kr(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=F("image",{image_hidden_to_cropper:t===D.CROP,image_hidden_effects:t!==D.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=M($t(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=Or;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ui=class extends U{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=tt("mask",{id:"backdrop-mask"}),a=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=tt("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Pt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Pt(n,f)}else{let f=Et(Math.min(d,p)/(24*2+34)/2,0,1),{d:b,center:A}=a?Fs(i,e,f):Vs(i,e,f),x=Math.max(Gi*Et(Math.min(d,p)/Gi/3,0,1),Ds);Pt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Pt(r,{d:b})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",F("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Pt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=tt("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=tt("rect",{fill:"transparent"}),l=tt("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=tt("svg"),t=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=tt("line",{x1:`${de*e}%`,y1:"0%",x2:`${de*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=tt("line",{x1:"0%",y1:`${de*e}%`,x2:"100%",y2:`${de*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=zs({rect:o,delta:[e,r],imageBox:n}):o=js({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return Kt(Zt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Hs(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Bs(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",F("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",F({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ui.template='';var yt=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=F({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Bo(s){let i=s+90;return i=i>=360?0:i,i}function zo(s,i){return s==="rotate"?Bo(i):["mirror","flip"].includes(s)?!i:null}var Te=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=zo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var xe={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",di=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?xe.FILTER:xe.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===xe.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===xe.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===xe.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};di.template=``;function Ee(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=J)}}}function Ae(s){let i=[];for(let n of s){let o=Ee(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var ee=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,M(Ze,$t(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=Ee(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};ee.template=`
`;var $e=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Lr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function Ur(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function ie(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,M(Ze,$t(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function jo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var pi=class extends U{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Lr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=Ur(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Yt({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Zt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,b]}=n,{width:A}=Yt(this._imageSize,r),x=o/A;i=Kt(Zt({x:l+f*x,y:a+b*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Ws(i,t)||u&&!Xs(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=Kt(Zt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Yt({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=F({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Yt(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[Et(Math.round(c/d),1,l),Et(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Yt(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,b=this._getCropDimensions(),A={dimensions:b,coords:[Et(Math.round((d-l)/m),0,c-b[0]),Et(Math.round((p-a)/f),0,u-b[1])]};if(!jo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(b[0]===c&&b[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=F({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(ie(i,e,t)),{promise:n,cancel:o,image:l}=Ee(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};pi.template=``;function ns(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Ho(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Xo(s,i){return s.map((t,e)=>tn-o)}var os=class extends U{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(ie(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Wo(r,t,e),o=Xo(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=Ae(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Rr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=Ae(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Rr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=F({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var qo=1,fi=class extends U{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>qo?this.scrollLeft+=e:this.scrollLeft+=t})}};fi.template=" ";function Go(s){return``}function Ko(s){return`
`}var mi=class extends U{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===D.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===D.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":D.CROP,showLoader:!1,filters:pr,colorOperations:dr,cropOperations:fr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===D.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new $e;return e.operation=t,e}_createFilterControl(t){let e=new ee;return e.filter=t,e}_createToggleControl(t){let e=new Te;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===D.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===D.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===D.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===D.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of G){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(ie(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=Ae([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of G){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};mi.template=`
{{*operationTooltip}}
${G.map(Ko).join("")}
${G.map(Go).join("")}
`;var Se=class extends _{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return F("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};Se.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Se.template=`
{{text}}
`;var gi=class extends _{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};gi.template=`
`;var bi={transition:"transition",visible:"visible",hidden:"hidden"},_i=class extends _{constructor(){super(),this._visible=!1,this._visibleStyle=bi.visible,this._hiddenStyle=bi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Sr(this,{[bi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(bi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};_i.template=" ";var yi=class extends _{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var ls=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Yo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},Pr=function(s,i="i"){let t=s.split("*").map(Yo);return new RegExp("^"+t.join(".+")+"$",i)};var Zo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Mr({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Zo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Nr=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},Dr=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Fr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var vi=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=N(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=Pr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Mr(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Fr(n),o.toString()}mountIframe(){let t=le({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Nr("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Dr("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};vi.template=`
{{activityCaption}}
{{counter}}
`;var ke=class extends _{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;N(i).forEach(e=>{let r=le({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ke.bindAttributes({"tab-list":null,default:null});ke.template=`
`;var se=class extends v{constructor(){super(...arguments);h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);h(this,"init$",{...this.init$,output:null,filesData:null})}get dict(){return se.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer),this.hasAttribute(this.dict.INPUT_REQUIRED))){let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=!0,this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(t){if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer.innerHTML="";let e=t.groupData?[t.groupData.cdnUrl]:t.map(r=>r.cdnUrl);for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r,this._dynamicInputsContainer.appendChild(n)}this.hasAttribute(this.dict.INPUT_REQUIRED)&&(this._validationInputElement.value=e.length?"__VALUE__":"")}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)}},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t){this.$.output=null,this.$.filesData=null;return}if(this.$.filesData=t,this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR)){let e=t.map(o=>o.uuid),r=await this.getUploadClientOptions(),n=await Rs(e,{...r});this.$.output={groupData:n,files:t}}else this.$.output=t},!1)}};se.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var as=class extends g{};var Ci=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};Ci.template=``;var Y={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},Vr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},it=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:Y.PLAY,fsIcon:Y.FS_ON,volIcon:Y.VOL_ON,capIcon:Y.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?Vr.exitFullscreen():Vr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===Y.CAP_OFF?(this.$.capIcon=Y.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(it.is+":captions","1")):(this.$.capIcon=Y.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(it.is+":captions"))}toggleSound(){this.$.volIcon===Y.VOL_ON?(this.$.volIcon=Y.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=Y.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(it.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(it.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=Y.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=Y.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=Y.FS_OFF:this.$.fsIcon=Y.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(it.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};it.template=`
{{currentTime}} / {{totalTime}}
`;it.bindAttributes({video:"video",src:"src"});var Jo="css-src";function wi(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),We({element:this,attribute:Jo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ie=class extends wi(_){};var Ti=class extends _{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(Ti,"template",`Powered by Uploadcare`);var kt=class extends Ie{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",ze(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var xi=class extends kt{};xi.template=``;var Ei=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};Ei.template=``;var Ai=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};Ai.template=``;var cs=class extends wi(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function hs(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var us="LR";async function Qo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[us]){t(window[us]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[us];i&&hs(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,as as ActivityHeader,zt as BaseComponent,_ as Block,oi as CameraSource,cs as CloudImageEditor,ls as CloudImageEditorActivity,at as CloudImageEditorBlock,ti as Config,ai as ConfirmationDialog,Ti as Copyright,ui as CropFrame,$ as Data,se as DataOutput,ye as DropArea,Te as EditorCropButtonControl,ee as EditorFilterControl,pi as EditorImageCropper,os as EditorImageFader,$e as EditorOperationControl,fi as EditorScroller,di as EditorSlider,mi as EditorToolbar,vi as ExternalSource,_t as FileItem,we as FilePreview,Ai as FileUploaderInline,Ei as FileUploaderMinimal,xi as FileUploaderRegular,ge as Icon,Zi as Img,gi as LineLoaderUi,Se as LrBtnUi,si as MessageBox,he as Modal,Gs as PACKAGE_NAME,Ks as PACKAGE_VERSION,_i as PresenceToggle,hi as ProgressBar,ci as ProgressBarCommon,Ci as Select,Ie as ShadowWrapper,_e as SimpleBtn,yi as SliderUi,ve as SourceBtn,es as SourceList,Ji as StartFrom,ke as Tabs,ss as UploadCtxProvider,li as UploadDetails,ri as UploadList,v as UploaderBlock,ni as UrlSource,it as Video,Qo as connectBlocksFrom,hs as registerBlocks,wi as shadowed,gt as toKebabCase}; \ No newline at end of file +var Or=Object.defineProperty;var Lr=(s,i,t)=>i in s?Or(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(Lr(s,typeof i!="symbol"?i+"":i,t),t);var Ur=Object.defineProperty,Rr=(s,i,t)=>i in s?Ur(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,bi=(s,i,t)=>(Rr(s,typeof i!="symbol"?i+"":i,t),t);function Pr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Pr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),rs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Mr=rs.length-1,Jt=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Dr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var is="__default__";function Fr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||is;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=is;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Vr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Br(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Nr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ns(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var we="{{",Zt="}}",zr="skip-text";function jr(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(zr))&&r.textContent.includes(we)&&r.textContent.includes(Zt)&&1}});for(;i=e.nextNode();)t.push(i);return t}var Hr=function(s,i){jr(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(Zt);)e.textContent.startsWith(we)?(n=e.textContent.indexOf(Zt)+Zt.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(we),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(we,"").replace(Zt,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},Wr=[Dr,Fr,Vr,Br,Hr],Te="'",Dt='"',Xr=/\\([0-9a-fA-F]{1,6} ?)/g;function qr(s){return(s[0]===Dt||s[0]===Te)&&(s[s.length-1]===Dt||s[s.length-1]===Te)}function Gr(s){return(s[0]===Dt||s[0]===Te)&&(s=s.slice(1)),(s[s.length-1]===Dt||s[s.length-1]===Te)&&(s=s.slice(0,-1)),s}function Kr(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ +`,"\\n"),i=Kr(i),i=Dt+i+Dt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ss=0,Nt=null,dt=null,vt=class extends HTMLElement{constructor(){super(),bi(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Jt.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ns(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Wr)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);dt==null||dt.delete(this.updateCssData),dt!=null&&dt.size||(Nt==null||Nt.disconnect(),Nt=null,dt=null)},100)))}static reg(s,i=!1){s||(ss++,s=`${C.AUTO_TAG_PRFX}-${ss}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=Yr(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){dt||(dt=new Set),dt.add(this.updateCssData),Nt||(Nt=new MutationObserver(s=>{s[0].type==="attributes"&&dt.forEach(i=>{i()})}),Nt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},Ft=vt;bi(Ft,"template");var _i=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(_i.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),_i.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};_i.appMap=Object.create(null);function yi(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function Zr(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function Qt(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&Zr(i,s.attributes),s.styles&&yi(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=Qt(t);i.appendChild(e)}),i}var os="idb-store-ready",Jr="symbiote-db",Qr="symbiote-idb-update_",tn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(os,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return Qr+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,ls.clear(this.name)}},ls=class{static get readyEventName(){return os}static open(s=Jr,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new tn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};bi(ls,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var en="--uploadcare-blocks-window-height",xe="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function vi(){return typeof window[xe]=="undefined"?!1:!!window[xe]}function as(){if(vi())return;let s=()=>{document.documentElement.style.setProperty(en,`${window.innerHeight}px`),window[xe]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[xe]=!1,window.removeEventListener("resize",i)}}var sn=s=>s,Ci="{{",hs="}}",cs="plural:";function te(s,i,t={}){var o;let{openToken:e=Ci,closeToken:r=hs,transform:n=sn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function us(s){let i=[],t=s.indexOf(Ci);for(;t!==-1;){let e=s.indexOf(hs,t),r=s.substring(t+2,e);if(r.startsWith(cs)){let n=s.substring(t+2,e).replace(cs,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Ci,e)}return i}function ds(s){return Object.prototype.toString.call(s)==="[object Object]"}var rn=/\W|_/g;function nn(s){return s.split(rn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function ps(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return ps(s,{ignoreKeys:i});if(!ds(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ds(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=ps(r,{ignoreKeys:i})),t[nn(e)]=r}return t}var on=s=>new Promise(i=>setTimeout(i,s));function Si({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var ln={factor:2,time:100};function an(s,i=ln){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>on(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var Vt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,Vt.prototype),this.originalProgressEvent=t}},Ae=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},cn=500,ms=({check:s,interval:i=cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ae(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},$e="application/octet-stream",gs="original",wt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ae(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,_=a.status;o({request:d,data:f,headers:m,status:_})}},a.onerror=d=>{u||l(new Vt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function hn(s,...i){return s}var un=({name:s})=>s?[s]:[],dn=hn,pn=()=>new FormData,_s=s=>!1,Se=s=>typeof Blob!="undefined"&&s instanceof Blob,ke=s=>typeof File!="undefined"&&s instanceof File,Ie=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",Bt=s=>Se(s)||ke(s)||_s()||Ie(s),fn=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",mn=s=>!!s&&typeof s=="object"&&!Array.isArray(s),gn=s=>!!s&&typeof s=="object"&&"data"in s&&Bt(s.data);function _n(s,i,t){if(gn(t)){let{name:e,contentType:r}=t,n=dn(t.data,e,r!=null?r:$e),o=un({name:e,contentType:r});s.push([i,n,...o])}else if(mn(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else fn(t)&&t&&s.push([i,t.toString()])}function bn(s){let i=[];for(let[t,e]of Object.entries(s))_n(i,t,e);return i}function ki(s){let i=pn(),t=bn(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var U=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,U.prototype)}},yn=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},pt=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=yn(t)),e.toString()},vn="6.7.0",Cn="UploadcareUploadClient",wn=vn;function Ot(s){return Si({libraryName:Cn,libraryVersion:wn,...s})}var Tn="RequestThrottledError",fs=15e3,xn=1e3;function En(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return fs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:fs}function Tt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return an(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Tn&&r{let i="";return(Se(s)||ke(s)||Ie(s))&&(i=s.type),i||$e},ys=s=>{let i="";return ke(s)&&s.name?i=s.name:Se(s)||_s()?i="":Ie(s)&&s.name&&(i=s.name),i||gs};function Ii(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function An(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({file:{data:s,name:t||ys(s),contentType:e||bs(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ii(l),signature:n,expire:o,source:u,metadata:_}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var xi;(function(s){s.Token="token",s.FileInfo="file_info"})(xi||(xi={}));function $n(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},url:pt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Ii(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:_}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var H;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(H||(H={}));var Sn=s=>"status"in s&&s.status===H.Error;function kn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return Tt(()=>wt({method:"GET",headers:i?{"X-UC-User-Agent":Ot({publicKey:i,integration:r,userAgent:n})}:void 0,url:pt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Sn(d))throw new U(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function In(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:a,userAgent:c})},url:pt(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let _=mt(JSON.parse(p));if("error"in _)throw new U(_.error.content,_.error.errorCode,f,_,m);return _}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function vs(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"GET",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},url:pt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function On(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({filename:e||gs,size:s,content_type:t||$e,part_size:r,UPLOADCARE_STORE:Ii(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:_}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(z=>w.parts[z]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Ln(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||$e}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Un(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",url:pt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},data:ki({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Oi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return ms({check:u=>vs(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function Rn(s){return"defaultEffects"in s}var ft=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:n}=i,o=pt(t,`${r}/`),l=n?pt(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Rn(i)&&(this.defaultEffects=i.defaultEffects)}},Pn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:_,metadata:A})=>An(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>Oi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new ft(x,{baseCDN:_})),Mn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>vs(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new ft(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Nn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ae(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Dn=window.WebSocket,Ei=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Fn=(s,i)=>s==="success"?{status:H.Success,...i}:s==="progress"?{status:H.Progress,...i}:{status:H.Error,...i},Ai=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Ei);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Dn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Fn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},wi=null,Li=s=>{if(!wi){let i=typeof window=="undefined"?0:3e4;wi=new Ai(s,i)}return wi},Vn=s=>{Li(s).connect()};function Bn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return ms({check:c=>kn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case H.Error:return new U(u.error,u.errorCode);case H.Waiting:return!1;case H.Unknown:return new U(`Token "${s}" was not found.`);case H.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case H.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var zn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=Li(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ae(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case H.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case H.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case H.Error:a(),n(new U(c.msg,c.error_code))}})}),jn=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Vn(A)).then(()=>$n(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,metadata:x})).catch(T=>{let w=Li(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===xi.FileInfo?T:Nn([({signal:w})=>Bn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:w}),({signal:w})=>zn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof U)throw T;return T}).then(T=>Oi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:u})).then(T=>new ft(T,{baseCDN:r})),Ti=new WeakMap,Hn=async s=>{if(Ti.has(s))return Ti.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ti.set(s,i),i},Cs=async s=>{if(ke(s)||Se(s))return s.size;if(Ie(s))return(await Hn(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},Wn=(s,i=E.multipartMinFileSize)=>s>=i,ws=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!Bt(s)&&t.test(s)},Ui=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!Bt(s)&&t.test(s)},Xn=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},Gn=async(s,i,t)=>e=>qn(s,e,i,t),Kn=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Ln(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Yn=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:_,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let z=e!=null?e:await Cs(s),ht,It=(L,j)=>{if(!c)return;ht||(ht=Array(L).fill(0));let tt=it=>it.reduce((ut,gi)=>ut+gi,0);return it=>{it.isComputable&&(ht[j]=it.value,c({isComputable:!0,value:tt(ht)/L}))}};return _||(_=bs(s)),On(z,{publicKey:i,contentType:_,fileName:t||ys(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:L,parts:j})=>{let tt=await Gn(s,z,A);return Promise.all([L,Xn(x,j.map((it,ut)=>()=>Kn(tt(ut),it,{publicKey:i,contentType:_,onProgress:It(j.length,ut),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([L])=>Un(L,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(L=>L.isReady?L:Oi({file:L.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(L=>new ft(L,{baseCDN:T}))};async function Ri(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:_,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,pusherKey:ht,metadata:It}){if(Bt(s)){let L=await Cs(s);return Wn(L,_)?Yn(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:L,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Pn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Ui(s))return jn(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(ws(s))return Mn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var $i=class{constructor(i,{baseCDN:t=E.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,n)=>r+n.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new ft(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Zn=s=>{for(let i of s)if(!Bt(i))return!1;return!0},Jn=s=>{for(let i of s)if(!ws(i))return!1;return!0},Qn=s=>{for(let i of s)if(!Ui(i))return!1;return!0};function Ts(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!Zn(s)&&!Qn(s)&&!Jn(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let z,ht=!0,It=s.length,L=(j,tt)=>{if(!a)return;z||(z=Array(j).fill(0));let it=ut=>ut.reduce((gi,Ir)=>gi+Ir)/j;return ut=>{if(!ut.isComputable||!ht){ht=!1,a({isComputable:!1});return}z[tt]=ut.value,a({isComputable:!0,value:it(z)})}};return Promise.all(s.map((j,tt)=>Bt(j)||Ui(j)?Ri(j,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:L(It,tt),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}).then(it=>it.uuid):j)).then(j=>In(j,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(tt=>new $i(tt,{baseCDN:A})).then(tt=>(a&&a({isComputable:!0,value:1}),tt)))}var Ee=class{constructor(i){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(o=>r(o)).catch(o=>n(o))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var Pi=()=>({"*blocksRegistry":new Set}),Mi=s=>({...Pi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),Oe=s=>({...Mi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Ee(1)});function xs(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var W=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Es=new Set;function Le(s){Es.has(s)||(Es.add(s),console.warn(s))}var Ue=(s,i)=>new Intl.PluralRules(s).select(i);var Re=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var Ni="lr-",b=class extends Ft{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Pi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(xs),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=us(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return te(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=Ue(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ni}${t}`,!0),vi()||(this._destroyInnerHeightTracker=as()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Re({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?te(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=W(r);return this.$[o]=n,!0},get:(e,r)=>{let n=W(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Le("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(W(t));r.ctx.has(r.name)?this.sub(W(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ni)?t:Ni+t)}};h(b,"StateConsumerScope",null),h(b,"className","");var ee=class extends b{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(ee,"StateConsumerScope","modal");ee.template=``;var As="active",ie="___ACTIVITY_IS_ACTIVE___",st=class extends b{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Mi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ie]=!1,this.removeAttribute(As),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ie]=!0,this.setAttribute(As,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ie]?this._deactivate():this.activityType===t&&!this[ie]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ie]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var se=33.333333333333336,y=1,Di=24,$s=6;function Lt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function J(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Lt(t,i),t}function Ss(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function ks(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Is(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function Os({rect:s,delta:[i,t],imageBox:e}){return jt({...s,x:s.x+i,y:s.y+t},e)}function jt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function to({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Ps(s,i){return Math.abs(s.width/s.height-i)<.1}function Ht({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function Ms(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Wt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function xt(s,i,t){return Math.min(Math.max(s,i),t)}var Me=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var Q=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Ns=s=>s?s.split(",").map(i=>i.trim()):[],Ut=s=>s?s.join(","):"";var Ds="blocks",Fs="0.27.6";function Vs(s){return Si({...s,libraryName:Ds,libraryVersion:Fs})}var Bs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ne=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Bs(i)).join("/-/"),R=(...s)=>{let i=Ne(...s);return i?`-/${i}/`:""};function zs(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function js(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Hs(s){let i=Ws(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Bs(n))}function Ws(s){let i=new URL(s),t=zs(s),e=Xs(t)?qs(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Xs(s){return s.startsWith("http")}function qs(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(Ws(s));if(t=t||zs(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Xs(t)){let r=qs(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},Et=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var P=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var re=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Fi=s=>s?s.filter(i=>typeof i=="string").map(i=>P(i)).flat():[],Vi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),Gs=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),ne=s=>{let i=s==null?void 0:s.type;return i?Vi(i,re):!1};var nt=1e3,Rt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),oe=s=>Math.ceil(s*100)/100,Ks=(s,i=Rt.AUTO)=>{let t=i===Rt.AUTO;if(i===Rt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(M,"_timeoutStore",Object.create(null));var Ys="[Typed State] Wrong property name: ",ao="[Typed State] Wrong property type: ",De=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||Jt.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(ao+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Fe=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||Jt.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){this.__collectionObservers.delete(i)}add(i){let t=new De(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){this.__propertyObservers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var Zs=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:ft,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",Oe(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_flushOutputItems",S(()=>{let t=this.getOutputData();t.length===this.uploadCollection.size&&(M.emit(new F({type:X.DATA_OUTPUT,ctx:this.ctxName,data:t})),this.$["*outputData"]=t)},100));h(this,"_handleCollectonUpdate",(t,e,r)=>{var n;this._runValidators();for(let o of r)(n=o==null?void 0:o.getValue("abortController"))==null||n.abort(),o==null||o.setValue("abortController",null),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl"));this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushOutputItems()});h(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,M.emit(new F({type:X.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&M.emit(new F({type:X.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{M.emit(new F({type:X.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{M.emit(new F({type:X.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{M.emit(new F({type:X.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){Le("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Fe({typedSchema:Zs,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectonUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){var t,e;super.destroyCallback(),this.isUploadCollectionOwner&&((t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this))}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:ne(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:ne(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Ut(Fi([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?re:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Ut(re)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:Q.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=P(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);M.emit(new F({type:X.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),M.emit(new F({type:X.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Fi([...e?re:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Vi(o,n),c=Gs(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:Ks(e)})}_validateMultipleLimit(t){let e=this.uploadCollection.items(),r=e.indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMin:1,o=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&e.length=o)return this.l10n("files-count-allowed",{count:o})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=Me(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=Ms(l,a,c),d=R(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Vs,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return(t?this.uploadCollection.findItems(t):this.uploadCollection.items()).forEach(n=>{var c,u;let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,originalFilename:o.fileName,size:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:(u=(c=o.cdnUrl)!=null?c:l.cdnUrl)!=null?u:null,validationErrorMessage:o.validationErrorMsg,uploadError:o.uploadError,isUploaded:!!o.uuid&&!!o.fileInfo,isValid:!o.validationErrorMsg&&!o.uploadError};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});var Y={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function co(s,i){if(typeof i=="number")return Y[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Y[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Y[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var Qs=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function At(s){return Ne(...Qs.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return co(i,t)}).filter(i=>!!i))}var Ve=Ne("format/auto","progressive/yes"),_t=([s])=>typeof s!="undefined"?Number(s):void 0,Js=()=>!0,ho=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),uo=([s,i])=>({dimensions:P(s,"x").map(Number),coords:P(i).map(Number)}),po={enhance:_t,brightness:_t,exposure:_t,gamma:_t,contrast:_t,saturation:_t,vibrance:_t,warmth:_t,filter:ho,mirror:Js,flip:Js,rotate:_t,crop:uo};function tr(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!Qs.includes(e))continue;let n=po[e],o=n(r);i[e]=o}return i}var N=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),q=[N.CROP,N.TUNING,N.FILTERS],er=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],ir=["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"],sr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Y.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Y.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Y.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Y.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Y.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Y.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Y.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Y.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Y.filter,range:[0,100],keypointsNumber:1}});var fo="https://ucarecdn.com",mo="https://upload.uploadcare.com",go="https://social.uploadcare.com",$t={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Ut(q),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:fo,baseUrl:mo,socialBaseUrl:go,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var G=s=>String(s),lt=s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},k=s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},_o=s=>s==="auto"?s:k(s),bo={pubkey:G,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:G,externalSourcesPreferredTypes:G,store:_o,cameraMirror:k,sourceList:G,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:G,removeCopyright:k,cropPreset:G,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:G,cdnCname:G,baseUrl:G,socialBaseUrl:G,secureSignature:G,secureExpire:G,secureDeliveryProxy:G,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:G},rr=(s,i)=>{if(!(typeof i=="undefined"||i===null))try{return bo[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),$t[s]}};var Be=Object.keys($t),yo=["metadata"],vo=s=>yo.includes(s),ze=Be.filter(s=>!vo(s)),Co={...Object.fromEntries(ze.map(s=>[gt(s),s])),...Object.fromEntries(ze.map(s=>[s.toLowerCase(),s]))},wo={...Object.fromEntries(Be.map(s=>[gt(s),W(s)])),...Object.fromEntries(Be.map(s=>[s.toLowerCase(),W(s)]))},je=class extends b{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries($t).map(([t,e])=>[W(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of ze)this.sub(W(e),r=>{r!==$t[e]&&(t[e]=r)},!1);for(let e of Be){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,ze.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[W(e)]!==n&&(typeof n=="undefined"||n===null?this.$[W(e)]=$t[e]:this.$[W(e)]=n)},get:()=>this.$[W(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Co[t],o=rr(n,r),l=o!=null?o:$t[n],a=this;a[n]=l}};je.bindAttributes(wo);var le=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};le.template=``;le.bindAttributes({name:"name",size:"size"});var To="https://ucarecdn.com",Pt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:To},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var nr=s=>[...new Set(s)];var ae="--lr-img-",or="unresolved",Xt=2,qt=3,lr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),cr=Object.create(null),ar;for(let s in Pt)cr[ae+s]=((ar=Pt[s])==null?void 0:ar.default)||"";var He=class extends Ft{constructor(){super(...arguments);h(this,"cssInit$",cr)}$$(t){return this.$[ae+t]}set$$(t){for(let e in t)this.$[ae+e]=t[e]}sub$$(t,e){this.sub(ae+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!lr&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return R(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Pt.format.default}`,`quality/${this.$$("quality")||Pt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(lr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?te(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(or,""),this.img.onload=()=>{this.img.removeAttribute(or)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Pt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?nr(P(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Xt+"x")}") ${n*Xt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*qt+"x")}") ${n*qt}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Xt))}") ${Xt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,qt))}") ${qt}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Xt+"x")+` ${e*Xt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*qt+"x")+` ${e*qt}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Pt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[ae+t]=r})}};var Bi=class extends He{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var ce=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};ce.template=``;ce.bindAttributes({dropzone:null});var zi=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function xo(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Eo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function hr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(xo(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var V={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},ur=["focus"],Ao=100,ji=new Map;function $o(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function Hi(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=V.INACTIVE,o=f=>{s.shouldIgnore()&&f!==V.INACTIVE||(n!==f&&e.forEach(_=>_(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(V.INACTIVE)},c=()=>{i+=1,n===V.INACTIVE&&o(V.ACTIVE)},u=()=>{i-=1,l()||o(V.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(V.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let _=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor($o(_,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let _=await hr(f.dataTransfer);s.onItems(_),o(V.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),ur.forEach(f=>{window.addEventListener(f,a)}),()=>{ji.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),ur.forEach(f=>{window.removeEventListener(f,a)})}}var he=class extends v{constructor(){super(),this.init$={...this.init$,state:V.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=Hi({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:Q.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:Q.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Hi({element:i,onChange:t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=P(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};he.template=`
{{text}}
`;he.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var So="src-type-",ue=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${So}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ue.template=`
`;ue.bindAttributes({type:null});var Wi=class extends b{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=P(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function dr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function pr(s="#fff",i="rgba(0, 0, 0, .1)"){return dr(``)}function de(s="hsl(209, 21%, 65%)",i=32,t=32){return dr(``)}function fr(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var B=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),bt=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:B.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=B.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=B.FAILED:t.getValue("validationMultipleLimitMsg")?e=B.LIMIT_OVERFLOW:t.getValue("isUploading")?e=B.UPLOADING:t.getValue("fileInfo")&&(e=B.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(Et(this.cfg.cdnCname,this._entry.getValue("uuid")),R(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await fr(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{bt.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),bt.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===B.FAILED,isLimitOverflow:t===B.LIMIT_OVERFLOW,isUploading:t===B.UPLOADING,isFinished:t===B.FINISHED,progressVisible:t===B.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===B.FAILED||t===B.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===B.FINISHED&&(this.$.badgeIcon="badge-success"),t===B.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),bt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));M.emit(new F({type:X.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Ri(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof U?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};bt.template=`
{{itemName}}{{errorText}}
`;bt.activeInstances=new Set;var We=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},Xe=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};Xe.template=`
{{captionTxt}}
{{msgTxt}}
`;var qe=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new We,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate)}};qe.template=`{{headerText}}
`;var Ge=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:Q.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};Ge.template=`
`;var Xi=()=>typeof navigator.permissions!="undefined";var Ke=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:Xi(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{Xi()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:Q.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};Ke.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var qi=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var Ye=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=de(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=ne(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,R("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};Ye.template=`
{{fileSize}}
{{errorTxt}}
`;var Gi=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},Ze=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new Gi);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};Ze.template=`{{activityCaption}}
{{messageTxt}}
`;var Je=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};Je.template=``;var Qe=class extends b{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};Qe.template='
';var Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var pe=class extends b{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:Z})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${pr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=Z}};pe.template='';pe.bindAttributes({checkerboard:"checkerboard"});var mr="--cfg-ctx-name",O=class extends b{get cfgCssCtxName(){return this.getCssData(mr,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(mr,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function gr(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function D(...s){let i=gr(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function _r(s,...i){let t=gr(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var br=s=>{if(!s)return q;let i=Ns(s).filter(t=>q.includes(t));return i.length===0?q:i};function yr(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":q,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:Z,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Ut(q),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Z,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=R(At(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var vr=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends O{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...yr(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===N.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=js(this.$.cdnUrl);this.$["*originalUrl"]=Et(this.$.cdnUrl,t);let e=Hs(this.$.cdnUrl),r=tr(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=Et(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],R("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===N.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==Z&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||Z)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Me(t)}),this.sub("tabs",t=>{this.$["*tabList"]=br(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=D("image",{image_hidden_to_cropper:t===N.CROP,image_hidden_effects:t!==N.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=R(At(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=vr;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ti=class extends O{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=J("mask",{id:"backdrop-mask"}),a=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=J("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Lt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Lt(n,f)}else{let f=xt(Math.min(d,p)/(24*2+34)/2,0,1),{d:_,center:A}=a?Ss(i,e,f):ks(i,e,f),x=Math.max(Di*xt(Math.min(d,p)/Di/3,0,1),$s);Lt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Lt(r,{d:_})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",D("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Lt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=J("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=J("rect",{fill:"transparent"}),l=J("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=J("svg"),t=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=J("line",{x1:`${se*e}%`,y1:"0%",x2:`${se*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=J("line",{x1:"0%",y1:`${se*e}%`,x2:"100%",y2:`${se*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=Os({rect:o,delta:[e,r],imageBox:n}):o=Ls({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return jt(Wt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Us(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Is(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",D("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",D({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ti.template='';var yt=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=D({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Io(s){let i=s+90;return i=i>=360?0:i,i}function Oo(s,i){return s==="rotate"?Io(i):["mirror","flip"].includes(s)?!i:null}var fe=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=Oo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var me={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",ei=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?me.FILTER:me.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===me.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===me.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===me.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};ei.template=``;function ge(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Z)}}}function _e(s){let i=[];for(let n of s){let o=ge(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var Gt=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,R(Ve,At(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=ge(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};Gt.template=`
`;var be=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Cr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function wr(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function Kt(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,R(Ve,At(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function Lo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var ii=class extends O{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Cr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=wr(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Ht({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Wt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,_]}=n,{width:A}=Ht(this._imageSize,r),x=o/A;i=jt(Wt({x:l+f*x,y:a+_*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Rs(i,t)||u&&!Ps(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=jt(Wt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Ht({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=D({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Ht(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[xt(Math.round(c/d),1,l),xt(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Ht(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,_=this._getCropDimensions(),A={dimensions:_,coords:[xt(Math.round((d-l)/m),0,c-_[0]),xt(Math.round((p-a)/f),0,u-_[1])]};if(!Lo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(_[0]===c&&_[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=D({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(Kt(i,e,t)),{promise:n,cancel:o,image:l}=ge(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};ii.template=``;function Ki(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Uo(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Po(s,i){return s.map((t,e)=>tn-o)}var Yi=class extends O{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(Kt(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Ro(r,t,e),o=Po(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=_e(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Tr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=_e(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Tr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=D({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Mo=1,si=class extends O{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Mo?this.scrollLeft+=e:this.scrollLeft+=t})}};si.template=" ";function No(s){return``}function Do(s){return`
`}var ri=class extends O{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===N.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===N.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":N.CROP,showLoader:!1,filters:ir,colorOperations:er,cropOperations:sr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===N.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new be;return e.operation=t,e}_createFilterControl(t){let e=new Gt;return e.filter=t,e}_createToggleControl(t){let e=new fe;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===N.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===N.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===N.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===N.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of q){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(Kt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=_e([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of q){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};ri.template=`
{{*operationTooltip}}
${q.map(Do).join("")}
${q.map(No).join("")}
`;var ye=class extends b{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return D("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};ye.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ye.template=`
{{text}}
`;var ni=class extends b{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};ni.template=`
`;var oi={transition:"transition",visible:"visible",hidden:"hidden"},li=class extends b{constructor(){super(),this._visible=!1,this._visibleStyle=oi.visible,this._hiddenStyle=oi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",_r(this,{[oi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(oi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};li.template=" ";var ai=class extends b{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var Zi=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Fo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},xr=function(s,i="i"){let t=s.split("*").map(Fo);return new RegExp("^"+t.join(".+")+"$",i)};var Vo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Er({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Vo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Ar=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},$r=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Sr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var ci=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=P(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=xr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Er(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Sr(n),o.toString()}mountIframe(){let t=Qt({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Ar("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&$r("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};ci.template=`
{{activityCaption}}
{{counter}}
`;var ve=class extends b{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;P(i).forEach(e=>{let r=Qt({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ve.bindAttributes({"tab-list":null,default:null});ve.template=`
`;var Yt=class extends v{constructor(){super();h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,output:null}}get dict(){return Yt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer);let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=this.hasAttribute(this.dict.INPUT_REQUIRED),t.tabIndex=-1,yi(t,{opacity:0,height:0,width:0}),this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&this._dynamicInputsContainer){this._dynamicInputsContainer.innerHTML="";let e;Array.isArray(t)?e=t.map(r=>r.cdnUrl):t!=null&&t.groupData?e=[t.groupData.cdnUrl]:e=[];for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r!=null?r:"",this._dynamicInputsContainer.appendChild(n)}if(this._validationInputElement){this._validationInputElement.value=e.length?"__VALUE__":"";let r=this.$["*message"];r!=null&&r.isError?this._validationInputElement.setCustomValidity(`${r.caption}. ${r.text}`):this._validationInputElement.setCustomValidity("")}}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t||!t.length){this.$.output=null;return}if(t.every(r=>r.isUploaded)&&(this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR))){let r=t.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:""));if(!t.every(a=>a.isValid)){this.$.output={groupData:void 0,files:t};return}let o=await this.getUploadClientOptions(),l=await Ts(r,o);this.$.output={groupData:l,files:t}}else this.$.output=t},!1)}};Yt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var Ji=class extends g{};var hi=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};hi.template=``;var K={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},kr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},et=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:K.PLAY,fsIcon:K.FS_ON,volIcon:K.VOL_ON,capIcon:K.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?kr.exitFullscreen():kr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===K.CAP_OFF?(this.$.capIcon=K.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(et.is+":captions","1")):(this.$.capIcon=K.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(et.is+":captions"))}toggleSound(){this.$.volIcon===K.VOL_ON?(this.$.volIcon=K.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=K.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(et.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(et.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=K.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=K.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=K.FS_OFF:this.$.fsIcon=K.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(et.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};et.template=`
{{currentTime}} / {{totalTime}}
`;et.bindAttributes({video:"video",src:"src"});var Bo="css-src";function ui(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Re({element:this,attribute:Bo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ce=class extends ui(b){};var di=class extends b{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(di,"template",`Powered by Uploadcare`);var kt=class extends Ce{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Oe(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var pi=class extends kt{};pi.template=``;var fi=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};fi.template=``;var mi=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};mi.template=``;var Qi=class extends ui(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function ts(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var es="LR";async function zo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[es]){t(window[es]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[es];i&&ts(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,Ji as ActivityHeader,Ft as BaseComponent,b as Block,Ke as CameraSource,Qi as CloudImageEditor,Zi as CloudImageEditorActivity,at as CloudImageEditorBlock,je as Config,Ze as ConfirmationDialog,di as Copyright,ti as CropFrame,$ as Data,Yt as DataOutput,he as DropArea,fe as EditorCropButtonControl,Gt as EditorFilterControl,ii as EditorImageCropper,Yi as EditorImageFader,be as EditorOperationControl,si as EditorScroller,ei as EditorSlider,ri as EditorToolbar,ci as ExternalSource,bt as FileItem,pe as FilePreview,mi as FileUploaderInline,fi as FileUploaderMinimal,pi as FileUploaderRegular,le as Icon,Bi as Img,ni as LineLoaderUi,ye as LrBtnUi,Xe as MessageBox,ee as Modal,Ds as PACKAGE_NAME,Fs as PACKAGE_VERSION,li as PresenceToggle,Qe as ProgressBar,Je as ProgressBarCommon,hi as Select,Ce as ShadowWrapper,ce as SimpleBtn,ai as SliderUi,ue as SourceBtn,Wi as SourceList,zi as StartFrom,ve as Tabs,qi as UploadCtxProvider,Ye as UploadDetails,qe as UploadList,v as UploaderBlock,Ge as UrlSource,et as Video,zo as connectBlocksFrom,ts as registerBlocks,ui as shadowed,gt as toKebabCase}; \ No newline at end of file diff --git a/web/lr-basic.min.css b/web/lr-basic.min.css index 51a8308c4..afdf81d8f 100644 --- a/web/lr-basic.min.css +++ b/web/lr-basic.min.css @@ -1 +1 @@ -:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0} +:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-minimum: "At least {{count}} files are required";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0} diff --git a/web/lr-cloud-image-editor.min.js b/web/lr-cloud-image-editor.min.js index 2fd98f381..3912479fc 100644 --- a/web/lr-cloud-image-editor.min.js +++ b/web/lr-cloud-image-editor.min.js @@ -23,6 +23,6 @@ * SOFTWARE. * */ -var Be=Object.defineProperty;var We=(r,e,t)=>e in r?Be(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(r,e,t)=>(We(r,typeof e!="symbol"?e+"":e,t),t);var Vt=r=>{if(typeof r!="string"||!r)return"";let e=r.trim();return e.startsWith("-/")?e=e.slice(2):e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,e.length-1)),e},ft=(...r)=>r.filter(e=>typeof e=="string"&&e).map(e=>Vt(e)).join("/-/"),D=(...r)=>{let e=ft(...r);return e?`-/${e}/`:""};function Gt(r){let e=new URL(r),t=e.pathname+e.search+e.hash,i=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return i>=0?o=t.slice(i):s>=0&&(o=t.slice(s+1)),o}function qt(r){let e=new URL(r),{pathname:t}=e,i=t.indexOf("/"),s=t.indexOf("/",i+1);return t.substring(i+1,s)}function Yt(r){let e=Zt(r),t=new URL(e),i=t.pathname.indexOf("/-/");return i===-1?[]:t.pathname.substring(i).split("/-/").filter(Boolean).map(o=>Vt(o))}function Zt(r){let e=new URL(r),t=Gt(r),i=Qt(t)?Jt(t).pathname:t;return e.pathname=e.pathname.replace(i,""),e.search="",e.hash="",e.toString()}function Qt(r){return r.startsWith("http")}function Jt(r){let e=new URL(r);return{pathname:e.origin+e.pathname||"",search:e.search||"",hash:e.hash||""}}var U=(r,e,t)=>{let i=new URL(Zt(r));if(t=t||Gt(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),Qt(t)){let s=Jt(t);i.pathname=i.pathname+(e||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(e||"")+(t||"");return i.toString()},Lt=(r,e)=>{let t=new URL(r);return t.pathname=e+"/",t.toString()};var P="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function I(r,e){let t,i=(...s)=>{clearTimeout(t),t=setTimeout(()=>r(...s),e)};return i.cancel=()=>{clearTimeout(t)},i}var Ke=Object.defineProperty,Ve=(r,e,t)=>e in r?Ke(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mt=(r,e,t)=>(Ve(r,typeof e!="symbol"?e+"":e,t),t);function Ge(r){let e=t=>{var i;for(let s in t)((i=t[s])==null?void 0:i.constructor)===Object&&(t[s]=e(t[s]));return{...t}};return e(r)}var y=class{constructor(r){r.constructor===Object?this.store=Ge(r):(this._storeIsProxy=!0,this.store=r),this.callbackMap=Object.create(null)}static warn(r,e){console.warn(`Symbiote Data: cannot ${r}. Prop name: `+e)}read(r){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(y.warn("read",r),null):this.store[r]}has(r){return this._storeIsProxy?this.store[r]!==void 0:this.store.hasOwnProperty(r)}add(r,e,t=!1){!t&&Object.keys(this.store).includes(r)||(this.store[r]=e,this.notify(r))}pub(r,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(r)){y.warn("publish",r);return}this.store[r]=e,this.notify(r)}multiPub(r){for(let e in r)this.pub(e,r[e])}notify(r){this.callbackMap[r]&&this.callbackMap[r].forEach(e=>{e(this.store[r])})}sub(r,e,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(y.warn("subscribe",r),null):(this.callbackMap[r]||(this.callbackMap[r]=new Set),this.callbackMap[r].add(e),t&&e(this.store[r]),{remove:()=>{this.callbackMap[r].delete(e),this.callbackMap[r].size||delete this.callbackMap[r]},callback:e})}static registerCtx(r,e=Symbol()){let t=y.globalStore.get(e);return t?console.warn('State: context UID "'+e+'" already in use'):(t=new y(r),y.globalStore.set(e,t)),t}static deleteCtx(r){y.globalStore.delete(r)}static getCtx(r,e=!0){return y.globalStore.get(r)||(e&&console.warn('State: wrong context UID - "'+r+'"'),null)}};y.globalStore=new Map;var f=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),ie="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",qe=ie.length-1,Ye=class{static generate(r="XXXXXXXXX-XXX"){let e="";for(let t=0;t{le&&t?e[0].toUpperCase()+e.slice(1):e).join("").split("_").map((e,t)=>e&&t?e.toUpperCase():e).join("")}function Qe(r,e){[...r.querySelectorAll(`[${f.REPEAT_ATTR}]`)].forEach(t=>{let i=t.getAttribute(f.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=class extends e.BaseComponent{constructor(){super(),i||(this.style.display="contents")}};let n=t.innerHTML;s.template=n,s.reg(i)}for(;t.firstChild;)t.firstChild.remove();let o=t.getAttribute(f.REPEAT_ATTR);e.sub(o,n=>{if(!n){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,h=c=>{c.forEach((u,_)=>{if(l[_])if(l[_].set$)setTimeout(()=>{l[_].set$(u)});else for(let g in u)l[_][g]=u[g];else{a||(a=new DocumentFragment);let g=new s;Object.assign(g.init$,u),a.appendChild(g)}}),a&&t.appendChild(a);let d=l.slice(c.length,l.length);for(let u of d)u.remove()};if(n.constructor===Array)h(n);else if(n.constructor===Object){let c=[];for(let d in n){let u=n[d];Object.defineProperty(u,"_KEY_",{value:d,enumerable:!0}),c.push(u)}h(c)}else console.warn("Symbiote repeat data type error:"),console.log(n)}),t.removeAttribute(f.REPEAT_ATTR),t.removeAttribute(f.REPEAT_ITEM_TAG_ATTR)})}var te="__default__";function Je(r,e){if(e.shadowRoot)return;let t=[...r.querySelectorAll("slot")];if(!t.length)return;let i={};t.forEach(s=>{let o=s.getAttribute("name")||te;i[o]={slot:s,fr:document.createDocumentFragment()}}),e.initChildren.forEach(s=>{var o;let n=te;s instanceof Element&&s.hasAttribute("slot")&&(n=s.getAttribute("slot"),s.removeAttribute("slot")),(o=i[n])==null||o.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}function ti(r,e){[...r.querySelectorAll(`[${f.EL_REF_ATTR}]`)].forEach(t=>{let i=t.getAttribute(f.EL_REF_ATTR);e.ref[i]=t,t.removeAttribute(f.EL_REF_ATTR)})}function ei(r,e){[...r.querySelectorAll(`[${f.BIND_ATTR}]`)].forEach(t=>{let s=t.getAttribute(f.BIND_ATTR).split(";");[...t.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let n=Ze(o.name.replace("-",""));s.push(n+":"+o.value),t.removeAttribute(o.name)}}),s.forEach(o=>{if(!o)return;let n=o.split(":").map(c=>c.trim()),l=n[0],a;l.indexOf(f.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(f.ATTR_BIND_PRFX,""));let h=n[1].split(",").map(c=>c.trim());for(let c of h){let d;c.startsWith("!!")?(d="double",c=c.replace("!!","")):c.startsWith("!")&&(d="single",c=c.replace("!","")),e.sub(c,u=>{d==="double"?u=!!u:d==="single"&&(u=!u),a?(u==null?void 0:u.constructor)===Boolean?u?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,u):re(t,l,u)||(t[f.SET_LATER_KEY]||(t[f.SET_LATER_KEY]=Object.create(null)),t[f.SET_LATER_KEY][l]=u)})}}),t.removeAttribute(f.BIND_ATTR)})}var mt="{{",ot="}}",ii="skip-text";function ri(r){let e,t=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(ii))&&s.textContent.includes(mt)&&s.textContent.includes(ot)&&1}});for(;e=i.nextNode();)t.push(e);return t}var si=function(r,e){ri(r).forEach(i=>{let s=[],o;for(;i.textContent.includes(ot);)i.textContent.startsWith(mt)?(o=i.textContent.indexOf(ot)+ot.length,i.splitText(o),s.push(i)):(o=i.textContent.indexOf(mt),i.splitText(o)),i=i.nextSibling;s.forEach(n=>{let l=n.textContent.replace(mt,"").replace(ot,"");n.textContent="",e.sub(l,a=>{n.textContent=a})})})},oi=[Qe,Je,ti,ei,si],_t="'",Z='"',ni=/\\([0-9a-fA-F]{1,6} ?)/g;function li(r){return(r[0]===Z||r[0]===_t)&&(r[r.length-1]===Z||r[r.length-1]===_t)}function ai(r){return(r[0]===Z||r[0]===_t)&&(r=r.slice(1)),(r[r.length-1]===Z||r[r.length-1]===_t)&&(r=r.slice(0,-1)),r}function hi(r){let e="",t="";for(var i=0;iString.fromCodePoint(parseInt(i.trim(),16))),e=e.replaceAll(`\\ -`,"\\n"),e=hi(e),e=Z+e+Z);try{return JSON.parse(e)}catch{throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${r}`)}}var ee=0,Y=null,z=null,j=class extends HTMLElement{constructor(){super(),Mt(this,"updateCssData",()=>{var r;this.dropCssDataCache(),(r=this.__boundCssProps)==null||r.forEach(e=>{let t=this.getCssData(this.__extractCssName(e),!0);t!==null&&this.$[e]!==t&&(this.$[e]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return j}initCallback(){}__initCallback(){var r;this.__initialized||(this.__initialized=!0,(r=this.initCallback)==null||r.call(this))}render(r,e=this.renderShadow){let t;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(f.USE_TPL);if(s){let o=this.getRootNode(),n=(o==null?void 0:o.querySelector(s))||document.querySelector(s);n?r=n.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(r||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(r==null?void 0:r.constructor)===DocumentFragment)t=r;else if((r==null?void 0:r.constructor)===String){let s=document.createElement("template");s.innerHTML=r,t=s.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(t,this)}let i=()=>{t&&(e&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){e=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=i,this.shadowRoot.prepend(s)}else i()}addTemplateProcessor(r){this.tplProcessors.add(r)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Ye.generate(),this.style.setProperty(f.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(f.CSS_CTX_PROP,!0)}get ctxName(){var r;let e=((r=this.getAttribute(f.CTX_NAME_ATTR))==null?void 0:r.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}get localCtx(){return this.__localCtx||(this.__localCtx=y.registerCtx({},this)),this.__localCtx}get nodeCtx(){return y.getCtx(this.ctxName,!1)||y.registerCtx({},this.ctxName)}static __parseProp(r,e){let t,i;if(r.startsWith(f.EXT_DATA_CTX_PRFX))t=e.nodeCtx,i=r.replace(f.EXT_DATA_CTX_PRFX,"");else if(r.includes(f.NAMED_DATA_CTX_SPLTR)){let s=r.split(f.NAMED_DATA_CTX_SPLTR);t=y.getCtx(s[0]),i=s[1]}else t=e.localCtx,i=r;return{ctx:t,name:i}}sub(r,e,t=!0){let i=o=>{this.isConnected&&e(o)},s=j.__parseProp(r,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,i,t)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,i,t))})}notify(r){let e=j.__parseProp(r,this);e.ctx.notify(e.name)}has(r){let e=j.__parseProp(r,this);return e.ctx.has(e.name)}add(r,e,t=!1){let i=j.__parseProp(r,this);i.ctx.add(i.name,e,t)}add$(r,e=!1){for(let t in r)this.add(t,r[t],e)}get $(){if(!this.__stateProxy){let r=Object.create(null);this.__stateProxy=new Proxy(r,{set:(e,t,i)=>{let s=j.__parseProp(t,this);return s.ctx.pub(s.name,i),!0},get:(e,t)=>{let i=j.__parseProp(t,this);return i.ctx.read(i.name)}})}return this.__stateProxy}set$(r,e=!1){for(let t in r){let i=r[t];e||![String,Number,Boolean].includes(i==null?void 0:i.constructor)?this.$[t]=i:this.$[t]!==i&&(this.$[t]=i)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(f.CTX_OWNER_ATTR)&&this.getAttribute(f.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let r=this.constructor.__attrDesc;if(r)for(let e of Object.values(r))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(f.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(f.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(f.NAMED_DATA_CTX_SPLTR)){let t=e.split(f.NAMED_DATA_CTX_SPLTR),i=t[0].trim(),s=t[1].trim();if(i&&s){let o=y.getCtx(i,!1);o||(o=y.registerCtx({},i)),o.add(s,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var r;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(r=this.getAttribute(f.CTX_NAME_ATTR))==null?void 0:r.trim();if(e&&this.style.setProperty(f.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[f.SET_LATER_KEY]){for(let t in this[f.SET_LATER_KEY])re(this,t,this[f.SET_LATER_KEY][t]);delete this[f.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of oi)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${f.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(f.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(s):t.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let r of this.allSubs)r.remove(),this.allSubs.delete(r);for(let r of this.tplProcessors)this.tplProcessors.delete(r);z==null||z.delete(this.updateCssData),z!=null&&z.size||(Y==null||Y.disconnect(),Y=null,z=null)},100)))}static reg(r,e=!1){r||(ee++,r=`${f.AUTO_TAG_PRFX}-${ee}`),this.__tag=r;let t=window.customElements.get(r);if(t){!e&&t!==this&&console.warn([`Element with tag name "${r}" 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(r,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(r){this.observedAttributes=Object.keys(r),this.__attrDesc=r}attributeChangedCallback(r,e,t){var i;if(e===t)return;let s=(i=this.constructor.__attrDesc)==null?void 0:i[r];s?this.__dataCtxInitialized?this.$[s]=t:this.init$[s]=t:this[r]=t}getCssData(r,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(r)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(r).trim();try{this.__cssDataCache[r]=ci(t)}catch{!e&&console.warn(`CSS Data error: ${r}`),this.__cssDataCache[r]=null}}return this.__cssDataCache[r]}__extractCssName(r){return r.split("--").map((e,t)=>t===0?"":e).join("--")}__initStyleAttrObserver(){z||(z=new Set),z.add(this.updateCssData),Y||(Y=new MutationObserver(r=>{r[0].type==="attributes"&&z.forEach(e=>{e()})}),Y.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(r,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(r);let t=this.getCssData(this.__extractCssName(r),!0);t===null&&(t=e),this.add(r,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(r,e,t){let i="__"+r;this[i]=this[r],Object.defineProperty(this,r,{set:s=>{this[i]=s,t?window.setTimeout(()=>{e==null||e(s)}):e==null||e(s)},get:()=>this[i]}),this[r]=this[i]}static set shadowStyles(r){let e=new Blob([r],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(r){if(!this.__rootStylesLink){let e=new Blob([r],{type:"text/css"}),t=URL.createObjectURL(e),i=document.createElement("link");i.href=t,i.rel="stylesheet",this.__rootStylesLink=i}}},Dt=j;Mt(Dt,"template");var Rt=class{static _print(r){console.warn(r)}static setDefaultTitle(r){this.defaultTitle=r}static setRoutingMap(r){Object.assign(this.appMap,r);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(r){this.__routingEventName=r}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let r={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))r.route=t.replace("?","");else if(t.includes("=")){let i=t.split("=");r.options[i[0]]=decodeURI(i[1])}else r.options[t]=!0}),r}static notify(){let r=this.readAddressBar(),e=this.appMap[r.route];if(e&&e.title&&(document.title=e.title),r.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${r.route}" not found...`);return}let t=new CustomEvent(Rt.routingEventName,{detail:{route:r.route,options:Object.assign(e||{},r.options)}});window.dispatchEvent(t)}static reflect(r,e={}){let t=this.appMap[r];if(!t){this._print("Wrong route: "+r);return}let i="?"+r;for(let o in e)e[o]===!0?i+=this.separator+o:i+=this.separator+o+`=${e[o]}`;let s=t.title||this.defaultTitle||"";window.history.pushState(null,s,i),document.title=s}static applyRoute(r,e={}){this.reflect(r,e),this.notify()}static setSeparator(r){this._separator=r}static get separator(){return this._separator||"&"}static createRouterData(r,e){this.setRoutingMap(e);let t=y.registerCtx({route:null,options:null,title:null},r);return window.addEventListener(this.routingEventName,i=>{var s;t.multiPub({route:i.detail.route,options:i.detail.options,title:((s=i.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),Rt.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};Rt.appMap=Object.create(null);var se="idb-store-ready",di="symbiote-db",ui="symbiote-idb-update_",pi=class{_notifyWhenReady(r=null){window.dispatchEvent(new CustomEvent(se,{detail:{dbName:this.name,storeName:this.storeName,event:r}}))}get _updEventName(){return ui+this.name}_getUpdateEvent(r){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:r}})}_notifySubscribers(r){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,r),window.dispatchEvent(this._getUpdateEvent(r))}constructor(r,e){this.name=r,this.storeName=e,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(e,{keyPath:"_key"}),this.objStore.transaction.oncomplete=i=>{this._notifyWhenReady(i)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async s=>{s(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(r){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(r);return new Promise((i,s)=>{t.onsuccess=o=>{var n;(n=o.target.result)!=null&&n._value?i(o.target.result._value):(i(null),console.warn(`IDB: cannot read "${r}"`))},t.onerror=o=>{s(o)}})}write(r,e,t=!1){let i={_key:r,_value:e},o=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(i);return new Promise((n,l)=>{o.onsuccess=a=>{t||this._notifySubscribers(r),n(a.target.result)},o.onerror=a=>{l(a)}})}delete(r,e=!1){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(r);return new Promise((s,o)=>{i.onsuccess=n=>{e||this._notifySubscribers(r),s(n)},i.onerror=n=>{o(n)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,i)=>{e.onsuccess=s=>{let o=s.target.result;t(o.map(n=>n._value))},e.onerror=s=>{i(s)}})}subscribe(r,e){this._subscriptionsMap[r]||(this._subscriptionsMap[r]=new Set);let t=this._subscriptionsMap[r];return t.add(e),{remove:()=>{t.delete(e),t.size||delete this._subscriptionsMap[r]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,oe.clear(this.name)}},oe=class{static get readyEventName(){return se}static open(r=di,e="store"){let t=r+"/"+e;return this._reg[t]||(this._reg[t]=new pi(r,e)),this._reg[t]}static clear(r){window.indexedDB.deleteDatabase(r);for(let e in this._reg)e.split("/")[0]===r&&delete this._reg[e]}};Mt(oe,"_reg",Object.create(null));var fi="--uploadcare-blocks-window-height",gt="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Ut(){return typeof window[gt]=="undefined"?!1:!!window[gt]}function ne(){if(Ut())return;let r=()=>{document.documentElement.style.setProperty(fi,`${window.innerHeight}px`),window[gt]=!0},e=I(r,100);return window.addEventListener("resize",e,{passive:!0}),r(),()=>{window[gt]=!1,window.removeEventListener("resize",e)}}var mi=r=>r,zt="{{",ae="}}",le="plural:";function Ft(r,e,t={}){var n;let{openToken:i=zt,closeToken:s=ae,transform:o=mi}=t;for(let l in e){let a=(n=e[l])==null?void 0:n.toString();r=r.replaceAll(i+l+s,typeof a=="string"?o(a):a)}return r}function he(r){let e=[],t=r.indexOf(zt);for(;t!==-1;){let i=r.indexOf(ae,t),s=r.substring(t+2,i);if(s.startsWith(le)){let o=r.substring(t+2,i).replace(le,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));e.push({variable:s,pluralKey:n,countVariable:l})}t=r.indexOf(zt,i)}return e}var ce=()=>({"*blocksRegistry":new Set});function de(r,e){[...r.querySelectorAll("[l10n]")].forEach(t=>{let i=t.getAttribute("l10n"),s="textContent";if(i.includes(":")){let n=i.split(":");s=n[0],i=n[1]}let o="l10n:"+i;e.__l10nKeys.push(o),e.add(o,i),e.sub(o,n=>{t[s]=e.l10n(n)}),t.removeAttribute("l10n")})}var x=r=>`*cfg/${r}`;var B=r=>{var e;return(e=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:e.map(t=>t.toLowerCase()).join("-")};var ue=new Set;function pe(r){ue.has(r)||(ue.add(r),console.warn(r))}var fe=(r,e)=>new Intl.PluralRules(r).select(e);var bt=({element:r,attribute:e,onSuccess:t,onTimeout:i,timeout:s=300})=>{let o=setTimeout(()=>{a.disconnect(),i()},s),n=h=>{let c=r.getAttribute(e);h.type==="attributes"&&h.attributeName===e&&c!==null&&(clearTimeout(o),a.disconnect(),t(c))},l=r.getAttribute(e);l!==null&&(clearTimeout(o),t(l));let a=new MutationObserver(h=>{let c=h[h.length-1];n(c)});a.observe(r,{attributes:!0,attributeFilter:[e]})};var Ht="lr-",b=class extends Dt{constructor(){super();m(this,"requireCtxName",!1);m(this,"allowCustomTemplate",!0);m(this,"init$",ce());m(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let i of t)i.isConnected&&i.updateCssData()});this.activityType=null,this.addTemplateProcessor(de),this.__l10nKeys=[]}l10n(t,i={}){if(!t)return"";let s=this.getCssData("--l10n-"+t,!0)||t,o=he(s);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return Ft(s,i)}pluralize(t,i){let s=this.l10n("locale-name")||"en-US",o=fe(s,i);return this.l10n(`${t}__${o}`)}applyL10nKey(t,i){let s="l10n:"+t;this.$[s]=i,this.__l10nKeys.push(t)}hasBlockInCtx(t){let i=this.$["*blocksRegistry"];for(let s of i)if(t(s))return!0;return!1}setOrAddState(t,i){this.add$({[t]:i},!0)}setActivity(t){if(this.hasBlockInCtx(i=>i.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ht}${t}`,!0),Ut()||(this._destroyInnerHeightTracker=ne()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?bt({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,i=2){let s=["B","KB","MB","GB","TB"],o=h=>this.getCssData("--l10n-unit-"+h.toLowerCase(),!0)||h;if(t===0)return`0 ${o(s[0])}`;let n=1024,l=i<0?0:i,a=Math.floor(Math.log(t)/Math.log(n));return parseFloat((t/n**a).toFixed(l))+" "+o(s[a])}proxyUrl(t){let i=this.cfg.secureDeliveryProxy;return i?Ft(i,{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(i,s,o)=>{if(typeof s!="string")return!1;let n=x(s);return this.$[n]=o,!0},get:(i,s)=>{let o=x(s),n=this.parseCfgProp(o);return n.ctx.has(n.name)?n.ctx.read(n.name):(pe("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${B(s)}`))}})}return this.__cfgProxy}subConfigValue(t,i){let s=this.parseCfgProp(x(t));s.ctx.has(s.name)?this.sub(x(t),i):(this.bindCssData(`--cfg-${B(t)}`),this.sub(`--cfg-${B(t)}`,i))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ht)?t:Ht+t)}};m(b,"StateConsumerScope",null),m(b,"className","");var me="--cfg-ctx-name",v=class extends b{get cfgCssCtxName(){return this.getCssData(me,!0)}get cfgCtxName(){var t;let e=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=e,e}connectedCallback(){var e;if(!this.connectedOnce){let t=(e=this.getAttribute("ctx-name"))==null?void 0:e.trim();t&&this.style.setProperty(me,`'${t}'`)}super.connectedCallback()}parseCfgProp(e){return{...super.parseCfgProp(e),ctx:y.getCtx(this.cfgCtxName)}}};function _e(...r){return r.reduce((e,t)=>{if(typeof t=="string")return e[t]=!0,e;for(let i of Object.keys(t))e[i]=t[i];return e},{})}function w(...r){let e=_e(...r);return Object.keys(e).reduce((t,i)=>(e[i]&&t.push(i),t),[]).join(" ")}function ge(r,...e){let t=_e(...e);for(let i of Object.keys(t))r.classList.toggle(i,t[i])}var be=r=>{if(!r)return[];let[e,t]=r.split(":").map(Number);if(!Number.isFinite(e)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:e,height:t}]};var Xt=(r,e=",")=>r.trim().split(e).map(t=>t.trim()).filter(t=>t.length>0);var A={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function _i(r,e){if(typeof e=="number")return A[r]!==e?`${r}/${e}`:"";if(typeof e=="boolean")return e&&A[r]!==e?`${r}`:"";if(r==="filter"){if(!e||A[r]===e.amount)return"";let{name:t,amount:i}=e;return`${r}/${t}/${i}`}if(r==="crop"){if(!e)return"";let{dimensions:t,coords:i}=e;return`${r}/${t.join("x")}/${i.join(",")}`}return""}var ve=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function W(r){return ft(...ve.filter(e=>typeof r[e]!="undefined"&&r[e]!==null).map(e=>{let t=r[e];return _i(e,t)}).filter(e=>!!e))}var yt=ft("format/auto","progressive/yes"),F=([r])=>typeof r!="undefined"?Number(r):void 0,ye=()=>!0,gi=([r,e])=>({name:r,amount:typeof e!="undefined"?Number(e):100}),bi=([r,e])=>({dimensions:Xt(r,"x").map(Number),coords:Xt(e).map(Number)}),yi={enhance:F,brightness:F,exposure:F,gamma:F,contrast:F,saturation:F,vibrance:F,warmth:F,filter:gi,mirror:ye,flip:ye,rotate:F,crop:bi};function we(r){let e={};for(let t of r){let[i,...s]=t.split("/");if(!ve.includes(i))continue;let o=yi[i],n=o(s);e[i]=n}return e}var Ce=r=>r?r.split(",").map(e=>e.trim()):[],vt=r=>r?r.join(","):"";var C=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),E=[C.CROP,C.TUNING,C.FILTERS],Te=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],xe=["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"],Ee=["rotate","mirror","flip"],k=Object.freeze({brightness:{zero:A.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:A.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:A.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:A.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:A.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:A.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:A.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:A.enhance,range:[0,100],keypointsNumber:1},filter:{zero:A.filter,range:[0,100],keypointsNumber:1}});var $e=r=>{if(!r)return E;let e=Ce(r).filter(t=>E.includes(t));return e.length===0?E:e};function Ae(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":E,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:P,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:vt(E),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let e=r.querySelectorAll("img");for(let t of e){let i=t.src;t.src=P,t.src=i}r.$["*networkProblems"]=!1},"*on.apply":e=>{if(!e)return;let t=r.$["*originalUrl"],i=D(W(e),"preview"),s=U(t,i),o={originalUrl:t,cdnUrlModifiers:i,cdnUrl:s,transformations:e};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var Se=`
Network error
{{fileType}}
{{msg}}
`;var K=class extends v{constructor(){super();m(this,"_debouncedShowLoader",I(this._showLoader.bind(this),300));this.init$={...this.init$,...Ae(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((i,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(i(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===C.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=qt(this.$.cdnUrl);this.$["*originalUrl"]=Lt(this.$.cdnUrl,t);let i=Yt(this.$.cdnUrl),s=we(i);this.$["*editorTransformations"]=s}else if(this.$.uuid)this.$["*originalUrl"]=Lt(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=U(this.$["*originalUrl"],D("json")),i=await fetch(t).then(n=>n.json()),{width:s,height:o}=i;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===C.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==P&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let i=this.ref["img-el"];i.src!==t&&(this._imgLoading=!0,i.src=t||P)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=be(t)}),this.sub("tabs",t=>{this.$["*tabList"]=$e(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=w("image",{image_hidden_to_cropper:t===C.CROP,image_hidden_effects:t!==C.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let i=this.$["*originalUrl"],s=D(W(t),"preview"),o=U(i,s),n={originalUrl:i,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};m(K,"className","cloud-image-editor");K.template=Se;K.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var nt=33.333333333333336,p=1,jt=24,Ie=6;function G(r,e){for(let t in e)r.setAttributeNS(null,t,e[t].toString())}function S(r,e={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return G(t,e),t}function Oe(r,e,t){let{x:i,y:s,width:o,height:n}=r,l=e.includes("w")?0:1,a=e.includes("n")?0:1,h=[-1,1][l],c=[-1,1][a],d=[i+l*o+1.5*h,s+a*n+1.5*c-24*t*c],u=[i+l*o+1.5*h,s+a*n+1.5*c],_=[i+l*o-24*t*h+1.5*h,s+a*n+1.5*c];return{d:`M ${d[0]} ${d[1]} L ${u[0]} ${u[1]} L ${_[0]} ${_[1]}`,center:u}}function Pe(r,e,t){let{x:i,y:s,width:o,height:n}=r,l=["n","s"].includes(e)?.5:{w:0,e:1}[e],a=["w","e"].includes(e)?.5:{n:0,s:1}[e],h=[-1,1][l],c=[-1,1][a],d,u;["n","s"].includes(e)?(d=[i+l*o-34*t/2,s+a*n+1.5*c],u=[i+l*o+34*t/2,s+a*n+1.5*c]):(d=[i+l*o+1.5*h,s+a*n-34*t/2],u=[i+l*o+1.5*h,s+a*n+34*t/2]);let _=`M ${d[0]} ${d[1]} L ${u[0]} ${u[1]}`,g=[u[0]-(u[0]-d[0])/2,u[1]-(u[1]-d[1])/2];return{d:_,center:g}}function ke(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 Ne({rect:r,delta:[e,t],imageBox:i}){return J({...r,x:r.x+e,y:r.y+t},i)}function J(r,e){let{x:t}=r,{y:i}=r;return r.xe.x+e.width&&(t=e.x+e.width-r.width),r.ye.y+e.height&&(i=e.y+e.height-r.height),{...r,x:t,y:i}}function vi({rect:r,delta:e,aspectRatio:t,imageBox:i}){let[,s]=e,{y:o,width:n,height:l}=r;o+=s,l-=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o<=i.y&&(o=i.y,l=r.y+r.height-o,t&&(n=l*t,a=r.x+r.width/2-n/2)),a<=i.x&&(a=i.x,o=r.y+r.height-l),a+n>=i.x+i.width&&(a=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-a,t&&(l=n/t),o=r.y+r.height-l),l=i.y+i.height&&(a=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-a,t&&(n=l*t),o=r.x+r.width-n),l=i.y+i.height&&(l=i.y+i.height-o,t&&(n=l*t),a=r.x+r.width/2-n/2),a<=i.x&&(a=i.x,o=r.y),a+n>=i.x+i.width&&(a=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-a,t&&(l=n/t),o=r.y),l=i.x+i.width&&(n=i.x+i.width-o,t&&(l=n/t),a=r.y+r.height/2-l/2),a<=i.y&&(a=i.y,o=r.x),a+l>=i.y+i.height&&(a=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-a,t&&(n=l*t),o=r.x),lt?(o=a/t-h,h+=o,l-=o,l<=i.y&&(h=h-(i.y-l),a=h*t,n=r.x+r.width-a,l=i.y)):t&&(s=h*t-a,a=a+s,n-=s,n<=i.x&&(a=a-(i.x-n),h=a/t,n=i.x,l=r.y+r.height-h)),hi.x+i.width&&(s=i.x+i.width-n-a),l+ot?(o=a/t-h,h+=o,l-=o,l<=i.y&&(h=h-(i.y-l),a=h*t,n=r.x,l=i.y)):t&&(s=h*t-a,a+=s,n+a>=i.x+i.width&&(a=i.x+i.width-n,h=a/t,n=i.x+i.width-a,l=r.y+r.height-h)),hi.y+i.height&&(o=i.y+i.height-l-h),n+=s,a-=s,h+=o,t&&Math.abs(a/h)>t?(o=a/t-h,h+=o,l+h>=i.y+i.height&&(h=i.y+i.height-l,a=h*t,n=r.x+r.width-a,l=i.y+i.height-h)):t&&(s=h*t-a,a+=s,n-=s,n<=i.x&&(a=a-(i.x-n),h=a/t,n=i.x,l=r.y)),hi.x+i.width&&(s=i.x+i.width-n-a),l+h+o>i.y+i.height&&(o=i.y+i.height-l-h),a+=s,h+=o,t&&Math.abs(a/h)>t?(o=a/t-h,h+=o,l+h>=i.y+i.height&&(h=i.y+i.height-l,a=h*t,n=r.x,l=i.y+i.height-h)):t&&(s=h*t-a,a+=s,n+a>=i.x+i.width&&(a=i.x+i.width-n,h=a/t,n=i.x+i.width-a,l=r.y)),h=e.x&&r.y>=e.y&&r.x+r.width<=e.x+e.width&&r.y+r.height<=e.y+e.height}function De(r,e){return Math.abs(r.width/r.height-e)<.1}function tt({width:r,height:e},t){let i=t/90%2!==0;return{width:i?e:r,height:i?r:e}}function et(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function V(r,e,t){return Math.min(Math.max(r,e),t)}var Ct=class extends v{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return;if(e===""&&t.height<=p&&t.width<=p)return!0;let i=t.height<=p&&(e.includes("n")||e.includes("s")),s=t.width<=p&&(e.includes("e")||e.includes("w"));return i||s}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:s,height:o}=e,n=this.ref["svg-el"],l=S("mask",{id:"backdrop-mask"}),a=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),h=S("rect",{x:t,y:i,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(h);let c=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(c),n.appendChild(l),this._backdropMask=l,this._backdropMaskInner=h}_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:s,height:o}=e;this._backdropMaskInner&&G(this._backdropMaskInner,{x:t,y:i,width:s,height:o})}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:i,pathNode:s,interactionNode:o,groupNode:n}=t,l=i==="",a=i.length===2,{x:h,y:c,width:d,height:u}=e;if(l){let g={x:h+d/3,y:c+u/3,width:d/3,height:u/3};G(o,g)}else{let g=V(Math.min(d,u)/(24*2+34)/2,0,1),{d:O,center:X}=a?Oe(e,i,g):Pe(e,i,g),M=Math.max(jt*V(Math.min(d,u)/jt/3,0,1),Ie);G(o,{x:X[0]-M,y:X[1]-M,width:M*2,height:M*2}),G(s,{d:O})}let _=this._shouldThumbBeDisabled(i);n.setAttribute("class",w("thumb",{"thumb--hidden":_,"thumb--visible":!_}))}G(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let s=`${["n","","s"][t]}${["w","","e"][i]}`,o=S("g");o.classList.add("thumb"),o.setAttribute("with-effects","");let n=S("rect",{fill:"transparent"}),l=S("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(l),o.appendChild(n),e[s]={direction:s,pathNode:l,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,s))}return e}_createGuides(){let e=S("svg"),t=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let s=S("line",{x1:`${nt*i}%`,y1:"0%",x2:`${nt*i}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});e.appendChild(s)}for(let i=1;i<=2;i++){let s=S("line",{x1:"0%",y1:`${nt*i}%`,x2:"100%",y2:`${nt*i}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});e.appendChild(s)}return e.classList.add("guides","guides--semi-hidden"),e}_createFrame(){let e=this.ref["svg-el"],t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))t.appendChild(o);e.appendChild(t),this._frameThumbs=s,this._frameGuides=i}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(this._shouldThumbBeDisabled(e))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-o,a=t.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,a],this._dragStartCrop={...s}}_handlePointerUp_(e){this._updateCursor(),this.$.dragging&&(e.stopPropagation(),e.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(e){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this.ref["svg-el"],{x:i,y:s}=t.getBoundingClientRect(),o=e.x-i,n=e.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:h}=this._draggingThumb,c=this._calcCropBox(h,[l,a]);c&&(this.$["*cropBox"]=c)}_calcCropBox(e,t){var h,c;let[i,s]=t,o=this.$["*imageBox"],n=(h=this._dragStartCrop)!=null?h:this.$["*cropBox"],l=(c=this.$["*cropPresetList"])==null?void 0:c[0],a=l?l.width/l.height:void 0;if(e===""?n=Ne({rect:n,delta:[i,s],imageBox:o}):n=Le({rect:n,delta:[i,s],direction:e,aspectRatio:a,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return J(et(n),this.$["*imageBox"])}_handleSvgPointerMove_(e){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Re(n,[e.x,e.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let e=this._hoverThumb;this.ref["svg-el"].style.cursor=e?ke(e.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(e){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",w("thumb",{"thumb--hidden":!e,"thumb--visible":e}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=p||e.width<=p,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",e=>{this._frameGuides&&this._frameGuides.setAttribute("class",w({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&e,"guides--semi-hidden":!this._guidesHidden&&!e}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};Ct.template='';var H=class extends v{constructor(){super(...arguments);m(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=w({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};H.template=`
{{title}}
`;function Ii(r){let e=r+90;return e=e>=360?0:e,e}function Oi(r,e){return r==="rotate"?Ii(e):["mirror","flip"].includes(r)?!e:null}var lt=class extends H{initCallback(){super.initCallback(),this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e)}),this.$["on.click"]=e=>{let t=this.$["*cropperEl"].getValue(this._operation),i=Oi(this._operation,t);this.$["*cropperEl"].setValue(this._operation,i)}}};var at={FILTER:"filter",COLOR_OPERATION:"color_operation"},L="original",Tt=class extends v{constructor(){super(...arguments);m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,i){this._controlType=t==="filter"?at.FILTER:at.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===L?void 0:this.$.value,filter:this._filter===L?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:i}=k[this._operation],[s,o]=t;this.$.min=s,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===at.FILTER){let l=o;if(n){let{name:a,amount:h}=n;l=a===this._filter?h:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===at.COLOR_OPERATION){let l=typeof n!="undefined"?n:i;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===at.FILTER?this._filter===L?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let i=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=i})}};Tt.template=``;function ht(r){let e=new Image;return{promise:new Promise((s,o)=>{e.src=r,e.onload=s,e.onerror=o}),image:e,cancel:()=>{e.naturalWidth===0&&(e.src=P)}}}function ct(r){let e=[];for(let o of r){let n=ht(o);e.push(n)}let t=e.map(o=>o.image);return{promise:Promise.allSettled(e.map(o=>o.promise)),images:t,cancel:()=>{e.forEach(o=>{o.cancel()})}}}var it=class extends H{constructor(){super(...arguments);m(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),i=window.devicePixelRatio,s=Math.ceil(i*t),o=i>=2?"lightest":"normal",n=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==L?{name:this._filter,amount:n}:void 0,U(this._originalUrl,D(yt,W(l),`quality/${o}`,`scale_crop/${s}x${s}/center`))}_observerCallback(t,i){if(t[0].isIntersecting){let o=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=ht(o);this._cancelPreload=a,l.catch(h=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:h})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),i.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=i=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",i=>{this._operation="filter",this._filter=i,this.$.isOriginal=i===L,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",i=>{this.$.active=i&&i===this._filter}),this.sub("isOriginal",i=>{this.$.iconSize=i?40:20}),this.sub("active",i=>{if(this.$.isOriginal)return;let s=this.ref["icon-el"];s.style.opacity=i?"1":"0";let o=this.ref["preview-el"];i?o.style.opacity="0":o.style.backgroundImage&&(o.style.opacity="1")}),this.sub("*networkProblems",i=>{if(!i){let s=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"];o.style.backgroundImage&&(o.style.backgroundImage="none",o.style.backgroundImage=`url(${s})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};it.template=`
`;var dt=class extends H{constructor(){super(...arguments);m(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:i}=k[this._operation],s=t[this._operation],o=typeof s!="undefined"?s!==i:!1;this.$.active=o})}};var Ue=(r,e)=>{let t,i,s;return(...o)=>{t?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=e&&(r(...o),s=Date.now())},Math.max(e-(Date.now()-s),0))):(r(...o),s=Date.now(),t=!0)}};function ze(r,e){let t={};for(let i of e){let s=r[i];(r.hasOwnProperty(i)||s!==void 0)&&(t[i]=s)}return t}function rt(r,e,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(e*s),3e3),n=s>=2?"lightest":"normal";return U(r,D(yt,W(t),`quality/${n}`,`stretch/off/-/resize/${o}x`))}function Pi(r){return r?[({dimensions:t,coords:i})=>[...t,...i].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:i})=>t.every(s=>s>0)&&i.every(s=>s>=0)].every(t=>t(r)):!0}var xt=class extends v{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=I(this._commit.bind(this),300),this._handleResizeThrottled=Ue(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],t=ze(e,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...t};this.$["*operations"]=i}_initCanvas(){let e=this.ref["canvas-el"],t=e.getContext("2d"),i=this.offsetWidth,s=this.offsetHeight,o=window.devicePixelRatio;e.style.width=`${i}px`,e.style.height=`${s}px`,e.width=i*o,e.height=s*o,t==null||t.scale(o,o),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,t=this.$["*padding"],i=this.$["*operations"],{rotate:s}=i,o={width:this.offsetWidth,height:this.offsetHeight},n=tt({width:e.naturalWidth,height:e.naturalHeight},s),l;if(n.width>o.width-t*2||n.height>o.height-t*2){let a=n.width/n.height,h=o.width/o.height;if(a>h){let c=o.width-t*2,d=c/a,u=0+t,_=t+(o.height-t*2)/2-d/2;l={x:u,y:_,width:c,height:d}}else{let c=o.height-t*2,d=c*a,u=t+(o.width-t*2)/2-d/2,_=0+t;l={x:u,y:_,width:d,height:c}}}else{let{width:a,height:h}=n,c=t+(o.width-t*2)/2-a/2,d=t+(o.height-t*2)/2-h/2;l={x:c,y:d,width:a,height:h}}this.$["*imageBox"]=et(l)}_alignCrop(){var d;let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,o=this.$["*editorTransformations"].crop,{width:n,x:l,y:a}=this.$["*imageBox"];if(o){let{dimensions:[u,_],coords:[g,O]}=o,{width:X}=tt(this._imageSize,s),M=n/X;e=J(et({x:l+g*M,y:a+O*M,width:u*M,height:_*M}),this.$["*imageBox"])}let h=(d=this.$["*cropPresetList"])==null?void 0:d[0],c=h?h.width/h.height:void 0;if(!Me(e,t)||c&&!De(e,c)){let u=t.width/t.height,_=t.width,g=t.height;c&&(u>c?_=Math.min(t.height*c,t.width):g=Math.min(t.width/c,t.height)),e={x:t.x+t.width/2-_/2,y:t.y+t.height/2-g/2,width:_,height:g}}this.$["*cropBox"]=J(et(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let t=this.$.image,i=this.$["*imageBox"],s=this.$["*operations"],{mirror:o,flip:n,rotate:l}=s,a=tt({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(o?-1:1,n?-1:1),e.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=w({active_from_viewer:e,active_from_editor:!e,inactive_to_editor:!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:o,height:n}=t,{width:l,height:a}=tt(this._imageSize,s),{width:h,height:c}=e,d=o/l,u=n/a;return[V(Math.round(h/d),1,l),V(Math.round(c/u),1,a)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:o,height:n,x:l,y:a}=t,{width:h,height:c}=tt(this._imageSize,s),{x:d,y:u}=e,_=o/h,g=n/c,O=this._getCropDimensions(),X={dimensions:O,coords:[V(Math.round((d-l)/_),0,h-O[0]),V(Math.round((u-a)/g),0,c-O[1])]};if(!Pi(X)){console.error("Cropper is trying to create invalid crop object",{payload:X});return}if(!(O[0]===h&&O[1]===c))return X}_commit(){if(!this.isConnected)return;let e=this.$["*operations"],{rotate:t,mirror:i,flip:s}=e,o=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:o,rotate:t,mirror:i,flip:s};this.$["*editorTransformations"]=l}setValue(e,t){console.log(`Apply cropper operation [${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=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(i){console.error("Failed to activate cropper",{error:i})}this._observer=new ResizeObserver(([i])=>{i.contentRect.width>0&&i.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){var t;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=w({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),t=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,i=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,s=Math.min(t,i),o=this.$["*cropBox"].x+this.$["*cropBox"].width/2,n=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${s}) translate(${(this.offsetWidth/2-o)/s}px, ${(this.offsetHeight/2-n)/s}px)`,this.style.transformOrigin=`${o}px ${n}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(e,t){let i=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=this.proxyUrl(rt(e,i,t)),{promise:o,cancel:n,image:l}=ht(s),a=this._handleImageLoading(s);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=n,o.then(()=>l).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(e){let t="crop",i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(t))!=null&&s.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};xt.template=``;function Bt(r,e,t){let i=Array(t);t--;for(let s=t;s>=0;s--)i[s]=Math.ceil((s*e+(t-s)*r)/t);return i}function ki(r){return r.reduce((e,t,i)=>is<=e&&e<=o);return r.map(s=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(e-i[0])/o;return i[0]===s?e>t?1:1-n:i[1]===s?e>=t?n:1:0})}function Li(r,e){return r.map((t,i)=>to-n)}var Wt=class extends v{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=I(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(t))!=null&&s.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}_imageSrc({url:e=this._url,filter:t=this._filter,operation:i,value:s}={}){let o={...this._transformations};i&&(o[i]=t?{name:t,amount:s}:s);let n=this.offsetWidth;return this.proxyUrl(rt(e,n,o))}_constructKeypoint(e,t){return{src:this._imageSrc({operation:e,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}_addKeypoint(e,t,i){let s=()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(a=>a.value===i);if(s())return;let o=this._constructKeypoint(e,i),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{once:!0}),o.image=n,n.classList.add("fader-image"),n.addEventListener("load",()=>{if(s())return;let a=this._keypoints,h=a.findIndex(d=>d.value>i),c=h{this.$["*networkProblems"]=!0},{once:!0})}set(e){e=typeof e=="string"?parseInt(e,10):e,this._update(this._operation,e),this._addKeypointDebounced(this._operation,this._filter,e)}_update(e,t){this._operation=e,this._value=t;let{zero:i}=k[e],s=this._keypoints.map(l=>l.value),o=Ni(s,t,i),n=Li(s,i);for(let[l,a]of Object.entries(this._keypoints))a.opacity=o[l],a.zIndex=n[l];this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add("fader-image","fader-image--preview"),e.style.opacity="0",e}async _initNodes(){let e=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&e.appendChild(this._previewImage);let t=document.createElement("div");e.appendChild(t);let i=this._keypoints.map(h=>h.src),{images:s,promise:o,cancel:n}=ct(i);s.forEach(h=>{let c=this._handleImageLoading(h.src);h.addEventListener("load",c),h.addEventListener("error",c)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await o,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((h,c)=>{let d=s[c];d.classList.add("fader-image"),h.image=d,this._container.appendChild(d)}),this.appendChild(e),this._flush())}setTransformations(e){if(this._transformations=e,this._previewImage){let t=this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:e,filter:t,operation:i,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let n=Fe(i,s).map(a=>this._imageSrc({url:e,filter:t,operation:i,value:a})),{cancel:l}=ct(n);this._cancelBatchPreload=l}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=w({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:!0}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=w({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:e,operation:t,value:i,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=e,this._operation=t||"initial",this._value=i,this._filter=s,this._fromViewer=o,typeof i!="number"&&!s){let l=this._imageSrc({operation:t,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Fe(t,i).map(l=>this._constructKeypoint(t,l)),this._update(t,i),this._initNodes()}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=w({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Ri=1,Et=class extends v{initCallback(){super.initCallback(),this.addEventListener("wheel",e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;Math.abs(i)>Ri?this.scrollLeft+=i:this.scrollLeft+=t})}};Et.template=" ";function Mi(r){return``}function Di(r){return`
`}var $t=class extends v{constructor(){super();m(this,"_updateInfoTooltip",I(()=>{var n,l;let t=this.$["*editorTransformations"],i=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===C.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;s=this.l10n(this.$["*currentFilter"])+" "+a}else s=this.l10n(L);else if(this.$["*tabId"]===C.TUNING&&i){o=!0;let a=(t==null?void 0:t[i])||k[i].zero;s=i+" "+a}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":L,"*currentOperation":null,"*tabId":C.CROP,showLoader:!1,filters:xe,colorOperations:Te,cropOperations:Ee,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let i=t.currentTarget.getAttribute("data-id");i&&this._activateTab(i,{fromViewer:!1})}},this._debouncedShowLoader=I(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===C.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let i=new dt;return i.operation=t,i}_createFilterControl(t){let i=new it;return i.filter=t,i}_createToggleControl(t){let i=new lt;return i.operation=t,i}_renderControlsList(t){let i=this.ref[`controls-list-${t}`],s=document.createDocumentFragment();t===C.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):t===C.FILTERS?[L,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):t===C.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);s.appendChild(n)}),[...s.children].forEach((o,n)=>{n===s.childNodes.length-1&&o.classList.add("controls-list_last-item")}),i.innerHTML="",i.appendChild(s)}_activateTab(t,{fromViewer:i}){this.$["*tabId"]=t,t===C.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let s of E){let o=s===t,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(t){let i=this.ref[`controls-list-${t}`];i&&(i.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,i=this.proxyUrl(rt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:s}=ct([i]);this._cancelPreload=()=>{s(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var s;let i=(s=t==null?void 0:t.filter)==null?void 0:s.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let i=!1;for(let[,s]of t.entries()){if(i)break;for(let[,o]of s.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let i of E){this.$[`presence.tabToggle.${i}`]=t.includes(i);let s=this.ref[`tab-toggle-${i}`];s.style.gridColumn=t.indexOf(i)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};$t.template=`
{{*operationTooltip}}
${E.map(Di).join("")}
${E.map(Mi).join("")}
`;var ut=class extends b{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return w("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",e=>{this._iconSingle=!this.$.text,this._iconHidden=!e,this.$.iconCss=this._iconCss()}),this.sub("theme",e=>{e!=="custom"&&(this.className=e)}),this.sub("text",e=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(e){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};ut.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ut.template=`
{{text}}
`;var At=class extends b{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let e=this.ref["line-el"];e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",e=>{typeof e=="boolean"&&(e?this._start():this._stop())})}_start(){this._active=!0;let{width:e}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};At.template=`
`;var St={transition:"transition",visible:"visible",hidden:"hidden"},It=class extends b{constructor(){super(),this._visible=!1,this._visibleStyle=St.visible,this._hiddenStyle=St.hidden,this._externalTransitions=!1,this.defineAccessor("styles",e=>{e&&(this._externalTransitions=!0,this._visibleStyle=e.visible,this._hiddenStyle=e.hidden)}),this.defineAccessor("visible",e=>{typeof e=="boolean"&&(this._visible=e,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",ge(this,{[St.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(St.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};It.template=" ";var Ot=class extends b{constructor(){super();m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let s=this.ref["input-el"];i?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:s}=i.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let l=document.createDocumentFragment(),a=document.createElement("div"),h=document.createElement("div");a.className="minor-step",h.className="border-step",l.appendChild(h);for(let d=0;d
`;var Ui="css-src";function Kt(r){return class extends r{constructor(){super(...arguments);m(this,"renderShadow",!0);m(this,"pauseRender",!0);m(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),bt({element:this,attribute:Ui,onSuccess:t=>{this.attachShadow({mode:"open"});let i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href=t,i.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(i)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var He=class extends Kt(b){};var Xe=class extends Kt(K){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};var pt=class extends b{constructor(){super(...arguments);m(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let i=this.getCssData(`--icon-${t}`);i&&(this.$.path=i)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};pt.template=``;pt.bindAttributes({name:"name",size:"size"});function zi(r){for(let e in r){let t=[...e].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),r[e].reg&&r[e].reg(t)}}var Fi="https://ucarecdn.com",Hi="https://upload.uploadcare.com",Xi="https://social.uploadcare.com",st={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:vt(E),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Fi,baseUrl:Hi,socialBaseUrl:Xi,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var $=r=>String(r),R=r=>Number(r),T=r=>typeof r=="boolean"?r:r==="true"||r===""?!0:r==="false"?!1:!!r,ji=r=>r==="auto"?r:T(r),Bi={pubkey:$,multiple:T,multipleMin:R,multipleMax:R,confirmUpload:T,imgOnly:T,accept:$,externalSourcesPreferredTypes:$,store:ji,cameraMirror:T,sourceList:$,maxLocalFileSizeBytes:R,thumbSize:R,showEmptyList:T,useLocalImageEditor:T,useCloudImageEditor:T,cloudImageEditorTabs:$,removeCopyright:T,cropPreset:$,modalScrollLock:T,modalBackdropStrokes:T,sourceListWrap:T,remoteTabSessionKey:$,cdnCname:$,baseUrl:$,socialBaseUrl:$,secureSignature:$,secureExpire:$,secureDeliveryProxy:$,retryThrottledRequestMaxTimes:R,multipartMinFileSize:R,multipartChunkSize:R,maxConcurrentRequests:R,multipartMaxConcurrentRequests:R,multipartMaxAttempts:R,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:T,groupOutput:T,userAgentIntegration:$},je=(r,e)=>{if(!(typeof e=="undefined"||e===null))return Bi[r](e)};var Pt=Object.keys(st),Wi=["metadata"],Ki=r=>Wi.includes(r),kt=Pt.filter(r=>!Ki(r)),Vi={...Object.fromEntries(kt.map(r=>[B(r),r])),...Object.fromEntries(kt.map(r=>[r.toLowerCase(),r]))},Gi={...Object.fromEntries(Pt.map(r=>[B(r),x(r)])),...Object.fromEntries(Pt.map(r=>[r.toLowerCase(),x(r)]))},Nt=class extends b{constructor(){super();m(this,"ctxOwner",!0);m(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(st).map(([t,i])=>[x(t),i]))}}initCallback(){super.initCallback();let t=this;for(let i of kt)this.sub(x(i),s=>{s!==st[i]&&(t[i]=s)},!1);for(let i of Pt){let s="__"+i;t[s]=t[i],Object.defineProperty(this,i,{set:o=>{if(t[s]=o,kt.includes(i)){let n=[...new Set([B(i),i.toLowerCase()])];for(let l of n)typeof o=="undefined"||o===null?this.removeAttribute(l):this.setAttribute(l,o.toString())}this.$[x(i)]!==o&&(typeof o=="undefined"||o===null?this.$[x(i)]=st[i]:this.$[x(i)]=o)},get:()=>this.$[x(i)]}),typeof t[i]!="undefined"&&t[i]!==null&&(t[i]=t[s])}}attributeChangedCallback(t,i,s){if(i===s)return;let o=Vi[t],n=je(o,s),l=n!=null?n:st[o],a=this;a[o]=l}};Nt.bindAttributes(Gi);export{Xe as CloudImageEditor,K as CloudImageEditorBlock,Nt as Config,Ct as CropFrame,lt as EditorCropButtonControl,it as EditorFilterControl,xt as EditorImageCropper,Wt as EditorImageFader,dt as EditorOperationControl,Et as EditorScroller,Tt as EditorSlider,$t as EditorToolbar,pt as Icon,At as LineLoaderUi,ut as LrBtnUi,It as PresenceToggle,Ot as SliderUi,zi as registerBlocks}; \ No newline at end of file +var Be=Object.defineProperty;var We=(r,e,t)=>e in r?Be(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(r,e,t)=>(We(r,typeof e!="symbol"?e+"":e,t),t);var Vt=r=>{if(typeof r!="string"||!r)return"";let e=r.trim();return e.startsWith("-/")?e=e.slice(2):e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,e.length-1)),e},ft=(...r)=>r.filter(e=>typeof e=="string"&&e).map(e=>Vt(e)).join("/-/"),D=(...r)=>{let e=ft(...r);return e?`-/${e}/`:""};function Gt(r){let e=new URL(r),t=e.pathname+e.search+e.hash,i=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return i>=0?o=t.slice(i):s>=0&&(o=t.slice(s+1)),o}function qt(r){let e=new URL(r),{pathname:t}=e,i=t.indexOf("/"),s=t.indexOf("/",i+1);return t.substring(i+1,s)}function Yt(r){let e=Zt(r),t=new URL(e),i=t.pathname.indexOf("/-/");return i===-1?[]:t.pathname.substring(i).split("/-/").filter(Boolean).map(o=>Vt(o))}function Zt(r){let e=new URL(r),t=Gt(r),i=Qt(t)?Jt(t).pathname:t;return e.pathname=e.pathname.replace(i,""),e.search="",e.hash="",e.toString()}function Qt(r){return r.startsWith("http")}function Jt(r){let e=new URL(r);return{pathname:e.origin+e.pathname||"",search:e.search||"",hash:e.hash||""}}var U=(r,e,t)=>{let i=new URL(Zt(r));if(t=t||Gt(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),Qt(t)){let s=Jt(t);i.pathname=i.pathname+(e||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(e||"")+(t||"");return i.toString()},Lt=(r,e)=>{let t=new URL(r);return t.pathname=e+"/",t.toString()};var P="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function I(r,e){let t,i=(...s)=>{clearTimeout(t),t=setTimeout(()=>r(...s),e)};return i.cancel=()=>{clearTimeout(t)},i}var Ke=Object.defineProperty,Ve=(r,e,t)=>e in r?Ke(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mt=(r,e,t)=>(Ve(r,typeof e!="symbol"?e+"":e,t),t);function Ge(r){let e=t=>{var i;for(let s in t)((i=t[s])==null?void 0:i.constructor)===Object&&(t[s]=e(t[s]));return{...t}};return e(r)}var y=class{constructor(r){r.constructor===Object?this.store=Ge(r):(this._storeIsProxy=!0,this.store=r),this.callbackMap=Object.create(null)}static warn(r,e){console.warn(`Symbiote Data: cannot ${r}. Prop name: `+e)}read(r){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(y.warn("read",r),null):this.store[r]}has(r){return this._storeIsProxy?this.store[r]!==void 0:this.store.hasOwnProperty(r)}add(r,e,t=!1){!t&&Object.keys(this.store).includes(r)||(this.store[r]=e,this.notify(r))}pub(r,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(r)){y.warn("publish",r);return}this.store[r]=e,this.notify(r)}multiPub(r){for(let e in r)this.pub(e,r[e])}notify(r){this.callbackMap[r]&&this.callbackMap[r].forEach(e=>{e(this.store[r])})}sub(r,e,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(y.warn("subscribe",r),null):(this.callbackMap[r]||(this.callbackMap[r]=new Set),this.callbackMap[r].add(e),t&&e(this.store[r]),{remove:()=>{this.callbackMap[r].delete(e),this.callbackMap[r].size||delete this.callbackMap[r]},callback:e})}static registerCtx(r,e=Symbol()){let t=y.globalStore.get(e);return t?console.warn('State: context UID "'+e+'" already in use'):(t=new y(r),y.globalStore.set(e,t)),t}static deleteCtx(r){y.globalStore.delete(r)}static getCtx(r,e=!0){return y.globalStore.get(r)||(e&&console.warn('State: wrong context UID - "'+r+'"'),null)}};y.globalStore=new Map;var f=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),ie="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",qe=ie.length-1,Ye=class{static generate(r="XXXXXXXXX-XXX"){let e="";for(let t=0;t{le&&t?e[0].toUpperCase()+e.slice(1):e).join("").split("_").map((e,t)=>e&&t?e.toUpperCase():e).join("")}function Qe(r,e){[...r.querySelectorAll(`[${f.REPEAT_ATTR}]`)].forEach(t=>{let i=t.getAttribute(f.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=class extends e.BaseComponent{constructor(){super(),i||(this.style.display="contents")}};let n=t.innerHTML;s.template=n,s.reg(i)}for(;t.firstChild;)t.firstChild.remove();let o=t.getAttribute(f.REPEAT_ATTR);e.sub(o,n=>{if(!n){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,h=c=>{c.forEach((u,_)=>{if(l[_])if(l[_].set$)setTimeout(()=>{l[_].set$(u)});else for(let g in u)l[_][g]=u[g];else{a||(a=new DocumentFragment);let g=new s;Object.assign(g.init$,u),a.appendChild(g)}}),a&&t.appendChild(a);let d=l.slice(c.length,l.length);for(let u of d)u.remove()};if(n.constructor===Array)h(n);else if(n.constructor===Object){let c=[];for(let d in n){let u=n[d];Object.defineProperty(u,"_KEY_",{value:d,enumerable:!0}),c.push(u)}h(c)}else console.warn("Symbiote repeat data type error:"),console.log(n)}),t.removeAttribute(f.REPEAT_ATTR),t.removeAttribute(f.REPEAT_ITEM_TAG_ATTR)})}var te="__default__";function Je(r,e){if(e.shadowRoot)return;let t=[...r.querySelectorAll("slot")];if(!t.length)return;let i={};t.forEach(s=>{let o=s.getAttribute("name")||te;i[o]={slot:s,fr:document.createDocumentFragment()}}),e.initChildren.forEach(s=>{var o;let n=te;s instanceof Element&&s.hasAttribute("slot")&&(n=s.getAttribute("slot"),s.removeAttribute("slot")),(o=i[n])==null||o.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}function ti(r,e){[...r.querySelectorAll(`[${f.EL_REF_ATTR}]`)].forEach(t=>{let i=t.getAttribute(f.EL_REF_ATTR);e.ref[i]=t,t.removeAttribute(f.EL_REF_ATTR)})}function ei(r,e){[...r.querySelectorAll(`[${f.BIND_ATTR}]`)].forEach(t=>{let s=t.getAttribute(f.BIND_ATTR).split(";");[...t.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let n=Ze(o.name.replace("-",""));s.push(n+":"+o.value),t.removeAttribute(o.name)}}),s.forEach(o=>{if(!o)return;let n=o.split(":").map(c=>c.trim()),l=n[0],a;l.indexOf(f.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(f.ATTR_BIND_PRFX,""));let h=n[1].split(",").map(c=>c.trim());for(let c of h){let d;c.startsWith("!!")?(d="double",c=c.replace("!!","")):c.startsWith("!")&&(d="single",c=c.replace("!","")),e.sub(c,u=>{d==="double"?u=!!u:d==="single"&&(u=!u),a?(u==null?void 0:u.constructor)===Boolean?u?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,u):re(t,l,u)||(t[f.SET_LATER_KEY]||(t[f.SET_LATER_KEY]=Object.create(null)),t[f.SET_LATER_KEY][l]=u)})}}),t.removeAttribute(f.BIND_ATTR)})}var mt="{{",ot="}}",ii="skip-text";function ri(r){let e,t=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(ii))&&s.textContent.includes(mt)&&s.textContent.includes(ot)&&1}});for(;e=i.nextNode();)t.push(e);return t}var si=function(r,e){ri(r).forEach(i=>{let s=[],o;for(;i.textContent.includes(ot);)i.textContent.startsWith(mt)?(o=i.textContent.indexOf(ot)+ot.length,i.splitText(o),s.push(i)):(o=i.textContent.indexOf(mt),i.splitText(o)),i=i.nextSibling;s.forEach(n=>{let l=n.textContent.replace(mt,"").replace(ot,"");n.textContent="",e.sub(l,a=>{n.textContent=a})})})},oi=[Qe,Je,ti,ei,si],_t="'",Q='"',ni=/\\([0-9a-fA-F]{1,6} ?)/g;function li(r){return(r[0]===Q||r[0]===_t)&&(r[r.length-1]===Q||r[r.length-1]===_t)}function ai(r){return(r[0]===Q||r[0]===_t)&&(r=r.slice(1)),(r[r.length-1]===Q||r[r.length-1]===_t)&&(r=r.slice(0,-1)),r}function hi(r){let e="",t="";for(var i=0;iString.fromCodePoint(parseInt(i.trim(),16))),e=e.replaceAll(`\\ +`,"\\n"),e=hi(e),e=Q+e+Q);try{return JSON.parse(e)}catch{throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${r}`)}}var ee=0,Z=null,z=null,j=class extends HTMLElement{constructor(){super(),Mt(this,"updateCssData",()=>{var r;this.dropCssDataCache(),(r=this.__boundCssProps)==null||r.forEach(e=>{let t=this.getCssData(this.__extractCssName(e),!0);t!==null&&this.$[e]!==t&&(this.$[e]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return j}initCallback(){}__initCallback(){var r;this.__initialized||(this.__initialized=!0,(r=this.initCallback)==null||r.call(this))}render(r,e=this.renderShadow){let t;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(f.USE_TPL);if(s){let o=this.getRootNode(),n=(o==null?void 0:o.querySelector(s))||document.querySelector(s);n?r=n.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(r||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(r==null?void 0:r.constructor)===DocumentFragment)t=r;else if((r==null?void 0:r.constructor)===String){let s=document.createElement("template");s.innerHTML=r,t=s.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(t,this)}let i=()=>{t&&(e&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){e=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=i,this.shadowRoot.prepend(s)}else i()}addTemplateProcessor(r){this.tplProcessors.add(r)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Ye.generate(),this.style.setProperty(f.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(f.CSS_CTX_PROP,!0)}get ctxName(){var r;let e=((r=this.getAttribute(f.CTX_NAME_ATTR))==null?void 0:r.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}get localCtx(){return this.__localCtx||(this.__localCtx=y.registerCtx({},this)),this.__localCtx}get nodeCtx(){return y.getCtx(this.ctxName,!1)||y.registerCtx({},this.ctxName)}static __parseProp(r,e){let t,i;if(r.startsWith(f.EXT_DATA_CTX_PRFX))t=e.nodeCtx,i=r.replace(f.EXT_DATA_CTX_PRFX,"");else if(r.includes(f.NAMED_DATA_CTX_SPLTR)){let s=r.split(f.NAMED_DATA_CTX_SPLTR);t=y.getCtx(s[0]),i=s[1]}else t=e.localCtx,i=r;return{ctx:t,name:i}}sub(r,e,t=!0){let i=o=>{this.isConnected&&e(o)},s=j.__parseProp(r,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,i,t)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,i,t))})}notify(r){let e=j.__parseProp(r,this);e.ctx.notify(e.name)}has(r){let e=j.__parseProp(r,this);return e.ctx.has(e.name)}add(r,e,t=!1){let i=j.__parseProp(r,this);i.ctx.add(i.name,e,t)}add$(r,e=!1){for(let t in r)this.add(t,r[t],e)}get $(){if(!this.__stateProxy){let r=Object.create(null);this.__stateProxy=new Proxy(r,{set:(e,t,i)=>{let s=j.__parseProp(t,this);return s.ctx.pub(s.name,i),!0},get:(e,t)=>{let i=j.__parseProp(t,this);return i.ctx.read(i.name)}})}return this.__stateProxy}set$(r,e=!1){for(let t in r){let i=r[t];e||![String,Number,Boolean].includes(i==null?void 0:i.constructor)?this.$[t]=i:this.$[t]!==i&&(this.$[t]=i)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(f.CTX_OWNER_ATTR)&&this.getAttribute(f.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let r=this.constructor.__attrDesc;if(r)for(let e of Object.values(r))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(f.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(f.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(f.NAMED_DATA_CTX_SPLTR)){let t=e.split(f.NAMED_DATA_CTX_SPLTR),i=t[0].trim(),s=t[1].trim();if(i&&s){let o=y.getCtx(i,!1);o||(o=y.registerCtx({},i)),o.add(s,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var r;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(r=this.getAttribute(f.CTX_NAME_ATTR))==null?void 0:r.trim();if(e&&this.style.setProperty(f.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[f.SET_LATER_KEY]){for(let t in this[f.SET_LATER_KEY])re(this,t,this[f.SET_LATER_KEY][t]);delete this[f.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of oi)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${f.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(f.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(s):t.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let r of this.allSubs)r.remove(),this.allSubs.delete(r);for(let r of this.tplProcessors)this.tplProcessors.delete(r);z==null||z.delete(this.updateCssData),z!=null&&z.size||(Z==null||Z.disconnect(),Z=null,z=null)},100)))}static reg(r,e=!1){r||(ee++,r=`${f.AUTO_TAG_PRFX}-${ee}`),this.__tag=r;let t=window.customElements.get(r);if(t){!e&&t!==this&&console.warn([`Element with tag name "${r}" 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(r,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(r){this.observedAttributes=Object.keys(r),this.__attrDesc=r}attributeChangedCallback(r,e,t){var i;if(e===t)return;let s=(i=this.constructor.__attrDesc)==null?void 0:i[r];s?this.__dataCtxInitialized?this.$[s]=t:this.init$[s]=t:this[r]=t}getCssData(r,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(r)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(r).trim();try{this.__cssDataCache[r]=ci(t)}catch{!e&&console.warn(`CSS Data error: ${r}`),this.__cssDataCache[r]=null}}return this.__cssDataCache[r]}__extractCssName(r){return r.split("--").map((e,t)=>t===0?"":e).join("--")}__initStyleAttrObserver(){z||(z=new Set),z.add(this.updateCssData),Z||(Z=new MutationObserver(r=>{r[0].type==="attributes"&&z.forEach(e=>{e()})}),Z.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(r,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(r);let t=this.getCssData(this.__extractCssName(r),!0);t===null&&(t=e),this.add(r,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(r,e,t){let i="__"+r;this[i]=this[r],Object.defineProperty(this,r,{set:s=>{this[i]=s,t?window.setTimeout(()=>{e==null||e(s)}):e==null||e(s)},get:()=>this[i]}),this[r]=this[i]}static set shadowStyles(r){let e=new Blob([r],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(r){if(!this.__rootStylesLink){let e=new Blob([r],{type:"text/css"}),t=URL.createObjectURL(e),i=document.createElement("link");i.href=t,i.rel="stylesheet",this.__rootStylesLink=i}}},Dt=j;Mt(Dt,"template");var Rt=class{static _print(r){console.warn(r)}static setDefaultTitle(r){this.defaultTitle=r}static setRoutingMap(r){Object.assign(this.appMap,r);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(r){this.__routingEventName=r}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let r={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))r.route=t.replace("?","");else if(t.includes("=")){let i=t.split("=");r.options[i[0]]=decodeURI(i[1])}else r.options[t]=!0}),r}static notify(){let r=this.readAddressBar(),e=this.appMap[r.route];if(e&&e.title&&(document.title=e.title),r.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${r.route}" not found...`);return}let t=new CustomEvent(Rt.routingEventName,{detail:{route:r.route,options:Object.assign(e||{},r.options)}});window.dispatchEvent(t)}static reflect(r,e={}){let t=this.appMap[r];if(!t){this._print("Wrong route: "+r);return}let i="?"+r;for(let o in e)e[o]===!0?i+=this.separator+o:i+=this.separator+o+`=${e[o]}`;let s=t.title||this.defaultTitle||"";window.history.pushState(null,s,i),document.title=s}static applyRoute(r,e={}){this.reflect(r,e),this.notify()}static setSeparator(r){this._separator=r}static get separator(){return this._separator||"&"}static createRouterData(r,e){this.setRoutingMap(e);let t=y.registerCtx({route:null,options:null,title:null},r);return window.addEventListener(this.routingEventName,i=>{var s;t.multiPub({route:i.detail.route,options:i.detail.options,title:((s=i.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),Rt.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};Rt.appMap=Object.create(null);var se="idb-store-ready",di="symbiote-db",ui="symbiote-idb-update_",pi=class{_notifyWhenReady(r=null){window.dispatchEvent(new CustomEvent(se,{detail:{dbName:this.name,storeName:this.storeName,event:r}}))}get _updEventName(){return ui+this.name}_getUpdateEvent(r){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:r}})}_notifySubscribers(r){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,r),window.dispatchEvent(this._getUpdateEvent(r))}constructor(r,e){this.name=r,this.storeName=e,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(e,{keyPath:"_key"}),this.objStore.transaction.oncomplete=i=>{this._notifyWhenReady(i)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async s=>{s(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(r){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(r);return new Promise((i,s)=>{t.onsuccess=o=>{var n;(n=o.target.result)!=null&&n._value?i(o.target.result._value):(i(null),console.warn(`IDB: cannot read "${r}"`))},t.onerror=o=>{s(o)}})}write(r,e,t=!1){let i={_key:r,_value:e},o=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(i);return new Promise((n,l)=>{o.onsuccess=a=>{t||this._notifySubscribers(r),n(a.target.result)},o.onerror=a=>{l(a)}})}delete(r,e=!1){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(r);return new Promise((s,o)=>{i.onsuccess=n=>{e||this._notifySubscribers(r),s(n)},i.onerror=n=>{o(n)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,i)=>{e.onsuccess=s=>{let o=s.target.result;t(o.map(n=>n._value))},e.onerror=s=>{i(s)}})}subscribe(r,e){this._subscriptionsMap[r]||(this._subscriptionsMap[r]=new Set);let t=this._subscriptionsMap[r];return t.add(e),{remove:()=>{t.delete(e),t.size||delete this._subscriptionsMap[r]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,oe.clear(this.name)}},oe=class{static get readyEventName(){return se}static open(r=di,e="store"){let t=r+"/"+e;return this._reg[t]||(this._reg[t]=new pi(r,e)),this._reg[t]}static clear(r){window.indexedDB.deleteDatabase(r);for(let e in this._reg)e.split("/")[0]===r&&delete this._reg[e]}};Mt(oe,"_reg",Object.create(null));var fi="--uploadcare-blocks-window-height",gt="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Ut(){return typeof window[gt]=="undefined"?!1:!!window[gt]}function ne(){if(Ut())return;let r=()=>{document.documentElement.style.setProperty(fi,`${window.innerHeight}px`),window[gt]=!0},e=I(r,100);return window.addEventListener("resize",e,{passive:!0}),r(),()=>{window[gt]=!1,window.removeEventListener("resize",e)}}var mi=r=>r,zt="{{",ae="}}",le="plural:";function Ft(r,e,t={}){var n;let{openToken:i=zt,closeToken:s=ae,transform:o=mi}=t;for(let l in e){let a=(n=e[l])==null?void 0:n.toString();r=r.replaceAll(i+l+s,typeof a=="string"?o(a):a)}return r}function he(r){let e=[],t=r.indexOf(zt);for(;t!==-1;){let i=r.indexOf(ae,t),s=r.substring(t+2,i);if(s.startsWith(le)){let o=r.substring(t+2,i).replace(le,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));e.push({variable:s,pluralKey:n,countVariable:l})}t=r.indexOf(zt,i)}return e}var ce=()=>({"*blocksRegistry":new Set});function de(r,e){[...r.querySelectorAll("[l10n]")].forEach(t=>{let i=t.getAttribute("l10n"),s="textContent";if(i.includes(":")){let n=i.split(":");s=n[0],i=n[1]}let o="l10n:"+i;e.__l10nKeys.push(o),e.add(o,i),e.sub(o,n=>{t[s]=e.l10n(n)}),t.removeAttribute("l10n")})}var x=r=>`*cfg/${r}`;var B=r=>{var e;return(e=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:e.map(t=>t.toLowerCase()).join("-")};var ue=new Set;function pe(r){ue.has(r)||(ue.add(r),console.warn(r))}var fe=(r,e)=>new Intl.PluralRules(r).select(e);var bt=({element:r,attribute:e,onSuccess:t,onTimeout:i,timeout:s=300})=>{let o=setTimeout(()=>{a.disconnect(),i()},s),n=h=>{let c=r.getAttribute(e);h.type==="attributes"&&h.attributeName===e&&c!==null&&(clearTimeout(o),a.disconnect(),t(c))},l=r.getAttribute(e);l!==null&&(clearTimeout(o),t(l));let a=new MutationObserver(h=>{let c=h[h.length-1];n(c)});a.observe(r,{attributes:!0,attributeFilter:[e]})};var Ht="lr-",b=class extends Dt{constructor(){super();m(this,"requireCtxName",!1);m(this,"allowCustomTemplate",!0);m(this,"init$",ce());m(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let i of t)i.isConnected&&i.updateCssData()});this.activityType=null,this.addTemplateProcessor(de),this.__l10nKeys=[]}l10n(t,i={}){if(!t)return"";let s=this.getCssData("--l10n-"+t,!0)||t,o=he(s);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return Ft(s,i)}pluralize(t,i){let s=this.l10n("locale-name")||"en-US",o=fe(s,i);return this.l10n(`${t}__${o}`)}applyL10nKey(t,i){let s="l10n:"+t;this.$[s]=i,this.__l10nKeys.push(t)}hasBlockInCtx(t){let i=this.$["*blocksRegistry"];for(let s of i)if(t(s))return!0;return!1}setOrAddState(t,i){this.add$({[t]:i},!0)}setActivity(t){if(this.hasBlockInCtx(i=>i.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ht}${t}`,!0),Ut()||(this._destroyInnerHeightTracker=ne()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?bt({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,i=2){let s=["B","KB","MB","GB","TB"],o=h=>this.getCssData("--l10n-unit-"+h.toLowerCase(),!0)||h;if(t===0)return`0 ${o(s[0])}`;let n=1024,l=i<0?0:i,a=Math.floor(Math.log(t)/Math.log(n));return parseFloat((t/n**a).toFixed(l))+" "+o(s[a])}proxyUrl(t){let i=this.cfg.secureDeliveryProxy;return i?Ft(i,{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(i,s,o)=>{if(typeof s!="string")return!1;let n=x(s);return this.$[n]=o,!0},get:(i,s)=>{let o=x(s),n=this.parseCfgProp(o);return n.ctx.has(n.name)?n.ctx.read(n.name):(pe("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${B(s)}`))}})}return this.__cfgProxy}subConfigValue(t,i){let s=this.parseCfgProp(x(t));s.ctx.has(s.name)?this.sub(x(t),i):(this.bindCssData(`--cfg-${B(t)}`),this.sub(`--cfg-${B(t)}`,i))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ht)?t:Ht+t)}};m(b,"StateConsumerScope",null),m(b,"className","");var me="--cfg-ctx-name",v=class extends b{get cfgCssCtxName(){return this.getCssData(me,!0)}get cfgCtxName(){var t;let e=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=e,e}connectedCallback(){var e;if(!this.connectedOnce){let t=(e=this.getAttribute("ctx-name"))==null?void 0:e.trim();t&&this.style.setProperty(me,`'${t}'`)}super.connectedCallback()}parseCfgProp(e){return{...super.parseCfgProp(e),ctx:y.getCtx(this.cfgCtxName)}}};function _e(...r){return r.reduce((e,t)=>{if(typeof t=="string")return e[t]=!0,e;for(let i of Object.keys(t))e[i]=t[i];return e},{})}function w(...r){let e=_e(...r);return Object.keys(e).reduce((t,i)=>(e[i]&&t.push(i),t),[]).join(" ")}function ge(r,...e){let t=_e(...e);for(let i of Object.keys(t))r.classList.toggle(i,t[i])}var be=r=>{if(!r)return[];let[e,t]=r.split(":").map(Number);if(!Number.isFinite(e)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:e,height:t}]};var Xt=(r,e=",")=>r.trim().split(e).map(t=>t.trim()).filter(t=>t.length>0);var A={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function _i(r,e){if(typeof e=="number")return A[r]!==e?`${r}/${e}`:"";if(typeof e=="boolean")return e&&A[r]!==e?`${r}`:"";if(r==="filter"){if(!e||A[r]===e.amount)return"";let{name:t,amount:i}=e;return`${r}/${t}/${i}`}if(r==="crop"){if(!e)return"";let{dimensions:t,coords:i}=e;return`${r}/${t.join("x")}/${i.join(",")}`}return""}var ve=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function W(r){return ft(...ve.filter(e=>typeof r[e]!="undefined"&&r[e]!==null).map(e=>{let t=r[e];return _i(e,t)}).filter(e=>!!e))}var yt=ft("format/auto","progressive/yes"),F=([r])=>typeof r!="undefined"?Number(r):void 0,ye=()=>!0,gi=([r,e])=>({name:r,amount:typeof e!="undefined"?Number(e):100}),bi=([r,e])=>({dimensions:Xt(r,"x").map(Number),coords:Xt(e).map(Number)}),yi={enhance:F,brightness:F,exposure:F,gamma:F,contrast:F,saturation:F,vibrance:F,warmth:F,filter:gi,mirror:ye,flip:ye,rotate:F,crop:bi};function we(r){let e={};for(let t of r){let[i,...s]=t.split("/");if(!ve.includes(i))continue;let o=yi[i],n=o(s);e[i]=n}return e}var Ce=r=>r?r.split(",").map(e=>e.trim()):[],vt=r=>r?r.join(","):"";var C=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),E=[C.CROP,C.TUNING,C.FILTERS],Te=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],xe=["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"],Ee=["rotate","mirror","flip"],k=Object.freeze({brightness:{zero:A.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:A.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:A.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:A.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:A.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:A.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:A.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:A.enhance,range:[0,100],keypointsNumber:1},filter:{zero:A.filter,range:[0,100],keypointsNumber:1}});var $e=r=>{if(!r)return E;let e=Ce(r).filter(t=>E.includes(t));return e.length===0?E:e};function Ae(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":E,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:P,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:vt(E),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let e=r.querySelectorAll("img");for(let t of e){let i=t.src;t.src=P,t.src=i}r.$["*networkProblems"]=!1},"*on.apply":e=>{if(!e)return;let t=r.$["*originalUrl"],i=D(W(e),"preview"),s=U(t,i),o={originalUrl:t,cdnUrlModifiers:i,cdnUrl:s,transformations:e};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var Se=`
Network error
{{fileType}}
{{msg}}
`;var K=class extends v{constructor(){super();m(this,"_debouncedShowLoader",I(this._showLoader.bind(this),300));this.init$={...this.init$,...Ae(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((i,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(i(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===C.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=qt(this.$.cdnUrl);this.$["*originalUrl"]=Lt(this.$.cdnUrl,t);let i=Yt(this.$.cdnUrl),s=we(i);this.$["*editorTransformations"]=s}else if(this.$.uuid)this.$["*originalUrl"]=Lt(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=U(this.$["*originalUrl"],D("json")),i=await fetch(t).then(n=>n.json()),{width:s,height:o}=i;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===C.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==P&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let i=this.ref["img-el"];i.src!==t&&(this._imgLoading=!0,i.src=t||P)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=be(t)}),this.sub("tabs",t=>{this.$["*tabList"]=$e(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=w("image",{image_hidden_to_cropper:t===C.CROP,image_hidden_effects:t!==C.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let i=this.$["*originalUrl"],s=D(W(t),"preview"),o=U(i,s),n={originalUrl:i,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};m(K,"className","cloud-image-editor");K.template=Se;K.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var nt=33.333333333333336,p=1,jt=24,Ie=6;function q(r,e){for(let t in e)r.setAttributeNS(null,t,e[t].toString())}function S(r,e={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return q(t,e),t}function Oe(r,e,t){let{x:i,y:s,width:o,height:n}=r,l=e.includes("w")?0:1,a=e.includes("n")?0:1,h=[-1,1][l],c=[-1,1][a],d=[i+l*o+1.5*h,s+a*n+1.5*c-24*t*c],u=[i+l*o+1.5*h,s+a*n+1.5*c],_=[i+l*o-24*t*h+1.5*h,s+a*n+1.5*c];return{d:`M ${d[0]} ${d[1]} L ${u[0]} ${u[1]} L ${_[0]} ${_[1]}`,center:u}}function Pe(r,e,t){let{x:i,y:s,width:o,height:n}=r,l=["n","s"].includes(e)?.5:{w:0,e:1}[e],a=["w","e"].includes(e)?.5:{n:0,s:1}[e],h=[-1,1][l],c=[-1,1][a],d,u;["n","s"].includes(e)?(d=[i+l*o-34*t/2,s+a*n+1.5*c],u=[i+l*o+34*t/2,s+a*n+1.5*c]):(d=[i+l*o+1.5*h,s+a*n-34*t/2],u=[i+l*o+1.5*h,s+a*n+34*t/2]);let _=`M ${d[0]} ${d[1]} L ${u[0]} ${u[1]}`,g=[u[0]-(u[0]-d[0])/2,u[1]-(u[1]-d[1])/2];return{d:_,center:g}}function ke(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 Ne({rect:r,delta:[e,t],imageBox:i}){return tt({...r,x:r.x+e,y:r.y+t},i)}function tt(r,e){let{x:t}=r,{y:i}=r;return r.xe.x+e.width&&(t=e.x+e.width-r.width),r.ye.y+e.height&&(i=e.y+e.height-r.height),{...r,x:t,y:i}}function vi({rect:r,delta:e,aspectRatio:t,imageBox:i}){let[,s]=e,{y:o,width:n,height:l}=r;o+=s,l-=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o<=i.y&&(o=i.y,l=r.y+r.height-o,t&&(n=l*t,a=r.x+r.width/2-n/2)),a<=i.x&&(a=i.x,o=r.y+r.height-l),a+n>=i.x+i.width&&(a=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-a,t&&(l=n/t),o=r.y+r.height-l),l=i.y+i.height&&(a=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-a,t&&(n=l*t),o=r.x+r.width-n),l=i.y+i.height&&(l=i.y+i.height-o,t&&(n=l*t),a=r.x+r.width/2-n/2),a<=i.x&&(a=i.x,o=r.y),a+n>=i.x+i.width&&(a=Math.max(i.x,i.x+i.width-n),n=i.x+i.width-a,t&&(l=n/t),o=r.y),l=i.x+i.width&&(n=i.x+i.width-o,t&&(l=n/t),a=r.y+r.height/2-l/2),a<=i.y&&(a=i.y,o=r.x),a+l>=i.y+i.height&&(a=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-a,t&&(n=l*t),o=r.x),lt?(o=a/t-h,h+=o,l-=o,l<=i.y&&(h=h-(i.y-l),a=h*t,n=r.x+r.width-a,l=i.y)):t&&(s=h*t-a,a=a+s,n-=s,n<=i.x&&(a=a-(i.x-n),h=a/t,n=i.x,l=r.y+r.height-h)),hi.x+i.width&&(s=i.x+i.width-n-a),l+ot?(o=a/t-h,h+=o,l-=o,l<=i.y&&(h=h-(i.y-l),a=h*t,n=r.x,l=i.y)):t&&(s=h*t-a,a+=s,n+a>=i.x+i.width&&(a=i.x+i.width-n,h=a/t,n=i.x+i.width-a,l=r.y+r.height-h)),hi.y+i.height&&(o=i.y+i.height-l-h),n+=s,a-=s,h+=o,t&&Math.abs(a/h)>t?(o=a/t-h,h+=o,l+h>=i.y+i.height&&(h=i.y+i.height-l,a=h*t,n=r.x+r.width-a,l=i.y+i.height-h)):t&&(s=h*t-a,a+=s,n-=s,n<=i.x&&(a=a-(i.x-n),h=a/t,n=i.x,l=r.y)),hi.x+i.width&&(s=i.x+i.width-n-a),l+h+o>i.y+i.height&&(o=i.y+i.height-l-h),a+=s,h+=o,t&&Math.abs(a/h)>t?(o=a/t-h,h+=o,l+h>=i.y+i.height&&(h=i.y+i.height-l,a=h*t,n=r.x,l=i.y+i.height-h)):t&&(s=h*t-a,a+=s,n+a>=i.x+i.width&&(a=i.x+i.width-n,h=a/t,n=i.x+i.width-a,l=r.y)),h=e.x&&r.y>=e.y&&r.x+r.width<=e.x+e.width&&r.y+r.height<=e.y+e.height}function De(r,e){return Math.abs(r.width/r.height-e)<.1}function et({width:r,height:e},t){let i=t/90%2!==0;return{width:i?e:r,height:i?r:e}}function it(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function V(r,e,t){return Math.min(Math.max(r,e),t)}var Ct=class extends v{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return;if(e===""&&t.height<=p&&t.width<=p)return!0;let i=t.height<=p&&(e.includes("n")||e.includes("s")),s=t.width<=p&&(e.includes("e")||e.includes("w"));return i||s}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:s,height:o}=e,n=this.ref["svg-el"],l=S("mask",{id:"backdrop-mask"}),a=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),h=S("rect",{x:t,y:i,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(h);let c=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(c),n.appendChild(l),this._backdropMask=l,this._backdropMaskInner=h}_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:s,height:o}=e;this._backdropMaskInner&&q(this._backdropMaskInner,{x:t,y:i,width:s,height:o})}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:i,pathNode:s,interactionNode:o,groupNode:n}=t,l=i==="",a=i.length===2,{x:h,y:c,width:d,height:u}=e;if(l){let g={x:h+d/3,y:c+u/3,width:d/3,height:u/3};q(o,g)}else{let g=V(Math.min(d,u)/(24*2+34)/2,0,1),{d:O,center:X}=a?Oe(e,i,g):Pe(e,i,g),M=Math.max(jt*V(Math.min(d,u)/jt/3,0,1),Ie);q(o,{x:X[0]-M,y:X[1]-M,width:M*2,height:M*2}),q(s,{d:O})}let _=this._shouldThumbBeDisabled(i);n.setAttribute("class",w("thumb",{"thumb--hidden":_,"thumb--visible":!_}))}q(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let s=`${["n","","s"][t]}${["w","","e"][i]}`,o=S("g");o.classList.add("thumb"),o.setAttribute("with-effects","");let n=S("rect",{fill:"transparent"}),l=S("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(l),o.appendChild(n),e[s]={direction:s,pathNode:l,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,s))}return e}_createGuides(){let e=S("svg"),t=S("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let s=S("line",{x1:`${nt*i}%`,y1:"0%",x2:`${nt*i}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});e.appendChild(s)}for(let i=1;i<=2;i++){let s=S("line",{x1:"0%",y1:`${nt*i}%`,x2:"100%",y2:`${nt*i}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});e.appendChild(s)}return e.classList.add("guides","guides--semi-hidden"),e}_createFrame(){let e=this.ref["svg-el"],t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))t.appendChild(o);e.appendChild(t),this._frameThumbs=s,this._frameGuides=i}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(this._shouldThumbBeDisabled(e))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-o,a=t.y-n;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,a],this._dragStartCrop={...s}}_handlePointerUp_(e){this._updateCursor(),this.$.dragging&&(e.stopPropagation(),e.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(e){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this.ref["svg-el"],{x:i,y:s}=t.getBoundingClientRect(),o=e.x-i,n=e.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:h}=this._draggingThumb,c=this._calcCropBox(h,[l,a]);c&&(this.$["*cropBox"]=c)}_calcCropBox(e,t){var h,c;let[i,s]=t,o=this.$["*imageBox"],n=(h=this._dragStartCrop)!=null?h:this.$["*cropBox"],l=(c=this.$["*cropPresetList"])==null?void 0:c[0],a=l?l.width/l.height:void 0;if(e===""?n=Ne({rect:n,delta:[i,s],imageBox:o}):n=Le({rect:n,delta:[i,s],direction:e,aspectRatio:a,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return tt(it(n),this.$["*imageBox"])}_handleSvgPointerMove_(e){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Re(n,[e.x,e.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let e=this._hoverThumb;this.ref["svg-el"].style.cursor=e?ke(e.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(e){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",w("thumb",{"thumb--hidden":!e,"thumb--visible":e}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=p||e.width<=p,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",e=>{this._frameGuides&&this._frameGuides.setAttribute("class",w({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&e,"guides--semi-hidden":!this._guidesHidden&&!e}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};Ct.template='';var H=class extends v{constructor(){super(...arguments);m(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=w({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};H.template=`
{{title}}
`;function Ii(r){let e=r+90;return e=e>=360?0:e,e}function Oi(r,e){return r==="rotate"?Ii(e):["mirror","flip"].includes(r)?!e:null}var lt=class extends H{initCallback(){super.initCallback(),this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e)}),this.$["on.click"]=e=>{let t=this.$["*cropperEl"].getValue(this._operation),i=Oi(this._operation,t);this.$["*cropperEl"].setValue(this._operation,i)}}};var at={FILTER:"filter",COLOR_OPERATION:"color_operation"},L="original",Tt=class extends v{constructor(){super(...arguments);m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,i){this._controlType=t==="filter"?at.FILTER:at.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===L?void 0:this.$.value,filter:this._filter===L?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:i}=k[this._operation],[s,o]=t;this.$.min=s,this.$.max=o,this.$.zero=i;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===at.FILTER){let l=o;if(n){let{name:a,amount:h}=n;l=a===this._filter?h:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===at.COLOR_OPERATION){let l=typeof n!="undefined"?n:i;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===at.FILTER?this._filter===L?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let i=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=i})}};Tt.template=``;function ht(r){let e=new Image;return{promise:new Promise((s,o)=>{e.src=r,e.onload=s,e.onerror=o}),image:e,cancel:()=>{e.naturalWidth===0&&(e.src=P)}}}function ct(r){let e=[];for(let o of r){let n=ht(o);e.push(n)}let t=e.map(o=>o.image);return{promise:Promise.allSettled(e.map(o=>o.promise)),images:t,cancel:()=>{e.forEach(o=>{o.cancel()})}}}var rt=class extends H{constructor(){super(...arguments);m(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),i=window.devicePixelRatio,s=Math.ceil(i*t),o=i>=2?"lightest":"normal",n=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==L?{name:this._filter,amount:n}:void 0,U(this._originalUrl,D(yt,W(l),`quality/${o}`,`scale_crop/${s}x${s}/center`))}_observerCallback(t,i){if(t[0].isIntersecting){let o=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=ht(o);this._cancelPreload=a,l.catch(h=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:h})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),i.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=i=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",i=>{this._operation="filter",this._filter=i,this.$.isOriginal=i===L,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",i=>{this.$.active=i&&i===this._filter}),this.sub("isOriginal",i=>{this.$.iconSize=i?40:20}),this.sub("active",i=>{if(this.$.isOriginal)return;let s=this.ref["icon-el"];s.style.opacity=i?"1":"0";let o=this.ref["preview-el"];i?o.style.opacity="0":o.style.backgroundImage&&(o.style.opacity="1")}),this.sub("*networkProblems",i=>{if(!i){let s=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"];o.style.backgroundImage&&(o.style.backgroundImage="none",o.style.backgroundImage=`url(${s})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};rt.template=`
`;var dt=class extends H{constructor(){super(...arguments);m(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:i}=k[this._operation],s=t[this._operation],o=typeof s!="undefined"?s!==i:!1;this.$.active=o})}};var Ue=(r,e)=>{let t,i,s;return(...o)=>{t?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=e&&(r(...o),s=Date.now())},Math.max(e-(Date.now()-s),0))):(r(...o),s=Date.now(),t=!0)}};function ze(r,e){let t={};for(let i of e){let s=r[i];(r.hasOwnProperty(i)||s!==void 0)&&(t[i]=s)}return t}function st(r,e,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(e*s),3e3),n=s>=2?"lightest":"normal";return U(r,D(yt,W(t),`quality/${n}`,`stretch/off/-/resize/${o}x`))}function Pi(r){return r?[({dimensions:t,coords:i})=>[...t,...i].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:i})=>t.every(s=>s>0)&&i.every(s=>s>=0)].every(t=>t(r)):!0}var xt=class extends v{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=I(this._commit.bind(this),300),this._handleResizeThrottled=Ue(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],t=ze(e,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...t};this.$["*operations"]=i}_initCanvas(){let e=this.ref["canvas-el"],t=e.getContext("2d"),i=this.offsetWidth,s=this.offsetHeight,o=window.devicePixelRatio;e.style.width=`${i}px`,e.style.height=`${s}px`,e.width=i*o,e.height=s*o,t==null||t.scale(o,o),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,t=this.$["*padding"],i=this.$["*operations"],{rotate:s}=i,o={width:this.offsetWidth,height:this.offsetHeight},n=et({width:e.naturalWidth,height:e.naturalHeight},s),l;if(n.width>o.width-t*2||n.height>o.height-t*2){let a=n.width/n.height,h=o.width/o.height;if(a>h){let c=o.width-t*2,d=c/a,u=0+t,_=t+(o.height-t*2)/2-d/2;l={x:u,y:_,width:c,height:d}}else{let c=o.height-t*2,d=c*a,u=t+(o.width-t*2)/2-d/2,_=0+t;l={x:u,y:_,width:d,height:c}}}else{let{width:a,height:h}=n,c=t+(o.width-t*2)/2-a/2,d=t+(o.height-t*2)/2-h/2;l={x:c,y:d,width:a,height:h}}this.$["*imageBox"]=it(l)}_alignCrop(){var d;let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,o=this.$["*editorTransformations"].crop,{width:n,x:l,y:a}=this.$["*imageBox"];if(o){let{dimensions:[u,_],coords:[g,O]}=o,{width:X}=et(this._imageSize,s),M=n/X;e=tt(it({x:l+g*M,y:a+O*M,width:u*M,height:_*M}),this.$["*imageBox"])}let h=(d=this.$["*cropPresetList"])==null?void 0:d[0],c=h?h.width/h.height:void 0;if(!Me(e,t)||c&&!De(e,c)){let u=t.width/t.height,_=t.width,g=t.height;c&&(u>c?_=Math.min(t.height*c,t.width):g=Math.min(t.width/c,t.height)),e={x:t.x+t.width/2-_/2,y:t.y+t.height/2-g/2,width:_,height:g}}this.$["*cropBox"]=tt(it(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let t=this.$.image,i=this.$["*imageBox"],s=this.$["*operations"],{mirror:o,flip:n,rotate:l}=s,a=et({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(o?-1:1,n?-1:1),e.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=w({active_from_viewer:e,active_from_editor:!e,inactive_to_editor:!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:o,height:n}=t,{width:l,height:a}=et(this._imageSize,s),{width:h,height:c}=e,d=o/l,u=n/a;return[V(Math.round(h/d),1,l),V(Math.round(c/u),1,a)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:o,height:n,x:l,y:a}=t,{width:h,height:c}=et(this._imageSize,s),{x:d,y:u}=e,_=o/h,g=n/c,O=this._getCropDimensions(),X={dimensions:O,coords:[V(Math.round((d-l)/_),0,h-O[0]),V(Math.round((u-a)/g),0,c-O[1])]};if(!Pi(X)){console.error("Cropper is trying to create invalid crop object",{payload:X});return}if(!(O[0]===h&&O[1]===c))return X}_commit(){if(!this.isConnected)return;let e=this.$["*operations"],{rotate:t,mirror:i,flip:s}=e,o=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:o,rotate:t,mirror:i,flip:s};this.$["*editorTransformations"]=l}setValue(e,t){console.log(`Apply cropper operation [${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=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(i){console.error("Failed to activate cropper",{error:i})}this._observer=new ResizeObserver(([i])=>{i.contentRect.width>0&&i.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){var t;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=w({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),t=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,i=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,s=Math.min(t,i),o=this.$["*cropBox"].x+this.$["*cropBox"].width/2,n=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${s}) translate(${(this.offsetWidth/2-o)/s}px, ${(this.offsetHeight/2-n)/s}px)`,this.style.transformOrigin=`${o}px ${n}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(e,t){let i=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=this.proxyUrl(st(e,i,t)),{promise:o,cancel:n,image:l}=ht(s),a=this._handleImageLoading(s);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=n,o.then(()=>l).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(e){let t="crop",i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(t))!=null&&s.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};xt.template=``;function Bt(r,e,t){let i=Array(t);t--;for(let s=t;s>=0;s--)i[s]=Math.ceil((s*e+(t-s)*r)/t);return i}function ki(r){return r.reduce((e,t,i)=>is<=e&&e<=o);return r.map(s=>{let o=Math.abs(i[0]-i[1]),n=Math.abs(e-i[0])/o;return i[0]===s?e>t?1:1-n:i[1]===s?e>=t?n:1:0})}function Li(r,e){return r.map((t,i)=>to-n)}var Wt=class extends v{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=I(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];return i.get(t)||i.set(t,new Map),i.get(t).get(e)||(i.set(t,i.get(t).set(e,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(t))!=null&&s.has(e)&&(i.get(t).delete(e),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}_imageSrc({url:e=this._url,filter:t=this._filter,operation:i,value:s}={}){let o={...this._transformations};i&&(o[i]=t?{name:t,amount:s}:s);let n=this.offsetWidth;return this.proxyUrl(st(e,n,o))}_constructKeypoint(e,t){return{src:this._imageSrc({operation:e,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}_addKeypoint(e,t,i){let s=()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(a=>a.value===i);if(s())return;let o=this._constructKeypoint(e,i),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{once:!0}),o.image=n,n.classList.add("fader-image"),n.addEventListener("load",()=>{if(s())return;let a=this._keypoints,h=a.findIndex(d=>d.value>i),c=h{this.$["*networkProblems"]=!0},{once:!0})}set(e){e=typeof e=="string"?parseInt(e,10):e,this._update(this._operation,e),this._addKeypointDebounced(this._operation,this._filter,e)}_update(e,t){this._operation=e,this._value=t;let{zero:i}=k[e],s=this._keypoints.map(l=>l.value),o=Ni(s,t,i),n=Li(s,i);for(let[l,a]of Object.entries(this._keypoints))a.opacity=o[l],a.zIndex=n[l];this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add("fader-image","fader-image--preview"),e.style.opacity="0",e}async _initNodes(){let e=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&e.appendChild(this._previewImage);let t=document.createElement("div");e.appendChild(t);let i=this._keypoints.map(h=>h.src),{images:s,promise:o,cancel:n}=ct(i);s.forEach(h=>{let c=this._handleImageLoading(h.src);h.addEventListener("load",c),h.addEventListener("error",c)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await o,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((h,c)=>{let d=s[c];d.classList.add("fader-image"),h.image=d,this._container.appendChild(d)}),this.appendChild(e),this._flush())}setTransformations(e){if(this._transformations=e,this._previewImage){let t=this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:e,filter:t,operation:i,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let n=Fe(i,s).map(a=>this._imageSrc({url:e,filter:t,operation:i,value:a})),{cancel:l}=ct(n);this._cancelBatchPreload=l}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=w({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:!0}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=w({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:e,operation:t,value:i,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=e,this._operation=t||"initial",this._value=i,this._filter=s,this._fromViewer=o,typeof i!="number"&&!s){let l=this._imageSrc({operation:t,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Fe(t,i).map(l=>this._constructKeypoint(t,l)),this._update(t,i),this._initNodes()}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=w({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Ri=1,Et=class extends v{initCallback(){super.initCallback(),this.addEventListener("wheel",e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;Math.abs(i)>Ri?this.scrollLeft+=i:this.scrollLeft+=t})}};Et.template=" ";function Mi(r){return``}function Di(r){return`
`}var $t=class extends v{constructor(){super();m(this,"_updateInfoTooltip",I(()=>{var n,l;let t=this.$["*editorTransformations"],i=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===C.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;s=this.l10n(this.$["*currentFilter"])+" "+a}else s=this.l10n(L);else if(this.$["*tabId"]===C.TUNING&&i){o=!0;let a=(t==null?void 0:t[i])||k[i].zero;s=i+" "+a}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":L,"*currentOperation":null,"*tabId":C.CROP,showLoader:!1,filters:xe,colorOperations:Te,cropOperations:Ee,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let i=t.currentTarget.getAttribute("data-id");i&&this._activateTab(i,{fromViewer:!1})}},this._debouncedShowLoader=I(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===C.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let i=new dt;return i.operation=t,i}_createFilterControl(t){let i=new rt;return i.filter=t,i}_createToggleControl(t){let i=new lt;return i.operation=t,i}_renderControlsList(t){let i=this.ref[`controls-list-${t}`],s=document.createDocumentFragment();t===C.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):t===C.FILTERS?[L,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):t===C.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);s.appendChild(n)}),[...s.children].forEach((o,n)=>{n===s.childNodes.length-1&&o.classList.add("controls-list_last-item")}),i.innerHTML="",i.appendChild(s)}_activateTab(t,{fromViewer:i}){this.$["*tabId"]=t,t===C.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let s of E){let o=s===t,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(t){let i=this.ref[`controls-list-${t}`];i&&(i.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,i=this.proxyUrl(st(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:s}=ct([i]);this._cancelPreload=()=>{s(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var s;let i=(s=t==null?void 0:t.filter)==null?void 0:s.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let i=!1;for(let[,s]of t.entries()){if(i)break;for(let[,o]of s.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let i of E){this.$[`presence.tabToggle.${i}`]=t.includes(i);let s=this.ref[`tab-toggle-${i}`];s.style.gridColumn=t.indexOf(i)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};$t.template=`
{{*operationTooltip}}
${E.map(Di).join("")}
${E.map(Mi).join("")}
`;var ut=class extends b{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return w("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",e=>{this._iconSingle=!this.$.text,this._iconHidden=!e,this.$.iconCss=this._iconCss()}),this.sub("theme",e=>{e!=="custom"&&(this.className=e)}),this.sub("text",e=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(e){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};ut.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ut.template=`
{{text}}
`;var At=class extends b{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let e=this.ref["line-el"];e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",e=>{typeof e=="boolean"&&(e?this._start():this._stop())})}_start(){this._active=!0;let{width:e}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};At.template=`
`;var St={transition:"transition",visible:"visible",hidden:"hidden"},It=class extends b{constructor(){super(),this._visible=!1,this._visibleStyle=St.visible,this._hiddenStyle=St.hidden,this._externalTransitions=!1,this.defineAccessor("styles",e=>{e&&(this._externalTransitions=!0,this._visibleStyle=e.visible,this._hiddenStyle=e.hidden)}),this.defineAccessor("visible",e=>{typeof e=="boolean"&&(this._visible=e,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",ge(this,{[St.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(St.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};It.template=" ";var Ot=class extends b{constructor(){super();m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let s=this.ref["input-el"];i?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:i}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:s}=i.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let l=document.createDocumentFragment(),a=document.createElement("div"),h=document.createElement("div");a.className="minor-step",h.className="border-step",l.appendChild(h);for(let d=0;d
`;var Ui="css-src";function Kt(r){return class extends r{constructor(){super(...arguments);m(this,"renderShadow",!0);m(this,"pauseRender",!0);m(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),bt({element:this,attribute:Ui,onSuccess:t=>{this.attachShadow({mode:"open"});let i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href=t,i.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(i)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var He=class extends Kt(b){};var Xe=class extends Kt(K){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};var pt=class extends b{constructor(){super(...arguments);m(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let i=this.getCssData(`--icon-${t}`);i&&(this.$.path=i)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};pt.template=``;pt.bindAttributes({name:"name",size:"size"});function zi(r){for(let e in r){let t=[...e].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),r[e].reg&&r[e].reg(t)}}var Fi="https://ucarecdn.com",Hi="https://upload.uploadcare.com",Xi="https://social.uploadcare.com",G={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:vt(E),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Fi,baseUrl:Hi,socialBaseUrl:Xi,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var $=r=>String(r),R=r=>{let e=Number(r);if(Number.isNaN(e))throw new Error(`Invalid number: "${r}"`);return e},T=r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},ji=r=>r==="auto"?r:T(r),Bi={pubkey:$,multiple:T,multipleMin:R,multipleMax:R,confirmUpload:T,imgOnly:T,accept:$,externalSourcesPreferredTypes:$,store:ji,cameraMirror:T,sourceList:$,maxLocalFileSizeBytes:R,thumbSize:R,showEmptyList:T,useLocalImageEditor:T,useCloudImageEditor:T,cloudImageEditorTabs:$,removeCopyright:T,cropPreset:$,modalScrollLock:T,modalBackdropStrokes:T,sourceListWrap:T,remoteTabSessionKey:$,cdnCname:$,baseUrl:$,socialBaseUrl:$,secureSignature:$,secureExpire:$,secureDeliveryProxy:$,retryThrottledRequestMaxTimes:R,multipartMinFileSize:R,multipartChunkSize:R,maxConcurrentRequests:R,multipartMaxConcurrentRequests:R,multipartMaxAttempts:R,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:T,groupOutput:T,userAgentIntegration:$},je=(r,e)=>{if(!(typeof e=="undefined"||e===null))try{return Bi[r](e)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),G[r]}};var Pt=Object.keys(G),Wi=["metadata"],Ki=r=>Wi.includes(r),kt=Pt.filter(r=>!Ki(r)),Vi={...Object.fromEntries(kt.map(r=>[B(r),r])),...Object.fromEntries(kt.map(r=>[r.toLowerCase(),r]))},Gi={...Object.fromEntries(Pt.map(r=>[B(r),x(r)])),...Object.fromEntries(Pt.map(r=>[r.toLowerCase(),x(r)]))},Nt=class extends b{constructor(){super();m(this,"ctxOwner",!0);m(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(G).map(([t,i])=>[x(t),i]))}}initCallback(){super.initCallback();let t=this;for(let i of kt)this.sub(x(i),s=>{s!==G[i]&&(t[i]=s)},!1);for(let i of Pt){let s="__"+i;t[s]=t[i],Object.defineProperty(this,i,{set:o=>{if(t[s]=o,kt.includes(i)){let n=[...new Set([B(i),i.toLowerCase()])];for(let l of n)typeof o=="undefined"||o===null?this.removeAttribute(l):this.setAttribute(l,o.toString())}this.$[x(i)]!==o&&(typeof o=="undefined"||o===null?this.$[x(i)]=G[i]:this.$[x(i)]=o)},get:()=>this.$[x(i)]}),typeof t[i]!="undefined"&&t[i]!==null&&(t[i]=t[s])}}attributeChangedCallback(t,i,s){if(i===s)return;let o=Vi[t],n=je(o,s),l=n!=null?n:G[o],a=this;a[o]=l}};Nt.bindAttributes(Gi);export{Xe as CloudImageEditor,K as CloudImageEditorBlock,Nt as Config,Ct as CropFrame,lt as EditorCropButtonControl,rt as EditorFilterControl,xt as EditorImageCropper,Wt as EditorImageFader,dt as EditorOperationControl,Et as EditorScroller,Tt as EditorSlider,$t as EditorToolbar,pt as Icon,At as LineLoaderUi,ut as LrBtnUi,It as PresenceToggle,Ot as SliderUi,zi as registerBlocks}; \ No newline at end of file diff --git a/web/lr-file-uploader-inline.min.css b/web/lr-file-uploader-inline.min.css index 8ddeec23c..9a1b05a76 100644 --- a/web/lr-file-uploader-inline.min.css +++ b/web/lr-file-uploader-inline.min.css @@ -1 +1 @@ -:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0}:host{flex:1}lr-start-from{height:100%}.lr-wgt-common,:host{--cfg-done-activity: "start-from";--cfg-init-activity: "start-from";container-type:inline-size}lr-activity-header:after{width:var(--ui-size);height:var(--ui-size);content:""}lr-activity-header .close-btn{display:none}@container (min-width: 500px){lr-start-from{grid-auto-rows:1fr max-content;grid-template-columns:1fr max-content}lr-start-from lr-copyright{grid-column:2}lr-start-from lr-drop-area{grid-row:span 2}} +:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-minimum: "At least {{count}} files are required";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0}:host{flex:1}lr-start-from{height:100%}.lr-wgt-common,:host{--cfg-done-activity: "start-from";--cfg-init-activity: "start-from";container-type:inline-size}lr-activity-header:after{width:var(--ui-size);height:var(--ui-size);content:""}lr-activity-header .close-btn{display:none}@container (min-width: 500px){lr-start-from{grid-auto-rows:1fr max-content;grid-template-columns:1fr max-content}lr-start-from lr-copyright{grid-column:2}lr-start-from lr-drop-area{grid-row:span 2}} diff --git a/web/lr-file-uploader-inline.min.js b/web/lr-file-uploader-inline.min.js index 608ea96b1..df97cf407 100644 --- a/web/lr-file-uploader-inline.min.js +++ b/web/lr-file-uploader-inline.min.js @@ -23,5 +23,5 @@ * SOFTWARE. * */ -var zr=Object.defineProperty;var jr=(s,i,t)=>i in s?zr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(jr(s,typeof i!="symbol"?i+"":i,t),t),Si=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var V=(s,i,t)=>(Si(s,i,"read from private field"),t?t.call(s):i.get(s)),Ot=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},re=(s,i,t,e)=>(Si(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var Oe=(s,i,t)=>(Si(s,i,"access private method"),t);var Hr=Object.defineProperty,Wr=(s,i,t)=>i in s?Hr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,Ii=(s,i,t)=>(Wr(s,typeof i!="symbol"?i+"":i,t),t);function Xr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Xr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),fs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",qr=fs.length-1,oe=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Kr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var ds="__default__";function Yr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||ds;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=ds;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Zr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Jr(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Gr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ms(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var Le="{{",ne="}}",Qr="skip-text";function tn(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(Qr))&&r.textContent.includes(Le)&&r.textContent.includes(ne)&&1}});for(;i=e.nextNode();)t.push(i);return t}var en=function(s,i){tn(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(ne);)e.textContent.startsWith(Le)?(n=e.textContent.indexOf(ne)+ne.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(Le),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(Le,"").replace(ne,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},sn=[Kr,Yr,Zr,Jr,en],Ue="'",Bt='"',rn=/\\([0-9a-fA-F]{1,6} ?)/g;function nn(s){return(s[0]===Bt||s[0]===Ue)&&(s[s.length-1]===Bt||s[s.length-1]===Ue)}function on(s){return(s[0]===Bt||s[0]===Ue)&&(s=s.slice(1)),(s[s.length-1]===Bt||s[s.length-1]===Ue)&&(s=s.slice(0,-1)),s}function ln(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ -`,"\\n"),i=ln(i),i=Bt+i+Bt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ps=0,Vt=null,pt=null,vt=class extends HTMLElement{constructor(){super(),Ii(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=oe.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ms(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of sn)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);pt==null||pt.delete(this.updateCssData),pt!=null&&pt.size||(Vt==null||Vt.disconnect(),Vt=null,pt=null)},100)))}static reg(s,i=!1){s||(ps++,s=`${C.AUTO_TAG_PRFX}-${ps}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=an(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){pt||(pt=new Set),pt.add(this.updateCssData),Vt||(Vt=new MutationObserver(s=>{s[0].type==="attributes"&&pt.forEach(i=>{i()})}),Vt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},zt=vt;Ii(zt,"template");var ki=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(ki.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),ki.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};ki.appMap=Object.create(null);function cn(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function hn(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function le(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&hn(i,s.attributes),s.styles&&cn(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=le(t);i.appendChild(e)}),i}var gs="idb-store-ready",un="symbiote-db",dn="symbiote-idb-update_",pn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(gs,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return dn+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,bs.clear(this.name)}},bs=class{static get readyEventName(){return gs}static open(s=un,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new pn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};Ii(bs,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var fn="--uploadcare-blocks-window-height",Re="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Oi(){return typeof window[Re]=="undefined"?!1:!!window[Re]}function _s(){if(Oi())return;let s=()=>{document.documentElement.style.setProperty(fn,`${window.innerHeight}px`),window[Re]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[Re]=!1,window.removeEventListener("resize",i)}}var mn=s=>s,Li="{{",vs="}}",ys="plural:";function ae(s,i,t={}){var o;let{openToken:e=Li,closeToken:r=vs,transform:n=mn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function Cs(s){let i=[],t=s.indexOf(Li);for(;t!==-1;){let e=s.indexOf(vs,t),r=s.substring(t+2,e);if(r.startsWith(ys)){let n=s.substring(t+2,e).replace(ys,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Li,e)}return i}function ws(s){return Object.prototype.toString.call(s)==="[object Object]"}var gn=/\W|_/g;function bn(s){return s.split(gn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Ts(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return Ts(s,{ignoreKeys:i});if(!ws(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ws(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Ts(r,{ignoreKeys:i})),t[bn(e)]=r}return t}var _n=s=>new Promise(i=>setTimeout(i,s));function Fi({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var yn={factor:2,time:100};function vn(s,i=yn){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>_n(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var qt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,qt.prototype),this.originalProgressEvent=t}},Ne=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},Cn=500,Es=({check:s,interval:i=Cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ne(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},De="application/octet-stream",As="original",Tt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ne(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,b=a.status;o({request:d,data:f,headers:m,status:b})}},a.onerror=d=>{u||l(new qt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function wn(s,...i){return s}var Tn=({name:s})=>s?[s]:[],xn=wn,En=()=>new FormData,$s=s=>!1,Fe=s=>typeof Blob!="undefined"&&s instanceof Blob,Ve=s=>typeof File!="undefined"&&s instanceof File,Be=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",ce=s=>Fe(s)||Ve(s)||$s()||Be(s),An=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",$n=s=>!!s&&typeof s=="object"&&!Array.isArray(s),Sn=s=>!!s&&typeof s=="object"&&"data"in s&&ce(s.data);function kn(s,i,t){if(Sn(t)){let{name:e,contentType:r}=t,n=xn(t.data,e,r!=null?r:De),o=Tn({name:e,contentType:r});s.push([i,n,...o])}else if($n(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else An(t)&&t&&s.push([i,t.toString()])}function In(s){let i=[];for(let[t,e]of Object.entries(s))kn(i,t,e);return i}function Vi(s){let i=En(),t=In(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var P=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,P.prototype)}},On=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},ft=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=On(t)),e.toString()},Ln="6.6.1",Un="UploadcareUploadClient",Rn=Ln;function Rt(s){return Fi({libraryName:Un,libraryVersion:Rn,...s})}var Pn="RequestThrottledError",xs=15e3,Mn=1e3;function Nn(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return xs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xs}function xt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return vn(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Pn&&r{let i="";return(Fe(s)||Ve(s)||Be(s))&&(i=s.type),i||De},ks=s=>{let i="";return Ve(s)&&s.name?i=s.name:Fe(s)||$s()?i="":Be(s)&&s.name&&(i=s.name),i||As};function Bi(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function Dn(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({file:{data:s,name:t||ks(s),contentType:e||Ss(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Bi(l),signature:n,expire:o,source:u,metadata:b}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var Pi;(function(s){s.Token="token",s.FileInfo="file_info"})(Pi||(Pi={}));function Fn(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Bi(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:b}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var X;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(X||(X={}));var Vn=s=>"status"in s&&s.status===X.Error;function Bn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return xt(()=>Tt({method:"GET",headers:i?{"X-UC-User-Agent":Rt({publicKey:i,integration:r,userAgent:n})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Vn(d))throw new P(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function zn(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:a,userAgent:c})},url:ft(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let b=mt(JSON.parse(p));if("error"in b)throw new P(b.error.content,b.error.errorCode,f,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function Is(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"GET",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},url:ft(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function jn(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({filename:e||As,size:s,content_type:t||De,part_size:r,UPLOADCARE_STORE:Bi(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:b}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(H=>w.parts[H]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Hn(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||De}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Wn(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},data:Vi({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function zi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Es({check:u=>Is(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}var wt=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);let{uuid:r,s3Bucket:n}=i,o=ft(t,`${r}/`),l=n?ft(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l}},Xn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:b,metadata:A})=>Dn(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>zi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new wt(x,{baseCDN:b})),qn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>Is(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new wt(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Gn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ne(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Kn=window.WebSocket,Mi=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Yn=(s,i)=>s==="success"?{status:X.Success,...i}:s==="progress"?{status:X.Progress,...i}:{status:X.Error,...i},Ni=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Mi);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Kn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Yn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Ui=null,ji=s=>{if(!Ui){let i=typeof window=="undefined"?0:3e4;Ui=new Ni(s,i)}return Ui},Zn=s=>{ji(s).connect()};function Jn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return Es({check:c=>Bn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case X.Error:return new P(u.error,u.errorCode);case X.Waiting:return!1;case X.Unknown:return new P(`Token "${s}" was not found.`);case X.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case X.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var Qn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=ji(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ne(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case X.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case X.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case X.Error:a(),n(new P(c.msg,c.error_code))}})}),to=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Zn(A)).then(()=>Fn(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,metadata:x})).catch(T=>{let w=ji(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===Pi.FileInfo?T:Gn([({signal:w})=>Jn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:w}),({signal:w})=>Qn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof P)throw T;return T}).then(T=>zi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:u})).then(T=>new wt(T,{baseCDN:r})),Ri=new WeakMap,eo=async s=>{if(Ri.has(s))return Ri.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ri.set(s,i),i},Os=async s=>{if(Ve(s)||Fe(s))return s.size;if(Be(s))return(await eo(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},io=(s,i=E.multipartMinFileSize)=>s>=i,Ls=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ce(s)&&t.test(s)},Us=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ce(s)&&t.test(s)},so=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},no=async(s,i,t)=>e=>ro(s,e,i,t),oo=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Hn(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),lo=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:b,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let H=e!=null?e:await Os(s),ht,It=(R,Q)=>{if(!c)return;ht||(ht=Array(R).fill(0));let ut=W=>W.reduce((dt,$i)=>dt+$i,0);return W=>{W.isComputable&&(ht[Q]=W.value,c({isComputable:!0,value:ut(ht)/R}))}};return b||(b=Ss(s)),jn(H,{publicKey:i,contentType:b,fileName:t||ks(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:R,parts:Q})=>{let ut=await no(s,H,A);return Promise.all([R,so(x,Q.map((W,dt)=>()=>oo(ut(dt),W,{publicKey:i,contentType:b,onProgress:It(Q.length,dt),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([R])=>Wn(R,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(R=>R.isReady?R:zi({file:R.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(R=>new wt(R,{baseCDN:T}))};async function Hi(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:b,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,pusherKey:ht,metadata:It}){if(ce(s)){let R=await Os(s);return io(R,b)?lo(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:R,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Xn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Us(s))return to(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(Ls(s))return qn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var Di=class{constructor(i,t){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount,this.totalSize=Object.values(i.files).reduce((e,r)=>e+r.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(i.files).filter(e=>e.isImage).length,this.cdnUrl=i.cdnUrl,this.files=t,this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},ao=s=>{for(let i of s)if(!ce(i))return!1;return!0},co=s=>{for(let i of s)if(!Ls(i))return!1;return!0},ho=s=>{for(let i of s)if(!Us(i))return!1;return!0};function Rs(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!ao(s)&&!ho(s)&&!co(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let H,ht=!0,It=s.length,R=(Q,ut)=>{if(!a)return;H||(H=Array(Q).fill(0));let W=dt=>dt.reduce(($i,Br)=>$i+Br)/Q;return dt=>{if(!dt.isComputable||!ht){ht=!1,a({isComputable:!1});return}H[ut]=dt.value,a({isComputable:!0,value:W(H)})}};return Promise.all(s.map((Q,ut)=>Hi(Q,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:R(It,ut),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}))).then(Q=>{let ut=Q.map(W=>W.uuid);return zn(ut,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(W=>new Di(W,Q)).then(W=>(a&&a({isComputable:!0,value:1}),W))})}var Lt,jt,Ut,Ht,Wt,Xt,Pe,Me=class{constructor(i){Ot(this,Xt);Ot(this,Lt,1);Ot(this,jt,[]);Ot(this,Ut,0);Ot(this,Ht,new WeakMap);Ot(this,Wt,new WeakMap);re(this,Lt,i)}add(i){return new Promise((t,e)=>{V(this,Ht).set(i,t),V(this,Wt).set(i,e),V(this,jt).push(i),Oe(this,Xt,Pe).call(this)})}get pending(){return V(this,jt).length}get running(){return V(this,Ut)}set concurrency(i){re(this,Lt,i),Oe(this,Xt,Pe).call(this)}get concurrency(){return V(this,Lt)}};Lt=new WeakMap,jt=new WeakMap,Ut=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Xt=new WeakSet,Pe=function(){let i=V(this,Lt)-V(this,Ut);for(let t=0;t{V(this,Ht).delete(e),V(this,Wt).delete(e),re(this,Ut,V(this,Ut)-1),Oe(this,Xt,Pe).call(this)}).then(o=>r(o)).catch(o=>n(o))}};var Wi=()=>({"*blocksRegistry":new Set}),Xi=s=>({...Wi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),ze=s=>({...Xi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Me(1)});function Ps(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var q=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Ms=new Set;function je(s){Ms.has(s)||(Ms.add(s),console.warn(s))}var He=(s,i)=>new Intl.PluralRules(s).select(i);var We=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var qi="lr-",_=class extends zt{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Wi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(Ps),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=Cs(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return ae(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=He(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${qi}${t}`,!0),Oi()||(this._destroyInnerHeightTracker=_s()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?We({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?ae(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=q(r);return this.$[o]=n,!0},get:(e,r)=>{let n=q(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(je("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(q(t));r.ctx.has(r.name)?this.sub(q(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(qi)?t:qi+t)}};h(_,"StateConsumerScope",null),h(_,"className","");var he=class extends _{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(he,"StateConsumerScope","modal");he.template=``;var Ns="active",ue="___ACTIVITY_IS_ACTIVE___",st=class extends _{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Xi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ue]=!1,this.removeAttribute(Ns),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ue]=!0,this.setAttribute(Ns,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ue]?this._deactivate():this.activityType===t&&!this[ue]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ue]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var de=33.333333333333336,y=1,Gi=24,Ds=6;function Pt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function tt(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Pt(t,i),t}function Fs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function Vs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Bs(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function zs({rect:s,delta:[i,t],imageBox:e}){return Kt({...s,x:s.x+i,y:s.y+t},e)}function Kt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function uo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Xs(s,i){return Math.abs(s.width/s.height-i)<.1}function Yt({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function qs(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Zt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function Et(s,i,t){return Math.min(Math.max(s,i),t)}var qe=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var et=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Gs="blocks",Ks="0.27.6";function Ys(s){return Fi({...s,libraryName:Gs,libraryVersion:Ks})}var Zs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ge=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Zs(i)).join("/-/"),M=(...s)=>{let i=Ge(...s);return i?`-/${i}/`:""};function Js(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function Qs(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function tr(s){let i=er(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Zs(n))}function er(s){let i=new URL(s),t=Js(s),e=ir(t)?sr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function ir(s){return s.startsWith("http")}function sr(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(er(s));if(t=t||Js(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),ir(t)){let r=sr(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},At=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var N=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var pe=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ki=s=>s?s.filter(i=>typeof i=="string").map(i=>N(i)).flat():[],Yi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),rr=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),fe=s=>{let i=s==null?void 0:s.type;return i?Yi(i,pe):!1};var nt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),me=s=>Math.ceil(s*100)/100,nr=(s,i=Mt.AUTO)=>{let t=i===Mt.AUTO;if(i===Mt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(O,"_timeoutStore",Object.create(null));var or="[Typed State] Wrong property name: ",vo="[Typed State] Wrong property type: ",Ke=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||oe.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(vo+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Ye=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||oe.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__handler=i.handler||null,this.__subsMap=Object.create(null),this.__observers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{this.__observers.forEach(n=>{n({...t})}),t=Object.create(null)})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{var e;let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear(),(e=this.__handler)==null||e.call(this,[...this.__items],i,t)})}setHandler(i){this.__handler=i,this.notify()}getHandler(){return this.__handler}removeHandler(){this.__handler=null}add(i){let t=new Ke(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observe(i){this.__observers.add(i)}unobserve(i){this.__observers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__observers=null,this.__handler=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var lr=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:wt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var ar=s=>s?s.split(",").map(i=>i.trim()):[],Nt=s=>s?s.join(","):"";var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",ze(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_handleCollectionUpdate",t=>{let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,O.emit(new B({type:L.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&O.emit(new B({type:L.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{O.emit(new B({type:L.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{O.emit(new B({type:L.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{O.emit(new B({type:L.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){je("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ye({typedSchema:lr,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this.__uploadCollectionHandler=(e,r,n)=>{var o;this._runValidators();for(let l of n)(o=l==null?void 0:l.getValue("abortController"))==null||o.abort(),l==null||l.setValue("abortController",null),URL.revokeObjectURL(l==null?void 0:l.getValue("thumbUrl"));this.$["*uploadList"]=e.map(l=>({uid:l}))},this.uploadCollection.setHandler(this.__uploadCollectionHandler),this.uploadCollection.observe(this._handleCollectionUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){super.destroyCallback(),this.isUploadCollectionOwner&&(this.uploadCollection.unobserve(this._handleCollectionUpdate),this.uploadCollection.getHandler()===this.__uploadCollectionHandler&&this.uploadCollection.removeHandler())}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:fe(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:et.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:fe(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Nt(Ki([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?pe:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Nt(pe)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:et.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=N(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);O.emit(new B({type:L.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),O.emit(new B({type:L.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Ki([...e?pe:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Yi(o,n),c=rr(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:nr(e)})}_validateMultipleLimit(t){let r=this.uploadCollection.items().indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&r>=n)return this.l10n("files-count-allowed",{count:n})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=qe(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=qs(l,a,c),d=M(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ys,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return this.uploadCollection.findItems(t).forEach(n=>{let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,fileSize:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl||l.cdnUrl};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});Object.values(L).forEach(s=>{let i=O.eName(s),t=S(e=>{if([L.UPLOAD_FINISH,L.REMOVE,L.CLOUD_MODIFICATION].includes(e.detail.type)){let n=$.getCtx(e.detail.ctx),o=n.read("uploadCollection"),l=[];o.items().forEach(a=>{let c=$.getCtx(a).store,u=c.fileInfo;if(u){let d={...u,cdnUrlModifiers:c.cdnUrlModifiers,cdnUrl:c.cdnUrl||u.cdnUrl};l.push(d)}}),O.emit(new B({type:L.DATA_OUTPUT,ctx:e.detail.ctx,data:l})),n.pub("outputData",l)}},0);window.addEventListener(i,t)});var Z={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function Co(s,i){if(typeof i=="number")return Z[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Z[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Z[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var hr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function $t(s){return Ge(...hr.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return Co(i,t)}).filter(i=>!!i))}var Ze=Ge("format/auto","progressive/yes"),bt=([s])=>typeof s!="undefined"?Number(s):void 0,cr=()=>!0,wo=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),To=([s,i])=>({dimensions:N(s,"x").map(Number),coords:N(i).map(Number)}),xo={enhance:bt,brightness:bt,exposure:bt,gamma:bt,contrast:bt,saturation:bt,vibrance:bt,warmth:bt,filter:wo,mirror:cr,flip:cr,rotate:bt,crop:To};function ur(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!hr.includes(e))continue;let n=xo[e],o=n(r);i[e]=o}return i}var D=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),G=[D.CROP,D.TUNING,D.FILTERS],dr=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],pr=["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"],fr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Z.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Z.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Z.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Z.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Z.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Z.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Z.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Z.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Z.filter,range:[0,100],keypointsNumber:1}});var Eo="https://ucarecdn.com",Ao="https://upload.uploadcare.com",$o="https://social.uploadcare.com",Jt={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Nt(G),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Eo,baseUrl:Ao,socialBaseUrl:$o,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var K=s=>String(s),lt=s=>Number(s),k=s=>typeof s=="boolean"?s:s==="true"||s===""?!0:s==="false"?!1:!!s,So=s=>s==="auto"?s:k(s),ko={pubkey:K,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:K,externalSourcesPreferredTypes:K,store:So,cameraMirror:k,sourceList:K,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:K,removeCopyright:k,cropPreset:K,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:K,cdnCname:K,baseUrl:K,socialBaseUrl:K,secureSignature:K,secureExpire:K,secureDeliveryProxy:K,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:K},mr=(s,i)=>{if(!(typeof i=="undefined"||i===null))return ko[s](i)};var Je=Object.keys(Jt),Io=["metadata"],Oo=s=>Io.includes(s),Qe=Je.filter(s=>!Oo(s)),Lo={...Object.fromEntries(Qe.map(s=>[gt(s),s])),...Object.fromEntries(Qe.map(s=>[s.toLowerCase(),s]))},Uo={...Object.fromEntries(Je.map(s=>[gt(s),q(s)])),...Object.fromEntries(Je.map(s=>[s.toLowerCase(),q(s)]))},ti=class extends _{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Jt).map(([t,e])=>[q(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of Qe)this.sub(q(e),r=>{r!==Jt[e]&&(t[e]=r)},!1);for(let e of Je){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,Qe.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[q(e)]!==n&&(typeof n=="undefined"||n===null?this.$[q(e)]=Jt[e]:this.$[q(e)]=n)},get:()=>this.$[q(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Lo[t],o=mr(n,r),l=o!=null?o:Jt[n],a=this;a[n]=l}};ti.bindAttributes(Uo);var ge=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};ge.template=``;ge.bindAttributes({name:"name",size:"size"});var Ro="https://ucarecdn.com",Dt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ro},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var gr=s=>[...new Set(s)];var be="--lr-img-",br="unresolved",Qt=2,te=3,_r=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),vr=Object.create(null),yr;for(let s in Dt)vr[be+s]=((yr=Dt[s])==null?void 0:yr.default)||"";var ei=class extends zt{constructor(){super(...arguments);h(this,"cssInit$",vr)}$$(t){return this.$[be+t]}set$$(t){for(let e in t)this.$[be+e]=t[e]}sub$$(t,e){this.sub(be+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!_r&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return M(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Dt.format.default}`,`quality/${this.$$("quality")||Dt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(_r&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?ae(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(br,""),this.img.onload=()=>{this.img.removeAttribute(br)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Dt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?gr(N(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Qt+"x")}") ${n*Qt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*te+"x")}") ${n*te}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Qt))}") ${Qt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,te))}") ${te}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Qt+"x")+` ${e*Qt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*te+"x")+` ${e*te}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Dt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[be+t]=r})}};var Zi=class extends ei{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var _e=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};_e.template=``;_e.bindAttributes({dropzone:null});var Ji=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function Po(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Mo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function Cr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(Po(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var z={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},wr=["focus"],No=100,Qi=new Map;function Do(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function ts(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=z.INACTIVE,o=f=>{s.shouldIgnore()&&f!==z.INACTIVE||(n!==f&&e.forEach(b=>b(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(z.INACTIVE)},c=()=>{i+=1,n===z.INACTIVE&&o(z.ACTIVE)},u=()=>{i-=1,l()||o(z.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(z.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let b=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor(Do(b,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let b=await Cr(f.dataTransfer);s.onItems(b),o(z.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),wr.forEach(f=>{window.addEventListener(f,a)}),()=>{Qi.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),wr.forEach(f=>{window.removeEventListener(f,a)})}}var ye=class extends v{constructor(){super(),this.init$={...this.init$,state:z.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=ts({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:et.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:et.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=ts({element:i,onChange:t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=N(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};ye.template=`
{{text}}
`;ye.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Fo="src-type-",ve=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${Fo}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ve.template=`
`;ve.bindAttributes({type:null});var es=class extends _{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=N(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function Tr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function xr(s="#fff",i="rgba(0, 0, 0, .1)"){return Tr(``)}function Ce(s="hsl(209, 21%, 65%)",i=32,t=32){return Tr(``)}function Er(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var j=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),_t=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:j.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=j.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=j.FAILED:t.getValue("validationMultipleLimitMsg")?e=j.LIMIT_OVERFLOW:t.getValue("isUploading")?e=j.UPLOADING:t.getValue("fileInfo")&&(e=j.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(At(this.cfg.cdnCname,this._entry.getValue("uuid")),M(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await Er(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{_t.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),_t.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===j.FAILED,isLimitOverflow:t===j.LIMIT_OVERFLOW,isUploading:t===j.UPLOADING,isFinished:t===j.FINISHED,progressVisible:t===j.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===j.FAILED||t===j.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===j.FINISHED&&(this.$.badgeIcon="badge-success"),t===j.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),_t.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));O.emit(new B({type:L.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Hi(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof P?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};_t.template=`
{{itemName}}{{errorText}}
`;_t.activeInstances=new Set;var ii=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},si=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};si.template=`
{{captionTxt}}
{{msgTxt}}
`;var ri=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new ii,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observe(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate)}};ri.template=`{{headerText}}
`;var ni=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:et.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};ni.template=`
`;var is=()=>typeof navigator.permissions!="undefined";var oi=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:is(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{is()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:et.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};oi.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var ss=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var li=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=Ce(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=fe(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,M("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};li.template=`
{{fileSize}}
{{errorTxt}}
`;var rs=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},ai=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new rs);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};ai.template=`{{activityCaption}}
{{messageTxt}}
`;var ci=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this.uploadCollection.observe(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}};ci.template=``;var hi=class extends _{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};hi.template='
';var J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var we=class extends _{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:J})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${xr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=J}};we.template='';we.bindAttributes({checkerboard:"checkerboard"});var Ar="--cfg-ctx-name",U=class extends _{get cfgCssCtxName(){return this.getCssData(Ar,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(Ar,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function $r(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function F(...s){let i=$r(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Sr(s,...i){let t=$r(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var kr=s=>{if(!s)return G;let i=ar(s).filter(t=>G.includes(t));return i.length===0?G:i};function Ir(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":G,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:J,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Nt(G),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=J,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=M($t(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var Or=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends U{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...Ir(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===D.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=Qs(this.$.cdnUrl);this.$["*originalUrl"]=At(this.$.cdnUrl,t);let e=tr(this.$.cdnUrl),r=ur(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=At(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],M("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===D.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==J&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||J)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=qe(t)}),this.sub("tabs",t=>{this.$["*tabList"]=kr(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=F("image",{image_hidden_to_cropper:t===D.CROP,image_hidden_effects:t!==D.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=M($t(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=Or;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ui=class extends U{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=tt("mask",{id:"backdrop-mask"}),a=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=tt("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Pt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Pt(n,f)}else{let f=Et(Math.min(d,p)/(24*2+34)/2,0,1),{d:b,center:A}=a?Fs(i,e,f):Vs(i,e,f),x=Math.max(Gi*Et(Math.min(d,p)/Gi/3,0,1),Ds);Pt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Pt(r,{d:b})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",F("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Pt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=tt("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=tt("rect",{fill:"transparent"}),l=tt("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=tt("svg"),t=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=tt("line",{x1:`${de*e}%`,y1:"0%",x2:`${de*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=tt("line",{x1:"0%",y1:`${de*e}%`,x2:"100%",y2:`${de*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=zs({rect:o,delta:[e,r],imageBox:n}):o=js({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return Kt(Zt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Hs(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Bs(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",F("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",F({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ui.template='';var yt=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=F({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Bo(s){let i=s+90;return i=i>=360?0:i,i}function zo(s,i){return s==="rotate"?Bo(i):["mirror","flip"].includes(s)?!i:null}var Te=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=zo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var xe={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",di=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?xe.FILTER:xe.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===xe.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===xe.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===xe.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};di.template=``;function Ee(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=J)}}}function Ae(s){let i=[];for(let n of s){let o=Ee(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var ee=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,M(Ze,$t(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=Ee(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};ee.template=`
`;var $e=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Lr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function Ur(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function ie(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,M(Ze,$t(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function jo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var pi=class extends U{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Lr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=Ur(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Yt({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Zt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,b]}=n,{width:A}=Yt(this._imageSize,r),x=o/A;i=Kt(Zt({x:l+f*x,y:a+b*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Ws(i,t)||u&&!Xs(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=Kt(Zt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Yt({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=F({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Yt(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[Et(Math.round(c/d),1,l),Et(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Yt(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,b=this._getCropDimensions(),A={dimensions:b,coords:[Et(Math.round((d-l)/m),0,c-b[0]),Et(Math.round((p-a)/f),0,u-b[1])]};if(!jo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(b[0]===c&&b[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=F({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(ie(i,e,t)),{promise:n,cancel:o,image:l}=Ee(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};pi.template=``;function ns(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Ho(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Xo(s,i){return s.map((t,e)=>tn-o)}var os=class extends U{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(ie(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Wo(r,t,e),o=Xo(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=Ae(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Rr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=Ae(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Rr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=F({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var qo=1,fi=class extends U{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>qo?this.scrollLeft+=e:this.scrollLeft+=t})}};fi.template=" ";function Go(s){return``}function Ko(s){return`
`}var mi=class extends U{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===D.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===D.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":D.CROP,showLoader:!1,filters:pr,colorOperations:dr,cropOperations:fr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===D.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new $e;return e.operation=t,e}_createFilterControl(t){let e=new ee;return e.filter=t,e}_createToggleControl(t){let e=new Te;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===D.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===D.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===D.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===D.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of G){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(ie(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=Ae([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of G){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};mi.template=`
{{*operationTooltip}}
${G.map(Ko).join("")}
${G.map(Go).join("")}
`;var Se=class extends _{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return F("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};Se.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Se.template=`
{{text}}
`;var gi=class extends _{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};gi.template=`
`;var bi={transition:"transition",visible:"visible",hidden:"hidden"},_i=class extends _{constructor(){super(),this._visible=!1,this._visibleStyle=bi.visible,this._hiddenStyle=bi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Sr(this,{[bi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(bi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};_i.template=" ";var yi=class extends _{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var ls=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Yo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},Pr=function(s,i="i"){let t=s.split("*").map(Yo);return new RegExp("^"+t.join(".+")+"$",i)};var Zo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Mr({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Zo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Nr=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},Dr=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Fr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var vi=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=N(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=Pr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Mr(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Fr(n),o.toString()}mountIframe(){let t=le({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Nr("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Dr("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};vi.template=`
{{activityCaption}}
{{counter}}
`;var ke=class extends _{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;N(i).forEach(e=>{let r=le({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ke.bindAttributes({"tab-list":null,default:null});ke.template=`
`;var se=class extends v{constructor(){super(...arguments);h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);h(this,"init$",{...this.init$,output:null,filesData:null})}get dict(){return se.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer),this.hasAttribute(this.dict.INPUT_REQUIRED))){let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=!0,this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(t){if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer.innerHTML="";let e=t.groupData?[t.groupData.cdnUrl]:t.map(r=>r.cdnUrl);for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r,this._dynamicInputsContainer.appendChild(n)}this.hasAttribute(this.dict.INPUT_REQUIRED)&&(this._validationInputElement.value=e.length?"__VALUE__":"")}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)}},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t){this.$.output=null,this.$.filesData=null;return}if(this.$.filesData=t,this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR)){let e=t.map(o=>o.uuid),r=await this.getUploadClientOptions(),n=await Rs(e,{...r});this.$.output={groupData:n,files:t}}else this.$.output=t},!1)}};se.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var as=class extends g{};var Ci=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};Ci.template=``;var Y={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},Vr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},it=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:Y.PLAY,fsIcon:Y.FS_ON,volIcon:Y.VOL_ON,capIcon:Y.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?Vr.exitFullscreen():Vr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===Y.CAP_OFF?(this.$.capIcon=Y.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(it.is+":captions","1")):(this.$.capIcon=Y.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(it.is+":captions"))}toggleSound(){this.$.volIcon===Y.VOL_ON?(this.$.volIcon=Y.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=Y.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(it.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(it.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=Y.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=Y.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=Y.FS_OFF:this.$.fsIcon=Y.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(it.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};it.template=`
{{currentTime}} / {{totalTime}}
`;it.bindAttributes({video:"video",src:"src"});var Jo="css-src";function wi(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),We({element:this,attribute:Jo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ie=class extends wi(_){};var Ti=class extends _{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(Ti,"template",`Powered by Uploadcare`);var kt=class extends Ie{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",ze(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var xi=class extends kt{};xi.template=``;var Ei=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};Ei.template=``;var Ai=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};Ai.template=``;var cs=class extends wi(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function hs(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var us="LR";async function Qo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[us]){t(window[us]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[us];i&&hs(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,as as ActivityHeader,zt as BaseComponent,_ as Block,oi as CameraSource,cs as CloudImageEditor,ls as CloudImageEditorActivity,at as CloudImageEditorBlock,ti as Config,ai as ConfirmationDialog,Ti as Copyright,ui as CropFrame,$ as Data,se as DataOutput,ye as DropArea,Te as EditorCropButtonControl,ee as EditorFilterControl,pi as EditorImageCropper,os as EditorImageFader,$e as EditorOperationControl,fi as EditorScroller,di as EditorSlider,mi as EditorToolbar,vi as ExternalSource,_t as FileItem,we as FilePreview,Ai as FileUploaderInline,Ei as FileUploaderMinimal,xi as FileUploaderRegular,ge as Icon,Zi as Img,gi as LineLoaderUi,Se as LrBtnUi,si as MessageBox,he as Modal,Gs as PACKAGE_NAME,Ks as PACKAGE_VERSION,_i as PresenceToggle,hi as ProgressBar,ci as ProgressBarCommon,Ci as Select,Ie as ShadowWrapper,_e as SimpleBtn,yi as SliderUi,ve as SourceBtn,es as SourceList,Ji as StartFrom,ke as Tabs,ss as UploadCtxProvider,li as UploadDetails,ri as UploadList,v as UploaderBlock,ni as UrlSource,it as Video,Qo as connectBlocksFrom,hs as registerBlocks,wi as shadowed,gt as toKebabCase}; \ No newline at end of file +var Or=Object.defineProperty;var Lr=(s,i,t)=>i in s?Or(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(Lr(s,typeof i!="symbol"?i+"":i,t),t);var Ur=Object.defineProperty,Rr=(s,i,t)=>i in s?Ur(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,bi=(s,i,t)=>(Rr(s,typeof i!="symbol"?i+"":i,t),t);function Pr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Pr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),rs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Mr=rs.length-1,Jt=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Dr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var is="__default__";function Fr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||is;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=is;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Vr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Br(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Nr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ns(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var we="{{",Zt="}}",zr="skip-text";function jr(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(zr))&&r.textContent.includes(we)&&r.textContent.includes(Zt)&&1}});for(;i=e.nextNode();)t.push(i);return t}var Hr=function(s,i){jr(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(Zt);)e.textContent.startsWith(we)?(n=e.textContent.indexOf(Zt)+Zt.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(we),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(we,"").replace(Zt,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},Wr=[Dr,Fr,Vr,Br,Hr],Te="'",Dt='"',Xr=/\\([0-9a-fA-F]{1,6} ?)/g;function qr(s){return(s[0]===Dt||s[0]===Te)&&(s[s.length-1]===Dt||s[s.length-1]===Te)}function Gr(s){return(s[0]===Dt||s[0]===Te)&&(s=s.slice(1)),(s[s.length-1]===Dt||s[s.length-1]===Te)&&(s=s.slice(0,-1)),s}function Kr(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ +`,"\\n"),i=Kr(i),i=Dt+i+Dt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ss=0,Nt=null,dt=null,vt=class extends HTMLElement{constructor(){super(),bi(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Jt.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ns(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Wr)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);dt==null||dt.delete(this.updateCssData),dt!=null&&dt.size||(Nt==null||Nt.disconnect(),Nt=null,dt=null)},100)))}static reg(s,i=!1){s||(ss++,s=`${C.AUTO_TAG_PRFX}-${ss}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=Yr(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){dt||(dt=new Set),dt.add(this.updateCssData),Nt||(Nt=new MutationObserver(s=>{s[0].type==="attributes"&&dt.forEach(i=>{i()})}),Nt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},Ft=vt;bi(Ft,"template");var _i=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(_i.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),_i.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};_i.appMap=Object.create(null);function yi(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function Zr(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function Qt(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&Zr(i,s.attributes),s.styles&&yi(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=Qt(t);i.appendChild(e)}),i}var os="idb-store-ready",Jr="symbiote-db",Qr="symbiote-idb-update_",tn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(os,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return Qr+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,ls.clear(this.name)}},ls=class{static get readyEventName(){return os}static open(s=Jr,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new tn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};bi(ls,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var en="--uploadcare-blocks-window-height",xe="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function vi(){return typeof window[xe]=="undefined"?!1:!!window[xe]}function as(){if(vi())return;let s=()=>{document.documentElement.style.setProperty(en,`${window.innerHeight}px`),window[xe]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[xe]=!1,window.removeEventListener("resize",i)}}var sn=s=>s,Ci="{{",hs="}}",cs="plural:";function te(s,i,t={}){var o;let{openToken:e=Ci,closeToken:r=hs,transform:n=sn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function us(s){let i=[],t=s.indexOf(Ci);for(;t!==-1;){let e=s.indexOf(hs,t),r=s.substring(t+2,e);if(r.startsWith(cs)){let n=s.substring(t+2,e).replace(cs,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Ci,e)}return i}function ds(s){return Object.prototype.toString.call(s)==="[object Object]"}var rn=/\W|_/g;function nn(s){return s.split(rn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function ps(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return ps(s,{ignoreKeys:i});if(!ds(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ds(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=ps(r,{ignoreKeys:i})),t[nn(e)]=r}return t}var on=s=>new Promise(i=>setTimeout(i,s));function Si({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var ln={factor:2,time:100};function an(s,i=ln){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>on(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var Vt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,Vt.prototype),this.originalProgressEvent=t}},Ae=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},cn=500,ms=({check:s,interval:i=cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ae(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},$e="application/octet-stream",gs="original",wt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ae(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,_=a.status;o({request:d,data:f,headers:m,status:_})}},a.onerror=d=>{u||l(new Vt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function hn(s,...i){return s}var un=({name:s})=>s?[s]:[],dn=hn,pn=()=>new FormData,_s=s=>!1,Se=s=>typeof Blob!="undefined"&&s instanceof Blob,ke=s=>typeof File!="undefined"&&s instanceof File,Ie=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",Bt=s=>Se(s)||ke(s)||_s()||Ie(s),fn=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",mn=s=>!!s&&typeof s=="object"&&!Array.isArray(s),gn=s=>!!s&&typeof s=="object"&&"data"in s&&Bt(s.data);function _n(s,i,t){if(gn(t)){let{name:e,contentType:r}=t,n=dn(t.data,e,r!=null?r:$e),o=un({name:e,contentType:r});s.push([i,n,...o])}else if(mn(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else fn(t)&&t&&s.push([i,t.toString()])}function bn(s){let i=[];for(let[t,e]of Object.entries(s))_n(i,t,e);return i}function ki(s){let i=pn(),t=bn(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var U=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,U.prototype)}},yn=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},pt=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=yn(t)),e.toString()},vn="6.7.0",Cn="UploadcareUploadClient",wn=vn;function Ot(s){return Si({libraryName:Cn,libraryVersion:wn,...s})}var Tn="RequestThrottledError",fs=15e3,xn=1e3;function En(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return fs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:fs}function Tt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return an(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Tn&&r{let i="";return(Se(s)||ke(s)||Ie(s))&&(i=s.type),i||$e},ys=s=>{let i="";return ke(s)&&s.name?i=s.name:Se(s)||_s()?i="":Ie(s)&&s.name&&(i=s.name),i||gs};function Ii(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function An(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({file:{data:s,name:t||ys(s),contentType:e||bs(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ii(l),signature:n,expire:o,source:u,metadata:_}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var xi;(function(s){s.Token="token",s.FileInfo="file_info"})(xi||(xi={}));function $n(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},url:pt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Ii(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:_}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var H;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(H||(H={}));var Sn=s=>"status"in s&&s.status===H.Error;function kn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return Tt(()=>wt({method:"GET",headers:i?{"X-UC-User-Agent":Ot({publicKey:i,integration:r,userAgent:n})}:void 0,url:pt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Sn(d))throw new U(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function In(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:a,userAgent:c})},url:pt(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let _=mt(JSON.parse(p));if("error"in _)throw new U(_.error.content,_.error.errorCode,f,_,m);return _}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function vs(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"GET",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},url:pt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function On(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({filename:e||gs,size:s,content_type:t||$e,part_size:r,UPLOADCARE_STORE:Ii(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:_}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(z=>w.parts[z]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Ln(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||$e}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Un(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",url:pt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},data:ki({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Oi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return ms({check:u=>vs(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function Rn(s){return"defaultEffects"in s}var ft=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:n}=i,o=pt(t,`${r}/`),l=n?pt(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Rn(i)&&(this.defaultEffects=i.defaultEffects)}},Pn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:_,metadata:A})=>An(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>Oi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new ft(x,{baseCDN:_})),Mn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>vs(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new ft(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Nn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ae(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Dn=window.WebSocket,Ei=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Fn=(s,i)=>s==="success"?{status:H.Success,...i}:s==="progress"?{status:H.Progress,...i}:{status:H.Error,...i},Ai=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Ei);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Dn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Fn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},wi=null,Li=s=>{if(!wi){let i=typeof window=="undefined"?0:3e4;wi=new Ai(s,i)}return wi},Vn=s=>{Li(s).connect()};function Bn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return ms({check:c=>kn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case H.Error:return new U(u.error,u.errorCode);case H.Waiting:return!1;case H.Unknown:return new U(`Token "${s}" was not found.`);case H.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case H.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var zn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=Li(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ae(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case H.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case H.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case H.Error:a(),n(new U(c.msg,c.error_code))}})}),jn=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Vn(A)).then(()=>$n(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,metadata:x})).catch(T=>{let w=Li(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===xi.FileInfo?T:Nn([({signal:w})=>Bn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:w}),({signal:w})=>zn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof U)throw T;return T}).then(T=>Oi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:u})).then(T=>new ft(T,{baseCDN:r})),Ti=new WeakMap,Hn=async s=>{if(Ti.has(s))return Ti.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ti.set(s,i),i},Cs=async s=>{if(ke(s)||Se(s))return s.size;if(Ie(s))return(await Hn(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},Wn=(s,i=E.multipartMinFileSize)=>s>=i,ws=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!Bt(s)&&t.test(s)},Ui=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!Bt(s)&&t.test(s)},Xn=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},Gn=async(s,i,t)=>e=>qn(s,e,i,t),Kn=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Ln(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Yn=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:_,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let z=e!=null?e:await Cs(s),ht,It=(L,j)=>{if(!c)return;ht||(ht=Array(L).fill(0));let tt=it=>it.reduce((ut,gi)=>ut+gi,0);return it=>{it.isComputable&&(ht[j]=it.value,c({isComputable:!0,value:tt(ht)/L}))}};return _||(_=bs(s)),On(z,{publicKey:i,contentType:_,fileName:t||ys(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:L,parts:j})=>{let tt=await Gn(s,z,A);return Promise.all([L,Xn(x,j.map((it,ut)=>()=>Kn(tt(ut),it,{publicKey:i,contentType:_,onProgress:It(j.length,ut),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([L])=>Un(L,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(L=>L.isReady?L:Oi({file:L.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(L=>new ft(L,{baseCDN:T}))};async function Ri(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:_,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,pusherKey:ht,metadata:It}){if(Bt(s)){let L=await Cs(s);return Wn(L,_)?Yn(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:L,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Pn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Ui(s))return jn(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(ws(s))return Mn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var $i=class{constructor(i,{baseCDN:t=E.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,n)=>r+n.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new ft(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Zn=s=>{for(let i of s)if(!Bt(i))return!1;return!0},Jn=s=>{for(let i of s)if(!ws(i))return!1;return!0},Qn=s=>{for(let i of s)if(!Ui(i))return!1;return!0};function Ts(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!Zn(s)&&!Qn(s)&&!Jn(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let z,ht=!0,It=s.length,L=(j,tt)=>{if(!a)return;z||(z=Array(j).fill(0));let it=ut=>ut.reduce((gi,Ir)=>gi+Ir)/j;return ut=>{if(!ut.isComputable||!ht){ht=!1,a({isComputable:!1});return}z[tt]=ut.value,a({isComputable:!0,value:it(z)})}};return Promise.all(s.map((j,tt)=>Bt(j)||Ui(j)?Ri(j,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:L(It,tt),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}).then(it=>it.uuid):j)).then(j=>In(j,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(tt=>new $i(tt,{baseCDN:A})).then(tt=>(a&&a({isComputable:!0,value:1}),tt)))}var Ee=class{constructor(i){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(o=>r(o)).catch(o=>n(o))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var Pi=()=>({"*blocksRegistry":new Set}),Mi=s=>({...Pi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),Oe=s=>({...Mi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Ee(1)});function xs(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var W=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Es=new Set;function Le(s){Es.has(s)||(Es.add(s),console.warn(s))}var Ue=(s,i)=>new Intl.PluralRules(s).select(i);var Re=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var Ni="lr-",b=class extends Ft{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Pi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(xs),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=us(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return te(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=Ue(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ni}${t}`,!0),vi()||(this._destroyInnerHeightTracker=as()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Re({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?te(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=W(r);return this.$[o]=n,!0},get:(e,r)=>{let n=W(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Le("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(W(t));r.ctx.has(r.name)?this.sub(W(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ni)?t:Ni+t)}};h(b,"StateConsumerScope",null),h(b,"className","");var ee=class extends b{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(ee,"StateConsumerScope","modal");ee.template=``;var As="active",ie="___ACTIVITY_IS_ACTIVE___",st=class extends b{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Mi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ie]=!1,this.removeAttribute(As),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ie]=!0,this.setAttribute(As,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ie]?this._deactivate():this.activityType===t&&!this[ie]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ie]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var se=33.333333333333336,y=1,Di=24,$s=6;function Lt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function J(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Lt(t,i),t}function Ss(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function ks(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Is(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function Os({rect:s,delta:[i,t],imageBox:e}){return jt({...s,x:s.x+i,y:s.y+t},e)}function jt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function to({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Ps(s,i){return Math.abs(s.width/s.height-i)<.1}function Ht({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function Ms(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Wt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function xt(s,i,t){return Math.min(Math.max(s,i),t)}var Me=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var Q=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Ns=s=>s?s.split(",").map(i=>i.trim()):[],Ut=s=>s?s.join(","):"";var Ds="blocks",Fs="0.27.6";function Vs(s){return Si({...s,libraryName:Ds,libraryVersion:Fs})}var Bs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ne=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Bs(i)).join("/-/"),R=(...s)=>{let i=Ne(...s);return i?`-/${i}/`:""};function zs(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function js(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Hs(s){let i=Ws(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Bs(n))}function Ws(s){let i=new URL(s),t=zs(s),e=Xs(t)?qs(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Xs(s){return s.startsWith("http")}function qs(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(Ws(s));if(t=t||zs(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Xs(t)){let r=qs(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},Et=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var P=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var re=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Fi=s=>s?s.filter(i=>typeof i=="string").map(i=>P(i)).flat():[],Vi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),Gs=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),ne=s=>{let i=s==null?void 0:s.type;return i?Vi(i,re):!1};var nt=1e3,Rt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),oe=s=>Math.ceil(s*100)/100,Ks=(s,i=Rt.AUTO)=>{let t=i===Rt.AUTO;if(i===Rt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(M,"_timeoutStore",Object.create(null));var Ys="[Typed State] Wrong property name: ",ao="[Typed State] Wrong property type: ",De=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||Jt.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(ao+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Fe=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||Jt.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){this.__collectionObservers.delete(i)}add(i){let t=new De(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){this.__propertyObservers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var Zs=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:ft,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",Oe(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_flushOutputItems",S(()=>{let t=this.getOutputData();t.length===this.uploadCollection.size&&(M.emit(new F({type:X.DATA_OUTPUT,ctx:this.ctxName,data:t})),this.$["*outputData"]=t)},100));h(this,"_handleCollectonUpdate",(t,e,r)=>{var n;this._runValidators();for(let o of r)(n=o==null?void 0:o.getValue("abortController"))==null||n.abort(),o==null||o.setValue("abortController",null),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl"));this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushOutputItems()});h(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,M.emit(new F({type:X.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&M.emit(new F({type:X.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{M.emit(new F({type:X.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{M.emit(new F({type:X.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{M.emit(new F({type:X.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){Le("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Fe({typedSchema:Zs,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectonUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){var t,e;super.destroyCallback(),this.isUploadCollectionOwner&&((t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this))}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:ne(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:ne(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Ut(Fi([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?re:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Ut(re)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:Q.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=P(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);M.emit(new F({type:X.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),M.emit(new F({type:X.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Fi([...e?re:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Vi(o,n),c=Gs(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:Ks(e)})}_validateMultipleLimit(t){let e=this.uploadCollection.items(),r=e.indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMin:1,o=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&e.length=o)return this.l10n("files-count-allowed",{count:o})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=Me(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=Ms(l,a,c),d=R(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Vs,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return(t?this.uploadCollection.findItems(t):this.uploadCollection.items()).forEach(n=>{var c,u;let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,originalFilename:o.fileName,size:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:(u=(c=o.cdnUrl)!=null?c:l.cdnUrl)!=null?u:null,validationErrorMessage:o.validationErrorMsg,uploadError:o.uploadError,isUploaded:!!o.uuid&&!!o.fileInfo,isValid:!o.validationErrorMsg&&!o.uploadError};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});var Y={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function co(s,i){if(typeof i=="number")return Y[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Y[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Y[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var Qs=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function At(s){return Ne(...Qs.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return co(i,t)}).filter(i=>!!i))}var Ve=Ne("format/auto","progressive/yes"),_t=([s])=>typeof s!="undefined"?Number(s):void 0,Js=()=>!0,ho=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),uo=([s,i])=>({dimensions:P(s,"x").map(Number),coords:P(i).map(Number)}),po={enhance:_t,brightness:_t,exposure:_t,gamma:_t,contrast:_t,saturation:_t,vibrance:_t,warmth:_t,filter:ho,mirror:Js,flip:Js,rotate:_t,crop:uo};function tr(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!Qs.includes(e))continue;let n=po[e],o=n(r);i[e]=o}return i}var N=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),q=[N.CROP,N.TUNING,N.FILTERS],er=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],ir=["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"],sr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Y.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Y.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Y.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Y.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Y.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Y.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Y.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Y.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Y.filter,range:[0,100],keypointsNumber:1}});var fo="https://ucarecdn.com",mo="https://upload.uploadcare.com",go="https://social.uploadcare.com",$t={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Ut(q),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:fo,baseUrl:mo,socialBaseUrl:go,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var G=s=>String(s),lt=s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},k=s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},_o=s=>s==="auto"?s:k(s),bo={pubkey:G,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:G,externalSourcesPreferredTypes:G,store:_o,cameraMirror:k,sourceList:G,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:G,removeCopyright:k,cropPreset:G,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:G,cdnCname:G,baseUrl:G,socialBaseUrl:G,secureSignature:G,secureExpire:G,secureDeliveryProxy:G,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:G},rr=(s,i)=>{if(!(typeof i=="undefined"||i===null))try{return bo[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),$t[s]}};var Be=Object.keys($t),yo=["metadata"],vo=s=>yo.includes(s),ze=Be.filter(s=>!vo(s)),Co={...Object.fromEntries(ze.map(s=>[gt(s),s])),...Object.fromEntries(ze.map(s=>[s.toLowerCase(),s]))},wo={...Object.fromEntries(Be.map(s=>[gt(s),W(s)])),...Object.fromEntries(Be.map(s=>[s.toLowerCase(),W(s)]))},je=class extends b{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries($t).map(([t,e])=>[W(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of ze)this.sub(W(e),r=>{r!==$t[e]&&(t[e]=r)},!1);for(let e of Be){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,ze.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[W(e)]!==n&&(typeof n=="undefined"||n===null?this.$[W(e)]=$t[e]:this.$[W(e)]=n)},get:()=>this.$[W(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Co[t],o=rr(n,r),l=o!=null?o:$t[n],a=this;a[n]=l}};je.bindAttributes(wo);var le=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};le.template=``;le.bindAttributes({name:"name",size:"size"});var To="https://ucarecdn.com",Pt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:To},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var nr=s=>[...new Set(s)];var ae="--lr-img-",or="unresolved",Xt=2,qt=3,lr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),cr=Object.create(null),ar;for(let s in Pt)cr[ae+s]=((ar=Pt[s])==null?void 0:ar.default)||"";var He=class extends Ft{constructor(){super(...arguments);h(this,"cssInit$",cr)}$$(t){return this.$[ae+t]}set$$(t){for(let e in t)this.$[ae+e]=t[e]}sub$$(t,e){this.sub(ae+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!lr&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return R(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Pt.format.default}`,`quality/${this.$$("quality")||Pt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(lr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?te(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(or,""),this.img.onload=()=>{this.img.removeAttribute(or)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Pt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?nr(P(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Xt+"x")}") ${n*Xt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*qt+"x")}") ${n*qt}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Xt))}") ${Xt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,qt))}") ${qt}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Xt+"x")+` ${e*Xt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*qt+"x")+` ${e*qt}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Pt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[ae+t]=r})}};var Bi=class extends He{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var ce=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};ce.template=``;ce.bindAttributes({dropzone:null});var zi=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function xo(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Eo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function hr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(xo(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var V={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},ur=["focus"],Ao=100,ji=new Map;function $o(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function Hi(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=V.INACTIVE,o=f=>{s.shouldIgnore()&&f!==V.INACTIVE||(n!==f&&e.forEach(_=>_(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(V.INACTIVE)},c=()=>{i+=1,n===V.INACTIVE&&o(V.ACTIVE)},u=()=>{i-=1,l()||o(V.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(V.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let _=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor($o(_,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let _=await hr(f.dataTransfer);s.onItems(_),o(V.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),ur.forEach(f=>{window.addEventListener(f,a)}),()=>{ji.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),ur.forEach(f=>{window.removeEventListener(f,a)})}}var he=class extends v{constructor(){super(),this.init$={...this.init$,state:V.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=Hi({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:Q.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:Q.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Hi({element:i,onChange:t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=P(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};he.template=`
{{text}}
`;he.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var So="src-type-",ue=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${So}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ue.template=`
`;ue.bindAttributes({type:null});var Wi=class extends b{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=P(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function dr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function pr(s="#fff",i="rgba(0, 0, 0, .1)"){return dr(``)}function de(s="hsl(209, 21%, 65%)",i=32,t=32){return dr(``)}function fr(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var B=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),bt=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:B.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=B.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=B.FAILED:t.getValue("validationMultipleLimitMsg")?e=B.LIMIT_OVERFLOW:t.getValue("isUploading")?e=B.UPLOADING:t.getValue("fileInfo")&&(e=B.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(Et(this.cfg.cdnCname,this._entry.getValue("uuid")),R(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await fr(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{bt.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),bt.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===B.FAILED,isLimitOverflow:t===B.LIMIT_OVERFLOW,isUploading:t===B.UPLOADING,isFinished:t===B.FINISHED,progressVisible:t===B.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===B.FAILED||t===B.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===B.FINISHED&&(this.$.badgeIcon="badge-success"),t===B.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),bt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));M.emit(new F({type:X.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Ri(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof U?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};bt.template=`
{{itemName}}{{errorText}}
`;bt.activeInstances=new Set;var We=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},Xe=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};Xe.template=`
{{captionTxt}}
{{msgTxt}}
`;var qe=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new We,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate)}};qe.template=`{{headerText}}
`;var Ge=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:Q.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};Ge.template=`
`;var Xi=()=>typeof navigator.permissions!="undefined";var Ke=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:Xi(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{Xi()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:Q.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};Ke.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var qi=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var Ye=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=de(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=ne(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,R("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};Ye.template=`
{{fileSize}}
{{errorTxt}}
`;var Gi=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},Ze=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new Gi);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};Ze.template=`{{activityCaption}}
{{messageTxt}}
`;var Je=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};Je.template=``;var Qe=class extends b{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};Qe.template='
';var Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var pe=class extends b{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:Z})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${pr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=Z}};pe.template='';pe.bindAttributes({checkerboard:"checkerboard"});var mr="--cfg-ctx-name",O=class extends b{get cfgCssCtxName(){return this.getCssData(mr,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(mr,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function gr(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function D(...s){let i=gr(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function _r(s,...i){let t=gr(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var br=s=>{if(!s)return q;let i=Ns(s).filter(t=>q.includes(t));return i.length===0?q:i};function yr(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":q,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:Z,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Ut(q),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Z,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=R(At(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var vr=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends O{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...yr(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===N.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=js(this.$.cdnUrl);this.$["*originalUrl"]=Et(this.$.cdnUrl,t);let e=Hs(this.$.cdnUrl),r=tr(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=Et(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],R("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===N.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==Z&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||Z)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Me(t)}),this.sub("tabs",t=>{this.$["*tabList"]=br(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=D("image",{image_hidden_to_cropper:t===N.CROP,image_hidden_effects:t!==N.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=R(At(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=vr;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ti=class extends O{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=J("mask",{id:"backdrop-mask"}),a=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=J("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Lt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Lt(n,f)}else{let f=xt(Math.min(d,p)/(24*2+34)/2,0,1),{d:_,center:A}=a?Ss(i,e,f):ks(i,e,f),x=Math.max(Di*xt(Math.min(d,p)/Di/3,0,1),$s);Lt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Lt(r,{d:_})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",D("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Lt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=J("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=J("rect",{fill:"transparent"}),l=J("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=J("svg"),t=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=J("line",{x1:`${se*e}%`,y1:"0%",x2:`${se*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=J("line",{x1:"0%",y1:`${se*e}%`,x2:"100%",y2:`${se*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=Os({rect:o,delta:[e,r],imageBox:n}):o=Ls({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return jt(Wt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Us(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Is(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",D("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",D({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ti.template='';var yt=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=D({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Io(s){let i=s+90;return i=i>=360?0:i,i}function Oo(s,i){return s==="rotate"?Io(i):["mirror","flip"].includes(s)?!i:null}var fe=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=Oo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var me={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",ei=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?me.FILTER:me.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===me.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===me.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===me.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};ei.template=``;function ge(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Z)}}}function _e(s){let i=[];for(let n of s){let o=ge(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var Gt=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,R(Ve,At(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=ge(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};Gt.template=`
`;var be=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Cr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function wr(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function Kt(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,R(Ve,At(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function Lo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var ii=class extends O{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Cr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=wr(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Ht({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Wt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,_]}=n,{width:A}=Ht(this._imageSize,r),x=o/A;i=jt(Wt({x:l+f*x,y:a+_*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Rs(i,t)||u&&!Ps(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=jt(Wt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Ht({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=D({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Ht(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[xt(Math.round(c/d),1,l),xt(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Ht(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,_=this._getCropDimensions(),A={dimensions:_,coords:[xt(Math.round((d-l)/m),0,c-_[0]),xt(Math.round((p-a)/f),0,u-_[1])]};if(!Lo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(_[0]===c&&_[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=D({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(Kt(i,e,t)),{promise:n,cancel:o,image:l}=ge(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};ii.template=``;function Ki(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Uo(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Po(s,i){return s.map((t,e)=>tn-o)}var Yi=class extends O{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(Kt(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Ro(r,t,e),o=Po(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=_e(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Tr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=_e(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Tr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=D({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Mo=1,si=class extends O{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Mo?this.scrollLeft+=e:this.scrollLeft+=t})}};si.template=" ";function No(s){return``}function Do(s){return`
`}var ri=class extends O{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===N.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===N.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":N.CROP,showLoader:!1,filters:ir,colorOperations:er,cropOperations:sr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===N.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new be;return e.operation=t,e}_createFilterControl(t){let e=new Gt;return e.filter=t,e}_createToggleControl(t){let e=new fe;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===N.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===N.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===N.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===N.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of q){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(Kt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=_e([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of q){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};ri.template=`
{{*operationTooltip}}
${q.map(Do).join("")}
${q.map(No).join("")}
`;var ye=class extends b{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return D("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};ye.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ye.template=`
{{text}}
`;var ni=class extends b{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};ni.template=`
`;var oi={transition:"transition",visible:"visible",hidden:"hidden"},li=class extends b{constructor(){super(),this._visible=!1,this._visibleStyle=oi.visible,this._hiddenStyle=oi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",_r(this,{[oi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(oi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};li.template=" ";var ai=class extends b{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var Zi=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Fo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},xr=function(s,i="i"){let t=s.split("*").map(Fo);return new RegExp("^"+t.join(".+")+"$",i)};var Vo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Er({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Vo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Ar=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},$r=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Sr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var ci=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=P(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=xr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Er(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Sr(n),o.toString()}mountIframe(){let t=Qt({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Ar("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&$r("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};ci.template=`
{{activityCaption}}
{{counter}}
`;var ve=class extends b{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;P(i).forEach(e=>{let r=Qt({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ve.bindAttributes({"tab-list":null,default:null});ve.template=`
`;var Yt=class extends v{constructor(){super();h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,output:null}}get dict(){return Yt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer);let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=this.hasAttribute(this.dict.INPUT_REQUIRED),t.tabIndex=-1,yi(t,{opacity:0,height:0,width:0}),this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&this._dynamicInputsContainer){this._dynamicInputsContainer.innerHTML="";let e;Array.isArray(t)?e=t.map(r=>r.cdnUrl):t!=null&&t.groupData?e=[t.groupData.cdnUrl]:e=[];for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r!=null?r:"",this._dynamicInputsContainer.appendChild(n)}if(this._validationInputElement){this._validationInputElement.value=e.length?"__VALUE__":"";let r=this.$["*message"];r!=null&&r.isError?this._validationInputElement.setCustomValidity(`${r.caption}. ${r.text}`):this._validationInputElement.setCustomValidity("")}}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t||!t.length){this.$.output=null;return}if(t.every(r=>r.isUploaded)&&(this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR))){let r=t.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:""));if(!t.every(a=>a.isValid)){this.$.output={groupData:void 0,files:t};return}let o=await this.getUploadClientOptions(),l=await Ts(r,o);this.$.output={groupData:l,files:t}}else this.$.output=t},!1)}};Yt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var Ji=class extends g{};var hi=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};hi.template=``;var K={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},kr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},et=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:K.PLAY,fsIcon:K.FS_ON,volIcon:K.VOL_ON,capIcon:K.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?kr.exitFullscreen():kr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===K.CAP_OFF?(this.$.capIcon=K.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(et.is+":captions","1")):(this.$.capIcon=K.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(et.is+":captions"))}toggleSound(){this.$.volIcon===K.VOL_ON?(this.$.volIcon=K.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=K.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(et.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(et.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=K.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=K.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=K.FS_OFF:this.$.fsIcon=K.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(et.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};et.template=`
{{currentTime}} / {{totalTime}}
`;et.bindAttributes({video:"video",src:"src"});var Bo="css-src";function ui(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Re({element:this,attribute:Bo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ce=class extends ui(b){};var di=class extends b{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(di,"template",`Powered by Uploadcare`);var kt=class extends Ce{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Oe(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var pi=class extends kt{};pi.template=``;var fi=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};fi.template=``;var mi=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};mi.template=``;var Qi=class extends ui(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function ts(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var es="LR";async function zo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[es]){t(window[es]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[es];i&&ts(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,Ji as ActivityHeader,Ft as BaseComponent,b as Block,Ke as CameraSource,Qi as CloudImageEditor,Zi as CloudImageEditorActivity,at as CloudImageEditorBlock,je as Config,Ze as ConfirmationDialog,di as Copyright,ti as CropFrame,$ as Data,Yt as DataOutput,he as DropArea,fe as EditorCropButtonControl,Gt as EditorFilterControl,ii as EditorImageCropper,Yi as EditorImageFader,be as EditorOperationControl,si as EditorScroller,ei as EditorSlider,ri as EditorToolbar,ci as ExternalSource,bt as FileItem,pe as FilePreview,mi as FileUploaderInline,fi as FileUploaderMinimal,pi as FileUploaderRegular,le as Icon,Bi as Img,ni as LineLoaderUi,ye as LrBtnUi,Xe as MessageBox,ee as Modal,Ds as PACKAGE_NAME,Fs as PACKAGE_VERSION,li as PresenceToggle,Qe as ProgressBar,Je as ProgressBarCommon,hi as Select,Ce as ShadowWrapper,ce as SimpleBtn,ai as SliderUi,ue as SourceBtn,Wi as SourceList,zi as StartFrom,ve as Tabs,qi as UploadCtxProvider,Ye as UploadDetails,qe as UploadList,v as UploaderBlock,Ge as UrlSource,et as Video,zo as connectBlocksFrom,ts as registerBlocks,ui as shadowed,gt as toKebabCase}; \ No newline at end of file diff --git a/web/lr-file-uploader-minimal.min.css b/web/lr-file-uploader-minimal.min.css index 9b97650e8..a2f1e9edb 100644 --- a/web/lr-file-uploader-minimal.min.css +++ b/web/lr-file-uploader-minimal.min.css @@ -1 +1 @@ -:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z"}:where(.lr-wgt-common),:host{--cfg-multiple: 1;--cfg-confirm-upload: 0;--cfg-init-activity: "start-from";--cfg-done-activity: "upload-list";position:relative;display:block}lr-start-from{display:flex;flex-direction:column;gap:var(--gap-min);padding:0;overflow:hidden;text-align:center;background-color:transparent}lr-drop-area{display:flex;align-items:center;justify-content:center;width:100%;min-height:calc(var(--ui-size) + var(--gap-mid) * 2 + var(--gap-min) * 4);padding:0;line-height:140%;text-align:center;background-color:var(--clr-background);border-radius:var(--border-radius-frame);cursor:pointer}lr-upload-list lr-activity-header{display:none}lr-upload-list>.toolbar{background-color:transparent}lr-upload-list{width:100%;height:unset;padding:var(--gap-small);background-color:transparent;border:var(--border-dashed);border-radius:var(--border-radius-frame)}lr-upload-list .files{padding:0}lr-upload-list .toolbar{display:block;padding:0}lr-upload-list .toolbar .cancel-btn,lr-upload-list .toolbar .upload-btn,lr-upload-list .toolbar .done-btn{display:none}lr-upload-list .toolbar .add-more-btn{width:100%;height:calc(var(--ui-size) + var(--gap-mid) * 2);margin-top:var(--gap-small);background-color:var(--clr-background)}lr-upload-list .toolbar .add-more-btn[disabled]{display:none}lr-upload-list .toolbar .add-more-btn:hover{background-color:var(--clr-background-dark)}lr-upload-list .toolbar .add-more-btn>span{display:none}lr-file-item{background-color:var(--clr-background);border-radius:var(--border-radius-element)}lr-file-item .edit-btn{display:none}lr-file-item lr-progress-bar{top:0!important;height:100%!important}lr-file-item lr-progress-bar .progress{background-color:var(--clr-accent-lightest);border-radius:var(--border-radius-element)}lr-upload-list lr-drop-area{width:100%;height:100%;margin:0;border-radius:var(--border-radius-frame)} +:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-minimum: "At least {{count}} files are required";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z"}:where(.lr-wgt-common),:host{--cfg-multiple: 1;--cfg-confirm-upload: 0;--cfg-init-activity: "start-from";--cfg-done-activity: "upload-list";position:relative;display:block}lr-start-from{display:flex;flex-direction:column;gap:var(--gap-min);padding:0;overflow:hidden;text-align:center;background-color:transparent}lr-drop-area{display:flex;align-items:center;justify-content:center;width:100%;min-height:calc(var(--ui-size) + var(--gap-mid) * 2 + var(--gap-min) * 4);padding:0;line-height:140%;text-align:center;background-color:var(--clr-background);border-radius:var(--border-radius-frame);cursor:pointer}lr-upload-list lr-activity-header{display:none}lr-upload-list>.toolbar{background-color:transparent}lr-upload-list{width:100%;height:unset;padding:var(--gap-small);background-color:transparent;border:var(--border-dashed);border-radius:var(--border-radius-frame)}lr-upload-list .files{padding:0}lr-upload-list .toolbar{display:block;padding:0}lr-upload-list .toolbar .cancel-btn,lr-upload-list .toolbar .upload-btn,lr-upload-list .toolbar .done-btn{display:none}lr-upload-list .toolbar .add-more-btn{width:100%;height:calc(var(--ui-size) + var(--gap-mid) * 2);margin-top:var(--gap-small);background-color:var(--clr-background)}lr-upload-list .toolbar .add-more-btn[disabled]{display:none}lr-upload-list .toolbar .add-more-btn:hover{background-color:var(--clr-background-dark)}lr-upload-list .toolbar .add-more-btn>span{display:none}lr-file-item{background-color:var(--clr-background);border-radius:var(--border-radius-element)}lr-file-item .edit-btn{display:none}lr-file-item lr-progress-bar{top:0!important;height:100%!important}lr-file-item lr-progress-bar .progress{background-color:var(--clr-accent-lightest);border-radius:var(--border-radius-element)}lr-upload-list lr-drop-area{width:100%;height:100%;margin:0;border-radius:var(--border-radius-frame)} diff --git a/web/lr-file-uploader-minimal.min.js b/web/lr-file-uploader-minimal.min.js index 3f5bd8972..f83b81d2b 100644 --- a/web/lr-file-uploader-minimal.min.js +++ b/web/lr-file-uploader-minimal.min.js @@ -23,5 +23,5 @@ * SOFTWARE. * */ -var Mi=Object.defineProperty;var Pi=(e,i,t)=>i in e?Mi(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var u=(e,i,t)=>(Pi(e,typeof i!="symbol"?i+"":i,t),t),ce=(e,i,t)=>{if(!i.has(e))throw TypeError("Cannot "+t)};var L=(e,i,t)=>(ce(e,i,"read from private field"),t?t.call(e):i.get(e)),at=(e,i,t)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,t)},vt=(e,i,t,r)=>(ce(e,i,"write to private field"),r?r.call(e,t):i.set(e,t),t);var Mt=(e,i,t)=>(ce(e,i,"access private method"),t);function ki(e){for(let i in e){let t=[...i].reduce((r,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),r+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),e[i].reg&&e[i].reg(t)}}var Ni=Object.defineProperty,Di=(e,i,t)=>i in e?Ni(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,de=(e,i,t)=>(Di(e,typeof i!="symbol"?i+"":i,t),t);function $i(e){let i=t=>{var r;for(let s in t)((r=t[s])==null?void 0:r.constructor)===Object&&(t[s]=i(t[s]));return{...t}};return i(e)}var E=class{constructor(e){e.constructor===Object?this.store=$i(e):(this._storeIsProxy=!0,this.store=e),this.callbackMap=Object.create(null)}static warn(e,i){console.warn(`Symbiote Data: cannot ${e}. Prop name: `+i)}read(e){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(E.warn("read",e),null):this.store[e]}has(e){return this._storeIsProxy?this.store[e]!==void 0:this.store.hasOwnProperty(e)}add(e,i,t=!1){!t&&Object.keys(this.store).includes(e)||(this.store[e]=i,this.notify(e))}pub(e,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(e)){E.warn("publish",e);return}this.store[e]=i,this.notify(e)}multiPub(e){for(let i in e)this.pub(i,e[i])}notify(e){this.callbackMap[e]&&this.callbackMap[e].forEach(i=>{i(this.store[e])})}sub(e,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(E.warn("subscribe",e),null):(this.callbackMap[e]||(this.callbackMap[e]=new Set),this.callbackMap[e].add(i),t&&i(this.store[e]),{remove:()=>{this.callbackMap[e].delete(i),this.callbackMap[e].size||delete this.callbackMap[e]},callback:i})}static registerCtx(e,i=Symbol()){let t=E.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new E(e),E.globalStore.set(i,t)),t}static deleteCtx(e){E.globalStore.delete(e)}static getCtx(e,i=!0){return E.globalStore.get(e)||(i&&console.warn('State: wrong context UID - "'+e+'"'),null)}};E.globalStore=new Map;var _=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),We="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Fi=We.length-1,At=class{static generate(e="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function zi(e,i){[...e.querySelectorAll(`[${_.REPEAT_ATTR}]`)].forEach(t=>{let r=t.getAttribute(_.REPEAT_ITEM_TAG_ATTR),s;if(r&&(s=window.customElements.get(r)),!s){s=class extends i.BaseComponent{constructor(){super(),r||(this.style.display="contents")}};let o=t.innerHTML;s.template=o,s.reg(r)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(_.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=h=>{h.forEach((f,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(f)});else for(let p in f)l[m][p]=f[p];else{a||(a=new DocumentFragment);let p=new s;Object.assign(p.init$,f),a.appendChild(p)}}),a&&t.appendChild(a);let d=l.slice(h.length,l.length);for(let f of d)f.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let h=[];for(let d in o){let f=o[d];Object.defineProperty(f,"_KEY_",{value:d,enumerable:!0}),h.push(f)}c(h)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(_.REPEAT_ATTR),t.removeAttribute(_.REPEAT_ITEM_TAG_ATTR)})}var je="__default__";function ji(e,i){if(i.shadowRoot)return;let t=[...e.querySelectorAll("slot")];if(!t.length)return;let r={};t.forEach(s=>{let n=s.getAttribute("name")||je;r[n]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=je;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=r[o])==null||n.fr.appendChild(s)}),Object.values(r).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(n,s.slot)}else s.slot.remove()})}function Hi(e,i){[...e.querySelectorAll(`[${_.EL_REF_ATTR}]`)].forEach(t=>{let r=t.getAttribute(_.EL_REF_ATTR);i.ref[r]=t,t.removeAttribute(_.EL_REF_ATTR)})}function Wi(e,i){[...e.querySelectorAll(`[${_.BIND_ATTR}]`)].forEach(t=>{let s=t.getAttribute(_.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Vi(n.name.replace("-",""));s.push(o+":"+n.value),t.removeAttribute(n.name)}}),s.forEach(n=>{if(!n)return;let o=n.split(":").map(h=>h.trim()),l=o[0],a;l.indexOf(_.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(_.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(h=>h.trim());for(let h of c){let d;h.startsWith("!!")?(d="double",h=h.replace("!!","")):h.startsWith("!")&&(d="single",h=h.replace("!","")),i.sub(h,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,f):Xe(t,l,f)||(t[_.SET_LATER_KEY]||(t[_.SET_LATER_KEY]=Object.create(null)),t[_.SET_LATER_KEY][l]=f)})}}),t.removeAttribute(_.BIND_ATTR)})}var Pt="{{",wt="}}",Xi="skip-text";function Bi(e){let i,t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var n;return!((n=s.parentElement)!=null&&n.hasAttribute(Xi))&&s.textContent.includes(Pt)&&s.textContent.includes(wt)&&1}});for(;i=r.nextNode();)t.push(i);return t}var qi=function(e,i){Bi(e).forEach(r=>{let s=[],n;for(;r.textContent.includes(wt);)r.textContent.startsWith(Pt)?(n=r.textContent.indexOf(wt)+wt.length,r.splitText(n),s.push(r)):(n=r.textContent.indexOf(Pt),r.splitText(n)),r=r.nextSibling;s.forEach(o=>{let l=o.textContent.replace(Pt,"").replace(wt,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},Gi=[zi,ji,Hi,Wi,qi],kt="'",pt='"',Ki=/\\([0-9a-fA-F]{1,6} ?)/g;function Yi(e){return(e[0]===pt||e[0]===kt)&&(e[e.length-1]===pt||e[e.length-1]===kt)}function Ji(e){return(e[0]===pt||e[0]===kt)&&(e=e.slice(1)),(e[e.length-1]===pt||e[e.length-1]===kt)&&(e=e.slice(0,-1)),e}function Qi(e){let i="",t="";for(var r=0;rString.fromCodePoint(parseInt(r.trim(),16))),i=i.replaceAll(`\\ -`,"\\n"),i=Qi(i),i=pt+i+pt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${e}`)}}var He=0,ft=null,Y=null,tt=class extends HTMLElement{constructor(){super(),de(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=this.__boundCssProps)==null||e.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return tt}initCallback(){}__initCallback(){var e;this.__initialized||(this.__initialized=!0,(e=this.initCallback)==null||e.call(this))}render(e,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(_.USE_TPL);if(s){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(s))||document.querySelector(s);o?e=o.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(e||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(e==null?void 0:e.constructor)===DocumentFragment)t=e;else if((e==null?void 0:e.constructor)===String){let s=document.createElement("template");s.innerHTML=e,t=s.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(t,this)}let r=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=r,this.shadowRoot.prepend(s)}else r()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=At.generate(),this.style.setProperty(_.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(_.CSS_CTX_PROP,!0)}get ctxName(){var e;let i=((e=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=E.registerCtx({},this)),this.__localCtx}get nodeCtx(){return E.getCtx(this.ctxName,!1)||E.registerCtx({},this.ctxName)}static __parseProp(e,i){let t,r;if(e.startsWith(_.EXT_DATA_CTX_PRFX))t=i.nodeCtx,r=e.replace(_.EXT_DATA_CTX_PRFX,"");else if(e.includes(_.NAMED_DATA_CTX_SPLTR)){let s=e.split(_.NAMED_DATA_CTX_SPLTR);t=E.getCtx(s[0]),r=s[1]}else t=i.localCtx,r=e;return{ctx:t,name:r}}sub(e,i,t=!0){let r=n=>{this.isConnected&&i(n)},s=tt.__parseProp(e,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,r,t)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,r,t))})}notify(e){let i=tt.__parseProp(e,this);i.ctx.notify(i.name)}has(e){let i=tt.__parseProp(e,this);return i.ctx.has(i.name)}add(e,i,t=!1){let r=tt.__parseProp(e,this);r.ctx.add(r.name,i,t)}add$(e,i=!1){for(let t in e)this.add(t,e[t],i)}get $(){if(!this.__stateProxy){let e=Object.create(null);this.__stateProxy=new Proxy(e,{set:(i,t,r)=>{let s=tt.__parseProp(t,this);return s.ctx.pub(s.name,r),!0},get:(i,t)=>{let r=tt.__parseProp(t,this);return r.ctx.read(r.name)}})}return this.__stateProxy}set$(e,i=!1){for(let t in e){let r=e[t];i||![String,Number,Boolean].includes(r==null?void 0:r.constructor)?this.$[t]=r:this.$[t]!==r&&(this.$[t]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(_.CTX_OWNER_ATTR)&&this.getAttribute(_.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let e=this.constructor.__attrDesc;if(e)for(let i of Object.values(e))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(_.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(_.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(_.NAMED_DATA_CTX_SPLTR)){let t=i.split(_.NAMED_DATA_CTX_SPLTR),r=t[0].trim(),s=t[1].trim();if(r&&s){let n=E.getCtx(r,!1);n||(n=E.registerCtx({},r)),n.add(s,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var e;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(e=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:e.trim();if(i&&this.style.setProperty(_.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[_.SET_LATER_KEY]){for(let t in this[_.SET_LATER_KEY])Xe(this,t,this[_.SET_LATER_KEY][t]);delete this[_.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Gi)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${_.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(_.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(s):t.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);for(let e of this.tplProcessors)this.tplProcessors.delete(e);Y==null||Y.delete(this.updateCssData),Y!=null&&Y.size||(ft==null||ft.disconnect(),ft=null,Y=null)},100)))}static reg(e,i=!1){e||(He++,e=`${_.AUTO_TAG_PRFX}-${He}`),this.__tag=e;let t=window.customElements.get(e);if(t){!i&&t!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=Object.keys(e),this.__attrDesc=e}attributeChangedCallback(e,i,t){var r;if(i===t)return;let s=(r=this.constructor.__attrDesc)==null?void 0:r[e];s?this.__dataCtxInitialized?this.$[s]=t:this.init$[s]=t:this[e]=t}getCssData(e,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(e)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(e).trim();try{this.__cssDataCache[e]=Zi(t)}catch{!i&&console.warn(`CSS Data error: ${e}`),this.__cssDataCache[e]=null}}return this.__cssDataCache[e]}__extractCssName(e){return e.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){Y||(Y=new Set),Y.add(this.updateCssData),ft||(ft=new MutationObserver(e=>{e[0].type==="attributes"&&Y.forEach(i=>{i()})}),ft.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(e,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(e);let t=this.getCssData(this.__extractCssName(e),!0);t===null&&(t=i),this.add(e,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(e,i,t){let r="__"+e;this[r]=this[e],Object.defineProperty(this,e,{set:s=>{this[r]=s,t?window.setTimeout(()=>{i==null||i(s)}):i==null||i(s)},get:()=>this[r]}),this[e]=this[r]}static set shadowStyles(e){let i=new Blob([e],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(e){if(!this.__rootStylesLink){let i=new Blob([e],{type:"text/css"}),t=URL.createObjectURL(i),r=document.createElement("link");r.href=t,r.rel="stylesheet",this.__rootStylesLink=r}}},fe=tt;de(fe,"template");var he=class{static _print(e){console.warn(e)}static setDefaultTitle(e){this.defaultTitle=e}static setRoutingMap(e){Object.assign(this.appMap,e);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(e){this.__routingEventName=e}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let e={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))e.route=t.replace("?","");else if(t.includes("=")){let r=t.split("=");e.options[r[0]]=decodeURI(r[1])}else e.options[t]=!0}),e}static notify(){let e=this.readAddressBar(),i=this.appMap[e.route];if(i&&i.title&&(document.title=i.title),e.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${e.route}" not found...`);return}let t=new CustomEvent(he.routingEventName,{detail:{route:e.route,options:Object.assign(i||{},e.options)}});window.dispatchEvent(t)}static reflect(e,i={}){let t=this.appMap[e];if(!t){this._print("Wrong route: "+e);return}let r="?"+e;for(let n in i)i[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${i[n]}`;let s=t.title||this.defaultTitle||"";window.history.pushState(null,s,r),document.title=s}static applyRoute(e,i={}){this.reflect(e,i),this.notify()}static setSeparator(e){this._separator=e}static get separator(){return this._separator||"&"}static createRouterData(e,i){this.setRoutingMap(i);let t=E.registerCtx({route:null,options:null,title:null},e);return window.addEventListener(this.routingEventName,r=>{var s;t.multiPub({route:r.detail.route,options:r.detail.options,title:((s=r.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),he.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};he.appMap=Object.create(null);var Be="idb-store-ready",tr="symbiote-db",er="symbiote-idb-update_",ir=class{_notifyWhenReady(e=null){window.dispatchEvent(new CustomEvent(Be,{detail:{dbName:this.name,storeName:this.storeName,event:e}}))}get _updEventName(){return er+this.name}_getUpdateEvent(e){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:e}})}_notifySubscribers(e){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,e),window.dispatchEvent(this._getUpdateEvent(e))}constructor(e,i){this.name=e,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async s=>{s(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(e){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(e);return new Promise((r,s)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${e}"`))},t.onerror=n=>{s(n)}})}write(e,i,t=!1){let r={_key:e,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(e),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(e,i=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(e);return new Promise((s,n)=>{r.onsuccess=o=>{i||this._notifySubscribers(e),s(o)},r.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,r)=>{i.onsuccess=s=>{let n=s.target.result;t(n.map(o=>o._value))},i.onerror=s=>{r(s)}})}subscribe(e,i){this._subscriptionsMap[e]||(this._subscriptionsMap[e]=new Set);let t=this._subscriptionsMap[e];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[e]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,qe.clear(this.name)}},qe=class{static get readyEventName(){return Be}static open(e=tr,i="store"){let t=e+"/"+i;return this._reg[t]||(this._reg[t]=new ir(e,i)),this._reg[t]}static clear(e){window.indexedDB.deleteDatabase(e);for(let i in this._reg)i.split("/")[0]===e&&delete this._reg[i]}};de(qe,"_reg",Object.create(null));function j(e,i){let t,r=(...s)=>{clearTimeout(t),t=setTimeout(()=>e(...s),i)};return r.cancel=()=>{clearTimeout(t)},r}var rr="--uploadcare-blocks-window-height",Nt="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function pe(){return typeof window[Nt]=="undefined"?!1:!!window[Nt]}function Ge(){if(pe())return;let e=()=>{document.documentElement.style.setProperty(rr,`${window.innerHeight}px`),window[Nt]=!0},i=j(e,100);return window.addEventListener("resize",i,{passive:!0}),e(),()=>{window[Nt]=!1,window.removeEventListener("resize",i)}}var sr=e=>e,me="{{",Ye="}}",Ke="plural:";function _e(e,i,t={}){var o;let{openToken:r=me,closeToken:s=Ye,transform:n=sr}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();e=e.replaceAll(r+l+s,typeof a=="string"?n(a):a)}return e}function Je(e){let i=[],t=e.indexOf(me);for(;t!==-1;){let r=e.indexOf(Ye,t),s=e.substring(t+2,r);if(s.startsWith(Ke)){let n=e.substring(t+2,r).replace(Ke,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:s,pluralKey:o,countVariable:l})}t=e.indexOf(me,r)}return i}function Qe(e){return Object.prototype.toString.call(e)==="[object Object]"}var nr=/\W|_/g;function or(e){return e.split(nr).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Ze(e,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(e)?e.map(t=>Q(t,{ignoreKeys:i})):e}function Q(e,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(e))return Ze(e,{ignoreKeys:i});if(!Qe(e))return e;let t={};for(let r of Object.keys(e)){let s=e[r];if(i.includes(r)){t[r]=s;continue}Qe(s)?s=Q(s,{ignoreKeys:i}):Array.isArray(s)&&(s=Ze(s,{ignoreKeys:i})),t[or(r)]=s}return t}var lr=e=>new Promise(i=>setTimeout(i,e));function ve({libraryName:e,libraryVersion:i,userAgent:t,publicKey:r="",integration:s=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:r,libraryName:e,libraryVersion:i,languageName:n,integration:s});let o=[e,i,r].filter(Boolean).join("/"),l=[n,s].filter(Boolean).join("; ");return`${o} (${l})`}var ar={factor:2,time:100};function ur(e,i=ar){let t=0;function r(s){let n=Math.round(i.time*i.factor**t);return s({attempt:t,retry:l=>lr(l!=null?l:n).then(()=>(t+=1,r(s)))})}return r(e)}var yt=class extends Error{constructor(t){super();u(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,yt.prototype),this.originalProgressEvent=t}},Ft=(e,i)=>{e&&(e.aborted?Promise.resolve().then(i):e.addEventListener("abort",()=>i(),{once:!0}))},et=class extends Error{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);Object.setPrototypeOf(this,et.prototype)}},cr=500,ei=({check:e,interval:i=cr,timeout:t,signal:r})=>new Promise((s,n)=>{let o,l;Ft(r,()=>{o&&clearTimeout(o),n(new et("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new et("Timed out"))},t));let a=()=>{try{Promise.resolve(e(r)).then(c=>{c?(l&&clearTimeout(l),s(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),C={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},Vt="application/octet-stream",ii="original",rt=({method:e,url:i,data:t,headers:r={},signal:s,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(e==null?void 0:e.toUpperCase())||"GET",h=!1;a.open(c,i,!0),r&&Object.entries(r).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(f,m)}),a.responseType="text",Ft(s,()=>{h=!0,a.abort(),l(new et)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:r||void 0,signal:s,onProgress:n},f=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let v=w.split(": "),b=v.shift(),g=v.join(": ");b&&typeof b!="undefined"&&(m[b]=g)});let p=a.response,y=a.status;o({request:d,data:p,headers:m,status:y})}},a.onerror=d=>{h||l(new yt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function hr(e,...i){return e}var dr=({name:e})=>e?[e]:[],fr=hr,pr=()=>new FormData,ri=e=>!1,zt=e=>typeof Blob!="undefined"&&e instanceof Blob,jt=e=>typeof File!="undefined"&&e instanceof File,Ht=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&"uri"in e&&typeof e.uri=="string",xt=e=>zt(e)||jt(e)||ri()||Ht(e),mr=e=>typeof e=="string"||typeof e=="number"||typeof e=="undefined",_r=e=>!!e&&typeof e=="object"&&!Array.isArray(e),gr=e=>!!e&&typeof e=="object"&&"data"in e&&xt(e.data);function br(e,i,t){if(gr(t)){let{name:r,contentType:s}=t,n=fr(t.data,r,s!=null?s:Vt),o=dr({name:r,contentType:s});e.push([i,n,...o])}else if(_r(t))for(let[r,s]of Object.entries(t))typeof s!="undefined"&&e.push([`${i}[${r}]`,String(s)]);else mr(t)&&t&&e.push([i,t.toString()])}function yr(e){let i=[];for(let[t,r]of Object.entries(e))br(i,t,r);return i}function we(e){let i=pr(),t=yr(e);for(let r of t){let[s,n,...o]=r;i.append(s,n,...o)}return i}var R=class extends Error{constructor(t,r,s,n,o){super();u(this,"isCancel");u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadClientError",this.message=t,this.code=r,this.request=s,this.response=n,this.headers=o,Object.setPrototypeOf(this,R.prototype)}},Cr=e=>{let i=new URLSearchParams;for(let[t,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).filter(s=>{var n;return(n=s[1])!=null?n:!1}).forEach(s=>i.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(r)?r.forEach(s=>{i.append(`${t}[]`,s)}):typeof r=="string"&&r?i.set(t,r):typeof r=="number"&&i.set(t,r.toString());return i.toString()},J=(e,i,t)=>{let r=new URL(e);return r.pathname=(r.pathname+i).replace("//","/"),t&&(r.search=Cr(t)),r.toString()},Er="6.6.1",Tr="UploadcareUploadClient",vr=Er;function ht(e){return ve({libraryName:Tr,libraryVersion:vr,...e})}var wr="RequestThrottledError",ti=15e3,Ar=1e3;function xr(e){let{headers:i}=e||{};if(!i||typeof i["retry-after"]!="string")return ti;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:ti}function st(e,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:r}=i;return ur(({attempt:s,retry:n})=>e().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===wr&&s{let i="";return(zt(e)||jt(e)||Ht(e))&&(i=e.type),i||Vt},ni=e=>{let i="";return jt(e)&&e.name?i=e.name:zt(e)||ri()?i="":Ht(e)&&e.name&&(i=e.name),i||ii};function Ae(e){return typeof e=="undefined"||e==="auto"?"auto":e?"1":"0"}function Sr(e,{publicKey:i,fileName:t,contentType:r,baseURL:s=C.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=C.retryNetworkErrorMaxTimes,metadata:y}){return st(()=>rt({method:"POST",url:J(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ht({publicKey:i,integration:d,userAgent:f})},data:we({file:{data:e,name:t||ni(e),contentType:r||si(e)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ae(l),signature:n,expire:o,source:h,metadata:y}),signal:a,onProgress:c}).then(({data:w,headers:v,request:b})=>{let g=Q(JSON.parse(w));if("error"in g)throw new R(g.error.content,g.error.errorCode,b,g,v);return g}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var ye;(function(e){e.Token="token",e.FileInfo="file_info"})(ye||(ye={}));function Or(e,{publicKey:i,baseURL:t=C.baseURL,store:r,fileName:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=C.retryNetworkErrorMaxTimes,metadata:y}){return st(()=>rt({method:"POST",headers:{"X-UC-User-Agent":ht({publicKey:i,integration:d,userAgent:f})},url:J(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:e,store:Ae(r),filename:s,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:y}),signal:h}).then(({data:w,headers:v,request:b})=>{let g=Q(JSON.parse(w));if("error"in g)throw new R(g.error.content,g.error.errorCode,b,g,v);return g}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var $;(function(e){e.Unknown="unknown",e.Waiting="waiting",e.Progress="progress",e.Error="error",e.Success="success"})($||($={}));var Ir=e=>"status"in e&&e.status===$.Error;function Ur(e,{publicKey:i,baseURL:t=C.baseURL,signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=C.retryNetworkErrorMaxTimes}={}){return st(()=>rt({method:"GET",headers:i?{"X-UC-User-Agent":ht({publicKey:i,integration:s,userAgent:n})}:void 0,url:J(t,"/from_url/status/",{jsonerrors:1,token:e}),signal:r}).then(({data:a,headers:c,request:h})=>{let d=Q(JSON.parse(a));if("error"in d&&!Ir(d))throw new R(d.error.content,void 0,h,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function Rr(e,{publicKey:i,baseURL:t=C.baseURL,jsonpCallback:r,secureSignature:s,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=C.retryNetworkErrorMaxTimes}){return st(()=>rt({method:"POST",headers:{"X-UC-User-Agent":ht({publicKey:i,integration:a,userAgent:c})},url:J(t,"/group/",{jsonerrors:1,pub_key:i,files:e,callback:r,signature:s,expire:n,source:l}),signal:o}).then(({data:f,headers:m,request:p})=>{let y=Q(JSON.parse(f));if("error"in y)throw new R(y.error.content,y.error.errorCode,p,y,m);return y}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:h})}function oi(e,{publicKey:i,baseURL:t=C.baseURL,signal:r,source:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=C.retryNetworkErrorMaxTimes}){return st(()=>rt({method:"GET",headers:{"X-UC-User-Agent":ht({publicKey:i,integration:n,userAgent:o})},url:J(t,"/info/",{jsonerrors:1,pub_key:i,file_id:e,source:s}),signal:r}).then(({data:c,headers:h,request:d})=>{let f=Q(JSON.parse(c));if("error"in f)throw new R(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Lr(e,{publicKey:i,contentType:t,fileName:r,multipartChunkSize:s=C.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=C.retryNetworkErrorMaxTimes,metadata:y}){return st(()=>rt({method:"POST",url:J(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ht({publicKey:i,integration:d,userAgent:f})},data:we({filename:r||ii,size:e,content_type:t||Vt,part_size:s,UPLOADCARE_STORE:Ae(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:h,metadata:y}),signal:c}).then(({data:w,headers:v,request:b})=>{let g=Q(JSON.parse(w));if("error"in g)throw new R(g.error.content,g.error.errorCode,b,g,v);return g.parts=Object.keys(g.parts).map(N=>g.parts[N]),g}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})}function Mr(e,i,{contentType:t,signal:r,onProgress:s,retryThrottledRequestMaxTimes:n=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=C.retryNetworkErrorMaxTimes}){return st(()=>rt({method:"PUT",url:i,data:e,onProgress:s,signal:r,headers:{"Content-Type":t||Vt}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Pr(e,{publicKey:i,baseURL:t=C.baseURL,source:r="local",signal:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=C.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=C.retryNetworkErrorMaxTimes}){return st(()=>rt({method:"POST",url:J(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ht({publicKey:i,integration:n,userAgent:o})},data:we({uuid:e,UPLOADCARE_PUB_KEY:i,source:r}),signal:s}).then(({data:c,headers:h,request:d})=>{let f=Q(JSON.parse(c));if("error"in f)throw new R(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function xe({file:e,publicKey:i,baseURL:t,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return ei({check:h=>oi(e,{publicKey:i,baseURL:t,signal:h,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}var it=class{constructor(i,{baseCDN:t=C.baseCDN,fileName:r}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);let{uuid:s,s3Bucket:n}=i,o=J(t,`${s}/`),l=n?J(`https://${n}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=r||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l}},kr=(e,{publicKey:i,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,baseCDN:y,metadata:w})=>Sr(e,{publicKey:i,fileName:t,contentType:l,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:w}).then(({file:v})=>xe({file:v,publicKey:i,baseURL:r,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(v=>new it(v,{baseCDN:y})),Nr=(e,{publicKey:i,fileName:t,baseURL:r,signal:s,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h,baseCDN:d})=>oi(e,{publicKey:i,baseURL:r,signal:s,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h}).then(f=>new it(f,{baseCDN:d,fileName:t})).then(f=>(n&&n({isComputable:!0,value:1}),f)),Dr=(e,{signal:i}={})=>{let t=null,r=null,s=e.map(()=>new AbortController),n=o=>()=>{r=o,s.forEach((l,a)=>a!==o&&l.abort())};return Ft(i,()=>{s.forEach(o=>o.abort())}),Promise.all(e.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(r===null)throw t;return o[r]})},$r=window.WebSocket,Ce=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var r;(r=this.events[i])==null||r.forEach(s=>s(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(r=>r!==t):this.events[i]=[]}},Fr=(e,i)=>e==="success"?{status:$.Success,...i}:e==="progress"?{status:$.Progress,...i}:{status:$.Error,...i},Ee=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new Ce);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new $r(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let r=JSON.parse(t.data.toString());switch(r.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(r.channel,Fr(r.event,JSON.parse(r.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var s;let r=JSON.stringify({event:i,data:t});(s=this.ws)==null||s.send(r)}subscribe(i,t){this.subscribers+=1,this.connect();let r=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:r}};this.emmitter.on(r,t),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,r={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(r.event,r.data):this.queue=this.queue.filter(s=>s.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},ge=null,Se=e=>{if(!ge){let i=typeof window=="undefined"?0:3e4;ge=new Ee(e,i)}return ge},Vr=e=>{Se(e).connect()};function zr({token:e,publicKey:i,baseURL:t,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return ei({check:c=>Ur(e,{publicKey:i,baseURL:t,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(h=>{switch(h.status){case $.Error:return new R(h.error,h.errorCode);case $.Waiting:return!1;case $.Unknown:return new R(`Token "${e}" was not found.`);case $.Progress:return l&&(h.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:h.done/h.total})),!1;case $.Success:return l&&l({isComputable:!0,value:h.done/h.total}),h;default:throw new Error("Unknown status")}}),signal:a})}var jr=({token:e,pusherKey:i,signal:t,onProgress:r})=>new Promise((s,n)=>{let o=Se(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(e)};Ft(t,()=>{a(),n(new et("pusher cancelled"))}),o.subscribe(e,c=>{switch(c.status){case $.Progress:{r&&(c.total==="unknown"?r({isComputable:!1}):r({isComputable:!0,value:c.done/c.total}));break}case $.Success:{a(),r&&r({isComputable:!0,value:c.done/c.total}),s(c);break}case $.Error:a(),n(new R(c.msg,c.error_code))}})}),Hr=(e,{publicKey:i,fileName:t,baseURL:r,baseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,onProgress:d,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:y,pusherKey:w=C.pusherKey,metadata:v})=>Promise.resolve(Vr(w)).then(()=>Or(e,{publicKey:i,fileName:t,baseURL:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:y,metadata:v})).catch(b=>{let g=Se(w);return g==null||g.disconnect(),Promise.reject(b)}).then(b=>b.type===ye.FileInfo?b:Dr([({signal:g})=>zr({token:b.token,publicKey:i,baseURL:r,integration:m,userAgent:p,retryThrottledRequestMaxTimes:y,onProgress:d,signal:g}),({signal:g})=>jr({token:b.token,pusherKey:w,signal:g,onProgress:d})],{signal:h})).then(b=>{if(b instanceof R)throw b;return b}).then(b=>xe({file:b.uuid,publicKey:i,baseURL:r,integration:m,userAgent:p,retryThrottledRequestMaxTimes:y,onProgress:d,signal:h})).then(b=>new it(b,{baseCDN:s})),be=new WeakMap,Wr=async e=>{if(be.has(e))return be.get(e);let i=await fetch(e.uri).then(t=>t.blob());return be.set(e,i),i},li=async e=>{if(jt(e)||zt(e))return e.size;if(Ht(e))return(await Wr(e)).size;throw new Error("Unknown file type. Cannot determine file size.")},Xr=(e,i=C.multipartMinFileSize)=>e>=i,ai=e=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!xt(e)&&t.test(e)},ui=e=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!xt(e)&&t.test(e)},Br=(e,i)=>new Promise((t,r)=>{let s=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,h=l.shift();h&&h().then(d=>{n||(s[c]=d,o-=1,o?a():t(s))}).catch(d=>{n=!0,r(d)})};for(let c=0;c{let s=r*i,n=Math.min(s+r,t);return e.slice(s,n)},Gr=async(e,i,t)=>r=>qr(e,r,i,t),Kr=(e,i,{publicKey:t,contentType:r,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Mr(e,i,{publicKey:t,contentType:r,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Yr=async(e,{publicKey:i,fileName:t,fileSize:r,baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,contentType:y,multipartChunkSize:w=C.multipartChunkSize,maxConcurrentRequests:v=C.maxConcurrentRequests,baseCDN:b,metadata:g})=>{let N=r!=null?r:await li(e),q,lt=(U,z)=>{if(!c)return;q||(q=Array(U).fill(0));let G=D=>D.reduce((K,ue)=>K+ue,0);return D=>{D.isComputable&&(q[z]=D.value,c({isComputable:!0,value:G(q)/U}))}};return y||(y=si(e)),Lr(N,{publicKey:i,contentType:y,fileName:t||ni(e),baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:g}).then(async({uuid:U,parts:z})=>{let G=await Gr(e,N,w);return Promise.all([U,Br(v,z.map((D,K)=>()=>Kr(G(K),D,{publicKey:i,contentType:y,onProgress:lt(z.length,K),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})))])}).then(([U])=>Pr(U,{publicKey:i,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})).then(U=>U.isReady?U:xe({file:U.uuid,publicKey:i,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(U=>new it(U,{baseCDN:b}))};async function Oe(e,{publicKey:i,fileName:t,baseURL:r=C.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartMinFileSize:y,multipartChunkSize:w,maxConcurrentRequests:v,baseCDN:b=C.baseCDN,checkForUrlDuplicates:g,saveUrlForRecurrentUploads:N,pusherKey:q,metadata:lt}){if(xt(e)){let U=await li(e);return Xr(U,y)?Yr(e,{publicKey:i,contentType:p,multipartChunkSize:w,fileSize:U,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,maxConcurrentRequests:v,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b,metadata:lt}):kr(e,{publicKey:i,fileName:t,contentType:p,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b,metadata:lt})}if(ui(e))return Hr(e,{publicKey:i,fileName:t,baseURL:r,baseCDN:b,checkForUrlDuplicates:g,saveUrlForRecurrentUploads:N,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:q,metadata:lt});if(ai(e))return Nr(e,{publicKey:i,fileName:t,baseURL:r,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b});throw new TypeError(`File uploading from "${e}" is not supported`)}var Te=class{constructor(i,t){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount,this.totalSize=Object.values(i.files).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(i.files).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=t,this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Jr=e=>{for(let i of e)if(!xt(i))return!1;return!0},Qr=e=>{for(let i of e)if(!ai(i))return!1;return!0},Zr=e=>{for(let i of e)if(!ui(i))return!1;return!0};function ci(e,{publicKey:i,fileName:t,baseURL:r=C.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:y=C.multipartChunkSize,baseCDN:w=C.baseCDN,checkForUrlDuplicates:v,saveUrlForRecurrentUploads:b,jsonpCallback:g}){if(!Jr(e)&&!Zr(e)&&!Qr(e))throw new TypeError(`Group uploading from "${e}" is not supported`);let N,q=!0,lt=e.length,U=(z,G)=>{if(!a)return;N||(N=Array(z).fill(0));let D=K=>K.reduce((ue,Li)=>ue+Li)/z;return K=>{if(!K.isComputable||!q){q=!1,a({isComputable:!1});return}N[G]=K.value,a({isComputable:!0,value:D(N)})}};return Promise.all(e.map((z,G)=>Oe(z,{publicKey:i,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:U(lt,G),source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:y,baseCDN:w,checkForUrlDuplicates:v,saveUrlForRecurrentUploads:b}))).then(z=>{let G=z.map(D=>D.uuid);return Rr(G,{publicKey:i,baseURL:r,jsonpCallback:g,secureSignature:s,secureExpire:n,signal:l,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(D=>new Te(D,z)).then(D=>(a&&a({isComputable:!0,value:1}),D))})}var ut,mt,ct,_t,gt,bt,Dt,$t=class{constructor(i){at(this,bt);at(this,ut,1);at(this,mt,[]);at(this,ct,0);at(this,_t,new WeakMap);at(this,gt,new WeakMap);vt(this,ut,i)}add(i){return new Promise((t,r)=>{L(this,_t).set(i,t),L(this,gt).set(i,r),L(this,mt).push(i),Mt(this,bt,Dt).call(this)})}get pending(){return L(this,mt).length}get running(){return L(this,ct)}set concurrency(i){vt(this,ut,i),Mt(this,bt,Dt).call(this)}get concurrency(){return L(this,ut)}};ut=new WeakMap,mt=new WeakMap,ct=new WeakMap,_t=new WeakMap,gt=new WeakMap,bt=new WeakSet,Dt=function(){let i=L(this,ut)-L(this,ct);for(let t=0;t{L(this,_t).delete(r),L(this,gt).delete(r),vt(this,ct,L(this,ct)-1),Mt(this,bt,Dt).call(this)}).then(o=>s(o)).catch(o=>n(o))}};var Ie=()=>({"*blocksRegistry":new Set}),Ue=e=>({...Ie(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{e.set$({"*modalActive":!1,"*currentActivity":""})}}),Wt=e=>({...Ue(e),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new $t(1)});function hi(e,i){[...e.querySelectorAll("[l10n]")].forEach(t=>{let r=t.getAttribute("l10n"),s="textContent";if(r.includes(":")){let o=r.split(":");s=o[0],r=o[1]}let n="l10n:"+r;i.__l10nKeys.push(n),i.add(n,r),i.sub(n,o=>{t[s]=i.l10n(o)}),t.removeAttribute("l10n")})}var F=e=>`*cfg/${e}`;var nt=e=>{var i;return(i=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var di=new Set;function Xt(e){di.has(e)||(di.add(e),console.warn(e))}var Bt=(e,i)=>new Intl.PluralRules(e).select(i);var qt=({element:e,attribute:i,onSuccess:t,onTimeout:r,timeout:s=300})=>{let n=setTimeout(()=>{a.disconnect(),r()},s),o=c=>{let h=e.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&h!==null&&(clearTimeout(n),a.disconnect(),t(h))},l=e.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let h=c[c.length-1];o(h)});a.observe(e,{attributes:!0,attributeFilter:[i]})};var Re="lr-",S=class extends fe{constructor(){super();u(this,"requireCtxName",!1);u(this,"allowCustomTemplate",!0);u(this,"init$",Ie());u(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let r of t)r.isConnected&&r.updateCssData()});this.activityType=null,this.addTemplateProcessor(hi),this.__l10nKeys=[]}l10n(t,r={}){if(!t)return"";let s=this.getCssData("--l10n-"+t,!0)||t,n=Je(s);for(let l of n)r[l.variable]=this.pluralize(l.pluralKey,Number(r[l.countVariable]));return _e(s,r)}pluralize(t,r){let s=this.l10n("locale-name")||"en-US",n=Bt(s,r);return this.l10n(`${t}__${n}`)}applyL10nKey(t,r){let s="l10n:"+t;this.$[s]=r,this.__l10nKeys.push(t)}hasBlockInCtx(t){let r=this.$["*blocksRegistry"];for(let s of r)if(t(s))return!0;return!1}setOrAddState(t,r){this.add$({[t]:r},!0)}setActivity(t){if(this.hasBlockInCtx(r=>r.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Re}${t}`,!0),pe()||(this._destroyInnerHeightTracker=Ge()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?qt({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,r=2){let s=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(s[0])}`;let o=1024,l=r<0?0:r,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(s[a])}proxyUrl(t){let r=this.cfg.secureDeliveryProxy;return r?_e(r,{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(r,s,n)=>{if(typeof s!="string")return!1;let o=F(s);return this.$[o]=n,!0},get:(r,s)=>{let n=F(s),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Xt("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${nt(s)}`))}})}return this.__cfgProxy}subConfigValue(t,r){let s=this.parseCfgProp(F(t));s.ctx.has(s.name)?this.sub(F(t),r):(this.bindCssData(`--cfg-${nt(t)}`),this.sub(`--cfg-${nt(t)}`,r))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Re)?t:Re+t)}};u(S,"StateConsumerScope",null),u(S,"className","");var fi="active",St="___ACTIVITY_IS_ACTIVE___",H=class extends S{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",Ue(this));u(this,"_debouncedHistoryFlush",j(this._historyFlush.bind(this),10))}_deactivate(){var r;let t=H._activityRegistry[this.activityKey];this[St]=!1,this.removeAttribute(fi),(r=t==null?void 0:t.deactivateCallback)==null||r.call(t)}_activate(){var r;let t=H._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[St]=!0,this.setAttribute(fi,""),(r=t==null?void 0:t.activateCallback)==null||r.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[St]?this._deactivate():this.activityType===t&&!this[St]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!H._activityRegistry[this.activityKey]}get isActivityActive(){return this[St]}registerActivity(t,r={}){let{onActivate:s,onDeactivate:n}=r;H._activityRegistry||(H._activityRegistry=Object.create(null)),H._activityRegistry[this.activityKey]={activateCallback:s,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),H._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(H._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}},T=H;u(T,"_activityRegistry",Object.create(null));T.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var ts="css-src";function es(e){return class extends e{constructor(){super(...arguments);u(this,"renderShadow",!0);u(this,"pauseRender",!0);u(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),qt({element:this,attribute:ts,onSuccess:t=>{this.attachShadow({mode:"open"});let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,r.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(r)},onTimeout:()=>{console.error("Attribute `css-src`is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Gt=class extends es(S){};var Kt=class extends Gt{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",Wt(this));u(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var Yt=class extends Kt{constructor(){super(...arguments);u(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",r=>{r||(this.$["*currentActivity"]=t.initActivity||T.activities.START_FROM)}),this.sub("*uploadList",r=>{(r==null?void 0:r.length)>0?this.$["*currentActivity"]=T.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||T.activities.START_FROM}),this.subConfigValue("sourceList",r=>{r!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",r=>{r!==!1&&(this.cfg.confirmUpload=!1)})}};Yt.template=``;var Le=class extends T{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function pi(e,i,t){let r=e/i,s,n;r>t?(s=Math.round(i*t),n=i):(s=e,n=Math.round(e/t));let o=Math.round((e-s)/2),l=Math.round((i-n)/2);return o+s>e&&(s=e-o),l+n>i&&(n=i-l),{x:o,y:l,width:s,height:n}}var mi=e=>{if(!e)return[];let[i,t]=e.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${e}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var ot=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var _i="blocks",gi="0.27.6";function bi(e){return ve({...e,libraryName:_i,libraryVersion:gi})}var is=e=>{if(typeof e!="string"||!e)return"";let i=e.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Me=(...e)=>e.filter(i=>typeof i=="string"&&i).map(i=>is(i)).join("/-/"),Jt=(...e)=>{let i=Me(...e);return i?`-/${i}/`:""};function yi(e){let i=new URL(e),t=i.pathname+i.search+i.hash,r=t.lastIndexOf("http"),s=t.lastIndexOf("/"),n="";return r>=0?n=t.slice(r):s>=0&&(n=t.slice(s+1)),n}function rs(e){let i=new URL(e),t=yi(e),r=Ci(t)?Ei(t).pathname:t;return i.pathname=i.pathname.replace(r,""),i.search="",i.hash="",i.toString()}function Ci(e){return e.startsWith("http")}function Ei(e){let i=new URL(e);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var Qt=(e,i,t)=>{let r=new URL(rs(e));if(t=t||yi(e),r.pathname.startsWith("//")&&(r.pathname=r.pathname.replace("//","/")),Ci(t)){let s=Ei(t);r.pathname=r.pathname+(i||"")+(s.pathname||""),r.search=s.search,r.hash=s.hash}else r.pathname=r.pathname+(i||"")+(t||"");return r.toString()},Ti=(e,i)=>{let t=new URL(e);return t.pathname=i+"/",t.toString()};var Ct=(e,i=",")=>e.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Ot=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Pe=e=>e?e.filter(i=>typeof i=="string").map(i=>Ct(i)).flat():[],ke=(e,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),e.startsWith(t)):e===t),vi=(e,i)=>i.some(t=>t.startsWith(".")?e.toLowerCase().endsWith(t.toLowerCase()):!1),Ne=e=>{let i=e==null?void 0:e.type;return i?ke(i,Ot):!1};var W=1e3,dt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),It=e=>Math.ceil(e*100)/100,wi=(e,i=dt.AUTO)=>{let t=i===dt.AUTO;if(i===dt.BYTE||t&&e{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!r){s();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{s(),delete this._timeoutStore[n]},20)}};u(O,"_timeoutStore",Object.create(null));var Ai="[Typed State] Wrong property name: ",ss="[Typed State] Wrong property type: ",Zt=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||At.generate(),this.__schema=Object.keys(i).reduce((r,s)=>(r[s]=i[s].value,r),{}),this.__data=E.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ai+i);return}let r=this.__typedSchema[i];if((t==null?void 0:t.constructor)===r.type||t instanceof r.type||r.nullable&&t===null){this.__data.pub(i,t);return}console.warn(ss+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ai+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){E.deleteCtx(this.__ctxId)}};var te=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||At.generate(),this.__data=E.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__handler=i.handler||null,this.__subsMap=Object.create(null),this.__observers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(r,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[r]||(t[r]=new Set),t[r].add(s),this.__observeTimeout=window.setTimeout(()=>{this.__observers.forEach(n=>{n({...t})}),t=Object.create(null)})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{var r;let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear(),(r=this.__handler)==null||r.call(this,[...this.__items],i,t)})}setHandler(i){this.__handler=i,this.notify()}getHandler(){return this.__handler}removeHandler(){this.__handler=null}add(i){let t=new Zt(this.__typedSchema);for(let r in i)t.setValue(r,i[r]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(r=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(r,()=>{this.__notifyObservers(r,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,r){this.read(i).setValue(t,r)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observe(i){this.__observers.add(i)}unobserve(i){this.__observers.delete(i)}findItems(i){let t=[];return this.__items.forEach(r=>{let s=this.read(r);i(s)&&t.push(r)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){E.deleteCtx(this.__data),this.__observers=null,this.__handler=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var xi=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:it,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var Ut=e=>e?e.join(","):"";var x=class extends T{constructor(){super(...arguments);u(this,"couldBeUploadCollectionOwner",!1);u(this,"isUploadCollectionOwner",!1);u(this,"init$",Wt(this));u(this,"__initialUploadMetadata",null);u(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);u(this,"_debouncedRunValidators",j(this._runValidators.bind(this),100));u(this,"_handleCollectionUpdate",t=>{let r=this.uploadCollection,s=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>r.read(n)).filter(Boolean);for(let n of s)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=r.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=r.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,O.emit(new M({type:I.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=r.findItems(l=>!!l.getValue("fileInfo")),o=r.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(r.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&O.emit(new M({type:I.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&r.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{O.emit(new M({type:I.UPLOAD_ERROR,ctx:this.ctxName,data:r.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&r.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{O.emit(new M({type:I.VALIDATION_ERROR,ctx:this.ctxName,data:r.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&r.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{O.emit(new M({type:I.CLOUD_MODIFICATION,ctx:this.ctxName,data:E.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){Xt("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let r=new te({typedSchema:xi,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",r)}let t=()=>this.hasBlockInCtx(r=>r instanceof x?r.isUploadCollectionOwner&&r.isConnected&&r!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this.__uploadCollectionHandler=(r,s,n)=>{var o;this._runValidators();for(let l of n)(o=l==null?void 0:l.getValue("abortController"))==null||o.abort(),l==null||l.setValue("abortController",null),URL.revokeObjectURL(l==null?void 0:l.getValue("thumbUrl"));this.$["*uploadList"]=r.map(l=>({uid:l}))},this.uploadCollection.setHandler(this.__uploadCollectionHandler),this.uploadCollection.observe(this._handleCollectionUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",r=>{this.$["*uploadQueue"].concurrency=Number(r)||1})}destroyCallback(){super.destroyCallback(),this.isUploadCollectionOwner&&(this.uploadCollection.unobserve(this._handleCollectionUpdate),this.uploadCollection.getHandler()===this.__uploadCollectionHandler&&this.uploadCollection.removeHandler())}addFileFromUrl(t,{silent:r,fileName:s,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:s!=null?s:null,silentUpload:r!=null?r:!1,source:n!=null?n:ot.API})}addFileFromUuid(t,{silent:r,fileName:s,source:n}={}){this.uploadCollection.add({uuid:t,fileName:s!=null?s:null,silentUpload:r!=null?r:!1,source:n!=null?n:ot.API})}addFileFromObject(t,{silent:r,fileName:s,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:Ne(t),mimeType:t.type,fileName:s!=null?s:t.name,fileSize:t.size,silentUpload:r!=null?r:!1,source:n!=null?n:ot.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(r=>{this.uploadCollection.add({file:r,isImage:Ne(r),mimeType:r.type,fileName:r.name,fileSize:r.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var s;let r=Ut(Pe([(s=this.cfg.accept)!=null?s:"",...this.cfg.imgOnly?Ot:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Ut(Ot)):this.fileInput.accept=r,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:ot.LOCAL})),this.$["*currentActivity"]=T.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=Ct(this.cfg.sourceList)),t}initFlow(t=!1){var r;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":T.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((r=this.sourceList)==null?void 0:r.length)===1){let s=this.sourceList[0];s==="local"?(this.$["*currentActivity"]=T.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(x.extSrcList).includes(s)?this.set$({"*currentActivityParams":{externalSourceType:s},"*currentActivity":T.activities.EXTERNAL}):this.$["*currentActivity"]=s,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":T.activities.START_FROM}),this.setOrAddState("*modalActive",!0);O.emit(new M({type:I.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),O.emit(new M({type:I.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let r=this.cfg.imgOnly,s=this.cfg.accept,n=Pe([...r?Ot:[],s]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=ke(o,n),c=vi(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let r=this.cfg.maxLocalFileSizeBytes,s=t.getValue("fileSize");if(r&&s&&s>r)return this.l10n("files-max-size-limit-error",{maxFileSize:wi(r)})}_validateMultipleLimit(t){let s=this.uploadCollection.items().indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&s>=n)return this.l10n("files-count-allowed",{count:n})}_validateIsImage(t){let r=this.cfg.imgOnly,s=t.getValue("isImage");if(!(!r||s)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let r of this._validators){let s=r(t);if(s){t.setValue("validationErrorMsg",s);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let r=this.uploadCollection.read(t);r&&this._runValidatorsForEntry(r)})}setInitialCrop(){let t=mi(this.cfg.cropPreset);if(t){let[r]=t,s=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of s){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=r.width/r.height,h=pi(l,a,c),d=Jt(`crop/${h.width}x${h.height}/${h.x},${h.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Qt(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===T.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=T.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var r;let t=(r=this.cfg.metadata)!=null?r:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:bi,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let r=[];return this.uploadCollection.findItems(t).forEach(n=>{let o=E.getCtx(n).store,l=o.fileInfo||{name:o.fileName,fileSize:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl||l.cdnUrl};r.push(a)}),r}};x.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});x.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...x.extSrcList});Object.values(I).forEach(e=>{let i=O.eName(e),t=j(r=>{if([I.UPLOAD_FINISH,I.REMOVE,I.CLOUD_MODIFICATION].includes(r.detail.type)){let n=E.getCtx(r.detail.ctx),o=n.read("uploadCollection"),l=[];o.items().forEach(a=>{let c=E.getCtx(a).store,h=c.fileInfo;if(h){let d={...h,cdnUrlModifiers:c.cdnUrlModifiers,cdnUrl:c.cdnUrl||h.cdnUrl};l.push(d)}}),O.emit(new M({type:I.DATA_OUTPUT,ctx:r.detail.ctx,data:l})),n.pub("outputData",l)}},0);window.addEventListener(i,t)});var V=e=>String(e),X=e=>Number(e),A=e=>typeof e=="boolean"?e:e==="true"||e===""?!0:e==="false"?!1:!!e,ns=e=>e==="auto"?e:A(e),os={pubkey:V,multiple:A,multipleMin:X,multipleMax:X,confirmUpload:A,imgOnly:A,accept:V,externalSourcesPreferredTypes:V,store:ns,cameraMirror:A,sourceList:V,maxLocalFileSizeBytes:X,thumbSize:X,showEmptyList:A,useLocalImageEditor:A,useCloudImageEditor:A,cloudImageEditorTabs:V,removeCopyright:A,cropPreset:V,modalScrollLock:A,modalBackdropStrokes:A,sourceListWrap:A,remoteTabSessionKey:V,cdnCname:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:X,multipartMinFileSize:X,multipartChunkSize:X,maxConcurrentRequests:X,multipartMaxConcurrentRequests:X,multipartMaxAttempts:X,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:A,groupOutput:A,userAgentIntegration:V},Si=(e,i)=>{if(!(typeof i=="undefined"||i===null))return os[e](i)};function ls(e){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let r=s=>{s.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=r,t.onprogress=r,t.readAsDataURL(e)}catch{i(!1)}})}function as(e,i){return new Promise(t=>{let r=0,s=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(r++,l.file(a=>{r--;let c=new File([a],a.name,{type:a.type||i});s.push({type:"file",file:c,fullPath:l.fullPath}),r===0&&t(s)})):l.isDirectory&&o(l.createReader())},o=l=>{r++,l.readEntries(a=>{r--;for(let c of a)n(c);r===0&&t(s)})};n(e)})}function Oi(e){let i=[],t=[];for(let r=0;r{a&&i.push(...a)}));continue}let o=s.getAsFile();o&&t.push(ls(o).then(l=>{l||i.push({type:"file",file:o})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&t.push(new Promise(n=>{s.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var P={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},Ii=["focus"],us=100,De=new Map;function cs(e,i){let t=Math.max(Math.min(e[0],i.x+i.width),i.x),r=Math.max(Math.min(e[1],i.y+i.height),i.y);return Math.sqrt((e[0]-t)*(e[0]-t)+(e[1]-r)*(e[1]-r))}function $e(e){let i=0,t=document.body,r=new Set,s=p=>r.add(p),n=P.INACTIVE,o=p=>{e.shouldIgnore()&&p!==P.INACTIVE||(n!==p&&r.forEach(y=>y(p)),n=p)},l=()=>i>0;s(p=>e.onChange(p));let a=()=>{i=0,o(P.INACTIVE)},c=()=>{i+=1,n===P.INACTIVE&&o(P.ACTIVE)},h=()=>{i-=1,l()||o(P.INACTIVE)},d=p=>{p.preventDefault(),i=0,o(P.INACTIVE)},f=p=>{if(e.shouldIgnore())return;l()||(i+=1);let y=[p.x,p.y],w=e.element.getBoundingClientRect(),v=Math.floor(cs(y,w)),b=v{if(e.shouldIgnore())return;p.preventDefault();let y=await Oi(p.dataTransfer);e.onItems(y),o(P.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",h),t.addEventListener("dragenter",c),t.addEventListener("dragover",f),e.element.addEventListener("drop",m),Ii.forEach(p=>{window.addEventListener(p,a)}),()=>{De.delete(e.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",h),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",f),e.element.removeEventListener("drop",m),Ii.forEach(p=>{window.removeEventListener(p,a)})}}var Rt=class extends x{constructor(){super(),this.init$={...this.init$,state:P.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,r=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return t&&n&&r}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!A(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:A(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:A(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:A(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=$e({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(r=>{r.type==="url"?this.addFileFromUrl(r.url,{source:ot.DROP_AREA}):r.type==="file"&&this.addFileFromObject(r.file,{source:ot.DROP_AREA,fullPath:r.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":T.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=$e({element:i,onChange:t=>{var s;let r=(s=Object.entries(P).find(([,n])=>n===t))==null?void 0:s[0].toLowerCase();r&&i.setAttribute("drag-state",r)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var s;let r=(s=Object.entries(P).find(([,n])=>n===t))==null?void 0:s[0].toLowerCase();r&&this.setAttribute("drag-state",r)}),this.subConfigValue("sourceList",t=>{let r=Ct(t);this.$.isEnabled=r.includes(x.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(r=>r!==this).filter(r=>r.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,r=this.uploadCollection.size;return!(i&&t&&r>=t||!i&&r>0)}destroyCallback(){var i,t,r,s;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(r=this._destroyDropzone)==null||r.call(this),(s=this._destroyContentWrapperDropzone)==null||s.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};Rt.template=`
{{text}}
`;Rt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var ee=class{constructor(){u(this,"caption","");u(this,"text","");u(this,"iconName","");u(this,"isError",!1)}},ie=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};ie.template=`
{{captionTxt}}
{{msgTxt}}
`;var re=class extends x{constructor(){super();u(this,"couldBeUploadCollectionOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",T.activities.UPLOAD_LIST);u(this,"_debouncedHandleCollectionUpdate",j(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(r=>!!r.getValue("fileInfo"));O.emit(new M({type:I.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var h,d;let t=!!this.cfg.multiple,r=t?(h=this.cfg.multipleMin)!=null?h:0:1,s=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=r?ns:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:r,max:s,exact:s===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,r=this._validateFilesCount();if(t&&!r.passed){let s=new ee,n=r.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";s.caption=this.l10n("files-count-limit-error-title"),s.text=this.l10n(n,{min:r.min,max:r.max,total:t}),s.isError=!0,this.set$({"*message":s})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),s={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let p=this.uploadCollection.read(m);p.getValue("fileInfo")&&!p.getValue("validationErrorMsg")&&(s.succeed+=1),p.getValue("isUploading")&&(s.uploading+=1),(p.getValue("validationErrorMsg")||p.getValue("uploadError"))&&(s.failed+=1),p.getValue("validationMultipleLimitMsg")&&(s.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=s.failed===0&&s.limitOverflow===0,c=!1,h=!1,d=!1;s.total-s.succeed-s.uploading-s.failed>0&&n?c=!0:(h=!0,d=s.total===s.succeed&&n&&a),this.set$({doneBtnVisible:h,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:s.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(s)})}_getHeaderText(t){let r=s=>{let n=t[s];return this.l10n(`header-${s}`,{count:n})};return t.uploading>0?r("uploading"):t.failed>0?r("failed"):t.succeed>0?r("succeed"):r("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var r;((r=this.uploadCollection)==null?void 0:r.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observe(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate)}};re.template=`{{headerText}}
`;function hs(e){let i=new Blob([e],{type:"image/svg+xml"});return URL.createObjectURL(i)}function Fe(e="hsl(209, 21%, 65%)",i=32,t=32){return hs(``)}function Ui(e,i=40){if(e.type==="image/svg+xml")return URL.createObjectURL(e);let t=document.createElement("canvas"),r=t.getContext("2d"),s=new Image,n=new Promise((o,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),r.fillStyle="rgb(240, 240, 240)",r.fillRect(0,0,t.width,t.height),r.drawImage(s,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let h=URL.createObjectURL(c);o(h)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(e),n}var k=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),Z=class extends x{constructor(){super();u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",j(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",j(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:k.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===T.activities.DETAILS)?this.$["*currentActivity"]=T.activities.DETAILS:this.$["*currentActivity"]=T.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let r=this.getOutputData(s=>s.getValue("uuid")===t);O.emit(new M({type:I.REMOVE,ctx:this.ctxName,data:r}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[r]=t;this._isIntersecting=r.isIntersecting,r.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),r.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,r=k.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?r=k.FAILED:t.getValue("validationMultipleLimitMsg")?r=k.LIMIT_OVERFLOW:t.getValue("isUploading")?r=k.UPLOADING:t.getValue("fileInfo")&&(r=k.FINISHED),this.$.state=r}async _generateThumbnail(){var r;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let s=this.cfg.thumbSize,n=this.proxyUrl(Qt(Ti(this.cfg.cdnCname,this._entry.getValue("uuid")),Jt(t.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((r=t.getValue("file"))!=null&&r.type.includes("image"))try{let s=await Ui(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",s)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Fe(n))}else{let s=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Fe(s))}}_subEntry(t,r){let s=this._entry.subscribe(t,n=>{this.isConnected&&r(n)});this._entrySubs.add(s)}_handleEntryId(t){var s;this._reset();let r=(s=this.uploadCollection)==null?void 0:s.read(t);this._entry=r,r&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||r.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=r.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{Z.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),Z.activeInstances.add(this)}_handleState(t){var r,s,n;this.set$({isFailed:t===k.FAILED,isLimitOverflow:t===k.LIMIT_OVERFLOW,isUploading:t===k.UPLOADING,isFinished:t===k.FINISHED,progressVisible:t===k.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((r=this._entry)==null?void 0:r.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===k.FAILED||t===k.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===k.FINISHED&&(this.$.badgeIcon="badge-success"),t===k.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),Z.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let r=this.cfg.multiple?this.cfg.multipleMax:1;if(r&&this.uploadCollection.size>r)return;let s=this.getOutputData(a=>!a.getValue("fileInfo"));O.emit(new M({type:I.UPLOAD_START,ctx:this.ctxName,data:s})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Oe(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:f=>{if(f.isComputable){let m=f.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!f.isComputable},signal:a.signal})},h=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:h,isUploading:!1,fileName:h.originalFilename,fileSize:h.size,isImage:h.isImage,mimeType:(l=(o=(n=h.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:h.mimeType,uuid:h.uuid,cdnUrl:h.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof R?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};Z.template=`
{{itemName}}{{errorText}}
`;Z.activeInstances=new Set;var Lt=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let r=this.getCssData(`--icon-${t}`);r&&(this.$.path=r)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};Lt.template=``;Lt.bindAttributes({name:"name",size:"size"});var se=class extends S{constructor(){super(...arguments);u(this,"_value",0);u(this,"_unknownMode",!1);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};se.template='
';var ne=class extends S{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};u(ne,"template",`Powered by Uploadcare`);var Et=class extends x{constructor(){super(...arguments);u(this,"processInnerHtml",!0);u(this,"requireCtxName",!0);u(this,"init$",{...this.init$,output:null,filesData:null})}get dict(){return Et.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer),this.hasAttribute(this.dict.INPUT_REQUIRED))){let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=!0,this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(t){if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer.innerHTML="";let r=t.groupData?[t.groupData.cdnUrl]:t.map(s=>s.cdnUrl);for(let s of r){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=s,this._dynamicInputsContainer.appendChild(n)}this.hasAttribute(this.dict.INPUT_REQUIRED)&&(this._validationInputElement.value=r.length?"__VALUE__":"")}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)}},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t){this.$.output=null,this.$.filesData=null;return}if(this.$.filesData=t,this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR)){let r=t.map(o=>o.uuid),s=await this.getUploadClientOptions(),n=await ci(r,{...s});this.$.output={groupData:n,files:t}}else this.$.output=t},!1)}};Et.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var B={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};var ol=Me("format/auto","progressive/yes");var Ve=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Ri=[Ve.CROP,Ve.TUNING,Ve.FILTERS];var ul=Object.freeze({brightness:{zero:B.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:B.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:B.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:B.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:B.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:B.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:B.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:B.enhance,range:[0,100],keypointsNumber:1},filter:{zero:B.filter,range:[0,100],keypointsNumber:1}});var ds="https://ucarecdn.com",fs="https://upload.uploadcare.com",ps="https://social.uploadcare.com",Tt={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Ut(Ri),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:ds,baseUrl:fs,socialBaseUrl:ps,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var oe=Object.keys(Tt),ms=["metadata"],_s=e=>ms.includes(e),le=oe.filter(e=>!_s(e)),gs={...Object.fromEntries(le.map(e=>[nt(e),e])),...Object.fromEntries(le.map(e=>[e.toLowerCase(),e]))},bs={...Object.fromEntries(oe.map(e=>[nt(e),F(e)])),...Object.fromEntries(oe.map(e=>[e.toLowerCase(),F(e)]))},ae=class extends S{constructor(){super();u(this,"ctxOwner",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Tt).map(([t,r])=>[F(t),r]))}}initCallback(){super.initCallback();let t=this;for(let r of le)this.sub(F(r),s=>{s!==Tt[r]&&(t[r]=s)},!1);for(let r of oe){let s="__"+r;t[s]=t[r],Object.defineProperty(this,r,{set:n=>{if(t[s]=n,le.includes(r)){let o=[...new Set([nt(r),r.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[F(r)]!==n&&(typeof n=="undefined"||n===null?this.$[F(r)]=Tt[r]:this.$[F(r)]=n)},get:()=>this.$[F(r)]}),typeof t[r]!="undefined"&&t[r]!==null&&(t[r]=t[s])}}attributeChangedCallback(t,r,s){if(r===s)return;let n=gs[t],o=Si(n,s),l=o!=null?o:Tt[n],a=this;a[n]=l}};ae.bindAttributes(bs);var ze=class extends x{constructor(){super(...arguments);u(this,"requireCtxName",!0)}};export{ae as Config,ne as Copyright,Et as DataOutput,Rt as DropArea,Z as FileItem,Yt as FileUploaderMinimal,Lt as Icon,ie as MessageBox,se as ProgressBar,Le as StartFrom,ze as UploadCtxProvider,re as UploadList,ki as registerBlocks}; \ No newline at end of file +var Ei=Object.defineProperty;var Ti=(e,i,t)=>i in e?Ei(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var u=(e,i,t)=>(Ti(e,typeof i!="symbol"?i+"":i,t),t);function wi(e){for(let i in e){let t=[...i].reduce((r,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),r+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),e[i].reg&&e[i].reg(t)}}var Ai=Object.defineProperty,xi=(e,i,t)=>i in e?Ai(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,te=(e,i,t)=>(xi(e,typeof i!="symbol"?i+"":i,t),t);function Si(e){let i=t=>{var r;for(let s in t)((r=t[s])==null?void 0:r.constructor)===Object&&(t[s]=i(t[s]));return{...t}};return i(e)}var E=class{constructor(e){e.constructor===Object?this.store=Si(e):(this._storeIsProxy=!0,this.store=e),this.callbackMap=Object.create(null)}static warn(e,i){console.warn(`Symbiote Data: cannot ${e}. Prop name: `+i)}read(e){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(E.warn("read",e),null):this.store[e]}has(e){return this._storeIsProxy?this.store[e]!==void 0:this.store.hasOwnProperty(e)}add(e,i,t=!1){!t&&Object.keys(this.store).includes(e)||(this.store[e]=i,this.notify(e))}pub(e,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(e)){E.warn("publish",e);return}this.store[e]=i,this.notify(e)}multiPub(e){for(let i in e)this.pub(i,e[i])}notify(e){this.callbackMap[e]&&this.callbackMap[e].forEach(i=>{i(this.store[e])})}sub(e,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(E.warn("subscribe",e),null):(this.callbackMap[e]||(this.callbackMap[e]=new Set),this.callbackMap[e].add(i),t&&i(this.store[e]),{remove:()=>{this.callbackMap[e].delete(i),this.callbackMap[e].size||delete this.callbackMap[e]},callback:i})}static registerCtx(e,i=Symbol()){let t=E.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new E(e),E.globalStore.set(i,t)),t}static deleteCtx(e){E.globalStore.delete(e)}static getCtx(e,i=!0){return E.globalStore.get(e)||(i&&console.warn('State: wrong context UID - "'+e+'"'),null)}};E.globalStore=new Map;var _=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),Me="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Oi=Me.length-1,gt=class{static generate(e="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Ui(e,i){[...e.querySelectorAll(`[${_.REPEAT_ATTR}]`)].forEach(t=>{let r=t.getAttribute(_.REPEAT_ITEM_TAG_ATTR),s;if(r&&(s=window.customElements.get(r)),!s){s=class extends i.BaseComponent{constructor(){super(),r||(this.style.display="contents")}};let o=t.innerHTML;s.template=o,s.reg(r)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(_.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=h=>{h.forEach((f,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(f)});else for(let p in f)l[m][p]=f[p];else{a||(a=new DocumentFragment);let p=new s;Object.assign(p.init$,f),a.appendChild(p)}}),a&&t.appendChild(a);let d=l.slice(h.length,l.length);for(let f of d)f.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let h=[];for(let d in o){let f=o[d];Object.defineProperty(f,"_KEY_",{value:d,enumerable:!0}),h.push(f)}c(h)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(_.REPEAT_ATTR),t.removeAttribute(_.REPEAT_ITEM_TAG_ATTR)})}var Re="__default__";function Ri(e,i){if(i.shadowRoot)return;let t=[...e.querySelectorAll("slot")];if(!t.length)return;let r={};t.forEach(s=>{let n=s.getAttribute("name")||Re;r[n]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=Re;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=r[o])==null||n.fr.appendChild(s)}),Object.values(r).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(n,s.slot)}else s.slot.remove()})}function Li(e,i){[...e.querySelectorAll(`[${_.EL_REF_ATTR}]`)].forEach(t=>{let r=t.getAttribute(_.EL_REF_ATTR);i.ref[r]=t,t.removeAttribute(_.EL_REF_ATTR)})}function Mi(e,i){[...e.querySelectorAll(`[${_.BIND_ATTR}]`)].forEach(t=>{let s=t.getAttribute(_.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Ii(n.name.replace("-",""));s.push(o+":"+n.value),t.removeAttribute(n.name)}}),s.forEach(n=>{if(!n)return;let o=n.split(":").map(h=>h.trim()),l=o[0],a;l.indexOf(_.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(_.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(h=>h.trim());for(let h of c){let d;h.startsWith("!!")?(d="double",h=h.replace("!!","")):h.startsWith("!")&&(d="single",h=h.replace("!","")),i.sub(h,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,f):Pe(t,l,f)||(t[_.SET_LATER_KEY]||(t[_.SET_LATER_KEY]=Object.create(null)),t[_.SET_LATER_KEY][l]=f)})}}),t.removeAttribute(_.BIND_ATTR)})}var wt="{{",_t="}}",Pi="skip-text";function ki(e){let i,t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var n;return!((n=s.parentElement)!=null&&n.hasAttribute(Pi))&&s.textContent.includes(wt)&&s.textContent.includes(_t)&&1}});for(;i=r.nextNode();)t.push(i);return t}var Ni=function(e,i){ki(e).forEach(r=>{let s=[],n;for(;r.textContent.includes(_t);)r.textContent.startsWith(wt)?(n=r.textContent.indexOf(_t)+_t.length,r.splitText(n),s.push(r)):(n=r.textContent.indexOf(wt),r.splitText(n)),r=r.nextSibling;s.forEach(o=>{let l=o.textContent.replace(wt,"").replace(_t,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},Di=[Ui,Ri,Li,Mi,Ni],At="'",ht='"',$i=/\\([0-9a-fA-F]{1,6} ?)/g;function Fi(e){return(e[0]===ht||e[0]===At)&&(e[e.length-1]===ht||e[e.length-1]===At)}function Vi(e){return(e[0]===ht||e[0]===At)&&(e=e.slice(1)),(e[e.length-1]===ht||e[e.length-1]===At)&&(e=e.slice(0,-1)),e}function zi(e){let i="",t="";for(var r=0;rString.fromCodePoint(parseInt(r.trim(),16))),i=i.replaceAll(`\\ +`,"\\n"),i=zi(i),i=ht+i+ht);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${e}`)}}var Le=0,ct=null,K=null,tt=class extends HTMLElement{constructor(){super(),te(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=this.__boundCssProps)==null||e.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return tt}initCallback(){}__initCallback(){var e;this.__initialized||(this.__initialized=!0,(e=this.initCallback)==null||e.call(this))}render(e,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(_.USE_TPL);if(s){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(s))||document.querySelector(s);o?e=o.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(e||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(e==null?void 0:e.constructor)===DocumentFragment)t=e;else if((e==null?void 0:e.constructor)===String){let s=document.createElement("template");s.innerHTML=e,t=s.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(t,this)}let r=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=r,this.shadowRoot.prepend(s)}else r()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=gt.generate(),this.style.setProperty(_.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(_.CSS_CTX_PROP,!0)}get ctxName(){var e;let i=((e=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=E.registerCtx({},this)),this.__localCtx}get nodeCtx(){return E.getCtx(this.ctxName,!1)||E.registerCtx({},this.ctxName)}static __parseProp(e,i){let t,r;if(e.startsWith(_.EXT_DATA_CTX_PRFX))t=i.nodeCtx,r=e.replace(_.EXT_DATA_CTX_PRFX,"");else if(e.includes(_.NAMED_DATA_CTX_SPLTR)){let s=e.split(_.NAMED_DATA_CTX_SPLTR);t=E.getCtx(s[0]),r=s[1]}else t=i.localCtx,r=e;return{ctx:t,name:r}}sub(e,i,t=!0){let r=n=>{this.isConnected&&i(n)},s=tt.__parseProp(e,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,r,t)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,r,t))})}notify(e){let i=tt.__parseProp(e,this);i.ctx.notify(i.name)}has(e){let i=tt.__parseProp(e,this);return i.ctx.has(i.name)}add(e,i,t=!1){let r=tt.__parseProp(e,this);r.ctx.add(r.name,i,t)}add$(e,i=!1){for(let t in e)this.add(t,e[t],i)}get $(){if(!this.__stateProxy){let e=Object.create(null);this.__stateProxy=new Proxy(e,{set:(i,t,r)=>{let s=tt.__parseProp(t,this);return s.ctx.pub(s.name,r),!0},get:(i,t)=>{let r=tt.__parseProp(t,this);return r.ctx.read(r.name)}})}return this.__stateProxy}set$(e,i=!1){for(let t in e){let r=e[t];i||![String,Number,Boolean].includes(r==null?void 0:r.constructor)?this.$[t]=r:this.$[t]!==r&&(this.$[t]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(_.CTX_OWNER_ATTR)&&this.getAttribute(_.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let e=this.constructor.__attrDesc;if(e)for(let i of Object.values(e))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(_.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(_.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(_.NAMED_DATA_CTX_SPLTR)){let t=i.split(_.NAMED_DATA_CTX_SPLTR),r=t[0].trim(),s=t[1].trim();if(r&&s){let n=E.getCtx(r,!1);n||(n=E.registerCtx({},r)),n.add(s,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var e;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(e=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:e.trim();if(i&&this.style.setProperty(_.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[_.SET_LATER_KEY]){for(let t in this[_.SET_LATER_KEY])Pe(this,t,this[_.SET_LATER_KEY][t]);delete this[_.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Di)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${_.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(_.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(s):t.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);for(let e of this.tplProcessors)this.tplProcessors.delete(e);K==null||K.delete(this.updateCssData),K!=null&&K.size||(ct==null||ct.disconnect(),ct=null,K=null)},100)))}static reg(e,i=!1){e||(Le++,e=`${_.AUTO_TAG_PRFX}-${Le}`),this.__tag=e;let t=window.customElements.get(e);if(t){!i&&t!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=Object.keys(e),this.__attrDesc=e}attributeChangedCallback(e,i,t){var r;if(i===t)return;let s=(r=this.constructor.__attrDesc)==null?void 0:r[e];s?this.__dataCtxInitialized?this.$[s]=t:this.init$[s]=t:this[e]=t}getCssData(e,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(e)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(e).trim();try{this.__cssDataCache[e]=ji(t)}catch{!i&&console.warn(`CSS Data error: ${e}`),this.__cssDataCache[e]=null}}return this.__cssDataCache[e]}__extractCssName(e){return e.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){K||(K=new Set),K.add(this.updateCssData),ct||(ct=new MutationObserver(e=>{e[0].type==="attributes"&&K.forEach(i=>{i()})}),ct.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(e,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(e);let t=this.getCssData(this.__extractCssName(e),!0);t===null&&(t=i),this.add(e,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(e,i,t){let r="__"+e;this[r]=this[e],Object.defineProperty(this,e,{set:s=>{this[r]=s,t?window.setTimeout(()=>{i==null||i(s)}):i==null||i(s)},get:()=>this[r]}),this[e]=this[r]}static set shadowStyles(e){let i=new Blob([e],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(e){if(!this.__rootStylesLink){let i=new Blob([e],{type:"text/css"}),t=URL.createObjectURL(i),r=document.createElement("link");r.href=t,r.rel="stylesheet",this.__rootStylesLink=r}}},ee=tt;te(ee,"template");var Qt=class{static _print(e){console.warn(e)}static setDefaultTitle(e){this.defaultTitle=e}static setRoutingMap(e){Object.assign(this.appMap,e);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(e){this.__routingEventName=e}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let e={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))e.route=t.replace("?","");else if(t.includes("=")){let r=t.split("=");e.options[r[0]]=decodeURI(r[1])}else e.options[t]=!0}),e}static notify(){let e=this.readAddressBar(),i=this.appMap[e.route];if(i&&i.title&&(document.title=i.title),e.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${e.route}" not found...`);return}let t=new CustomEvent(Qt.routingEventName,{detail:{route:e.route,options:Object.assign(i||{},e.options)}});window.dispatchEvent(t)}static reflect(e,i={}){let t=this.appMap[e];if(!t){this._print("Wrong route: "+e);return}let r="?"+e;for(let n in i)i[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${i[n]}`;let s=t.title||this.defaultTitle||"";window.history.pushState(null,s,r),document.title=s}static applyRoute(e,i={}){this.reflect(e,i),this.notify()}static setSeparator(e){this._separator=e}static get separator(){return this._separator||"&"}static createRouterData(e,i){this.setRoutingMap(i);let t=E.registerCtx({route:null,options:null,title:null},e);return window.addEventListener(this.routingEventName,r=>{var s;t.multiPub({route:r.detail.route,options:r.detail.options,title:((s=r.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),Qt.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};Qt.appMap=Object.create(null);function ke(e,i){for(let t in i)t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t]}var Ne="idb-store-ready",Hi="symbiote-db",Wi="symbiote-idb-update_",Xi=class{_notifyWhenReady(e=null){window.dispatchEvent(new CustomEvent(Ne,{detail:{dbName:this.name,storeName:this.storeName,event:e}}))}get _updEventName(){return Wi+this.name}_getUpdateEvent(e){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:e}})}_notifySubscribers(e){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,e),window.dispatchEvent(this._getUpdateEvent(e))}constructor(e,i){this.name=e,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async s=>{s(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(e){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(e);return new Promise((r,s)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${e}"`))},t.onerror=n=>{s(n)}})}write(e,i,t=!1){let r={_key:e,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(e),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(e,i=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(e);return new Promise((s,n)=>{r.onsuccess=o=>{i||this._notifySubscribers(e),s(o)},r.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,r)=>{i.onsuccess=s=>{let n=s.target.result;t(n.map(o=>o._value))},i.onerror=s=>{r(s)}})}subscribe(e,i){this._subscriptionsMap[e]||(this._subscriptionsMap[e]=new Set);let t=this._subscriptionsMap[e];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[e]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,De.clear(this.name)}},De=class{static get readyEventName(){return Ne}static open(e=Hi,i="store"){let t=e+"/"+i;return this._reg[t]||(this._reg[t]=new Xi(e,i)),this._reg[t]}static clear(e){window.indexedDB.deleteDatabase(e);for(let i in this._reg)i.split("/")[0]===e&&delete this._reg[i]}};te(De,"_reg",Object.create(null));function V(e,i){let t,r=(...s)=>{clearTimeout(t),t=setTimeout(()=>e(...s),i)};return r.cancel=()=>{clearTimeout(t)},r}var Bi="--uploadcare-blocks-window-height",xt="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function ie(){return typeof window[xt]=="undefined"?!1:!!window[xt]}function $e(){if(ie())return;let e=()=>{document.documentElement.style.setProperty(Bi,`${window.innerHeight}px`),window[xt]=!0},i=V(e,100);return window.addEventListener("resize",i,{passive:!0}),e(),()=>{window[xt]=!1,window.removeEventListener("resize",i)}}var Gi=e=>e,re="{{",Ve="}}",Fe="plural:";function se(e,i,t={}){var o;let{openToken:r=re,closeToken:s=Ve,transform:n=Gi}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();e=e.replaceAll(r+l+s,typeof a=="string"?n(a):a)}return e}function ze(e){let i=[],t=e.indexOf(re);for(;t!==-1;){let r=e.indexOf(Ve,t),s=e.substring(t+2,r);if(s.startsWith(Fe)){let n=e.substring(t+2,r).replace(Fe,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:s,pluralKey:o,countVariable:l})}t=e.indexOf(re,r)}return i}function je(e){return Object.prototype.toString.call(e)==="[object Object]"}var qi=/\W|_/g;function Ki(e){return e.split(qi).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function He(e,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(e)?e.map(t=>Z(t,{ignoreKeys:i})):e}function Z(e,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(e))return He(e,{ignoreKeys:i});if(!je(e))return e;let t={};for(let r of Object.keys(e)){let s=e[r];if(i.includes(r)){t[r]=s;continue}je(s)?s=Z(s,{ignoreKeys:i}):Array.isArray(s)&&(s=He(s,{ignoreKeys:i})),t[Ki(r)]=s}return t}var Yi=e=>new Promise(i=>setTimeout(i,e));function he({libraryName:e,libraryVersion:i,userAgent:t,publicKey:r="",integration:s=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:r,libraryName:e,libraryVersion:i,languageName:n,integration:s});let o=[e,i,r].filter(Boolean).join("/"),l=[n,s].filter(Boolean).join("; ");return`${o} (${l})`}var Ji={factor:2,time:100};function Zi(e,i=Ji){let t=0;function r(s){let n=Math.round(i.time*i.factor**t);return s({attempt:t,retry:l=>Yi(l!=null?l:n).then(()=>(t+=1,r(s)))})}return r(e)}var dt=class extends Error{constructor(t){super();u(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,dt.prototype),this.originalProgressEvent=t}},Ot=(e,i)=>{e&&(e.aborted?Promise.resolve().then(i):e.addEventListener("abort",()=>i(),{once:!0}))},et=class extends Error{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);Object.setPrototypeOf(this,et.prototype)}},Qi=500,Xe=({check:e,interval:i=Qi,timeout:t,signal:r})=>new Promise((s,n)=>{let o,l;Ot(r,()=>{o&&clearTimeout(o),n(new et("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new et("Timed out"))},t));let a=()=>{try{Promise.resolve(e(r)).then(c=>{c?(l&&clearTimeout(l),s(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),y={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},It="application/octet-stream",Be="original",it=({method:e,url:i,data:t,headers:r={},signal:s,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(e==null?void 0:e.toUpperCase())||"GET",h=!1;a.open(c,i,!0),r&&Object.entries(r).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(f,m)}),a.responseType="text",Ot(s,()=>{h=!0,a.abort(),l(new et)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:r||void 0,signal:s,onProgress:n},f=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let T=w.split(": "),b=T.shift(),g=T.join(": ");b&&typeof b!="undefined"&&(m[b]=g)});let p=a.response,C=a.status;o({request:d,data:p,headers:m,status:C})}},a.onerror=d=>{h||l(new dt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function tr(e,...i){return e}var er=({name:e})=>e?[e]:[],ir=tr,rr=()=>new FormData,Ge=e=>!1,Ut=e=>typeof Blob!="undefined"&&e instanceof Blob,Rt=e=>typeof File!="undefined"&&e instanceof File,Lt=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&"uri"in e&&typeof e.uri=="string",ft=e=>Ut(e)||Rt(e)||Ge()||Lt(e),sr=e=>typeof e=="string"||typeof e=="number"||typeof e=="undefined",nr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),or=e=>!!e&&typeof e=="object"&&"data"in e&&ft(e.data);function lr(e,i,t){if(or(t)){let{name:r,contentType:s}=t,n=ir(t.data,r,s!=null?s:It),o=er({name:r,contentType:s});e.push([i,n,...o])}else if(nr(t))for(let[r,s]of Object.entries(t))typeof s!="undefined"&&e.push([`${i}[${r}]`,String(s)]);else sr(t)&&t&&e.push([i,t.toString()])}function ar(e){let i=[];for(let[t,r]of Object.entries(e))lr(i,t,r);return i}function de(e){let i=rr(),t=ar(e);for(let r of t){let[s,n,...o]=r;i.append(s,n,...o)}return i}var I=class extends Error{constructor(t,r,s,n,o){super();u(this,"isCancel");u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadClientError",this.message=t,this.code=r,this.request=s,this.response=n,this.headers=o,Object.setPrototypeOf(this,I.prototype)}},ur=e=>{let i=new URLSearchParams;for(let[t,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).filter(s=>{var n;return(n=s[1])!=null?n:!1}).forEach(s=>i.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(r)?r.forEach(s=>{i.append(`${t}[]`,s)}):typeof r=="string"&&r?i.set(t,r):typeof r=="number"&&i.set(t,r.toString());return i.toString()},Y=(e,i,t)=>{let r=new URL(e);return r.pathname=(r.pathname+i).replace("//","/"),t&&(r.search=ur(t)),r.toString()},cr="6.7.0",hr="UploadcareUploadClient",dr=cr;function at(e){return he({libraryName:hr,libraryVersion:dr,...e})}var fr="RequestThrottledError",We=15e3,pr=1e3;function mr(e){let{headers:i}=e||{};if(!i||typeof i["retry-after"]!="string")return We;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:We}function rt(e,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:r}=i;return Zi(({attempt:s,retry:n})=>e().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===fr&&s{let i="";return(Ut(e)||Rt(e)||Lt(e))&&(i=e.type),i||It},Ke=e=>{let i="";return Rt(e)&&e.name?i=e.name:Ut(e)||Ge()?i="":Lt(e)&&e.name&&(i=e.name),i||Be};function fe(e){return typeof e=="undefined"||e==="auto"?"auto":e?"1":"0"}function _r(e,{publicKey:i,fileName:t,contentType:r,baseURL:s=y.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=y.retryNetworkErrorMaxTimes,metadata:C}){return rt(()=>it({method:"POST",url:Y(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":at({publicKey:i,integration:d,userAgent:f})},data:de({file:{data:e,name:t||Ke(e),contentType:r||qe(e)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:fe(l),signature:n,expire:o,source:h,metadata:C}),signal:a,onProgress:c}).then(({data:w,headers:T,request:b})=>{let g=Z(JSON.parse(w));if("error"in g)throw new I(g.error.content,g.error.errorCode,b,g,T);return g}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var le;(function(e){e.Token="token",e.FileInfo="file_info"})(le||(le={}));function gr(e,{publicKey:i,baseURL:t=y.baseURL,store:r,fileName:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=y.retryNetworkErrorMaxTimes,metadata:C}){return rt(()=>it({method:"POST",headers:{"X-UC-User-Agent":at({publicKey:i,integration:d,userAgent:f})},url:Y(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:e,store:fe(r),filename:s,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:C}),signal:h}).then(({data:w,headers:T,request:b})=>{let g=Z(JSON.parse(w));if("error"in g)throw new I(g.error.content,g.error.errorCode,b,g,T);return g}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var N;(function(e){e.Unknown="unknown",e.Waiting="waiting",e.Progress="progress",e.Error="error",e.Success="success"})(N||(N={}));var br=e=>"status"in e&&e.status===N.Error;function yr(e,{publicKey:i,baseURL:t=y.baseURL,signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=y.retryNetworkErrorMaxTimes}={}){return rt(()=>it({method:"GET",headers:i?{"X-UC-User-Agent":at({publicKey:i,integration:s,userAgent:n})}:void 0,url:Y(t,"/from_url/status/",{jsonerrors:1,token:e}),signal:r}).then(({data:a,headers:c,request:h})=>{let d=Z(JSON.parse(a));if("error"in d&&!br(d))throw new I(d.error.content,void 0,h,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function Cr(e,{publicKey:i,baseURL:t=y.baseURL,jsonpCallback:r,secureSignature:s,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=y.retryNetworkErrorMaxTimes}){return rt(()=>it({method:"POST",headers:{"X-UC-User-Agent":at({publicKey:i,integration:a,userAgent:c})},url:Y(t,"/group/",{jsonerrors:1,pub_key:i,files:e,callback:r,signature:s,expire:n,source:l}),signal:o}).then(({data:f,headers:m,request:p})=>{let C=Z(JSON.parse(f));if("error"in C)throw new I(C.error.content,C.error.errorCode,p,C,m);return C}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:h})}function Ye(e,{publicKey:i,baseURL:t=y.baseURL,signal:r,source:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=y.retryNetworkErrorMaxTimes}){return rt(()=>it({method:"GET",headers:{"X-UC-User-Agent":at({publicKey:i,integration:n,userAgent:o})},url:Y(t,"/info/",{jsonerrors:1,pub_key:i,file_id:e,source:s}),signal:r}).then(({data:c,headers:h,request:d})=>{let f=Z(JSON.parse(c));if("error"in f)throw new I(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function vr(e,{publicKey:i,contentType:t,fileName:r,multipartChunkSize:s=y.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=y.retryNetworkErrorMaxTimes,metadata:C}){return rt(()=>it({method:"POST",url:Y(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":at({publicKey:i,integration:d,userAgent:f})},data:de({filename:r||Be,size:e,content_type:t||It,part_size:s,UPLOADCARE_STORE:fe(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:h,metadata:C}),signal:c}).then(({data:w,headers:T,request:b})=>{let g=Z(JSON.parse(w));if("error"in g)throw new I(g.error.content,g.error.errorCode,b,g,T);return g.parts=Object.keys(g.parts).map(P=>g.parts[P]),g}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})}function Er(e,i,{contentType:t,signal:r,onProgress:s,retryThrottledRequestMaxTimes:n=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=y.retryNetworkErrorMaxTimes}){return rt(()=>it({method:"PUT",url:i,data:e,onProgress:s,signal:r,headers:{"Content-Type":t||It}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Tr(e,{publicKey:i,baseURL:t=y.baseURL,source:r="local",signal:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=y.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=y.retryNetworkErrorMaxTimes}){return rt(()=>it({method:"POST",url:Y(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":at({publicKey:i,integration:n,userAgent:o})},data:de({uuid:e,UPLOADCARE_PUB_KEY:i,source:r}),signal:s}).then(({data:c,headers:h,request:d})=>{let f=Z(JSON.parse(c));if("error"in f)throw new I(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function pe({file:e,publicKey:i,baseURL:t,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Xe({check:h=>Ye(e,{publicKey:i,baseURL:t,signal:h,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function wr(e){return"defaultEffects"in e}var J=class{constructor(i,{baseCDN:t=y.baseCDN,fileName:r}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:s,s3Bucket:n}=i,o=Y(t,`${s}/`),l=n?Y(`https://${n}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=r||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l,wr(i)&&(this.defaultEffects=i.defaultEffects)}},Ar=(e,{publicKey:i,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,baseCDN:C,metadata:w})=>_r(e,{publicKey:i,fileName:t,contentType:l,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:w}).then(({file:T})=>pe({file:T,publicKey:i,baseURL:r,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(T=>new J(T,{baseCDN:C})),xr=(e,{publicKey:i,fileName:t,baseURL:r,signal:s,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h,baseCDN:d})=>Ye(e,{publicKey:i,baseURL:r,signal:s,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h}).then(f=>new J(f,{baseCDN:d,fileName:t})).then(f=>(n&&n({isComputable:!0,value:1}),f)),Sr=(e,{signal:i}={})=>{let t=null,r=null,s=e.map(()=>new AbortController),n=o=>()=>{r=o,s.forEach((l,a)=>a!==o&&l.abort())};return Ot(i,()=>{s.forEach(o=>o.abort())}),Promise.all(e.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(r===null)throw t;return o[r]})},Or=window.WebSocket,ae=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var r;(r=this.events[i])==null||r.forEach(s=>s(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(r=>r!==t):this.events[i]=[]}},Ir=(e,i)=>e==="success"?{status:N.Success,...i}:e==="progress"?{status:N.Progress,...i}:{status:N.Error,...i},ue=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new ae);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Or(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let r=JSON.parse(t.data.toString());switch(r.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(r.channel,Ir(r.event,JSON.parse(r.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var s;let r=JSON.stringify({event:i,data:t});(s=this.ws)==null||s.send(r)}subscribe(i,t){this.subscribers+=1,this.connect();let r=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:r}};this.emmitter.on(r,t),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,r={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(r.event,r.data):this.queue=this.queue.filter(s=>s.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},ne=null,me=e=>{if(!ne){let i=typeof window=="undefined"?0:3e4;ne=new ue(e,i)}return ne},Ur=e=>{me(e).connect()};function Rr({token:e,publicKey:i,baseURL:t,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return Xe({check:c=>yr(e,{publicKey:i,baseURL:t,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(h=>{switch(h.status){case N.Error:return new I(h.error,h.errorCode);case N.Waiting:return!1;case N.Unknown:return new I(`Token "${e}" was not found.`);case N.Progress:return l&&(h.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:h.done/h.total})),!1;case N.Success:return l&&l({isComputable:!0,value:h.done/h.total}),h;default:throw new Error("Unknown status")}}),signal:a})}var Lr=({token:e,pusherKey:i,signal:t,onProgress:r})=>new Promise((s,n)=>{let o=me(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(e)};Ot(t,()=>{a(),n(new et("pusher cancelled"))}),o.subscribe(e,c=>{switch(c.status){case N.Progress:{r&&(c.total==="unknown"?r({isComputable:!1}):r({isComputable:!0,value:c.done/c.total}));break}case N.Success:{a(),r&&r({isComputable:!0,value:c.done/c.total}),s(c);break}case N.Error:a(),n(new I(c.msg,c.error_code))}})}),Mr=(e,{publicKey:i,fileName:t,baseURL:r,baseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,onProgress:d,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:C,pusherKey:w=y.pusherKey,metadata:T})=>Promise.resolve(Ur(w)).then(()=>gr(e,{publicKey:i,fileName:t,baseURL:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:C,metadata:T})).catch(b=>{let g=me(w);return g==null||g.disconnect(),Promise.reject(b)}).then(b=>b.type===le.FileInfo?b:Sr([({signal:g})=>Rr({token:b.token,publicKey:i,baseURL:r,integration:m,userAgent:p,retryThrottledRequestMaxTimes:C,onProgress:d,signal:g}),({signal:g})=>Lr({token:b.token,pusherKey:w,signal:g,onProgress:d})],{signal:h})).then(b=>{if(b instanceof I)throw b;return b}).then(b=>pe({file:b.uuid,publicKey:i,baseURL:r,integration:m,userAgent:p,retryThrottledRequestMaxTimes:C,onProgress:d,signal:h})).then(b=>new J(b,{baseCDN:s})),oe=new WeakMap,Pr=async e=>{if(oe.has(e))return oe.get(e);let i=await fetch(e.uri).then(t=>t.blob());return oe.set(e,i),i},Je=async e=>{if(Rt(e)||Ut(e))return e.size;if(Lt(e))return(await Pr(e)).size;throw new Error("Unknown file type. Cannot determine file size.")},kr=(e,i=y.multipartMinFileSize)=>e>=i,Ze=e=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ft(e)&&t.test(e)},_e=e=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ft(e)&&t.test(e)},Nr=(e,i)=>new Promise((t,r)=>{let s=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,h=l.shift();h&&h().then(d=>{n||(s[c]=d,o-=1,o?a():t(s))}).catch(d=>{n=!0,r(d)})};for(let c=0;c{let s=r*i,n=Math.min(s+r,t);return e.slice(s,n)},$r=async(e,i,t)=>r=>Dr(e,r,i,t),Fr=(e,i,{publicKey:t,contentType:r,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Er(e,i,{publicKey:t,contentType:r,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Vr=async(e,{publicKey:i,fileName:t,fileSize:r,baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,contentType:C,multipartChunkSize:w=y.multipartChunkSize,maxConcurrentRequests:T=y.maxConcurrentRequests,baseCDN:b,metadata:g})=>{let P=r!=null?r:await Je(e),G,lt=(O,k)=>{if(!c)return;G||(G=Array(O).fill(0));let z=j=>j.reduce((q,Zt)=>q+Zt,0);return j=>{j.isComputable&&(G[k]=j.value,c({isComputable:!0,value:z(G)/O}))}};return C||(C=qe(e)),vr(P,{publicKey:i,contentType:C,fileName:t||Ke(e),baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:g}).then(async({uuid:O,parts:k})=>{let z=await $r(e,P,w);return Promise.all([O,Nr(T,k.map((j,q)=>()=>Fr(z(q),j,{publicKey:i,contentType:C,onProgress:lt(k.length,q),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})))])}).then(([O])=>Tr(O,{publicKey:i,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})).then(O=>O.isReady?O:pe({file:O.uuid,publicKey:i,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(O=>new J(O,{baseCDN:b}))};async function ge(e,{publicKey:i,fileName:t,baseURL:r=y.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartMinFileSize:C,multipartChunkSize:w,maxConcurrentRequests:T,baseCDN:b=y.baseCDN,checkForUrlDuplicates:g,saveUrlForRecurrentUploads:P,pusherKey:G,metadata:lt}){if(ft(e)){let O=await Je(e);return kr(O,C)?Vr(e,{publicKey:i,contentType:p,multipartChunkSize:w,fileSize:O,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,maxConcurrentRequests:T,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b,metadata:lt}):Ar(e,{publicKey:i,fileName:t,contentType:p,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b,metadata:lt})}if(_e(e))return Mr(e,{publicKey:i,fileName:t,baseURL:r,baseCDN:b,checkForUrlDuplicates:g,saveUrlForRecurrentUploads:P,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:G,metadata:lt});if(Ze(e))return xr(e,{publicKey:i,fileName:t,baseURL:r,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:b});throw new TypeError(`File uploading from "${e}" is not supported`)}var ce=class{constructor(i,{baseCDN:t=y.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let r=i.files.filter(Boolean);this.totalSize=Object.values(r).reduce((s,n)=>s+n.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(r).filter(s=>s.isImage).length,this.cdnUrl=i.cdnUrl,this.files=r.map(s=>new J(s,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},zr=e=>{for(let i of e)if(!ft(i))return!1;return!0},jr=e=>{for(let i of e)if(!Ze(i))return!1;return!0},Hr=e=>{for(let i of e)if(!_e(i))return!1;return!0};function Qe(e,{publicKey:i,fileName:t,baseURL:r=y.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:C=y.multipartChunkSize,baseCDN:w=y.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:b,jsonpCallback:g}){if(!zr(e)&&!Hr(e)&&!jr(e))throw new TypeError(`Group uploading from "${e}" is not supported`);let P,G=!0,lt=e.length,O=(k,z)=>{if(!a)return;P||(P=Array(k).fill(0));let j=q=>q.reduce((Zt,vi)=>Zt+vi)/k;return q=>{if(!q.isComputable||!G){G=!1,a({isComputable:!1});return}P[z]=q.value,a({isComputable:!0,value:j(P)})}};return Promise.all(e.map((k,z)=>ft(k)||_e(k)?ge(k,{publicKey:i,fileName:t,baseURL:r,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:O(lt,z),source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:C,baseCDN:w,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:b}).then(j=>j.uuid):k)).then(k=>Cr(k,{publicKey:i,baseURL:r,jsonpCallback:g,secureSignature:s,secureExpire:n,signal:l,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(z=>new ce(z,{baseCDN:w})).then(z=>(a&&a({isComputable:!0,value:1}),z)))}var St=class{constructor(i){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t{this._resolvers.delete(r),this._rejectors.delete(r),this._running-=1,this._run()}).then(o=>s(o)).catch(o=>n(o))}}add(i){return new Promise((t,r)=>{this._resolvers.set(i,t),this._rejectors.set(i,r),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var be=()=>({"*blocksRegistry":new Set}),ye=e=>({...be(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{e.set$({"*modalActive":!1,"*currentActivity":""})}}),Mt=e=>({...ye(e),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new St(1)});function ti(e,i){[...e.querySelectorAll("[l10n]")].forEach(t=>{let r=t.getAttribute("l10n"),s="textContent";if(r.includes(":")){let o=r.split(":");s=o[0],r=o[1]}let n="l10n:"+r;i.__l10nKeys.push(n),i.add(n,r),i.sub(n,o=>{t[s]=i.l10n(o)}),t.removeAttribute("l10n")})}var D=e=>`*cfg/${e}`;var st=e=>{var i;return(i=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var ei=new Set;function Pt(e){ei.has(e)||(ei.add(e),console.warn(e))}var kt=(e,i)=>new Intl.PluralRules(e).select(i);var Nt=({element:e,attribute:i,onSuccess:t,onTimeout:r,timeout:s=300})=>{let n=setTimeout(()=>{a.disconnect(),r()},s),o=c=>{let h=e.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&h!==null&&(clearTimeout(n),a.disconnect(),t(h))},l=e.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let h=c[c.length-1];o(h)});a.observe(e,{attributes:!0,attributeFilter:[i]})};var Ce="lr-",S=class extends ee{constructor(){super();u(this,"requireCtxName",!1);u(this,"allowCustomTemplate",!0);u(this,"init$",be());u(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let r of t)r.isConnected&&r.updateCssData()});this.activityType=null,this.addTemplateProcessor(ti),this.__l10nKeys=[]}l10n(t,r={}){if(!t)return"";let s=this.getCssData("--l10n-"+t,!0)||t,n=ze(s);for(let l of n)r[l.variable]=this.pluralize(l.pluralKey,Number(r[l.countVariable]));return se(s,r)}pluralize(t,r){let s=this.l10n("locale-name")||"en-US",n=kt(s,r);return this.l10n(`${t}__${n}`)}applyL10nKey(t,r){let s="l10n:"+t;this.$[s]=r,this.__l10nKeys.push(t)}hasBlockInCtx(t){let r=this.$["*blocksRegistry"];for(let s of r)if(t(s))return!0;return!1}setOrAddState(t,r){this.add$({[t]:r},!0)}setActivity(t){if(this.hasBlockInCtx(r=>r.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ce}${t}`,!0),ie()||(this._destroyInnerHeightTracker=$e()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Nt({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,r=2){let s=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(s[0])}`;let o=1024,l=r<0?0:r,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(s[a])}proxyUrl(t){let r=this.cfg.secureDeliveryProxy;return r?se(r,{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(r,s,n)=>{if(typeof s!="string")return!1;let o=D(s);return this.$[o]=n,!0},get:(r,s)=>{let n=D(s),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Pt("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${st(s)}`))}})}return this.__cfgProxy}subConfigValue(t,r){let s=this.parseCfgProp(D(t));s.ctx.has(s.name)?this.sub(D(t),r):(this.bindCssData(`--cfg-${st(t)}`),this.sub(`--cfg-${st(t)}`,r))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ce)?t:Ce+t)}};u(S,"StateConsumerScope",null),u(S,"className","");var ii="active",bt="___ACTIVITY_IS_ACTIVE___",H=class extends S{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",ye(this));u(this,"_debouncedHistoryFlush",V(this._historyFlush.bind(this),10))}_deactivate(){var r;let t=H._activityRegistry[this.activityKey];this[bt]=!1,this.removeAttribute(ii),(r=t==null?void 0:t.deactivateCallback)==null||r.call(t)}_activate(){var r;let t=H._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[bt]=!0,this.setAttribute(ii,""),(r=t==null?void 0:t.activateCallback)==null||r.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[bt]?this._deactivate():this.activityType===t&&!this[bt]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!H._activityRegistry[this.activityKey]}get isActivityActive(){return this[bt]}registerActivity(t,r={}){let{onActivate:s,onDeactivate:n}=r;H._activityRegistry||(H._activityRegistry=Object.create(null)),H._activityRegistry[this.activityKey]={activateCallback:s,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),H._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(H._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}},v=H;u(v,"_activityRegistry",Object.create(null));v.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Wr="css-src";function Xr(e){return class extends e{constructor(){super(...arguments);u(this,"renderShadow",!0);u(this,"pauseRender",!0);u(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Nt({element:this,attribute:Wr,onSuccess:t=>{this.attachShadow({mode:"open"});let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,r.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(r)},onTimeout:()=>{console.error("Attribute `css-src`is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Dt=class extends Xr(S){};var $t=class extends Dt{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",Mt(this));u(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var Ft=class extends $t{constructor(){super(...arguments);u(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",r=>{r||(this.$["*currentActivity"]=t.initActivity||v.activities.START_FROM)}),this.sub("*uploadList",r=>{(r==null?void 0:r.length)>0?this.$["*currentActivity"]=v.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||v.activities.START_FROM}),this.subConfigValue("sourceList",r=>{r!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",r=>{r!==!1&&(this.cfg.confirmUpload=!1)})}};Ft.template=``;var ve=class extends v{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function ri(e,i,t){let r=e/i,s,n;r>t?(s=Math.round(i*t),n=i):(s=e,n=Math.round(e/t));let o=Math.round((e-s)/2),l=Math.round((i-n)/2);return o+s>e&&(s=e-o),l+n>i&&(n=i-l),{x:o,y:l,width:s,height:n}}var si=e=>{if(!e)return[];let[i,t]=e.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${e}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var nt=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var yt=e=>e?e.join(","):"";var ni="blocks",oi="0.27.6";function li(e){return he({...e,libraryName:ni,libraryVersion:oi})}var Br=e=>{if(typeof e!="string"||!e)return"";let i=e.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ee=(...e)=>e.filter(i=>typeof i=="string"&&i).map(i=>Br(i)).join("/-/"),Vt=(...e)=>{let i=Ee(...e);return i?`-/${i}/`:""};function ai(e){let i=new URL(e),t=i.pathname+i.search+i.hash,r=t.lastIndexOf("http"),s=t.lastIndexOf("/"),n="";return r>=0?n=t.slice(r):s>=0&&(n=t.slice(s+1)),n}function Gr(e){let i=new URL(e),t=ai(e),r=ui(t)?ci(t).pathname:t;return i.pathname=i.pathname.replace(r,""),i.search="",i.hash="",i.toString()}function ui(e){return e.startsWith("http")}function ci(e){let i=new URL(e);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var zt=(e,i,t)=>{let r=new URL(Gr(e));if(t=t||ai(e),r.pathname.startsWith("//")&&(r.pathname=r.pathname.replace("//","/")),ui(t)){let s=ci(t);r.pathname=r.pathname+(i||"")+(s.pathname||""),r.search=s.search,r.hash=s.hash}else r.pathname=r.pathname+(i||"")+(t||"");return r.toString()},hi=(e,i)=>{let t=new URL(e);return t.pathname=i+"/",t.toString()};var pt=(e,i=",")=>e.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Ct=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Te=e=>e?e.filter(i=>typeof i=="string").map(i=>pt(i)).flat():[],we=(e,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),e.startsWith(t)):e===t),di=(e,i)=>i.some(t=>t.startsWith(".")?e.toLowerCase().endsWith(t.toLowerCase()):!1),Ae=e=>{let i=e==null?void 0:e.type;return i?we(i,Ct):!1};var W=1e3,ut=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),vt=e=>Math.ceil(e*100)/100,fi=(e,i=ut.AUTO)=>{let t=i===ut.AUTO;if(i===ut.BYTE||t&&e{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!r){s();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{s(),delete this._timeoutStore[n]},20)}};u(U,"_timeoutStore",Object.create(null));var pi="[Typed State] Wrong property name: ",qr="[Typed State] Wrong property type: ",jt=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||gt.generate(),this.__schema=Object.keys(i).reduce((r,s)=>(r[s]=i[s].value,r),{}),this.__data=E.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(pi+i);return}let r=this.__typedSchema[i];if((t==null?void 0:t.constructor)===r.type||t instanceof r.type||r.nullable&&t===null){this.__data.pub(i,t);return}console.warn(qr+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(pi+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){E.deleteCtx(this.__ctxId)}};var Ht=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||gt.generate(),this.__data=E.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(r,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[r]||(t[r]=new Set),t[r].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let r of this.__collectionObservers)r==null||r([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){this.__collectionObservers.delete(i)}add(i){let t=new jt(this.__typedSchema);for(let r in i)t.setValue(r,i[r]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(r=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(r,()=>{this.__notifyObservers(r,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,r){this.read(i).setValue(t,r)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){this.__propertyObservers.delete(i)}findItems(i){let t=[];return this.__items.forEach(r=>{let s=this.read(r);i(s)&&t.push(r)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){E.deleteCtx(this.__data),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var mi=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:J,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var x=class extends v{constructor(){super(...arguments);u(this,"couldBeUploadCollectionOwner",!1);u(this,"isUploadCollectionOwner",!1);u(this,"init$",Mt(this));u(this,"__initialUploadMetadata",null);u(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);u(this,"_debouncedRunValidators",V(this._runValidators.bind(this),100));u(this,"_flushOutputItems",V(()=>{let t=this.getOutputData();t.length===this.uploadCollection.size&&(U.emit(new R({type:$.DATA_OUTPUT,ctx:this.ctxName,data:t})),this.$["*outputData"]=t)},100));u(this,"_handleCollectonUpdate",(t,r,s)=>{var n;this._runValidators();for(let o of s)(n=o==null?void 0:o.getValue("abortController"))==null||n.abort(),o==null||o.setValue("abortController",null),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl"));this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushOutputItems()});u(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let r=this.uploadCollection,s=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>r.read(n)).filter(Boolean);for(let n of s)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=r.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=r.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,U.emit(new R({type:$.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=r.findItems(l=>!!l.getValue("fileInfo")),o=r.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(r.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&U.emit(new R({type:$.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&r.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{U.emit(new R({type:$.UPLOAD_ERROR,ctx:this.ctxName,data:r.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&r.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{U.emit(new R({type:$.VALIDATION_ERROR,ctx:this.ctxName,data:r.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&r.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{U.emit(new R({type:$.CLOUD_MODIFICATION,ctx:this.ctxName,data:E.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){Pt("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let r=new Ht({typedSchema:mi,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",r)}let t=()=>this.hasBlockInCtx(r=>r instanceof x?r.isUploadCollectionOwner&&r.isConnected&&r!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectonUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",r=>{this.$["*uploadQueue"].concurrency=Number(r)||1})}destroyCallback(){var t,r;super.destroyCallback(),this.isUploadCollectionOwner&&((t=this._unobserveCollectionProperties)==null||t.call(this),(r=this._unobserveCollection)==null||r.call(this))}addFileFromUrl(t,{silent:r,fileName:s,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:s!=null?s:null,silentUpload:r!=null?r:!1,source:n!=null?n:nt.API})}addFileFromUuid(t,{silent:r,fileName:s,source:n}={}){this.uploadCollection.add({uuid:t,fileName:s!=null?s:null,silentUpload:r!=null?r:!1,source:n!=null?n:nt.API})}addFileFromObject(t,{silent:r,fileName:s,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:Ae(t),mimeType:t.type,fileName:s!=null?s:t.name,fileSize:t.size,silentUpload:r!=null?r:!1,source:n!=null?n:nt.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(r=>{this.uploadCollection.add({file:r,isImage:Ae(r),mimeType:r.type,fileName:r.name,fileSize:r.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var s;let r=yt(Te([(s=this.cfg.accept)!=null?s:"",...this.cfg.imgOnly?Ct:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=yt(Ct)):this.fileInput.accept=r,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:nt.LOCAL})),this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=pt(this.cfg.sourceList)),t}initFlow(t=!1){var r;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((r=this.sourceList)==null?void 0:r.length)===1){let s=this.sourceList[0];s==="local"?(this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(x.extSrcList).includes(s)?this.set$({"*currentActivityParams":{externalSourceType:s},"*currentActivity":v.activities.EXTERNAL}):this.$["*currentActivity"]=s,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":v.activities.START_FROM}),this.setOrAddState("*modalActive",!0);U.emit(new R({type:$.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),U.emit(new R({type:$.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let r=this.cfg.imgOnly,s=this.cfg.accept,n=Te([...r?Ct:[],s]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=we(o,n),c=di(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let r=this.cfg.maxLocalFileSizeBytes,s=t.getValue("fileSize");if(r&&s&&s>r)return this.l10n("files-max-size-limit-error",{maxFileSize:fi(r)})}_validateMultipleLimit(t){let r=this.uploadCollection.items(),s=r.indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMin:1,o=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&r.length=o)return this.l10n("files-count-allowed",{count:o})}_validateIsImage(t){let r=this.cfg.imgOnly,s=t.getValue("isImage");if(!(!r||s)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let r of this._validators){let s=r(t);if(s){t.setValue("validationErrorMsg",s);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let r=this.uploadCollection.read(t);r&&this._runValidatorsForEntry(r)})}setInitialCrop(){let t=si(this.cfg.cropPreset);if(t){let[r]=t,s=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of s){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=r.width/r.height,h=ri(l,a,c),d=Vt(`crop/${h.width}x${h.height}/${h.x},${h.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:zt(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===v.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var r;let t=(r=this.cfg.metadata)!=null?r:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:li,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let r=[];return(t?this.uploadCollection.findItems(t):this.uploadCollection.items()).forEach(n=>{var c,h;let o=E.getCtx(n).store,l=o.fileInfo||{name:o.fileName,originalFilename:o.fileName,size:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:(h=(c=o.cdnUrl)!=null?c:l.cdnUrl)!=null?h:null,validationErrorMessage:o.validationErrorMsg,uploadError:o.uploadError,isUploaded:!!o.uuid&&!!o.fileInfo,isValid:!o.validationErrorMsg&&!o.uploadError};r.push(a)}),r}};x.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});x.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...x.extSrcList});var X={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};var ro=Ee("format/auto","progressive/yes");var xe=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),_i=[xe.CROP,xe.TUNING,xe.FILTERS];var oo=Object.freeze({brightness:{zero:X.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:X.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:X.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:X.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:X.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:X.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:X.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:X.enhance,range:[0,100],keypointsNumber:1},filter:{zero:X.filter,range:[0,100],keypointsNumber:1}});var Kr="https://ucarecdn.com",Yr="https://upload.uploadcare.com",Jr="https://social.uploadcare.com",ot={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:yt(_i),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Kr,baseUrl:Yr,socialBaseUrl:Jr,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var F=e=>String(e),B=e=>{let i=Number(e);if(Number.isNaN(i))throw new Error(`Invalid number: "${e}"`);return i},A=e=>{if(typeof e=="undefined"||e===null)return!1;if(typeof e=="boolean")return e;if(e==="true"||e==="")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean: "${e}"`)},Zr=e=>e==="auto"?e:A(e),Qr={pubkey:F,multiple:A,multipleMin:B,multipleMax:B,confirmUpload:A,imgOnly:A,accept:F,externalSourcesPreferredTypes:F,store:Zr,cameraMirror:A,sourceList:F,maxLocalFileSizeBytes:B,thumbSize:B,showEmptyList:A,useLocalImageEditor:A,useCloudImageEditor:A,cloudImageEditorTabs:F,removeCopyright:A,cropPreset:F,modalScrollLock:A,modalBackdropStrokes:A,sourceListWrap:A,remoteTabSessionKey:F,cdnCname:F,baseUrl:F,socialBaseUrl:F,secureSignature:F,secureExpire:F,secureDeliveryProxy:F,retryThrottledRequestMaxTimes:B,multipartMinFileSize:B,multipartChunkSize:B,maxConcurrentRequests:B,multipartMaxConcurrentRequests:B,multipartMaxAttempts:B,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:A,groupOutput:A,userAgentIntegration:F},gi=(e,i)=>{if(!(typeof i=="undefined"||i===null))try{return Qr[e](i)}catch(t){return console.error(`Invalid value for config key "${e}".`,t),ot[e]}};function ts(e){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let r=s=>{s.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=r,t.onprogress=r,t.readAsDataURL(e)}catch{i(!1)}})}function es(e,i){return new Promise(t=>{let r=0,s=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(r++,l.file(a=>{r--;let c=new File([a],a.name,{type:a.type||i});s.push({type:"file",file:c,fullPath:l.fullPath}),r===0&&t(s)})):l.isDirectory&&o(l.createReader())},o=l=>{r++,l.readEntries(a=>{r--;for(let c of a)n(c);r===0&&t(s)})};n(e)})}function bi(e){let i=[],t=[];for(let r=0;r{a&&i.push(...a)}));continue}let o=s.getAsFile();o&&t.push(ts(o).then(l=>{l||i.push({type:"file",file:o})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&t.push(new Promise(n=>{s.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var L={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},yi=["focus"],is=100,Se=new Map;function rs(e,i){let t=Math.max(Math.min(e[0],i.x+i.width),i.x),r=Math.max(Math.min(e[1],i.y+i.height),i.y);return Math.sqrt((e[0]-t)*(e[0]-t)+(e[1]-r)*(e[1]-r))}function Oe(e){let i=0,t=document.body,r=new Set,s=p=>r.add(p),n=L.INACTIVE,o=p=>{e.shouldIgnore()&&p!==L.INACTIVE||(n!==p&&r.forEach(C=>C(p)),n=p)},l=()=>i>0;s(p=>e.onChange(p));let a=()=>{i=0,o(L.INACTIVE)},c=()=>{i+=1,n===L.INACTIVE&&o(L.ACTIVE)},h=()=>{i-=1,l()||o(L.INACTIVE)},d=p=>{p.preventDefault(),i=0,o(L.INACTIVE)},f=p=>{if(e.shouldIgnore())return;l()||(i+=1);let C=[p.x,p.y],w=e.element.getBoundingClientRect(),T=Math.floor(rs(C,w)),b=T{if(e.shouldIgnore())return;p.preventDefault();let C=await bi(p.dataTransfer);e.onItems(C),o(L.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",h),t.addEventListener("dragenter",c),t.addEventListener("dragover",f),e.element.addEventListener("drop",m),yi.forEach(p=>{window.addEventListener(p,a)}),()=>{Se.delete(e.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",h),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",f),e.element.removeEventListener("drop",m),yi.forEach(p=>{window.removeEventListener(p,a)})}}var Et=class extends x{constructor(){super(),this.init$={...this.init$,state:L.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,r=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return t&&n&&r}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!A(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:A(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:A(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:A(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=Oe({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(r=>{r.type==="url"?this.addFileFromUrl(r.url,{source:nt.DROP_AREA}):r.type==="file"&&this.addFileFromObject(r.file,{source:nt.DROP_AREA,fullPath:r.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Oe({element:i,onChange:t=>{var s;let r=(s=Object.entries(L).find(([,n])=>n===t))==null?void 0:s[0].toLowerCase();r&&i.setAttribute("drag-state",r)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var s;let r=(s=Object.entries(L).find(([,n])=>n===t))==null?void 0:s[0].toLowerCase();r&&this.setAttribute("drag-state",r)}),this.subConfigValue("sourceList",t=>{let r=pt(t);this.$.isEnabled=r.includes(x.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(r=>r!==this).filter(r=>r.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,r=this.uploadCollection.size;return!(i&&t&&r>=t||!i&&r>0)}destroyCallback(){var i,t,r,s;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(r=this._destroyDropzone)==null||r.call(this),(s=this._destroyContentWrapperDropzone)==null||s.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};Et.template=`
{{text}}
`;Et.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Wt=class{constructor(){u(this,"caption","");u(this,"text","");u(this,"iconName","");u(this,"isError",!1)}},Xt=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};Xt.template=`
{{captionTxt}}
{{msgTxt}}
`;var Bt=class extends x{constructor(){super();u(this,"couldBeUploadCollectionOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",v.activities.UPLOAD_LIST);u(this,"_debouncedHandleCollectionUpdate",V(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(r=>!!r.getValue("fileInfo"));U.emit(new R({type:$.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var h,d;let t=!!this.cfg.multiple,r=t?(h=this.cfg.multipleMin)!=null?h:0:1,s=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=r?ns:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:r,max:s,exact:s===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,r=this._validateFilesCount();if(t&&!r.passed){let s=new Wt,n=r.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";s.caption=this.l10n("files-count-limit-error-title"),s.text=this.l10n(n,{min:r.min,max:r.max,total:t}),s.isError=!0,this.set$({"*message":s})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),s={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let p=this.uploadCollection.read(m);p.getValue("fileInfo")&&!p.getValue("validationErrorMsg")&&(s.succeed+=1),p.getValue("isUploading")&&(s.uploading+=1),(p.getValue("validationErrorMsg")||p.getValue("uploadError"))&&(s.failed+=1),p.getValue("validationMultipleLimitMsg")&&(s.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=s.failed===0&&s.limitOverflow===0,c=!1,h=!1,d=!1;s.total-s.succeed-s.uploading-s.failed>0&&n?c=!0:(h=!0,d=s.total===s.succeed&&n&&a),this.set$({doneBtnVisible:h,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:s.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(s)})}_getHeaderText(t){let r=s=>{let n=t[s];return this.l10n(`header-${s}`,{count:n})};return t.uploading>0?r("uploading"):t.failed>0?r("failed"):t.succeed>0?r("succeed"):r("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var r;((r=this.uploadCollection)==null?void 0:r.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate)}};Bt.template=`{{headerText}}
`;function ss(e){let i=new Blob([e],{type:"image/svg+xml"});return URL.createObjectURL(i)}function Ie(e="hsl(209, 21%, 65%)",i=32,t=32){return ss(``)}function Ci(e,i=40){if(e.type==="image/svg+xml")return URL.createObjectURL(e);let t=document.createElement("canvas"),r=t.getContext("2d"),s=new Image,n=new Promise((o,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),r.fillStyle="rgb(240, 240, 240)",r.fillRect(0,0,t.width,t.height),r.drawImage(s,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let h=URL.createObjectURL(c);o(h)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(e),n}var M=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),Q=class extends x{constructor(){super();u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",V(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",V(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:M.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===v.activities.DETAILS)?this.$["*currentActivity"]=v.activities.DETAILS:this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let r=this.getOutputData(s=>s.getValue("uuid")===t);U.emit(new R({type:$.REMOVE,ctx:this.ctxName,data:r}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[r]=t;this._isIntersecting=r.isIntersecting,r.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),r.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,r=M.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?r=M.FAILED:t.getValue("validationMultipleLimitMsg")?r=M.LIMIT_OVERFLOW:t.getValue("isUploading")?r=M.UPLOADING:t.getValue("fileInfo")&&(r=M.FINISHED),this.$.state=r}async _generateThumbnail(){var r;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let s=this.cfg.thumbSize,n=this.proxyUrl(zt(hi(this.cfg.cdnCname,this._entry.getValue("uuid")),Vt(t.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((r=t.getValue("file"))!=null&&r.type.includes("image"))try{let s=await Ci(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",s)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ie(n))}else{let s=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ie(s))}}_subEntry(t,r){let s=this._entry.subscribe(t,n=>{this.isConnected&&r(n)});this._entrySubs.add(s)}_handleEntryId(t){var s;this._reset();let r=(s=this.uploadCollection)==null?void 0:s.read(t);this._entry=r,r&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||r.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=r.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{Q.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),Q.activeInstances.add(this)}_handleState(t){var r,s,n;this.set$({isFailed:t===M.FAILED,isLimitOverflow:t===M.LIMIT_OVERFLOW,isUploading:t===M.UPLOADING,isFinished:t===M.FINISHED,progressVisible:t===M.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((r=this._entry)==null?void 0:r.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===M.FAILED||t===M.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===M.FINISHED&&(this.$.badgeIcon="badge-success"),t===M.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),Q.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let r=this.cfg.multiple?this.cfg.multipleMax:1;if(r&&this.uploadCollection.size>r)return;let s=this.getOutputData(a=>!a.getValue("fileInfo"));U.emit(new R({type:$.UPLOAD_START,ctx:this.ctxName,data:s})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return ge(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:f=>{if(f.isComputable){let m=f.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!f.isComputable},signal:a.signal})},h=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:h,isUploading:!1,fileName:h.originalFilename,fileSize:h.size,isImage:h.isImage,mimeType:(l=(o=(n=h.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:h.mimeType,uuid:h.uuid,cdnUrl:h.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof I?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};Q.template=`
{{itemName}}{{errorText}}
`;Q.activeInstances=new Set;var Tt=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let r=this.getCssData(`--icon-${t}`);r&&(this.$.path=r)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};Tt.template=``;Tt.bindAttributes({name:"name",size:"size"});var Gt=class extends S{constructor(){super(...arguments);u(this,"_value",0);u(this,"_unknownMode",!1);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};Gt.template='
';var qt=class extends S{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};u(qt,"template",`Powered by Uploadcare`);var mt=class extends x{constructor(){super();u(this,"processInnerHtml",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,output:null}}get dict(){return mt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer);let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=this.hasAttribute(this.dict.INPUT_REQUIRED),t.tabIndex=-1,ke(t,{opacity:0,height:0,width:0}),this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&this._dynamicInputsContainer){this._dynamicInputsContainer.innerHTML="";let r;Array.isArray(t)?r=t.map(s=>s.cdnUrl):t!=null&&t.groupData?r=[t.groupData.cdnUrl]:r=[];for(let s of r){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=s!=null?s:"",this._dynamicInputsContainer.appendChild(n)}if(this._validationInputElement){this._validationInputElement.value=r.length?"__VALUE__":"";let s=this.$["*message"];s!=null&&s.isError?this._validationInputElement.setCustomValidity(`${s.caption}. ${s.text}`):this._validationInputElement.setCustomValidity("")}}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t||!t.length){this.$.output=null;return}if(t.every(s=>s.isUploaded)&&(this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR))){let s=t.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:""));if(!t.every(a=>a.isValid)){this.$.output={groupData:void 0,files:t};return}let o=await this.getUploadClientOptions(),l=await Qe(s,o);this.$.output={groupData:l,files:t}}else this.$.output=t},!1)}};mt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var Kt=Object.keys(ot),ns=["metadata"],os=e=>ns.includes(e),Yt=Kt.filter(e=>!os(e)),ls={...Object.fromEntries(Yt.map(e=>[st(e),e])),...Object.fromEntries(Yt.map(e=>[e.toLowerCase(),e]))},as={...Object.fromEntries(Kt.map(e=>[st(e),D(e)])),...Object.fromEntries(Kt.map(e=>[e.toLowerCase(),D(e)]))},Jt=class extends S{constructor(){super();u(this,"ctxOwner",!0);u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(ot).map(([t,r])=>[D(t),r]))}}initCallback(){super.initCallback();let t=this;for(let r of Yt)this.sub(D(r),s=>{s!==ot[r]&&(t[r]=s)},!1);for(let r of Kt){let s="__"+r;t[s]=t[r],Object.defineProperty(this,r,{set:n=>{if(t[s]=n,Yt.includes(r)){let o=[...new Set([st(r),r.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[D(r)]!==n&&(typeof n=="undefined"||n===null?this.$[D(r)]=ot[r]:this.$[D(r)]=n)},get:()=>this.$[D(r)]}),typeof t[r]!="undefined"&&t[r]!==null&&(t[r]=t[s])}}attributeChangedCallback(t,r,s){if(r===s)return;let n=ls[t],o=gi(n,s),l=o!=null?o:ot[n],a=this;a[n]=l}};Jt.bindAttributes(as);var Ue=class extends x{constructor(){super(...arguments);u(this,"requireCtxName",!0)}};export{Jt as Config,qt as Copyright,mt as DataOutput,Et as DropArea,Q as FileItem,Ft as FileUploaderMinimal,Tt as Icon,Xt as MessageBox,Gt as ProgressBar,ve as StartFrom,Ue as UploadCtxProvider,Bt as UploadList,wi as registerBlocks}; \ No newline at end of file diff --git a/web/lr-file-uploader-regular.min.css b/web/lr-file-uploader-regular.min.css index 51a8308c4..afdf81d8f 100644 --- a/web/lr-file-uploader-regular.min.css +++ b/web/lr-file-uploader-regular.min.css @@ -1 +1 @@ -:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0} +:where(.lr-wgt-cfg,.lr-wgt-common),:host{--cfg-pubkey: "YOUR_PUBLIC_KEY";--cfg-multiple: 1;--cfg-multiple-min: 0;--cfg-multiple-max: 0;--cfg-confirm-upload: 0;--cfg-img-only: 0;--cfg-accept: "";--cfg-external-sources-preferred-types: "";--cfg-store: "auto";--cfg-camera-mirror: 1;--cfg-source-list: "local, url, camera, dropbox, gdrive";--cfg-max-local-file-size-bytes: 0;--cfg-thumb-size: 76;--cfg-show-empty-list: 0;--cfg-use-local-image-editor: 0;--cfg-use-cloud-image-editor: 1;--cfg-remove-copyright: 0;--cfg-modal-scroll-lock: 1;--cfg-modal-backdrop-strokes: 0;--cfg-source-list-wrap: 1;--cfg-init-activity: "start-from";--cfg-done-activity: "";--cfg-remote-tab-session-key: "";--cfg-cdn-cname: "https://ucarecdn.com";--cfg-base-url: "https://upload.uploadcare.com";--cfg-social-base-url: "https://social.uploadcare.com";--cfg-secure-signature: "";--cfg-secure-expire: "";--cfg-secure-delivery-proxy: "";--cfg-retry-throttled-request-max-times: 1;--cfg-multipart-min-file-size: 26214400;--cfg-multipart-chunk-size: 5242880;--cfg-max-concurrent-requests: 10;--cfg-multipart-max-concurrent-requests: 4;--cfg-multipart-max-attempts: 3;--cfg-check-for-url-duplicates: 0;--cfg-save-url-for-recurrent-uploads: 0;--cfg-group-output: 0;--cfg-user-agent-integration: ""}:where(.lr-wgt-icons,.lr-wgt-common),:host{--icon-default: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-file: "m2.89453 1.2012c0-.473389.38376-.857145.85714-.857145h8.40003c.2273 0 .4453.090306.6061.251051l8.4 8.400004c.1607.16074.251.37876.251.60609v13.2c0 .4734-.3837.8571-.8571.8571h-16.80003c-.47338 0-.85714-.3837-.85714-.8571zm1.71429.85714v19.88576h15.08568v-11.4858h-7.5428c-.4734 0-.8572-.3837-.8572-.8571v-7.54286zm8.39998 1.21218 5.4736 5.47353-5.4736.00001z";--icon-close: "m4.60395 4.60395c.29289-.2929.76776-.2929 1.06066 0l6.33539 6.33535 6.3354-6.33535c.2929-.2929.7677-.2929 1.0606 0 .2929.29289.2929.76776 0 1.06066l-6.3353 6.33539 6.3353 6.3354c.2929.2929.2929.7677 0 1.0606s-.7677.2929-1.0606 0l-6.3354-6.3353-6.33539 6.3353c-.2929.2929-.76777.2929-1.06066 0-.2929-.2929-.2929-.7677 0-1.0606l6.33535-6.3354-6.33535-6.33539c-.2929-.2929-.2929-.76777 0-1.06066z";--icon-collapse: "M3.11572 12C3.11572 11.5858 3.45151 11.25 3.86572 11.25H20.1343C20.5485 11.25 20.8843 11.5858 20.8843 12C20.8843 12.4142 20.5485 12.75 20.1343 12.75H3.86572C3.45151 12.75 3.11572 12.4142 3.11572 12Z";--icon-expand: "M12.0001 8.33716L3.53033 16.8068C3.23743 17.0997 2.76256 17.0997 2.46967 16.8068C2.17678 16.5139 2.17678 16.0391 2.46967 15.7462L11.0753 7.14067C11.1943 7.01825 11.3365 6.92067 11.4936 6.8536C11.6537 6.78524 11.826 6.75 12.0001 6.75C12.1742 6.75 12.3465 6.78524 12.5066 6.8536C12.6637 6.92067 12.8059 7.01826 12.925 7.14068L21.5304 15.7462C21.8233 16.0391 21.8233 16.5139 21.5304 16.8068C21.2375 17.0997 20.7627 17.0997 20.4698 16.8068L12.0001 8.33716Z";--icon-info: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";--icon-error: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";--icon-arrow-down: "m11.5009 23.0302c.2844.2533.7135.2533.9978 0l9.2899-8.2758c.3092-.2756.3366-.7496.0611-1.0589s-.7496-.3367-1.0589-.0612l-8.0417 7.1639v-19.26834c0-.41421-.3358-.749997-.75-.749997s-.75.335787-.75.749997v19.26704l-8.04025-7.1626c-.30928-.2755-.78337-.2481-1.05889.0612-.27553.3093-.24816.7833.06112 1.0589z";--icon-upload: "m11.5014.392135c.2844-.253315.7134-.253315.9978 0l6.7037 5.971925c.3093.27552.3366.74961.0611 1.05889-.2755.30929-.7496.33666-1.0589.06113l-5.4553-4.85982v13.43864c0 .4142-.3358.75-.75.75s-.75-.3358-.75-.75v-13.43771l-5.45427 4.85889c-.30929.27553-.78337.24816-1.0589-.06113-.27553-.30928-.24816-.78337.06113-1.05889zm-10.644466 16.336765c.414216 0 .749996.3358.749996.75v4.9139h20.78567v-4.9139c0-.4142.3358-.75.75-.75.4143 0 .75.3358.75.75v5.6639c0 .4143-.3357.75-.75.75h-22.285666c-.414214 0-.75-.3357-.75-.75v-5.6639c0-.4142.335786-.75.75-.75z";--icon-local: "m3 3.75c-.82843 0-1.5.67157-1.5 1.5v13.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-9.75c0-.82843-.6716-1.5-1.5-1.5h-9c-.2634 0-.5076-.13822-.6431-.36413l-2.03154-3.38587zm-3 1.5c0-1.65685 1.34315-3 3-3h6.75c.2634 0 .5076.13822.6431.36413l2.0315 3.38587h8.5754c1.6569 0 3 1.34315 3 3v9.75c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3z";--icon-url: "m19.1099 3.67026c-1.7092-1.70917-4.5776-1.68265-6.4076.14738l-2.2212 2.22122c-.2929.29289-.7678.29289-1.0607 0-.29289-.29289-.29289-.76777 0-1.06066l2.2212-2.22122c2.376-2.375966 6.1949-2.481407 8.5289-.14738l1.2202 1.22015c2.334 2.33403 2.2286 6.15294-.1474 8.52895l-2.2212 2.2212c-.2929.2929-.7678.2929-1.0607 0s-.2929-.7678 0-1.0607l2.2212-2.2212c1.8301-1.83003 1.8566-4.69842.1474-6.40759zm-3.3597 4.57991c.2929.29289.2929.76776 0 1.06066l-6.43918 6.43927c-.29289.2928-.76777.2928-1.06066 0-.29289-.2929-.29289-.7678 0-1.0607l6.43924-6.43923c.2929-.2929.7677-.2929 1.0606 0zm-9.71158 1.17048c.29289.29289.29289.76775 0 1.06065l-2.22123 2.2212c-1.83002 1.8301-1.85654 4.6984-.14737 6.4076l1.22015 1.2202c1.70917 1.7091 4.57756 1.6826 6.40763-.1474l2.2212-2.2212c.2929-.2929.7677-.2929 1.0606 0s.2929.7677 0 1.0606l-2.2212 2.2212c-2.37595 2.376-6.19486 2.4815-8.52889.1474l-1.22015-1.2201c-2.334031-2.3341-2.22859-6.153.14737-8.5289l2.22123-2.22125c.29289-.2929.76776-.2929 1.06066 0z";--icon-camera: "m7.65 2.55c.14164-.18885.36393-.3.6-.3h7.5c.2361 0 .4584.11115.6.3l2.025 2.7h2.625c1.6569 0 3 1.34315 3 3v10.5c0 1.6569-1.3431 3-3 3h-18c-1.65685 0-3-1.3431-3-3v-10.5c0-1.65685 1.34315-3 3-3h2.625zm.975 1.2-2.025 2.7c-.14164.18885-.36393.3-.6.3h-3c-.82843 0-1.5.67157-1.5 1.5v10.5c0 .8284.67157 1.5 1.5 1.5h18c.8284 0 1.5-.6716 1.5-1.5v-10.5c0-.82843-.6716-1.5-1.5-1.5h-3c-.2361 0-.4584-.11115-.6-.3l-2.025-2.7zm3.375 6c-1.864 0-3.375 1.511-3.375 3.375s1.511 3.375 3.375 3.375 3.375-1.511 3.375-3.375-1.511-3.375-3.375-3.375zm-4.875 3.375c0-2.6924 2.18261-4.875 4.875-4.875 2.6924 0 4.875 2.1826 4.875 4.875s-2.1826 4.875-4.875 4.875c-2.69239 0-4.875-2.1826-4.875-4.875z";--icon-dots: "M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z";--icon-back: "M20.251 12.0001C20.251 12.4143 19.9152 12.7501 19.501 12.7501L6.06696 12.7501L11.7872 18.6007C12.0768 18.8968 12.0715 19.3717 11.7753 19.6613C11.4791 19.9508 11.0043 19.9455 10.7147 19.6493L4.13648 12.9213C4.01578 12.8029 3.91947 12.662 3.85307 12.5065C3.78471 12.3464 3.74947 12.1741 3.74947 12C3.74947 11.8259 3.78471 11.6536 3.85307 11.4935C3.91947 11.338 4.01578 11.1971 4.13648 11.0787L10.7147 4.35068C11.0043 4.0545 11.4791 4.04916 11.7753 4.33873C12.0715 4.62831 12.0768 5.10315 11.7872 5.39932L6.06678 11.2501L19.501 11.2501C19.9152 11.2501 20.251 11.5859 20.251 12.0001Z";--icon-remove: "m6.35673 9.71429c-.76333 0-1.35856.66121-1.27865 1.42031l1.01504 9.6429c.06888.6543.62067 1.1511 1.27865 1.1511h9.25643c.658 0 1.2098-.4968 1.2787-1.1511l1.015-9.6429c.0799-.7591-.5153-1.42031-1.2786-1.42031zm.50041-4.5v.32142h-2.57143c-.71008 0-1.28571.57564-1.28571 1.28572s.57563 1.28571 1.28571 1.28571h15.42859c.7101 0 1.2857-.57563 1.2857-1.28571s-.5756-1.28572-1.2857-1.28572h-2.5714v-.32142c0-1.77521-1.4391-3.21429-3.2143-3.21429h-3.8572c-1.77517 0-3.21426 1.43908-3.21426 3.21429zm7.07146-.64286c.355 0 .6428.28782.6428.64286v.32142h-5.14283v-.32142c0-.35504.28782-.64286.64283-.64286z";--icon-edit: "M3.96371 14.4792c-.15098.151-.25578.3419-.3021.5504L2.52752 20.133c-.17826.8021.53735 1.5177 1.33951 1.3395l5.10341-1.1341c.20844-.0463.39934-.1511.55032-.3021l8.05064-8.0507-5.557-5.55702-8.05069 8.05062ZM13.4286 5.01437l5.557 5.55703 2.0212-2.02111c.6576-.65765.6576-1.72393 0-2.38159l-3.1755-3.17546c-.6577-.65765-1.7239-.65765-2.3816 0l-2.0211 2.02113Z";--icon-detail: "M5,3C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3H5M5,5H19V19H5V5M7,7V9H17V7H7M7,11V13H17V11H7M7,15V17H14V15H7Z";--icon-select: "M7,10L12,15L17,10H7Z";--icon-check: "m12 22c5.5228 0 10-4.4772 10-10 0-5.52285-4.4772-10-10-10-5.52285 0-10 4.47715-10 10 0 5.5228 4.47715 10 10 10zm4.7071-11.4929-5.9071 5.9071-3.50711-3.5071c-.39052-.3905-.39052-1.0237 0-1.4142.39053-.3906 1.02369-.3906 1.41422 0l2.09289 2.0929 4.4929-4.49294c.3905-.39052 1.0237-.39052 1.4142 0 .3905.39053.3905 1.02374 0 1.41424z";--icon-add: "M12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C11.5858 21.75 11.25 21.4142 11.25 21V12.7499H3C2.58579 12.7499 2.25 12.4141 2.25 11.9999C2.25 11.5857 2.58579 11.2499 3 11.2499H11.25V3C11.25 2.58579 11.5858 2.25 12 2.25C12.4142 2.25 12.75 2.58579 12.75 3V11.2499H21C21.4142 11.2499 21.75 11.5857 21.75 11.9999C21.75 12.4141 21.4142 12.7499 21 12.7499H12.75V21Z";--icon-edit-file: "m12.1109 6c.3469-1.69213 1.8444-2.96484 3.6391-2.96484s3.2922 1.27271 3.6391 2.96484h2.314c.4142 0 .75.33578.75.75 0 .41421-.3358.75-.75.75h-2.314c-.3469 1.69213-1.8444 2.9648-3.6391 2.9648s-3.2922-1.27267-3.6391-2.9648h-9.81402c-.41422 0-.75001-.33579-.75-.75 0-.41422.33578-.75.75-.75zm3.6391-1.46484c-1.2232 0-2.2148.99162-2.2148 2.21484s.9916 2.21484 2.2148 2.21484 2.2148-.99162 2.2148-2.21484-.9916-2.21484-2.2148-2.21484zm-11.1391 11.96484c.34691-1.6921 1.84437-2.9648 3.6391-2.9648 1.7947 0 3.2922 1.2727 3.6391 2.9648h9.814c.4142 0 .75.3358.75.75s-.3358.75-.75.75h-9.814c-.3469 1.6921-1.8444 2.9648-3.6391 2.9648-1.79473 0-3.29219-1.2727-3.6391-2.9648h-2.31402c-.41422 0-.75-.3358-.75-.75s.33578-.75.75-.75zm3.6391-1.4648c-1.22322 0-2.21484.9916-2.21484 2.2148s.99162 2.2148 2.21484 2.2148 2.2148-.9916 2.2148-2.2148-.99158-2.2148-2.2148-2.2148z";--icon-remove-file: "m11.9554 3.29999c-.7875 0-1.5427.31281-2.0995.86963-.49303.49303-.79476 1.14159-.85742 1.83037h5.91382c-.0627-.68878-.3644-1.33734-.8575-1.83037-.5568-.55682-1.312-.86963-2.0994-.86963zm4.461 2.7c-.0656-1.08712-.5264-2.11657-1.3009-2.89103-.8381-.83812-1.9749-1.30897-3.1601-1.30897-1.1853 0-2.32204.47085-3.16016 1.30897-.77447.77446-1.23534 1.80391-1.30087 2.89103h-2.31966c-.03797 0-.07529.00282-.11174.00827h-1.98826c-.41422 0-.75.33578-.75.75 0 .41421.33578.75.75.75h1.35v11.84174c0 .7559.30026 1.4808.83474 2.0152.53448.5345 1.25939.8348 2.01526.8348h9.44999c.7559 0 1.4808-.3003 2.0153-.8348.5344-.5344.8347-1.2593.8347-2.0152v-11.84174h1.35c.4142 0 .75-.33579.75-.75 0-.41422-.3358-.75-.75-.75h-1.9883c-.0364-.00545-.0737-.00827-.1117-.00827zm-10.49169 1.50827v11.84174c0 .358.14223.7014.3954.9546.25318.2532.59656.3954.9546.3954h9.44999c.358 0 .7014-.1422.9546-.3954s.3954-.5966.3954-.9546v-11.84174z";--icon-trash-file: var(--icon-remove);--icon-upload-error: var(--icon-error);--icon-fullscreen: "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";--icon-fullscreen-exit: "M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z";--icon-badge-success: "M10.5 18.2044L18.0992 10.0207C18.6629 9.41362 18.6277 8.46452 18.0207 7.90082C17.4136 7.33711 16.4645 7.37226 15.9008 7.97933L10.5 13.7956L8.0992 11.2101C7.53549 10.603 6.5864 10.5679 5.97933 11.1316C5.37226 11.6953 5.33711 12.6444 5.90082 13.2515L10.5 18.2044Z";--icon-badge-error: "m13.6 18.4c0 .8837-.7164 1.6-1.6 1.6-.8837 0-1.6-.7163-1.6-1.6s.7163-1.6 1.6-1.6c.8836 0 1.6.7163 1.6 1.6zm-1.6-13.9c.8284 0 1.5.67157 1.5 1.5v7c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5v-7c0-.82843.6716-1.5 1.5-1.5z";--icon-about: "M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922.163-.241.369-.419.617-.532.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72-.1.216-.234.408-.405.574a3.48 3.48 0 0 1-.575.453c-.33.199-.613.42-.847.66-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577ZM11.205 17.15c.21.206.46.31.75.31.196 0 .374-.049.534-.144.16-.096.287-.224.383-.384.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z";--icon-edit-rotate: "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";--icon-edit-flip-v: "M3 15V17H5V15M15 19V21H17V19M19 3H5C3.9 3 3 3.9 3 5V9H5V5H19V9H21V5C21 3.9 20.1 3 19 3M21 19H19V21C20.1 21 21 20.1 21 19M1 11V13H23V11M7 19V21H9V19M19 15V17H21V15M11 19V21H13V19M3 19C3 20.1 3.9 21 5 21V19Z";--icon-edit-flip-h: "M15 21H17V19H15M19 9H21V7H19M3 5V19C3 20.1 3.9 21 5 21H9V19H5V5H9V3H5C3.9 3 3 3.9 3 5M19 3V5H21C21 3.9 20.1 3 19 3M11 23H13V1H11M19 17H21V15H19M15 5H17V3H15M19 13H21V11H19M19 21C20.1 21 21 20.1 21 19H19Z";--icon-edit-brightness: "M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";--icon-edit-contrast: "M12,20C9.79,20 7.79,19.1 6.34,17.66L17.66,6.34C19.1,7.79 20,9.79 20,12A8,8 0 0,1 12,20M6,8H8V6H9.5V8H11.5V9.5H9.5V11.5H8V9.5H6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,16H17V14.5H12V16Z";--icon-edit-saturation: "M3,13A9,9 0 0,0 12,22C12,17 7.97,13 3,13M12,5.5A2.5,2.5 0 0,1 14.5,8A2.5,2.5 0 0,1 12,10.5A2.5,2.5 0 0,1 9.5,8A2.5,2.5 0 0,1 12,5.5M5.6,10.25A2.5,2.5 0 0,0 8.1,12.75C8.63,12.75 9.12,12.58 9.5,12.31C9.5,12.37 9.5,12.43 9.5,12.5A2.5,2.5 0 0,0 12,15A2.5,2.5 0 0,0 14.5,12.5C14.5,12.43 14.5,12.37 14.5,12.31C14.88,12.58 15.37,12.75 15.9,12.75C17.28,12.75 18.4,11.63 18.4,10.25C18.4,9.25 17.81,8.4 16.97,8C17.81,7.6 18.4,6.74 18.4,5.75C18.4,4.37 17.28,3.25 15.9,3.25C15.37,3.25 14.88,3.41 14.5,3.69C14.5,3.63 14.5,3.56 14.5,3.5A2.5,2.5 0 0,0 12,1A2.5,2.5 0 0,0 9.5,3.5C9.5,3.56 9.5,3.63 9.5,3.69C9.12,3.41 8.63,3.25 8.1,3.25A2.5,2.5 0 0,0 5.6,5.75C5.6,6.74 6.19,7.6 7.03,8C6.19,8.4 5.6,9.25 5.6,10.25M12,22A9,9 0 0,0 21,13C16,13 12,17 12,22Z";--icon-edit-crop: "M7,17V1H5V5H1V7H5V17A2,2 0 0,0 7,19H17V23H19V19H23V17M17,15H19V7C19,5.89 18.1,5 17,5H9V7H17V15Z";--icon-edit-text: "M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z";--icon-edit-draw: "m21.879394 2.1631238c-1.568367-1.62768627-4.136546-1.53831744-5.596267.1947479l-8.5642801 10.1674753c-1.4906533-.224626-3.061232.258204-4.2082427 1.448604-1.0665468 1.106968-1.0997707 2.464806-1.1203996 3.308068-.00142.05753-.00277.113001-.00439.16549-.02754.894146-.08585 1.463274-.5821351 2.069648l-.80575206.98457.88010766.913285c1.0539516 1.093903 2.6691689 1.587048 4.1744915 1.587048 1.5279113 0 3.2235468-.50598 4.4466094-1.775229 1.147079-1.190514 1.612375-2.820653 1.395772-4.367818l9.796763-8.8879697c1.669907-1.5149954 1.75609-4.1802333.187723-5.8079195zm-16.4593821 13.7924592c.8752943-.908358 2.2944227-.908358 3.1697054 0 .8752942.908358.8752942 2.381259 0 3.289617-.5909138.61325-1.5255389.954428-2.53719.954428-.5223687 0-.9935663-.09031-1.3832112-.232762.3631253-.915463.3952949-1.77626.4154309-2.429737.032192-1.045425.072224-1.308557.3352649-1.581546z";--icon-edit-guides: "M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z";--icon-edit-color: "M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";--icon-edit-resize: "M10.59,12L14.59,8H11V6H18V13H16V9.41L12,13.41V16H20V4H8V12H10.59M22,2V18H12V22H2V12H6V2H22M10,14H4V20H10V14Z";--icon-external-source-placeholder: "M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z";--icon-facebook: "m12 1.5c-5.79901 0-10.5 4.70099-10.5 10.5 0 4.9427 3.41586 9.0888 8.01562 10.2045v-6.1086h-2.13281c-.41421 0-.75-.3358-.75-.75v-3.2812c0-.4142.33579-.75.75-.75h2.13281v-1.92189c0-.95748.22571-2.51089 1.38068-3.6497 1.1934-1.17674 3.1742-1.71859 6.2536-1.05619.3455.07433.5923.3798.5923.73323v2.75395c0 .41422-.3358.75-.75.75-.6917 0-1.2029.02567-1.5844.0819-.3865.05694-.5781.13711-.675.20223-.1087.07303-.2367.20457-.2367 1.02837v1.0781h2.3906c.2193 0 .4275.0959.57.2626.1425.1666.205.3872.1709.6038l-.5156 3.2813c-.0573.3647-.3716.6335-.7409.6335h-1.875v6.1058c4.5939-1.1198 8.0039-5.2631 8.0039-10.2017 0-5.79901-4.701-10.5-10.5-10.5zm-12 10.5c0-6.62744 5.37256-12 12-12 6.6274 0 12 5.37256 12 12 0 5.9946-4.3948 10.9614-10.1384 11.8564-.2165.0337-.4369-.0289-.6033-.1714s-.2622-.3506-.2622-.5697v-7.7694c0-.4142.3358-.75.75-.75h1.9836l.28-1.7812h-2.2636c-.4142 0-.75-.3358-.75-.75v-1.8281c0-.82854.0888-1.72825.9-2.27338.3631-.24396.8072-.36961 1.293-.4412.3081-.0454.6583-.07238 1.0531-.08618v-1.39629c-2.4096-.40504-3.6447.13262-4.2928.77165-.7376.72735-.9338 1.79299-.9338 2.58161v2.67189c0 .4142-.3358.75-.75.75h-2.13279v1.7812h2.13279c.4142 0 .75.3358.75.75v7.7712c0 .219-.0956.427-.2619.5695-.1662.1424-.3864.2052-.6028.1717-5.74968-.8898-10.1509-5.8593-10.1509-11.8583z";--icon-dropbox: "m6.01895 1.92072c.24583-.15659.56012-.15658.80593.00003l5.17512 3.29711 5.1761-3.29714c.2458-.15659.5601-.15658.8059.00003l5.5772 3.55326c.2162.13771.347.37625.347.63253 0 .25629-.1308.49483-.347.63254l-4.574 2.91414 4.574 2.91418c.2162.1377.347.3762.347.6325s-.1308.4948-.347.6325l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.1761-3.2971-5.17512 3.2971c-.24581.1566-.5601.1566-.80593 0l-5.578142-3.5532c-.216172-.1377-.347058-.3763-.347058-.6326s.130886-.4949.347058-.6326l4.574772-2.91408-4.574772-2.91411c-.216172-.1377-.347058-.37626-.347058-.63257 0-.2563.130886-.49486.347058-.63256zm.40291 8.61518-4.18213 2.664 4.18213 2.664 4.18144-2.664zm6.97504 2.664 4.1821 2.664 4.1814-2.664-4.1814-2.664zm2.7758-3.54668-4.1727 2.65798-4.17196-2.65798 4.17196-2.658zm1.4063-.88268 4.1814-2.664-4.1814-2.664-4.1821 2.664zm-6.9757-2.664-4.18144-2.664-4.18213 2.664 4.18213 2.664zm-4.81262 12.43736c.22254-.3494.68615-.4522 1.03551-.2297l5.17521 3.2966 5.1742-3.2965c.3493-.2226.813-.1198 1.0355.2295.2226.3494.1198.813-.2295 1.0355l-5.5772 3.5533c-.2458.1566-.5601.1566-.8059 0l-5.57819-3.5532c-.34936-.2226-.45216-.6862-.22963-1.0355z";--icon-gdrive: "m7.73633 1.81806c.13459-.22968.38086-.37079.64707-.37079h7.587c.2718 0 .5223.14697.6548.38419l7.2327 12.94554c.1281.2293.1269.5089-.0031.7371l-3.7935 6.6594c-.1334.2342-.3822.3788-.6517.3788l-14.81918.0004c-.26952 0-.51831-.1446-.65171-.3788l-3.793526-6.6598c-.1327095-.233-.130949-.5191.004617-.7504zm.63943 1.87562-6.71271 11.45452 2.93022 5.1443 6.65493-11.58056zm3.73574 6.52652-2.39793 4.1727 4.78633.0001zm4.1168 4.1729 5.6967-.0002-6.3946-11.44563h-5.85354zm5.6844 1.4998h-13.06111l-2.96515 5.1598 13.08726-.0004z";--icon-gphotos: "M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z";--icon-instagram: "M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zM18.425 6.975a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zM11.958.175h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12c0 2.203 0 3.8.124 5.046.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z";--icon-flickr: "M5.95874 7.92578C3.66131 7.92578 1.81885 9.76006 1.81885 11.9994C1.81885 14.2402 3.66145 16.0744 5.95874 16.0744C8.26061 16.0744 10.1039 14.2396 10.1039 11.9994C10.1039 9.76071 8.26074 7.92578 5.95874 7.92578ZM0.318848 11.9994C0.318848 8.91296 2.85168 6.42578 5.95874 6.42578C9.06906 6.42578 11.6039 8.91232 11.6039 11.9994C11.6039 15.0877 9.06919 17.5744 5.95874 17.5744C2.85155 17.5744 0.318848 15.0871 0.318848 11.9994ZM18.3898 7.92578C16.0878 7.92578 14.2447 9.76071 14.2447 11.9994C14.2447 14.2396 16.088 16.0744 18.3898 16.0744C20.6886 16.0744 22.531 14.2401 22.531 11.9994C22.531 9.76019 20.6887 7.92578 18.3898 7.92578ZM12.7447 11.9994C12.7447 8.91232 15.2795 6.42578 18.3898 6.42578C21.4981 6.42578 24.031 8.91283 24.031 11.9994C24.031 15.0872 21.4982 17.5744 18.3898 17.5744C15.2794 17.5744 12.7447 15.0877 12.7447 11.9994Z";--icon-vk: var(--icon-external-source-placeholder);--icon-evernote: "M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276.01-.039.018-.078.022-.105.011-.061.023-.14.034-.23.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576-.097-.015-.18-.028-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915.197.193.412.357.627.493a5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235-.212-.103-.5-.174-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996ZM15.638 11.626a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z";--icon-box: "M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z";--icon-onedrive: "M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z";--icon-huddle: "M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z"}:where(.lr-wgt-l10n_en-US,.lr-wgt-common),:host{--l10n-locale-name: "en-US";--l10n-upload-file: "Upload file";--l10n-upload-files: "Upload files";--l10n-choose-file: "Choose file";--l10n-choose-files: "Choose files";--l10n-drop-files-here: "Drop files here";--l10n-select-file-source: "Select file source";--l10n-selected: "Selected";--l10n-upload: "Upload";--l10n-add-more: "Add more";--l10n-cancel: "Cancel";--l10n-clear: "Clear";--l10n-camera-shot: "Shot";--l10n-upload-url: "Import";--l10n-upload-url-placeholder: "Paste link here";--l10n-edit-image: "Edit image";--l10n-edit-detail: "Details";--l10n-back: "Back";--l10n-done: "Done";--l10n-ok: "Ok";--l10n-remove-from-list: "Remove";--l10n-no: "No";--l10n-yes: "Yes";--l10n-confirm-your-action: "Confirm your action";--l10n-are-you-sure: "Are you sure?";--l10n-selected-count: "Selected:";--l10n-upload-error: "Upload error";--l10n-validation-error: "Validation error";--l10n-no-files: "No files selected";--l10n-browse: "Browse";--l10n-not-uploaded-yet: "Not uploaded yet...";--l10n-file__one: "file";--l10n-file__other: "files";--l10n-error__one: "error";--l10n-error__other: "errors";--l10n-header-uploading: "Uploading {{count}} {{plural:file(count)}}";--l10n-header-failed: "{{count}} {{plural:error(count)}}";--l10n-header-succeed: "{{count}} {{plural:file(count)}} uploaded";--l10n-header-total: "{{count}} {{plural:file(count)}} selected";--l10n-src-type-local: "From device";--l10n-src-type-from-url: "From link";--l10n-src-type-camera: "Camera";--l10n-src-type-draw: "Draw";--l10n-src-type-facebook: "Facebook";--l10n-src-type-dropbox: "Dropbox";--l10n-src-type-gdrive: "Google Drive";--l10n-src-type-gphotos: "Google Photos";--l10n-src-type-instagram: "Instagram";--l10n-src-type-flickr: "Flickr";--l10n-src-type-vk: "VK";--l10n-src-type-evernote: "Evernote";--l10n-src-type-box: "Box";--l10n-src-type-onedrive: "Onedrive";--l10n-src-type-huddle: "Huddle";--l10n-src-type-other: "Other";--l10n-src-type: var(--l10n-src-type-local);--l10n-caption-from-url: "Import from link";--l10n-caption-camera: "Camera";--l10n-caption-draw: "Draw";--l10n-caption-edit-file: "Edit file";--l10n-file-no-name: "No name...";--l10n-toggle-fullscreen: "Toggle fullscreen";--l10n-toggle-guides: "Toggle guides";--l10n-rotate: "Rotate";--l10n-flip-vertical: "Flip vertical";--l10n-flip-horizontal: "Flip horizontal";--l10n-brightness: "Brightness";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-resize: "Resize image";--l10n-crop: "Crop";--l10n-select-color: "Select color";--l10n-text: "Text";--l10n-draw: "Draw";--l10n-cancel-edit: "Cancel edit";--l10n-tab-view: "Preview";--l10n-tab-details: "Details";--l10n-file-name: "Name";--l10n-file-size: "Size";--l10n-cdn-url: "CDN URL";--l10n-file-size-unknown: "Unknown";--l10n-camera-permissions-denied: "Camera access denied";--l10n-camera-permissions-prompt: "Please allow access to the camera";--l10n-camera-permissions-request: "Request access";--l10n-files-count-limit-error-title: "Files count limit overflow";--l10n-files-count-limit-error-too-few: "You\2019ve chosen {{total}}. At least {{min}} required.";--l10n-files-count-limit-error-too-many: "You\2019ve chosen too many files. {{max}} is maximum.";--l10n-files-count-minimum: "At least {{count}} files are required";--l10n-files-count-allowed: "Only {{count}} files are allowed";--l10n-files-max-size-limit-error: "File is too big. Max file size is {{maxFileSize}}.";--l10n-has-validation-errors: "File validation error ocurred. Please, check your files before upload.";--l10n-images-only-accepted: "Only image files are accepted.";--l10n-file-type-not-allowed: "Uploading of these file types is not allowed."}:where(.lr-wgt-theme,.lr-wgt-common),:host{--darkmode: 0;--h-foreground: 208;--s-foreground: 4%;--l-foreground: calc(10% + 78% * var(--darkmode));--h-background: 208;--s-background: 4%;--l-background: calc(97% - 85% * var(--darkmode));--h-accent: 211;--s-accent: 100%;--l-accent: calc(50% - 5% * var(--darkmode));--h-confirm: 137;--s-confirm: 85%;--l-confirm: 53%;--h-error: 358;--s-error: 100%;--l-error: 66%;--shadows: 1;--h-shadow: 0;--s-shadow: 0%;--l-shadow: 0%;--opacity-normal: .6;--opacity-hover: .9;--opacity-active: 1;--ui-size: 32px;--gap-min: 2px;--gap-small: 4px;--gap-mid: 10px;--gap-max: 20px;--gap-table: 0px;--borders: 1;--border-radius-element: 8px;--border-radius-frame: 12px;--border-radius-thumb: 6px;--transition-duration: .2s;--modal-max-w: 800px;--modal-max-h: 600px;--modal-normal-w: 430px;--darkmode-minus: calc(1 + var(--darkmode) * -2);--clr-background: hsl(var(--h-background), var(--s-background), var(--l-background));--clr-background-dark: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-background-light: hsl( var(--h-background), var(--s-background), calc(var(--l-background) + 3% * var(--darkmode-minus)) );--clr-accent: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 15% * var(--darkmode)));--clr-accent-light: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 30%);--clr-accent-lightest: hsla(var(--h-accent), var(--s-accent), var(--l-accent), 10%);--clr-accent-light-opaque: hsl(var(--h-accent), var(--s-accent), calc(var(--l-accent) + 45% * var(--darkmode-minus)));--clr-accent-lightest-opaque: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) + 47% * var(--darkmode-minus)) );--clr-confirm: hsl(var(--h-confirm), var(--s-confirm), var(--l-confirm));--clr-error: hsl(var(--h-error), var(--s-error), var(--l-error));--clr-error-light: hsla(var(--h-error), var(--s-error), var(--l-error), 15%);--clr-error-lightest: hsla(var(--h-error), var(--s-error), var(--l-error), 5%);--clr-error-message-bgr: hsl(var(--h-error), var(--s-error), calc(var(--l-error) + 60% * var(--darkmode-minus)));--clr-txt: hsl(var(--h-foreground), var(--s-foreground), var(--l-foreground));--clr-txt-mid: hsl(var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 20% * var(--darkmode-minus)));--clr-txt-light: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 30% * var(--darkmode-minus)) );--clr-txt-lightest: hsl( var(--h-foreground), var(--s-foreground), calc(var(--l-foreground) + 50% * var(--darkmode-minus)) );--clr-shade-lv1: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 5%);--clr-shade-lv2: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 8%);--clr-shade-lv3: hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), 12%);--clr-generic-file-icon: var(--clr-txt-lightest);--border-light: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.1 - .05 * var(--darkmode)) * var(--borders)) );--border-mid: 1px solid hsla( var(--h-foreground), var(--s-foreground), var(--l-foreground), calc((.2 - .1 * var(--darkmode)) * var(--borders)) );--border-accent: 1px solid hsla(var(--h-accent), var(--s-accent), var(--l-accent), 1 * var(--borders));--border-dashed: 1px dashed hsla(var(--h-foreground), var(--s-foreground), var(--l-foreground), calc(.2 * var(--borders)));--clr-curtain: hsla(var(--h-background), var(--s-background), calc(var(--l-background)), 60%);--hsl-shadow: var(--h-shadow), var(--s-shadow), var(--l-shadow);--modal-shadow: 0px 0px 1px hsla(var(--hsl-shadow), calc((.3 + .65 * var(--darkmode)) * var(--shadows))), 0px 6px 20px hsla(var(--hsl-shadow), calc((.1 + .4 * var(--darkmode)) * var(--shadows)));--clr-btn-bgr-primary: var(--clr-accent);--clr-btn-bgr-primary-hover: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 4% * var(--darkmode-minus)) );--clr-btn-bgr-primary-active: hsl( var(--h-accent), var(--s-accent), calc(var(--l-accent) - 8% * var(--darkmode-minus)) );--clr-btn-txt-primary: hsl(var(--h-accent), var(--s-accent), 98%);--shadow-btn-primary: none;--clr-btn-bgr-secondary: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 3% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-hover: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 7% * var(--darkmode-minus)) );--clr-btn-bgr-secondary-active: hsl( var(--h-background), var(--s-background), calc(var(--l-background) - 12% * var(--darkmode-minus)) );--clr-btn-txt-secondary: var(--clr-txt-mid);--shadow-btn-secondary: none;--clr-btn-bgr-disabled: var(--clr-background);--clr-btn-txt-disabled: var(--clr-txt-lightest);--shadow-btn-disabled: none}@media only screen and (max-height: 600px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-h: 100%}}@media only screen and (max-width: 430px){:where(.lr-wgt-theme,.lr-wgt-common),:host{--modal-max-w: 100vw;--modal-max-h: var(--uploadcare-blocks-window-height)}}:where(.lr-wgt-theme,.lr-wgt-common),:host{color:var(--clr-txt);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}:where(.lr-wgt-theme,.lr-wgt-common) *,:host *{box-sizing:border-box}:where(.lr-wgt-theme,.lr-wgt-common) [hidden],:host [hidden]{display:none!important}:where(.lr-wgt-theme,.lr-wgt-common) [activity]:not([active]),:host [activity]:not([active]){display:none}:where(.lr-wgt-theme,.lr-wgt-common) dialog:not([open]) [activity],:host dialog:not([open]) [activity]{display:none}:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{display:flex;align-items:center;justify-content:center;height:var(--ui-size);padding-right:1.4em;padding-left:1.4em;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--border-radius-element);cursor:pointer;user-select:none}@media only screen and (max-width: 800px){:where(.lr-wgt-theme,.lr-wgt-common) button,:host button{padding-right:1em;padding-left:1em}}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn,:host button.primary-btn{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary);box-shadow:var(--shadow-btn-primary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:hover,:host button.primary-btn:hover{background-color:var(--clr-btn-bgr-primary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.primary-btn:active,:host button.primary-btn:active{background-color:var(--clr-btn-bgr-primary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn,:host button.secondary-btn{color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary);transition:background-color var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:hover,:host button.secondary-btn:hover{background-color:var(--clr-btn-bgr-secondary-hover)}:where(.lr-wgt-theme,.lr-wgt-common) button.secondary-btn:active,:host button.secondary-btn:active{background-color:var(--clr-btn-bgr-secondary-active)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn,:host button.mini-btn{width:var(--ui-size);height:var(--ui-size);padding:0;background-color:transparent;border:none;cursor:pointer;transition:var(--transition-duration) ease;color:var(--clr-txt)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:hover,:host button.mini-btn:hover{background-color:var(--clr-shade-lv1)}:where(.lr-wgt-theme,.lr-wgt-common) button.mini-btn:active,:host button.mini-btn:active{background-color:var(--clr-shade-lv2)}:where(.lr-wgt-theme,.lr-wgt-common) :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]),:host :is(button[disabled],button.primary-btn[disabled],button.secondary-btn[disabled]){color:var(--clr-btn-txt-disabled);background-color:var(--clr-btn-bgr-disabled);box-shadow:var(--shadow-btn-disabled);pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) a,:host a{color:var(--clr-accent);text-decoration:none}:where(.lr-wgt-theme,.lr-wgt-common) a[disabled],:host a[disabled]{pointer-events:none}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]{display:flex;width:100%;height:var(--ui-size);padding-right:.6em;padding-left:.6em;color:var(--clr-txt);font-size:1em;font-family:inherit;background-color:var(--clr-background-light);border:var(--border-light);border-radius:var(--border-radius-element);transition:var(--transition-duration)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text],:host input[type=text]::placeholder{color:var(--clr-txt-lightest)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:hover,:host input[type=text]:hover{border-color:var(--clr-accent-light)}:where(.lr-wgt-theme,.lr-wgt-common) input[type=text]:focus,:host input[type=text]:focus{border-color:var(--clr-accent);outline:none}:where(.lr-wgt-theme,.lr-wgt-common) input[disabled],:host input[disabled]{opacity:.6;pointer-events:none}lr-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size)}lr-icon svg{width:calc(var(--ui-size) / 2);height:calc(var(--ui-size) / 2)}lr-icon:not([raw]) path{fill:currentColor}lr-tabs{display:grid;grid-template-rows:min-content minmax(var(--ui-size),auto);height:100%;overflow:hidden;color:var(--clr-txt-lightest)}lr-tabs>.tabs-row{display:flex;grid-template-columns:minmax();background-color:var(--clr-background-light)}lr-tabs>.tabs-context{overflow-y:auto}lr-tabs .tabs-row>.tab{display:flex;flex-grow:1;align-items:center;justify-content:center;height:var(--ui-size);border-bottom:var(--border-light);cursor:pointer;transition:var(--transition-duration)}lr-tabs .tabs-row>.tab[current]{color:var(--clr-txt);border-color:var(--clr-txt)}lr-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--ui-size)}lr-range datalist{display:none}lr-range input{width:100%;height:100%;opacity:0}lr-range .track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;user-select:none;pointer-events:none}lr-range .track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}lr-range .slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}lr-range .bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}lr-range .caption{position:absolute;display:inline-flex;justify-content:center}lr-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-size);height:var(--ui-size);overflow:hidden;background-color:var(--clr-background);cursor:pointer}lr-color[current]{background-color:var(--clr-txt)}lr-color input[type=color]{position:absolute;display:block;width:100%;height:100%;opacity:0}lr-color .current-color{position:absolute;width:50%;height:50%;border:2px solid #fff;border-radius:100%;pointer-events:none}lr-config{display:none}lr-simple-btn{position:relative;display:inline-flex}lr-simple-btn button{padding-left:.2em!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-simple-btn button lr-icon svg{transform:scale(.8)}lr-simple-btn button:hover{background-color:var(--clr-btn-bgr-secondary-hover)}lr-simple-btn button:active{background-color:var(--clr-btn-bgr-secondary-active)}lr-simple-btn>lr-drop-area{display:contents}lr-simple-btn .visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--gap-min);border:var(--border-dashed);border-radius:inherit;opacity:0;transition:border-color var(--transition-duration) ease,background-color var(--transition-duration) ease,opacity var(--transition-duration) ease}lr-simple-btn .visual-drop-area:before{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--clr-txt-light);background-color:var(--clr-background);border-radius:inherit;content:var(--l10n-drop-files-here)}lr-simple-btn>lr-drop-area[drag-state=active] .visual-drop-area{background-color:var(--clr-accent-lightest);opacity:1}lr-simple-btn>lr-drop-area[drag-state=inactive] .visual-drop-area{background-color:var(--clr-shade-lv1);opacity:0}lr-simple-btn>lr-drop-area[drag-state=near] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent-light);opacity:1}lr-simple-btn>lr-drop-area[drag-state=over] .visual-drop-area{background-color:var(--clr-accent-lightest);border-color:var(--clr-accent);opacity:1}lr-simple-btn>:where(lr-drop-area[drag-state="active"],lr-drop-area[drag-state="near"],lr-drop-area[drag-state="over"]) button{box-shadow:none}lr-simple-btn>lr-drop-area:after{content:""}lr-source-btn{display:flex;align-items:center;margin-bottom:var(--gap-min);padding:var(--gap-min) var(--gap-mid);color:var(--clr-txt-mid);border-radius:var(--border-radius-element);cursor:pointer;transition-duration:var(--transition-duration);transition-property:background-color,color;user-select:none}lr-source-btn:hover{color:var(--clr-accent);background-color:var(--clr-accent-lightest)}lr-source-btn:active{color:var(--clr-accent);background-color:var(--clr-accent-light)}lr-source-btn lr-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--ui-size);margin-right:var(--gap-mid);opacity:.8}lr-source-btn[type=local]>.txt:after{content:var(--l10n-local-files)}lr-source-btn[type=camera]>.txt:after{content:var(--l10n-camera)}lr-source-btn[type=url]>.txt:after{content:var(--l10n-from-url)}lr-source-btn[type=other]>.txt:after{content:var(--l10n-other)}lr-source-btn .txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--ui-size);padding:0;white-space:nowrap;border:none}lr-drop-area{padding:var(--gap-min);overflow:hidden;border:var(--border-dashed);border-radius:var(--border-radius-frame);transition:var(--transition-duration) ease}lr-drop-area,lr-drop-area .content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}lr-drop-area .text{position:relative;margin:var(--gap-mid);color:var(--clr-txt-light);transition:var(--transition-duration) ease}lr-drop-area[ghost][drag-state=inactive]{display:none;opacity:0}lr-drop-area[ghost]:not([fullscreen]):is([drag-state="active"],[drag-state="near"],[drag-state="over"]){background:var(--clr-background)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) :is(.text,.icon-container){color:var(--clr-accent)}lr-drop-area:is([drag-state="active"],[drag-state="near"],[drag-state="over"],:hover){color:var(--clr-accent);background:var(--clr-accent-lightest);border-color:var(--clr-accent-light)}lr-drop-area:is([drag-state="active"],[drag-state="near"]){opacity:1}lr-drop-area[drag-state=over]{border-color:var(--clr-accent);opacity:1}lr-drop-area[with-icon]{min-height:calc(var(--ui-size) * 6)}lr-drop-area[with-icon] .content-wrapper{display:flex;flex-direction:column}lr-drop-area[with-icon] .text{color:var(--clr-txt);font-weight:500;font-size:1.1em}lr-drop-area[with-icon] .icon-container{position:relative;width:calc(var(--ui-size) * 2);height:calc(var(--ui-size) * 2);margin:var(--gap-mid);overflow:hidden;color:var(--clr-txt);background-color:var(--clr-background);border-radius:50%;transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon{position:absolute;top:calc(50% - var(--ui-size) / 2);left:calc(50% - var(--ui-size) / 2);transition:var(--transition-duration) ease}lr-drop-area[with-icon] lr-icon:last-child{transform:translateY(calc(var(--ui-size) * 1.5))}lr-drop-area[with-icon]:hover .icon-container,lr-drop-area[with-icon]:hover .text{color:var(--clr-accent)}lr-drop-area[with-icon]:hover .icon-container{background-color:var(--clr-accent-lightest)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .icon-container{color:#fff;background-color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) .text{color:var(--clr-accent)}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-drop-area[with-icon]>.content-wrapper:is([drag-state="active"],[drag-state="near"],[drag-state="over"]) lr-icon:last-child{transform:translateY(0)}lr-drop-area[with-icon]>.content-wrapper[drag-state=near] lr-icon:last-child{transform:scale(1.3)}lr-drop-area[with-icon]>.content-wrapper[drag-state=over] lr-icon:last-child{transform:scale(1.5)}lr-drop-area[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--gap-mid) * 2);height:calc(100vh - var(--gap-mid) * 2);margin:var(--gap-mid)}lr-drop-area[fullscreen] .content-wrapper{width:100%;max-width:calc(var(--modal-normal-w) * .8);height:calc(var(--ui-size) * 6);color:var(--clr-txt);background-color:var(--clr-background-light);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:var(--transition-duration) ease}lr-drop-area[with-icon][fullscreen][drag-state=active]>.content-wrapper,lr-drop-area[with-icon][fullscreen][drag-state=near]>.content-wrapper{transform:translateY(var(--gap-mid));opacity:0}lr-drop-area[with-icon][fullscreen][drag-state=over]>.content-wrapper{transform:translateY(0);opacity:1}:is(lr-drop-area[with-icon][fullscreen])>.content-wrapper lr-icon:first-child{transform:translateY(calc(var(--ui-size) * -1.5))}lr-modal{--modal-max-content-height: calc(var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--gap-mid) - var(--ui-size));--modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh)}lr-modal[dialog-fallback]{--lr-z-max: 2147483647;position:fixed;z-index:var(--lr-z-max);display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;pointer-events:none;inset:0}lr-modal[dialog-fallback] dialog[open]{z-index:var(--lr-z-max);pointer-events:auto}lr-modal[dialog-fallback] dialog[open]+.backdrop{position:fixed;top:0;left:0;z-index:calc(var(--lr-z-max) - 1);align-items:center;justify-content:center;width:100vw;height:100vh;background-color:var(--clr-curtain);pointer-events:auto}lr-modal[strokes][dialog-fallback] dialog[open]+.backdrop{background-image:var(--modal-backdrop-background-image)}@supports selector(dialog::backdrop){lr-modal>dialog::backdrop{background-color:#0000001a}lr-modal[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}lr-modal>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}lr-modal>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}lr-modal>dialog{display:flex;flex-direction:column;width:max-content;max-width:min(calc(100% - var(--gap-mid) * 2),calc(var(--modal-max-w) - var(--gap-mid) * 2));min-height:var(--ui-size);max-height:calc(var(--modal-max-h) - var(--gap-mid) * 2);margin:auto;padding:0;overflow:hidden;background-color:var(--clr-background-light);border:0;border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:transform calc(var(--transition-duration) * 2)}@media only screen and (max-width: 430px),only screen and (max-height: 600px){lr-modal>dialog>.content{height:var(--modal-max-content-height)}}lr-url-source{display:block;background-color:var(--clr-background-light)}lr-modal lr-url-source{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-url-source>.content{display:grid;grid-gap:var(--gap-small);grid-template-columns:1fr min-content;padding:var(--gap-mid);padding-top:0}lr-url-source .url-input{display:flex}lr-url-source .url-upload-btn:after{content:var(--l10n-upload-url)}lr-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--clr-background-light);border-radius:var(--border-radius-element)}lr-modal lr-camera-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:100vh;max-height:var(--modal-max-content-height)}lr-camera-source.initialized{height:max-content}@media only screen and (max-width: 430px){lr-camera-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--clr-background-dark);border-radius:var(--border-radius-element)}lr-camera-source .toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-camera-source .content{display:flex;flex:1;justify-content:center;width:100%;padding:var(--gap-mid);padding-top:0;overflow:hidden}lr-camera-source .message-box{--padding: calc(var(--gap-max) * 2);display:flex;flex-direction:column;grid-gap:var(--gap-max);align-items:center;justify-content:center;padding:var(--padding) var(--padding) 0 var(--padding);color:var(--clr-txt)}lr-camera-source .message-box button{color:var(--clr-btn-txt-primary);background-color:var(--clr-btn-bgr-primary)}lr-camera-source .shot-btn{position:absolute;bottom:var(--gap-max);width:calc(var(--ui-size) * 1.8);height:calc(var(--ui-size) * 1.8);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;opacity:.85;transition:var(--transition-duration) ease}lr-camera-source .shot-btn:hover{transform:scale(1.05);opacity:1}lr-camera-source .shot-btn:active{background-color:var(--clr-txt-mid);opacity:1}lr-camera-source .shot-btn[disabled]{bottom:calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2)}lr-camera-source .shot-btn lr-icon svg{width:calc(var(--ui-size) / 1.5);height:calc(var(--ui-size) / 1.5)}lr-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--clr-background-light);overflow:hidden}lr-modal lr-external-source{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height)}lr-external-source>.content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}@media only screen and (max-width: 430px){lr-external-source{width:calc(100vw - var(--gap-mid) * 2);height:var(--modal-content-height-fill, 100%)}}lr-external-source iframe{display:block;width:100%;height:100%;border:none}lr-external-source .iframe-wrapper{overflow:hidden}lr-external-source .toolbar{display:grid;grid-gap:var(--gap-mid);grid-template-columns:max-content 1fr max-content max-content;align-items:center;width:100%;padding:var(--gap-mid);border-top:var(--border-light)}lr-external-source .back-btn{padding-left:0}lr-external-source .back-btn:after{content:var(--l10n-back)}lr-external-source .selected-counter{display:flex;grid-gap:var(--gap-mid);align-items:center;justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt-light)}lr-upload-list{display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light);transition:opacity var(--transition-duration)}lr-modal lr-upload-list{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:max-content;max-height:var(--modal-max-content-height)}lr-upload-list .no-files{height:var(--ui-size);padding:var(--gap-max)}lr-upload-list .files{display:block;flex:1;min-height:var(--ui-size);padding:0 var(--gap-mid);overflow:auto}lr-upload-list .toolbar{display:flex;gap:var(--gap-small);justify-content:space-between;padding:var(--gap-mid);background-color:var(--clr-background-light)}lr-upload-list .toolbar .add-more-btn{padding-left:.2em}lr-upload-list .toolbar-spacer{flex:1}lr-upload-list lr-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--gap-mid) * 2);height:calc(100% - var(--gap-mid) * 2);margin:var(--gap-mid);border-radius:var(--border-radius-element)}lr-upload-list lr-activity-header>.header-text{padding:0 var(--gap-mid)}lr-start-from{display:grid;grid-auto-flow:row;grid-auto-rows:1fr max-content max-content;gap:var(--gap-max);width:100%;height:max-content;padding:var(--gap-max);overflow-y:auto;background-color:var(--clr-background-light)}lr-modal lr-start-from{width:min(calc(var(--modal-normal-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2))}lr-file-item{display:block}lr-file-item>.inner{position:relative;display:grid;grid-template-columns:32px 1fr max-content;gap:var(--gap-min);align-items:center;margin-bottom:var(--gap-small);padding:var(--gap-mid);overflow:hidden;font-size:.95em;background-color:var(--clr-background);border-radius:var(--border-radius-element);transition:var(--transition-duration)}lr-file-item:last-of-type>.inner{margin-bottom:0}lr-file-item>.inner[focused]{background-color:transparent}lr-file-item>.inner[uploading] .edit-btn{display:none}lr-file-item>:where(.inner[failed],.inner[limit-overflow]){background-color:var(--clr-error-lightest)}lr-file-item .thumb{position:relative;display:inline-flex;width:var(--ui-size);height:var(--ui-size);background-color:var(--clr-shade-lv1);background-position:center center;background-size:cover;border-radius:var(--border-radius-thumb)}lr-file-item .file-name-wrapper{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--gap-mid);padding-left:var(--gap-mid);overflow:hidden;color:var(--clr-txt-light);transition:color var(--transition-duration)}lr-file-item .file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}lr-file-item .file-error{display:none;color:var(--clr-error);font-size:.85em;line-height:130%}lr-file-item button.remove-btn,lr-file-item button.edit-btn{color:var(--clr-txt-lightest)!important}lr-file-item button.upload-btn{display:none}lr-file-item button:hover{color:var(--clr-txt-light)}lr-file-item .badge{position:absolute;top:calc(var(--ui-size) * -.13);right:calc(var(--ui-size) * -.13);width:calc(var(--ui-size) * .44);height:calc(var(--ui-size) * .44);color:var(--clr-background-light);background-color:var(--clr-txt);border-radius:50%;transform:scale(.3);opacity:0;transition:var(--transition-duration) ease}lr-file-item>.inner:where([failed],[limit-overflow],[finished]) .badge{transform:scale(1);opacity:1}lr-file-item>.inner[finished] .badge{background-color:var(--clr-confirm)}lr-file-item>.inner:where([failed],[limit-overflow]) .badge{background-color:var(--clr-error)}lr-file-item>.inner:where([failed],[limit-overflow]) .file-error{display:block}lr-file-item .badge lr-icon,lr-file-item .badge lr-icon svg{width:100%;height:100%}lr-file-item .progress-bar{top:calc(100% - 2px);height:2px}lr-file-item .file-actions{display:flex;gap:var(--gap-min);align-items:center;justify-content:center}lr-upload-details{display:flex;flex-direction:column;width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%);max-height:var(--modal-max-content-height);overflow:hidden;background-color:var(--clr-background-light)}lr-upload-details>.content{position:relative;display:grid;flex:1;grid-template-rows:auto min-content}lr-upload-details lr-tabs .tabs-context{position:relative}lr-upload-details .toolbar{display:grid;grid-template-columns:min-content min-content 1fr min-content;gap:var(--gap-mid);padding:var(--gap-mid);border-top:var(--border-light)}lr-upload-details .toolbar[edit-disabled]{display:flex;justify-content:space-between}lr-upload-details .remove-btn{padding-left:.5em}lr-upload-details .detail-btn{padding-left:0;color:var(--clr-txt);background-color:var(--clr-background)}lr-upload-details .edit-btn{padding-left:.5em}lr-upload-details .details{padding:var(--gap-max)}lr-upload-details .info-block{padding-top:var(--gap-max);padding-bottom:calc(var(--gap-max) + var(--gap-table));color:var(--clr-txt);border-bottom:var(--border-light)}lr-upload-details .info-block:first-of-type{padding-top:0}lr-upload-details .info-block:last-of-type{border-bottom:none}lr-upload-details .info-block>.info-block_name{margin-bottom:.4em;color:var(--clr-txt-light);font-size:.8em}lr-upload-details .cdn-link[disabled]{pointer-events:none}lr-upload-details .cdn-link[disabled]:before{filter:grayscale(1);content:var(--l10n-not-uploaded-yet)}lr-file-preview{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}lr-file-preview>lr-img{display:contents}lr-file-preview>lr-img>.img-view{position:absolute;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:scale-down}lr-message-box{position:fixed;right:var(--gap-mid);bottom:var(--gap-mid);left:var(--gap-mid);z-index:100000;display:grid;grid-template-rows:min-content auto;color:var(--clr-txt);font-size:.9em;background:var(--clr-background);border-radius:var(--border-radius-frame);box-shadow:var(--modal-shadow);transition:calc(var(--transition-duration) * 2)}lr-message-box[inline]{position:static}lr-message-box:not([active]){transform:translateY(10px);visibility:hidden;opacity:0}lr-message-box[error]{color:var(--clr-error);background-color:var(--clr-error-message-bgr)}lr-message-box .heading{display:grid;grid-template-columns:min-content auto min-content;padding:var(--gap-mid)}lr-message-box .caption{display:flex;align-items:center;word-break:break-word}lr-message-box .heading button{width:var(--ui-size);padding:0;color:currentColor;background-color:transparent;opacity:var(--opacity-normal)}lr-message-box .heading button:hover{opacity:var(--opacity-hover)}lr-message-box .heading button:active{opacity:var(--opacity-active)}lr-message-box .msg{padding:var(--gap-max);padding-top:0;text-align:left}lr-confirmation-dialog{display:block;padding:var(--gap-mid);padding-top:var(--gap-max)}lr-confirmation-dialog .message{display:flex;justify-content:center;padding:var(--gap-mid);padding-bottom:var(--gap-max);font-weight:500;font-size:1.1em}lr-confirmation-dialog .toolbar{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap-mid);margin-top:var(--gap-mid)}lr-progress-bar-common{position:absolute;right:0;bottom:0;left:0;z-index:10000;display:block;height:var(--gap-mid);background-color:var(--clr-background);transition:opacity .3s}lr-progress-bar-common:not([active]){opacity:0;pointer-events:none}lr-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}lr-progress-bar .progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--clr-accent-light);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}lr-progress-bar .progress--unknown{width:100%;transform-origin:0% 50%;animation:lr-indeterminateAnimation 1s infinite linear}lr-progress-bar .progress--hidden{opacity:0}@keyframes lr-indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}lr-activity-header{display:flex;gap:var(--gap-mid);justify-content:space-between;padding:var(--gap-mid);color:var(--clr-txt);font-weight:500;font-size:1em;line-height:var(--ui-size)}lr-activity-header lr-icon{height:var(--ui-size)}lr-activity-header>*{display:flex;align-items:center}lr-activity-header button{display:inline-flex;align-items:center;justify-content:center;color:var(--clr-txt-mid)}lr-activity-header button:hover{background-color:var(--clr-background)}lr-activity-header button:active{background-color:var(--clr-background-dark)}lr-copyright .credits{padding:0 var(--gap-mid) var(--gap-mid) calc(var(--gap-mid) * 1.5);color:var(--clr-txt-lightest);font-weight:400;font-size:.85em;opacity:.7;transition:var(--transition-duration) ease}lr-copyright .credits:hover{opacity:1}:host(.lr-cloud-image-editor) lr-icon,.lr-cloud-image-editor lr-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:host(.lr-cloud-image-editor) lr-icon svg,.lr-cloud-image-editor lr-icon svg{width:unset;height:unset}:host(.lr-cloud-image-editor) lr-icon:not([raw]) path,.lr-cloud-image-editor lr-icon:not([raw]) path{stroke-linejoin:round;fill:none;stroke:currentColor;stroke-width:1.2}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--icon-rotate: "M13.5.399902L12 1.9999l1.5 1.6M12.0234 2H14.4C16.3882 2 18 3.61178 18 5.6V8M4 17h9c.5523 0 1-.4477 1-1V7c0-.55228-.4477-1-1-1H4c-.55228 0-1 .44771-1 1v9c0 .5523.44771 1 1 1z";--icon-mirror: "M5.00042.399902l-1.5 1.599998 1.5 1.6M15.0004.399902l1.5 1.599998-1.5 1.6M3.51995 2H16.477M8.50042 16.7V6.04604c0-.30141-.39466-.41459-.5544-.159L1.28729 16.541c-.12488.1998.01877.459.2544.459h6.65873c.16568 0 .3-.1343.3-.3zm2.99998 0V6.04604c0-.30141.3947-.41459.5544-.159L18.7135 16.541c.1249.1998-.0187.459-.2544.459h-6.6587c-.1657 0-.3-.1343-.3-.3z";--icon-flip: "M19.6001 4.99993l-1.6-1.5-1.6 1.5m3.2 9.99997l-1.6 1.5-1.6-1.5M18 3.52337V16.4765M3.3 8.49993h10.654c.3014 0 .4146-.39466.159-.5544L3.459 1.2868C3.25919 1.16192 3 1.30557 3 1.5412v6.65873c0 .16568.13432.3.3.3zm0 2.99997h10.654c.3014 0 .4146.3947.159.5544L3.459 18.7131c-.19981.1248-.459-.0188-.459-.2544v-6.6588c0-.1657.13432-.3.3-.3z";--icon-sad: "M2 17c4.41828-4 11.5817-4 16 0M16.5 5c0 .55228-.4477 1-1 1s-1-.44772-1-1 .4477-1 1-1 1 .44772 1 1zm-11 0c0 .55228-.44772 1-1 1s-1-.44772-1-1 .44772-1 1-1 1 .44772 1 1z";--icon-closeMax: "M3 3l14 14m0-14L3 17";--icon-crop: "M20 14H7.00513C6.45001 14 6 13.55 6 12.9949V0M0 6h13.0667c.5154 0 .9333.41787.9333.93333V20M14.5.399902L13 1.9999l1.5 1.6M13 2h2c1.6569 0 3 1.34315 3 3v2M5.5 19.5999l1.5-1.6-1.5-1.6M7 18H5c-1.65685 0-3-1.3431-3-3v-2";--icon-tuning: "M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4M12 4.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M5 10a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0M12 15.5a1.5 1.5 0 103 0 1.5 1.5 0 10-3 0";--icon-filters: "M4.5 6.5a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m-3.5 6a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0m7 0a5.5 5.5 0 1011 0 5.5 5.5 0 10-11 0";--icon-done: "M1 10.6316l5.68421 5.6842L19 4";--icon-original: "M0 40L40-.00000133";--icon-slider: "M0 10h11m0 0c0 1.1046.8954 2 2 2s2-.8954 2-2m-4 0c0-1.10457.8954-2 2-2s2 .89543 2 2m0 0h5";--icon-exposure: "M10 20v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M5 10a5 5 0 1010 0 5 5 0 10-10 0";--icon-contrast: "M2 10a8 8 0 1016 0 8 8 0 10-16 0m8-8v16m8-8h-8m7.5977 2.5H10m6.24 2.5H10m7.6-7.5H10M16.2422 5H10";--icon-brightness: "M15 10c0 2.7614-2.2386 5-5 5m5-5c0-2.76142-2.2386-5-5-5m5 5h-5m0 5c-2.76142 0-5-2.2386-5-5 0-2.76142 2.23858-5 5-5m0 10V5m0 15v-3M2.92946 2.92897l2.12132 2.12132M0 10h3m-.07054 7.071l2.12132-2.1213M10 0v3m7.0705 14.071l-2.1213-2.1213M20 10h-3m.0705-7.07103l-2.1213 2.12132M14.3242 7.5H10m4.3242 5H10";--icon-gamma: "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";--icon-enhance: "M19 13h-2m0 0c-2.2091 0-4-1.7909-4-4m4 4c-2.2091 0-4 1.7909-4 4m0-8V7m0 2c0 2.2091-1.7909 4-4 4m-2 0h2m0 0c2.2091 0 4 1.7909 4 4m0 0v2M8 8.5H6.5m0 0c-1.10457 0-2-.89543-2-2m2 2c-1.10457 0-2 .89543-2 2m0-4V5m0 1.5c0 1.10457-.89543 2-2 2M1 8.5h1.5m0 0c1.10457 0 2 .89543 2 2m0 0V12M12 3h-1m0 0c-.5523 0-1-.44772-1-1m1 1c-.5523 0-1 .44772-1 1m0-2V1m0 1c0 .55228-.44772 1-1 1M8 3h1m0 0c.55228 0 1 .44772 1 1m0 0v1";--icon-saturation: ' ';--icon-warmth: ' ';--icon-vibrance: ' '}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--l10n-cancel: "Cancel";--l10n-apply: "Apply";--l10n-brightness: "Brightness";--l10n-exposure: "Exposure";--l10n-gamma: "Gamma";--l10n-contrast: "Contrast";--l10n-saturation: "Saturation";--l10n-vibrance: "Vibrance";--l10n-warmth: "Warmth";--l10n-enhance: "Enhance";--l10n-original: "Original"}:host(.lr-cloud-image-editor),.lr-cloud-image-editor{--rgb-primary-accent: 6, 2, 196;--rgb-text-base: 0, 0, 0;--rgb-text-accent-contrast: 255, 255, 255;--rgb-fill-contrast: 255, 255, 255;--rgb-fill-shaded: 245, 245, 245;--rgb-shadow: 0, 0, 0;--rgb-error: 209, 81, 81;--opacity-shade-mid: .2;--color-primary-accent: rgb(var(--rgb-primary-accent));--color-text-base: rgb(var(--rgb-text-base));--color-text-accent-contrast: rgb(var(--rgb-text-accent-contrast));--color-text-soft: rgb(var(--rgb-fill-contrast));--color-text-error: rgb(var(--rgb-error));--color-fill-contrast: rgb(var(--rgb-fill-contrast));--color-modal-backdrop: rgba(var(--rgb-fill-shaded), .95);--color-image-background: rgba(var(--rgb-fill-shaded));--color-outline: rgba(var(--rgb-text-base), var(--opacity-shade-mid));--color-underline: rgba(var(--rgb-text-base), .08);--color-shade: rgba(var(--rgb-text-base), .02);--color-focus-ring: var(--color-primary-accent);--color-input-placeholder: rgba(var(--rgb-text-base), .32);--color-error: rgb(var(--rgb-error));--font-size-ui: 16px;--font-size-title: 18px;--font-weight-title: 500;--font-size-soft: 14px;--size-touch-area: 40px;--size-panel-heading: 66px;--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--border-radius-connect: 2px;--border-radius-editor: 3px;--border-radius-thumb: 4px;--border-radius-ui: 5px;--border-radius-base: 6px;--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--opacity-min: var(--opacity-shade-mid);--opacity-mid: .1;--opacity-max: .05;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--shadow-base: 0px 5px 15px rgba(var(--rgb-shadow), .1), 0px 1px 4px rgba(var(--rgb-shadow), .15);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}:host(.lr-cloud-image-editor) :is([can-handle-paste]:hover,[can-handle-paste]:focus),.lr-cloud-image-editor :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}:host(.lr-cloud-image-editor) :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover),.lr-cloud-image-editor :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex]:active,[with-effects]:active),.lr-cloud-image-editor :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important}:host(.lr-cloud-image-editor) :is([tabindex][active],[with-effects][active]),.lr-cloud-image-editor :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important}:host(.lr-cloud-image-editor) [hidden-scrollbar]::-webkit-scrollbar,.lr-cloud-image-editor [hidden-scrollbar]::-webkit-scrollbar{display:none}:host(.lr-cloud-image-editor) [hidden-scrollbar],.lr-cloud-image-editor [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}:host(.lr-cloud-image-editor.editor_ON),.lr-cloud-image-editor.editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}:host(.lr-cloud-image-editor.editor_OFF),.lr-cloud-image-editor.editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto;transition:.3s}@media only screen and (max-width: 800px){:host(.lr-cloud-image-editor)>.wrapper,.lr-cloud-image-editor>.wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}:host(.lr-cloud-image-editor)>.wrapper>.viewport,.lr-cloud-image-editor>.wrapper>.viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);user-select:none;pointer-events:auto}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_visible_viewer,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container>.image.image_hidden_effects,.lr-cloud-image-editor>.wrapper>.viewport>.image_container>.image.image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.image_container,.lr-cloud-image-editor>.wrapper>.viewport>.image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar,.lr-cloud-image-editor>.wrapper>.toolbar{position:relative;transition:.3s}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}:host(.lr-cloud-image-editor)>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor,.lr-cloud-image-editor>.wrapper>.toolbar>.toolbar_content.toolbar_content__editor{display:flex}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.info_pan,.lr-cloud-image-editor>.wrapper>.viewport>.info_pan{position:absolute;user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);user-select:none}:host(.lr-cloud-image-editor)>.wrapper>.viewport>.file_type_outer>.file_type,.lr-cloud-image-editor>.wrapper>.viewport>.file_type_outer>.file_type{padding:4px .8em}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash,.lr-cloud-image-editor>.wrapper>.network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:rgba(var(--rgb-text-base),.6);background-color:rgba(var(--rgb-fill-shaded));border-radius:50%}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_content>.network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui)}:host(.lr-cloud-image-editor)>.wrapper>.network_problems_splash>.network_problems_footer,.lr-cloud-image-editor>.wrapper>.network_problems_splash>.network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}lr-crop-frame>.svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}lr-crop-frame>.thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}lr-crop-frame>.thumb--visible{opacity:1;pointer-events:auto}lr-crop-frame>.thumb--hidden{opacity:0;pointer-events:none}lr-crop-frame>.guides{transition:var(--transition-duration-3)}lr-crop-frame>.guides--hidden{opacity:0}lr-crop-frame>.guides--semi-hidden{opacity:.2}lr-crop-frame>.guides--visible{opacity:1}lr-editor-button-control,lr-editor-crop-button-control,lr-editor-filter-control,lr-editor-operation-control{--l-base-min-width: 40px;--l-base-height: var(--l-base-min-width);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--rgb-text-base);--idle-opacity: .05;--idle-filter: 1;--hover-color-rgb: var(--idle-color-rgb);--hover-opacity: .08;--hover-filter: .8;--down-color-rgb: var(--hover-color-rgb);--down-opacity: .12;--down-filter: .6;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;align-items:center;height:var(--l-base-height);color:rgba(var(--idle-color-rgb));outline:none;cursor:pointer;transition:var(--l-width-transition)}lr-editor-button-control.active,lr-editor-operation-control.active,lr-editor-crop-button-control.active,lr-editor-filter-control.active{--idle-color-rgb: var(--rgb-primary-accent)}lr-editor-filter-control.not_active .preview[loaded]{opacity:1}lr-editor-filter-control.active .preview{opacity:0}lr-editor-button-control.not_active,lr-editor-operation-control.not_active,lr-editor-crop-button-control.not_active,lr-editor-filter-control.not_active{--idle-color-rgb: var(--rgb-text-base)}lr-editor-button-control>.before,lr-editor-operation-control>.before,lr-editor-crop-button-control>.before,lr-editor-filter-control>.before{position:absolute;right:0;left:0;z-index:-1;width:100%;height:100%;background-color:rgba(var(--color-effect),var(--opacity-effect));border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}lr-editor-button-control>.title,lr-editor-operation-control>.title,lr-editor-crop-button-control>.title,lr-editor-filter-control>.title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}lr-editor-filter-control>.preview{position:absolute;right:0;left:0;z-index:1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}lr-editor-filter-control>.original-icon{color:var(--color-text-base);opacity:.3}lr-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none}lr-editor-image-cropper.active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}lr-editor-image-cropper.inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}lr-editor-image-cropper>.canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}lr-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}lr-editor-image-fader.active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}lr-editor-image-fader.active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}lr-editor-image-fader.inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}lr-editor-image-fader .fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);user-select:none;content-visibility:auto}lr-editor-image-fader .fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}lr-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}lr-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:66px}lr-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width: 600px){lr-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--cldtr-gap-min);--l-controls-padding: var(--cldtr-gap-min)}}@media only screen and (min-width: 601px){lr-editor-toolbar{--l-tab-gap: calc(var(--cldtr-gap-mid-1) + var(--cldtr-gap-max));--l-slider-padding: var(--cldtr-gap-mid-1);--l-controls-padding: var(--cldtr-gap-mid-1)}}lr-editor-toolbar>.toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}lr-editor-toolbar>.toolbar-container>.sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar.sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--color-primary-accent);transform:translate(0);transition:transform var(--transition-duration-3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row{position:relative}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--visible{opacity:1;pointer-events:auto}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content.tab-content--hidden{opacity:0;pointer-events:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--visible{display:contents}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles>.tab-toggle.tab-toggle--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.controls-row>.tab-toggles.tab-toggles--hidden{display:none}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--cldtr-gap-max)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;grid-gap:calc((var(--cldtr-gap-min) - 1px) * 3)}lr-editor-toolbar>.toolbar-container>.sub-toolbar>.tab-content-row>.tab-content .controls-list_inner:last-child{padding-right:var(--cldtr-gap-max)}lr-editor-toolbar .controls-list_last-item{margin-right:var(--cldtr-gap-max)}lr-editor-toolbar .info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}lr-editor-toolbar .info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}lr-editor-toolbar .info-tooltip{z-index:3;padding-top:calc(var(--cldtr-gap-min) / 2);padding-right:var(--cldtr-gap-min);padding-bottom:calc(var(--cldtr-gap-min) / 2);padding-left:var(--cldtr-gap-min);color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}lr-editor-toolbar .info-tooltip_visible{transform:translateY(0);opacity:1}lr-editor-toolbar .slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}lr-btn-ui{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--l-transition-effect: var(--css-transition, color var(--transition-duration-2), filter var(--transition-duration-2));display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--size-touch-area));padding-right:var(--css-padding-right, var(--cldtr-gap-mid-1));padding-left:var(--css-padding-left, var(--cldtr-gap-mid-1));color:rgba(var(--color-effect),var(--opacity-effect));outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);user-select:none}lr-btn-ui .text{white-space:nowrap}lr-btn-ui .icon{display:flex;align-items:center;justify-content:center;color:rgba(var(--color-effect),var(--opacity-effect));filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}lr-btn-ui .icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}lr-btn-ui .icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}lr-btn-ui .icon_single{margin-right:0;margin-left:0}lr-btn-ui .icon_hidden{display:none;margin:0}lr-btn-ui.primary{--idle-color-rgb: var(--rgb-primary-accent);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--idle-color-rgb);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.boring{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-text-base);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: 1;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-btn-ui.default{--idle-color-rgb: var(--rgb-text-base);--idle-brightness: 1;--idle-opacity: .6;--hover-color-rgb: var(--rgb-primary-accent);--hover-brightness: 1;--hover-opacity: 1;--down-color-rgb: var(--hover-color-rgb);--down-brightness: .75;--down-opacity: 1;--active-color-rgb: var(--rgb-primary-accent);--active-brightness: 1;--active-opacity: 1}lr-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}lr-line-loader-ui .inner{width:25%;max-width:200px;height:100%}lr-line-loader-ui .line{width:100%;height:100%;background-color:var(--color-primary-accent);transform:translate(-101%);transition:transform 1s}lr-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--rgb-text-base);--hover-color-rgb: var(--rgb-primary-accent);--down-color-rgb: var(--rgb-primary-accent);--color-effect: var(--idle-color-rgb);--l-color: rgb(var(--color-effect));position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}lr-slider-ui .thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2)}lr-slider-ui .steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}lr-slider-ui .border-step{width:0px;height:10px;border-right:1px solid var(--l-color);opacity:.6;transition:var(--transition-duration-2)}lr-slider-ui .minor-step{width:0px;height:4px;border-right:1px solid var(--l-color);opacity:.2;transition:var(--transition-duration-2)}lr-slider-ui .zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}lr-slider-ui .input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}lr-presence-toggle.transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}lr-presence-toggle.visible{opacity:1;pointer-events:inherit}lr-presence-toggle.hidden{opacity:0;pointer-events:none}ctx-provider{--color-text-base: black;--color-primary-accent: blue;display:flex;align-items:center;justify-content:center;width:190px;height:40px;padding-right:10px;padding-left:10px;background-color:#f5f5f5;border-radius:3px}lr-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--clr-background-light)}lr-modal lr-cloud-image-editor-activity{width:min(calc(var(--modal-max-w) - var(--gap-mid) * 2),calc(100vw - var(--gap-mid) * 2));height:var(--modal-content-height-fill, 100%)}lr-select{display:inline-flex}lr-select>button{position:relative;display:inline-flex;align-items:center;padding-right:0!important;color:var(--clr-btn-txt-secondary);background-color:var(--clr-btn-bgr-secondary);box-shadow:var(--shadow-btn-secondary)}lr-select>button>select{position:absolute;display:block;width:100%;height:100%;opacity:0} diff --git a/web/lr-file-uploader-regular.min.js b/web/lr-file-uploader-regular.min.js index 608ea96b1..df97cf407 100644 --- a/web/lr-file-uploader-regular.min.js +++ b/web/lr-file-uploader-regular.min.js @@ -23,5 +23,5 @@ * SOFTWARE. * */ -var zr=Object.defineProperty;var jr=(s,i,t)=>i in s?zr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(jr(s,typeof i!="symbol"?i+"":i,t),t),Si=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var V=(s,i,t)=>(Si(s,i,"read from private field"),t?t.call(s):i.get(s)),Ot=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},re=(s,i,t,e)=>(Si(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var Oe=(s,i,t)=>(Si(s,i,"access private method"),t);var Hr=Object.defineProperty,Wr=(s,i,t)=>i in s?Hr(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,Ii=(s,i,t)=>(Wr(s,typeof i!="symbol"?i+"":i,t),t);function Xr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Xr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),fs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",qr=fs.length-1,oe=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Kr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var ds="__default__";function Yr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||ds;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=ds;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Zr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Jr(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Gr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ms(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var Le="{{",ne="}}",Qr="skip-text";function tn(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(Qr))&&r.textContent.includes(Le)&&r.textContent.includes(ne)&&1}});for(;i=e.nextNode();)t.push(i);return t}var en=function(s,i){tn(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(ne);)e.textContent.startsWith(Le)?(n=e.textContent.indexOf(ne)+ne.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(Le),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(Le,"").replace(ne,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},sn=[Kr,Yr,Zr,Jr,en],Ue="'",Bt='"',rn=/\\([0-9a-fA-F]{1,6} ?)/g;function nn(s){return(s[0]===Bt||s[0]===Ue)&&(s[s.length-1]===Bt||s[s.length-1]===Ue)}function on(s){return(s[0]===Bt||s[0]===Ue)&&(s=s.slice(1)),(s[s.length-1]===Bt||s[s.length-1]===Ue)&&(s=s.slice(0,-1)),s}function ln(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ -`,"\\n"),i=ln(i),i=Bt+i+Bt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ps=0,Vt=null,pt=null,vt=class extends HTMLElement{constructor(){super(),Ii(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=oe.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ms(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of sn)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);pt==null||pt.delete(this.updateCssData),pt!=null&&pt.size||(Vt==null||Vt.disconnect(),Vt=null,pt=null)},100)))}static reg(s,i=!1){s||(ps++,s=`${C.AUTO_TAG_PRFX}-${ps}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=an(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){pt||(pt=new Set),pt.add(this.updateCssData),Vt||(Vt=new MutationObserver(s=>{s[0].type==="attributes"&&pt.forEach(i=>{i()})}),Vt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},zt=vt;Ii(zt,"template");var ki=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(ki.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),ki.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};ki.appMap=Object.create(null);function cn(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function hn(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function le(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&hn(i,s.attributes),s.styles&&cn(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=le(t);i.appendChild(e)}),i}var gs="idb-store-ready",un="symbiote-db",dn="symbiote-idb-update_",pn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(gs,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return dn+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,bs.clear(this.name)}},bs=class{static get readyEventName(){return gs}static open(s=un,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new pn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};Ii(bs,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var fn="--uploadcare-blocks-window-height",Re="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function Oi(){return typeof window[Re]=="undefined"?!1:!!window[Re]}function _s(){if(Oi())return;let s=()=>{document.documentElement.style.setProperty(fn,`${window.innerHeight}px`),window[Re]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[Re]=!1,window.removeEventListener("resize",i)}}var mn=s=>s,Li="{{",vs="}}",ys="plural:";function ae(s,i,t={}){var o;let{openToken:e=Li,closeToken:r=vs,transform:n=mn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function Cs(s){let i=[],t=s.indexOf(Li);for(;t!==-1;){let e=s.indexOf(vs,t),r=s.substring(t+2,e);if(r.startsWith(ys)){let n=s.substring(t+2,e).replace(ys,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Li,e)}return i}function ws(s){return Object.prototype.toString.call(s)==="[object Object]"}var gn=/\W|_/g;function bn(s){return s.split(gn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Ts(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return Ts(s,{ignoreKeys:i});if(!ws(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ws(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Ts(r,{ignoreKeys:i})),t[bn(e)]=r}return t}var _n=s=>new Promise(i=>setTimeout(i,s));function Fi({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var yn={factor:2,time:100};function vn(s,i=yn){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>_n(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var qt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,qt.prototype),this.originalProgressEvent=t}},Ne=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},Cn=500,Es=({check:s,interval:i=Cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ne(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},De="application/octet-stream",As="original",Tt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ne(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,b=a.status;o({request:d,data:f,headers:m,status:b})}},a.onerror=d=>{u||l(new qt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function wn(s,...i){return s}var Tn=({name:s})=>s?[s]:[],xn=wn,En=()=>new FormData,$s=s=>!1,Fe=s=>typeof Blob!="undefined"&&s instanceof Blob,Ve=s=>typeof File!="undefined"&&s instanceof File,Be=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",ce=s=>Fe(s)||Ve(s)||$s()||Be(s),An=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",$n=s=>!!s&&typeof s=="object"&&!Array.isArray(s),Sn=s=>!!s&&typeof s=="object"&&"data"in s&&ce(s.data);function kn(s,i,t){if(Sn(t)){let{name:e,contentType:r}=t,n=xn(t.data,e,r!=null?r:De),o=Tn({name:e,contentType:r});s.push([i,n,...o])}else if($n(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else An(t)&&t&&s.push([i,t.toString()])}function In(s){let i=[];for(let[t,e]of Object.entries(s))kn(i,t,e);return i}function Vi(s){let i=En(),t=In(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var P=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,P.prototype)}},On=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},ft=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=On(t)),e.toString()},Ln="6.6.1",Un="UploadcareUploadClient",Rn=Ln;function Rt(s){return Fi({libraryName:Un,libraryVersion:Rn,...s})}var Pn="RequestThrottledError",xs=15e3,Mn=1e3;function Nn(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return xs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xs}function xt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return vn(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Pn&&r{let i="";return(Fe(s)||Ve(s)||Be(s))&&(i=s.type),i||De},ks=s=>{let i="";return Ve(s)&&s.name?i=s.name:Fe(s)||$s()?i="":Be(s)&&s.name&&(i=s.name),i||As};function Bi(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function Dn(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({file:{data:s,name:t||ks(s),contentType:e||Ss(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Bi(l),signature:n,expire:o,source:u,metadata:b}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var Pi;(function(s){s.Token="token",s.FileInfo="file_info"})(Pi||(Pi={}));function Fn(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Bi(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:b}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var X;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(X||(X={}));var Vn=s=>"status"in s&&s.status===X.Error;function Bn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return xt(()=>Tt({method:"GET",headers:i?{"X-UC-User-Agent":Rt({publicKey:i,integration:r,userAgent:n})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Vn(d))throw new P(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function zn(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:a,userAgent:c})},url:ft(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let b=mt(JSON.parse(p));if("error"in b)throw new P(b.error.content,b.error.errorCode,f,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function Is(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"GET",headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},url:ft(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function jn(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:b}){return xt(()=>Tt({method:"POST",url:ft(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:d,userAgent:p})},data:Vi({filename:e||As,size:s,content_type:t||De,part_size:r,UPLOADCARE_STORE:Bi(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:b}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new P(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(H=>w.parts[H]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Hn(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||De}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Wn(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return xt(()=>Tt({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Rt({publicKey:i,integration:n,userAgent:o})},data:Vi({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new P(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function zi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Es({check:u=>Is(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}var wt=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);let{uuid:r,s3Bucket:n}=i,o=ft(t,`${r}/`),l=n?ft(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l}},Xn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:b,metadata:A})=>Dn(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>zi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new wt(x,{baseCDN:b})),qn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>Is(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new wt(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Gn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ne(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Kn=window.WebSocket,Mi=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Yn=(s,i)=>s==="success"?{status:X.Success,...i}:s==="progress"?{status:X.Progress,...i}:{status:X.Error,...i},Ni=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Mi);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Kn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Yn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Ui=null,ji=s=>{if(!Ui){let i=typeof window=="undefined"?0:3e4;Ui=new Ni(s,i)}return Ui},Zn=s=>{ji(s).connect()};function Jn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return Es({check:c=>Bn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case X.Error:return new P(u.error,u.errorCode);case X.Waiting:return!1;case X.Unknown:return new P(`Token "${s}" was not found.`);case X.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case X.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var Qn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=ji(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ne(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case X.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case X.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case X.Error:a(),n(new P(c.msg,c.error_code))}})}),to=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Zn(A)).then(()=>Fn(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,metadata:x})).catch(T=>{let w=ji(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===Pi.FileInfo?T:Gn([({signal:w})=>Jn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:w}),({signal:w})=>Qn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof P)throw T;return T}).then(T=>zi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:b,onProgress:d,signal:u})).then(T=>new wt(T,{baseCDN:r})),Ri=new WeakMap,eo=async s=>{if(Ri.has(s))return Ri.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ri.set(s,i),i},Os=async s=>{if(Ve(s)||Fe(s))return s.size;if(Be(s))return(await eo(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},io=(s,i=E.multipartMinFileSize)=>s>=i,Ls=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ce(s)&&t.test(s)},Us=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ce(s)&&t.test(s)},so=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},no=async(s,i,t)=>e=>ro(s,e,i,t),oo=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Hn(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),lo=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:b,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let H=e!=null?e:await Os(s),ht,It=(R,Q)=>{if(!c)return;ht||(ht=Array(R).fill(0));let ut=W=>W.reduce((dt,$i)=>dt+$i,0);return W=>{W.isComputable&&(ht[Q]=W.value,c({isComputable:!0,value:ut(ht)/R}))}};return b||(b=Ss(s)),jn(H,{publicKey:i,contentType:b,fileName:t||ks(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:R,parts:Q})=>{let ut=await no(s,H,A);return Promise.all([R,so(x,Q.map((W,dt)=>()=>oo(ut(dt),W,{publicKey:i,contentType:b,onProgress:It(Q.length,dt),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([R])=>Wn(R,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(R=>R.isReady?R:zi({file:R.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(R=>new wt(R,{baseCDN:T}))};async function Hi(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:b,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,pusherKey:ht,metadata:It}){if(ce(s)){let R=await Os(s);return io(R,b)?lo(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:R,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Xn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Us(s))return to(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:H,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(Ls(s))return qn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var Di=class{constructor(i,t){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount,this.totalSize=Object.values(i.files).reduce((e,r)=>e+r.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(i.files).filter(e=>e.isImage).length,this.cdnUrl=i.cdnUrl,this.files=t,this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},ao=s=>{for(let i of s)if(!ce(i))return!1;return!0},co=s=>{for(let i of s)if(!Ls(i))return!1;return!0},ho=s=>{for(let i of s)if(!Us(i))return!1;return!0};function Rs(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!ao(s)&&!ho(s)&&!co(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let H,ht=!0,It=s.length,R=(Q,ut)=>{if(!a)return;H||(H=Array(Q).fill(0));let W=dt=>dt.reduce(($i,Br)=>$i+Br)/Q;return dt=>{if(!dt.isComputable||!ht){ht=!1,a({isComputable:!1});return}H[ut]=dt.value,a({isComputable:!0,value:W(H)})}};return Promise.all(s.map((Q,ut)=>Hi(Q,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:R(It,ut),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:b,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}))).then(Q=>{let ut=Q.map(W=>W.uuid);return zn(ut,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(W=>new Di(W,Q)).then(W=>(a&&a({isComputable:!0,value:1}),W))})}var Lt,jt,Ut,Ht,Wt,Xt,Pe,Me=class{constructor(i){Ot(this,Xt);Ot(this,Lt,1);Ot(this,jt,[]);Ot(this,Ut,0);Ot(this,Ht,new WeakMap);Ot(this,Wt,new WeakMap);re(this,Lt,i)}add(i){return new Promise((t,e)=>{V(this,Ht).set(i,t),V(this,Wt).set(i,e),V(this,jt).push(i),Oe(this,Xt,Pe).call(this)})}get pending(){return V(this,jt).length}get running(){return V(this,Ut)}set concurrency(i){re(this,Lt,i),Oe(this,Xt,Pe).call(this)}get concurrency(){return V(this,Lt)}};Lt=new WeakMap,jt=new WeakMap,Ut=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Xt=new WeakSet,Pe=function(){let i=V(this,Lt)-V(this,Ut);for(let t=0;t{V(this,Ht).delete(e),V(this,Wt).delete(e),re(this,Ut,V(this,Ut)-1),Oe(this,Xt,Pe).call(this)}).then(o=>r(o)).catch(o=>n(o))}};var Wi=()=>({"*blocksRegistry":new Set}),Xi=s=>({...Wi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),ze=s=>({...Xi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Me(1)});function Ps(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var q=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Ms=new Set;function je(s){Ms.has(s)||(Ms.add(s),console.warn(s))}var He=(s,i)=>new Intl.PluralRules(s).select(i);var We=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var qi="lr-",_=class extends zt{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Wi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(Ps),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=Cs(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return ae(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=He(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${qi}${t}`,!0),Oi()||(this._destroyInnerHeightTracker=_s()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?We({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?ae(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=q(r);return this.$[o]=n,!0},get:(e,r)=>{let n=q(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(je("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(q(t));r.ctx.has(r.name)?this.sub(q(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(qi)?t:qi+t)}};h(_,"StateConsumerScope",null),h(_,"className","");var he=class extends _{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(he,"StateConsumerScope","modal");he.template=``;var Ns="active",ue="___ACTIVITY_IS_ACTIVE___",st=class extends _{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Xi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ue]=!1,this.removeAttribute(Ns),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ue]=!0,this.setAttribute(Ns,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ue]?this._deactivate():this.activityType===t&&!this[ue]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ue]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var de=33.333333333333336,y=1,Gi=24,Ds=6;function Pt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function tt(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Pt(t,i),t}function Fs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function Vs(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Bs(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function zs({rect:s,delta:[i,t],imageBox:e}){return Kt({...s,x:s.x+i,y:s.y+t},e)}function Kt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function uo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Xs(s,i){return Math.abs(s.width/s.height-i)<.1}function Yt({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function qs(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Zt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function Et(s,i,t){return Math.min(Math.max(s,i),t)}var qe=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var et=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Gs="blocks",Ks="0.27.6";function Ys(s){return Fi({...s,libraryName:Gs,libraryVersion:Ks})}var Zs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ge=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Zs(i)).join("/-/"),M=(...s)=>{let i=Ge(...s);return i?`-/${i}/`:""};function Js(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function Qs(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function tr(s){let i=er(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Zs(n))}function er(s){let i=new URL(s),t=Js(s),e=ir(t)?sr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function ir(s){return s.startsWith("http")}function sr(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(er(s));if(t=t||Js(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),ir(t)){let r=sr(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},At=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var N=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var pe=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ki=s=>s?s.filter(i=>typeof i=="string").map(i=>N(i)).flat():[],Yi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),rr=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),fe=s=>{let i=s==null?void 0:s.type;return i?Yi(i,pe):!1};var nt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),me=s=>Math.ceil(s*100)/100,nr=(s,i=Mt.AUTO)=>{let t=i===Mt.AUTO;if(i===Mt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(O,"_timeoutStore",Object.create(null));var or="[Typed State] Wrong property name: ",vo="[Typed State] Wrong property type: ",Ke=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||oe.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(vo+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(or+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Ye=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||oe.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__handler=i.handler||null,this.__subsMap=Object.create(null),this.__observers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{this.__observers.forEach(n=>{n({...t})}),t=Object.create(null)})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{var e;let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear(),(e=this.__handler)==null||e.call(this,[...this.__items],i,t)})}setHandler(i){this.__handler=i,this.notify()}getHandler(){return this.__handler}removeHandler(){this.__handler=null}add(i){let t=new Ke(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observe(i){this.__observers.add(i)}unobserve(i){this.__observers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__observers=null,this.__handler=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var lr=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:wt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var ar=s=>s?s.split(",").map(i=>i.trim()):[],Nt=s=>s?s.join(","):"";var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",ze(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_handleCollectionUpdate",t=>{let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,O.emit(new B({type:L.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&O.emit(new B({type:L.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{O.emit(new B({type:L.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{O.emit(new B({type:L.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{O.emit(new B({type:L.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){je("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ye({typedSchema:lr,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this.__uploadCollectionHandler=(e,r,n)=>{var o;this._runValidators();for(let l of n)(o=l==null?void 0:l.getValue("abortController"))==null||o.abort(),l==null||l.setValue("abortController",null),URL.revokeObjectURL(l==null?void 0:l.getValue("thumbUrl"));this.$["*uploadList"]=e.map(l=>({uid:l}))},this.uploadCollection.setHandler(this.__uploadCollectionHandler),this.uploadCollection.observe(this._handleCollectionUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){super.destroyCallback(),this.isUploadCollectionOwner&&(this.uploadCollection.unobserve(this._handleCollectionUpdate),this.uploadCollection.getHandler()===this.__uploadCollectionHandler&&this.uploadCollection.removeHandler())}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:et.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:fe(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:et.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:fe(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Nt(Ki([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?pe:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Nt(pe)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:et.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=N(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);O.emit(new B({type:L.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),O.emit(new B({type:L.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Ki([...e?pe:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Yi(o,n),c=rr(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:nr(e)})}_validateMultipleLimit(t){let r=this.uploadCollection.items().indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&r>=n)return this.l10n("files-count-allowed",{count:n})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=qe(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=qs(l,a,c),d=M(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ys,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return this.uploadCollection.findItems(t).forEach(n=>{let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,fileSize:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl||l.cdnUrl};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});Object.values(L).forEach(s=>{let i=O.eName(s),t=S(e=>{if([L.UPLOAD_FINISH,L.REMOVE,L.CLOUD_MODIFICATION].includes(e.detail.type)){let n=$.getCtx(e.detail.ctx),o=n.read("uploadCollection"),l=[];o.items().forEach(a=>{let c=$.getCtx(a).store,u=c.fileInfo;if(u){let d={...u,cdnUrlModifiers:c.cdnUrlModifiers,cdnUrl:c.cdnUrl||u.cdnUrl};l.push(d)}}),O.emit(new B({type:L.DATA_OUTPUT,ctx:e.detail.ctx,data:l})),n.pub("outputData",l)}},0);window.addEventListener(i,t)});var Z={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function Co(s,i){if(typeof i=="number")return Z[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Z[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Z[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var hr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function $t(s){return Ge(...hr.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return Co(i,t)}).filter(i=>!!i))}var Ze=Ge("format/auto","progressive/yes"),bt=([s])=>typeof s!="undefined"?Number(s):void 0,cr=()=>!0,wo=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),To=([s,i])=>({dimensions:N(s,"x").map(Number),coords:N(i).map(Number)}),xo={enhance:bt,brightness:bt,exposure:bt,gamma:bt,contrast:bt,saturation:bt,vibrance:bt,warmth:bt,filter:wo,mirror:cr,flip:cr,rotate:bt,crop:To};function ur(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!hr.includes(e))continue;let n=xo[e],o=n(r);i[e]=o}return i}var D=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),G=[D.CROP,D.TUNING,D.FILTERS],dr=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],pr=["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"],fr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Z.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Z.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Z.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Z.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Z.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Z.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Z.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Z.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Z.filter,range:[0,100],keypointsNumber:1}});var Eo="https://ucarecdn.com",Ao="https://upload.uploadcare.com",$o="https://social.uploadcare.com",Jt={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Nt(G),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Eo,baseUrl:Ao,socialBaseUrl:$o,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var K=s=>String(s),lt=s=>Number(s),k=s=>typeof s=="boolean"?s:s==="true"||s===""?!0:s==="false"?!1:!!s,So=s=>s==="auto"?s:k(s),ko={pubkey:K,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:K,externalSourcesPreferredTypes:K,store:So,cameraMirror:k,sourceList:K,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:K,removeCopyright:k,cropPreset:K,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:K,cdnCname:K,baseUrl:K,socialBaseUrl:K,secureSignature:K,secureExpire:K,secureDeliveryProxy:K,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:K},mr=(s,i)=>{if(!(typeof i=="undefined"||i===null))return ko[s](i)};var Je=Object.keys(Jt),Io=["metadata"],Oo=s=>Io.includes(s),Qe=Je.filter(s=>!Oo(s)),Lo={...Object.fromEntries(Qe.map(s=>[gt(s),s])),...Object.fromEntries(Qe.map(s=>[s.toLowerCase(),s]))},Uo={...Object.fromEntries(Je.map(s=>[gt(s),q(s)])),...Object.fromEntries(Je.map(s=>[s.toLowerCase(),q(s)]))},ti=class extends _{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Jt).map(([t,e])=>[q(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of Qe)this.sub(q(e),r=>{r!==Jt[e]&&(t[e]=r)},!1);for(let e of Je){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,Qe.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[q(e)]!==n&&(typeof n=="undefined"||n===null?this.$[q(e)]=Jt[e]:this.$[q(e)]=n)},get:()=>this.$[q(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Lo[t],o=mr(n,r),l=o!=null?o:Jt[n],a=this;a[n]=l}};ti.bindAttributes(Uo);var ge=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};ge.template=``;ge.bindAttributes({name:"name",size:"size"});var Ro="https://ucarecdn.com",Dt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ro},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var gr=s=>[...new Set(s)];var be="--lr-img-",br="unresolved",Qt=2,te=3,_r=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),vr=Object.create(null),yr;for(let s in Dt)vr[be+s]=((yr=Dt[s])==null?void 0:yr.default)||"";var ei=class extends zt{constructor(){super(...arguments);h(this,"cssInit$",vr)}$$(t){return this.$[be+t]}set$$(t){for(let e in t)this.$[be+e]=t[e]}sub$$(t,e){this.sub(be+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!_r&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return M(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Dt.format.default}`,`quality/${this.$$("quality")||Dt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(_r&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(At(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?ae(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(br,""),this.img.onload=()=>{this.img.removeAttribute(br)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Dt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?gr(N(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Qt+"x")}") ${n*Qt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*te+"x")}") ${n*te}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Qt))}") ${Qt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,te))}") ${te}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Qt+"x")+` ${e*Qt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*te+"x")+` ${e*te}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Dt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[be+t]=r})}};var Zi=class extends ei{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var _e=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};_e.template=``;_e.bindAttributes({dropzone:null});var Ji=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function Po(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Mo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function Cr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(Po(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var z={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},wr=["focus"],No=100,Qi=new Map;function Do(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function ts(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=z.INACTIVE,o=f=>{s.shouldIgnore()&&f!==z.INACTIVE||(n!==f&&e.forEach(b=>b(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(z.INACTIVE)},c=()=>{i+=1,n===z.INACTIVE&&o(z.ACTIVE)},u=()=>{i-=1,l()||o(z.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(z.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let b=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor(Do(b,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let b=await Cr(f.dataTransfer);s.onItems(b),o(z.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),wr.forEach(f=>{window.addEventListener(f,a)}),()=>{Qi.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),wr.forEach(f=>{window.removeEventListener(f,a)})}}var ye=class extends v{constructor(){super(),this.init$={...this.init$,state:z.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=ts({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:et.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:et.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=ts({element:i,onChange:t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(z).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=N(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};ye.template=`
{{text}}
`;ye.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Fo="src-type-",ve=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${Fo}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ve.template=`
`;ve.bindAttributes({type:null});var es=class extends _{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=N(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function Tr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function xr(s="#fff",i="rgba(0, 0, 0, .1)"){return Tr(``)}function Ce(s="hsl(209, 21%, 65%)",i=32,t=32){return Tr(``)}function Er(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var j=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),_t=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:j.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=j.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=j.FAILED:t.getValue("validationMultipleLimitMsg")?e=j.LIMIT_OVERFLOW:t.getValue("isUploading")?e=j.UPLOADING:t.getValue("fileInfo")&&(e=j.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(At(this.cfg.cdnCname,this._entry.getValue("uuid")),M(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await Er(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",Ce(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{_t.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),_t.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===j.FAILED,isLimitOverflow:t===j.LIMIT_OVERFLOW,isUploading:t===j.UPLOADING,isFinished:t===j.FINISHED,progressVisible:t===j.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===j.FAILED||t===j.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===j.FINISHED&&(this.$.badgeIcon="badge-success"),t===j.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),_t.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));O.emit(new B({type:L.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Hi(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof P?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};_t.template=`
{{itemName}}{{errorText}}
`;_t.activeInstances=new Set;var ii=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},si=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};si.template=`
{{captionTxt}}
{{msgTxt}}
`;var ri=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));O.emit(new B({type:L.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new ii,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observe(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserve(this._debouncedHandleCollectionUpdate)}};ri.template=`{{headerText}}
`;var ni=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:et.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};ni.template=`
`;var is=()=>typeof navigator.permissions!="undefined";var oi=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:is(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{is()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:et.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};oi.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var ss=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var li=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=Ce(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=fe(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,M("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};li.template=`
{{fileSize}}
{{errorTxt}}
`;var rs=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},ai=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new rs);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};ai.template=`{{activityCaption}}
{{messageTxt}}
`;var ci=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this.uploadCollection.observe(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}};ci.template=``;var hi=class extends _{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};hi.template='
';var J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var we=class extends _{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:J})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${xr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=J}};we.template='';we.bindAttributes({checkerboard:"checkerboard"});var Ar="--cfg-ctx-name",U=class extends _{get cfgCssCtxName(){return this.getCssData(Ar,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(Ar,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function $r(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function F(...s){let i=$r(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Sr(s,...i){let t=$r(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var kr=s=>{if(!s)return G;let i=ar(s).filter(t=>G.includes(t));return i.length===0?G:i};function Ir(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":G,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:J,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Nt(G),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=J,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=M($t(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var Or=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends U{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...Ir(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===D.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=Qs(this.$.cdnUrl);this.$["*originalUrl"]=At(this.$.cdnUrl,t);let e=tr(this.$.cdnUrl),r=ur(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=At(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],M("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===D.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==J&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||J)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=qe(t)}),this.sub("tabs",t=>{this.$["*tabList"]=kr(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=F("image",{image_hidden_to_cropper:t===D.CROP,image_hidden_effects:t!==D.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=M($t(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=Or;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ui=class extends U{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=tt("mask",{id:"backdrop-mask"}),a=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=tt("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Pt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Pt(n,f)}else{let f=Et(Math.min(d,p)/(24*2+34)/2,0,1),{d:b,center:A}=a?Fs(i,e,f):Vs(i,e,f),x=Math.max(Gi*Et(Math.min(d,p)/Gi/3,0,1),Ds);Pt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Pt(r,{d:b})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",F("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Pt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=tt("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=tt("rect",{fill:"transparent"}),l=tt("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=tt("svg"),t=tt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=tt("line",{x1:`${de*e}%`,y1:"0%",x2:`${de*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=tt("line",{x1:"0%",y1:`${de*e}%`,x2:"100%",y2:`${de*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=zs({rect:o,delta:[e,r],imageBox:n}):o=js({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return Kt(Zt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Hs(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Bs(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",F("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",F({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ui.template='';var yt=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=F({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Bo(s){let i=s+90;return i=i>=360?0:i,i}function zo(s,i){return s==="rotate"?Bo(i):["mirror","flip"].includes(s)?!i:null}var Te=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=zo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var xe={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",di=class extends U{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?xe.FILTER:xe.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===xe.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===xe.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===xe.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};di.template=``;function Ee(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=J)}}}function Ae(s){let i=[];for(let n of s){let o=Ee(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var ee=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,M(Ze,$t(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=Ee(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};ee.template=`
`;var $e=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Lr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function Ur(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function ie(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,M(Ze,$t(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function jo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var pi=class extends U{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Lr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=Ur(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Yt({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Zt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,b]}=n,{width:A}=Yt(this._imageSize,r),x=o/A;i=Kt(Zt({x:l+f*x,y:a+b*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Ws(i,t)||u&&!Xs(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=Kt(Zt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Yt({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=F({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Yt(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[Et(Math.round(c/d),1,l),Et(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Yt(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,b=this._getCropDimensions(),A={dimensions:b,coords:[Et(Math.round((d-l)/m),0,c-b[0]),Et(Math.round((p-a)/f),0,u-b[1])]};if(!jo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(b[0]===c&&b[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=F({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(ie(i,e,t)),{promise:n,cancel:o,image:l}=Ee(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};pi.template=``;function ns(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Ho(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Xo(s,i){return s.map((t,e)=>tn-o)}var os=class extends U{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(ie(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Wo(r,t,e),o=Xo(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=Ae(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Rr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=Ae(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=F({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Rr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=F({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var qo=1,fi=class extends U{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>qo?this.scrollLeft+=e:this.scrollLeft+=t})}};fi.template=" ";function Go(s){return``}function Ko(s){return`
`}var mi=class extends U{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===D.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===D.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":D.CROP,showLoader:!1,filters:pr,colorOperations:dr,cropOperations:fr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===D.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new $e;return e.operation=t,e}_createFilterControl(t){let e=new ee;return e.filter=t,e}_createToggleControl(t){let e=new Te;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===D.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===D.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===D.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===D.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of G){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(ie(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=Ae([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of G){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};mi.template=`
{{*operationTooltip}}
${G.map(Ko).join("")}
${G.map(Go).join("")}
`;var Se=class extends _{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return F("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};Se.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Se.template=`
{{text}}
`;var gi=class extends _{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};gi.template=`
`;var bi={transition:"transition",visible:"visible",hidden:"hidden"},_i=class extends _{constructor(){super(),this._visible=!1,this._visibleStyle=bi.visible,this._hiddenStyle=bi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Sr(this,{[bi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(bi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};_i.template=" ";var yi=class extends _{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var ls=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Yo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},Pr=function(s,i="i"){let t=s.split("*").map(Yo);return new RegExp("^"+t.join(".+")+"$",i)};var Zo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Mr({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Zo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Nr=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},Dr=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Fr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var vi=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=N(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=Pr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Mr(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Fr(n),o.toString()}mountIframe(){let t=le({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Nr("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&Dr("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};vi.template=`
{{activityCaption}}
{{counter}}
`;var ke=class extends _{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;N(i).forEach(e=>{let r=le({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ke.bindAttributes({"tab-list":null,default:null});ke.template=`
`;var se=class extends v{constructor(){super(...arguments);h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);h(this,"init$",{...this.init$,output:null,filesData:null})}get dict(){return se.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer),this.hasAttribute(this.dict.INPUT_REQUIRED))){let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=!0,this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(t){if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer.innerHTML="";let e=t.groupData?[t.groupData.cdnUrl]:t.map(r=>r.cdnUrl);for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r,this._dynamicInputsContainer.appendChild(n)}this.hasAttribute(this.dict.INPUT_REQUIRED)&&(this._validationInputElement.value=e.length?"__VALUE__":"")}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)}},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t){this.$.output=null,this.$.filesData=null;return}if(this.$.filesData=t,this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR)){let e=t.map(o=>o.uuid),r=await this.getUploadClientOptions(),n=await Rs(e,{...r});this.$.output={groupData:n,files:t}}else this.$.output=t},!1)}};se.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var as=class extends g{};var Ci=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};Ci.template=``;var Y={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},Vr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},it=class extends _{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:Y.PLAY,fsIcon:Y.FS_ON,volIcon:Y.VOL_ON,capIcon:Y.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?Vr.exitFullscreen():Vr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===Y.CAP_OFF?(this.$.capIcon=Y.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(it.is+":captions","1")):(this.$.capIcon=Y.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(it.is+":captions"))}toggleSound(){this.$.volIcon===Y.VOL_ON?(this.$.volIcon=Y.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=Y.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(it.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(it.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=Y.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=Y.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=Y.FS_OFF:this.$.fsIcon=Y.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(it.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};it.template=`
{{currentTime}} / {{totalTime}}
`;it.bindAttributes({video:"video",src:"src"});var Jo="css-src";function wi(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),We({element:this,attribute:Jo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ie=class extends wi(_){};var Ti=class extends _{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(Ti,"template",`Powered by Uploadcare`);var kt=class extends Ie{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",ze(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var xi=class extends kt{};xi.template=``;var Ei=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};Ei.template=``;var Ai=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};Ai.template=``;var cs=class extends wi(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function hs(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var us="LR";async function Qo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[us]){t(window[us]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[us];i&&hs(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,as as ActivityHeader,zt as BaseComponent,_ as Block,oi as CameraSource,cs as CloudImageEditor,ls as CloudImageEditorActivity,at as CloudImageEditorBlock,ti as Config,ai as ConfirmationDialog,Ti as Copyright,ui as CropFrame,$ as Data,se as DataOutput,ye as DropArea,Te as EditorCropButtonControl,ee as EditorFilterControl,pi as EditorImageCropper,os as EditorImageFader,$e as EditorOperationControl,fi as EditorScroller,di as EditorSlider,mi as EditorToolbar,vi as ExternalSource,_t as FileItem,we as FilePreview,Ai as FileUploaderInline,Ei as FileUploaderMinimal,xi as FileUploaderRegular,ge as Icon,Zi as Img,gi as LineLoaderUi,Se as LrBtnUi,si as MessageBox,he as Modal,Gs as PACKAGE_NAME,Ks as PACKAGE_VERSION,_i as PresenceToggle,hi as ProgressBar,ci as ProgressBarCommon,Ci as Select,Ie as ShadowWrapper,_e as SimpleBtn,yi as SliderUi,ve as SourceBtn,es as SourceList,Ji as StartFrom,ke as Tabs,ss as UploadCtxProvider,li as UploadDetails,ri as UploadList,v as UploaderBlock,ni as UrlSource,it as Video,Qo as connectBlocksFrom,hs as registerBlocks,wi as shadowed,gt as toKebabCase}; \ No newline at end of file +var Or=Object.defineProperty;var Lr=(s,i,t)=>i in s?Or(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var h=(s,i,t)=>(Lr(s,typeof i!="symbol"?i+"":i,t),t);var Ur=Object.defineProperty,Rr=(s,i,t)=>i in s?Ur(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,bi=(s,i,t)=>(Rr(s,typeof i!="symbol"?i+"":i,t),t);function Pr(s){let i=t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}};return i(s)}var $=class{constructor(s){s.constructor===Object?this.store=Pr(s):(this._storeIsProxy=!0,this.store=s),this.callbackMap=Object.create(null)}static warn(s,i){console.warn(`Symbiote Data: cannot ${s}. Prop name: `+i)}read(s){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("read",s),null):this.store[s]}has(s){return this._storeIsProxy?this.store[s]!==void 0:this.store.hasOwnProperty(s)}add(s,i,t=!1){!t&&Object.keys(this.store).includes(s)||(this.store[s]=i,this.notify(s))}pub(s,i){if(!this._storeIsProxy&&!this.store.hasOwnProperty(s)){$.warn("publish",s);return}this.store[s]=i,this.notify(s)}multiPub(s){for(let i in s)this.pub(i,s[i])}notify(s){this.callbackMap[s]&&this.callbackMap[s].forEach(i=>{i(this.store[s])})}sub(s,i,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(s)?($.warn("subscribe",s),null):(this.callbackMap[s]||(this.callbackMap[s]=new Set),this.callbackMap[s].add(i),t&&i(this.store[s]),{remove:()=>{this.callbackMap[s].delete(i),this.callbackMap[s].size||delete this.callbackMap[s]},callback:i})}static registerCtx(s,i=Symbol()){let t=$.globalStore.get(i);return t?console.warn('State: context UID "'+i+'" already in use'):(t=new $(s),$.globalStore.set(i,t)),t}static deleteCtx(s){$.globalStore.delete(s)}static getCtx(s,i=!0){return $.globalStore.get(s)||(i&&console.warn('State: wrong context UID - "'+s+'"'),null)}};$.globalStore=new Map;var C=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),rs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Mr=rs.length-1,Jt=class{static generate(s="XXXXXXXXX-XXX"){let i="";for(let t=0;t{li&&t?i[0].toUpperCase()+i.slice(1):i).join("").split("_").map((i,t)=>i&&t?i.toUpperCase():i).join("")}function Dr(s,i){[...s.querySelectorAll(`[${C.REPEAT_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.REPEAT_ITEM_TAG_ATTR),r;if(e&&(r=window.customElements.get(e)),!r){r=class extends i.BaseComponent{constructor(){super(),e||(this.style.display="contents")}};let o=t.innerHTML;r.template=o,r.reg(e)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(C.REPEAT_ATTR);i.sub(n,o=>{if(!o){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],a,c=u=>{u.forEach((p,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(p)});else for(let f in p)l[m][f]=p[f];else{a||(a=new DocumentFragment);let f=new r;Object.assign(f.init$,p),a.appendChild(f)}}),a&&t.appendChild(a);let d=l.slice(u.length,l.length);for(let p of d)p.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let u=[];for(let d in o){let p=o[d];Object.defineProperty(p,"_KEY_",{value:d,enumerable:!0}),u.push(p)}c(u)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),t.removeAttribute(C.REPEAT_ATTR),t.removeAttribute(C.REPEAT_ITEM_TAG_ATTR)})}var is="__default__";function Fr(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let n=r.getAttribute("name")||is;e[n]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=is;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(n,r.slot)}else r.slot.remove()})}function Vr(s,i){[...s.querySelectorAll(`[${C.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(C.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(C.EL_REF_ATTR)})}function Br(s,i){[...s.querySelectorAll(`[${C.BIND_ATTR}]`)].forEach(t=>{let r=t.getAttribute(C.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Nr(n.name.replace("-",""));r.push(o+":"+n.value),t.removeAttribute(n.name)}}),r.forEach(n=>{if(!n)return;let o=n.split(":").map(u=>u.trim()),l=o[0],a;l.indexOf(C.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(C.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(u=>u.trim());for(let u of c){let d;u.startsWith("!!")?(d="double",u=u.replace("!!","")):u.startsWith("!")&&(d="single",u=u.replace("!","")),i.sub(u,p=>{d==="double"?p=!!p:d==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):ns(t,l,p)||(t[C.SET_LATER_KEY]||(t[C.SET_LATER_KEY]=Object.create(null)),t[C.SET_LATER_KEY][l]=p)})}}),t.removeAttribute(C.BIND_ATTR)})}var we="{{",Zt="}}",zr="skip-text";function jr(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var n;return!((n=r.parentElement)!=null&&n.hasAttribute(zr))&&r.textContent.includes(we)&&r.textContent.includes(Zt)&&1}});for(;i=e.nextNode();)t.push(i);return t}var Hr=function(s,i){jr(s).forEach(e=>{let r=[],n;for(;e.textContent.includes(Zt);)e.textContent.startsWith(we)?(n=e.textContent.indexOf(Zt)+Zt.length,e.splitText(n),r.push(e)):(n=e.textContent.indexOf(we),e.splitText(n)),e=e.nextSibling;r.forEach(o=>{let l=o.textContent.replace(we,"").replace(Zt,"");o.textContent="",i.sub(l,a=>{o.textContent=a})})})},Wr=[Dr,Fr,Vr,Br,Hr],Te="'",Dt='"',Xr=/\\([0-9a-fA-F]{1,6} ?)/g;function qr(s){return(s[0]===Dt||s[0]===Te)&&(s[s.length-1]===Dt||s[s.length-1]===Te)}function Gr(s){return(s[0]===Dt||s[0]===Te)&&(s=s.slice(1)),(s[s.length-1]===Dt||s[s.length-1]===Te)&&(s=s.slice(0,-1)),s}function Kr(s){let i="",t="";for(var e=0;eString.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ +`,"\\n"),i=Kr(i),i=Dt+i+Dt);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}var ss=0,Nt=null,dt=null,vt=class extends HTMLElement{constructor(){super(),bi(this,"updateCssData",()=>{var s;this.dropCssDataCache(),(s=this.__boundCssProps)==null||s.forEach(i=>{let t=this.getCssData(this.__extractCssName(i),!0);t!==null&&this.$[i]!==t&&(this.$[i]=t)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return vt}initCallback(){}__initCallback(){var s;this.__initialized||(this.__initialized=!0,(s=this.initCallback)==null||s.call(this))}render(s,i=this.renderShadow){let t;if((i||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let r=this.getAttribute(C.USE_TPL);if(r){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(r))||document.querySelector(r);o?s=o.content.cloneNode(!0):console.warn(`Symbiote template "${r}" is not found...`)}}if(this.processInnerHtml)for(let r of this.tplProcessors)r(this,this);if(s||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(s==null?void 0:s.constructor)===DocumentFragment)t=s;else if((s==null?void 0:s.constructor)===String){let r=document.createElement("template");r.innerHTML=s,t=r.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let r of this.tplProcessors)r(t,this)}let e=()=>{t&&(i&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){i=!0;let r=document.createElement("link");r.rel="stylesheet",r.href=this.constructor.__shadowStylesUrl,r.onload=e,this.shadowRoot.prepend(r)}else e()}addTemplateProcessor(s){this.tplProcessors.add(s)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Jt.generate(),this.style.setProperty(C.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(C.CSS_CTX_PROP,!0)}get ctxName(){var s;let i=((s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=i,i}get localCtx(){return this.__localCtx||(this.__localCtx=$.registerCtx({},this)),this.__localCtx}get nodeCtx(){return $.getCtx(this.ctxName,!1)||$.registerCtx({},this.ctxName)}static __parseProp(s,i){let t,e;if(s.startsWith(C.EXT_DATA_CTX_PRFX))t=i.nodeCtx,e=s.replace(C.EXT_DATA_CTX_PRFX,"");else if(s.includes(C.NAMED_DATA_CTX_SPLTR)){let r=s.split(C.NAMED_DATA_CTX_SPLTR);t=$.getCtx(r[0]),e=r[1]}else t=i.localCtx,e=s;return{ctx:t,name:e}}sub(s,i,t=!0){let e=n=>{this.isConnected&&i(n)},r=vt.__parseProp(s,this);r.ctx.has(r.name)?this.allSubs.add(r.ctx.sub(r.name,e,t)):window.setTimeout(()=>{this.allSubs.add(r.ctx.sub(r.name,e,t))})}notify(s){let i=vt.__parseProp(s,this);i.ctx.notify(i.name)}has(s){let i=vt.__parseProp(s,this);return i.ctx.has(i.name)}add(s,i,t=!1){let e=vt.__parseProp(s,this);e.ctx.add(e.name,i,t)}add$(s,i=!1){for(let t in s)this.add(t,s[t],i)}get $(){if(!this.__stateProxy){let s=Object.create(null);this.__stateProxy=new Proxy(s,{set:(i,t,e)=>{let r=vt.__parseProp(t,this);return r.ctx.pub(r.name,e),!0},get:(i,t)=>{let e=vt.__parseProp(t,this);return e.ctx.read(e.name)}})}return this.__stateProxy}set$(s,i=!1){for(let t in s){let e=s[t];i||![String,Number,Boolean].includes(e==null?void 0:e.constructor)?this.$[t]=e:this.$[t]!==e&&(this.$[t]=e)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(C.CTX_OWNER_ATTR)&&this.getAttribute(C.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let s=this.constructor.__attrDesc;if(s)for(let i of Object.values(s))Object.keys(this.init$).includes(i)||(this.init$[i]="");for(let i in this.init$)if(i.startsWith(C.EXT_DATA_CTX_PRFX))this.nodeCtx.add(i.replace(C.EXT_DATA_CTX_PRFX,""),this.init$[i],this.__ctxOwner);else if(i.includes(C.NAMED_DATA_CTX_SPLTR)){let t=i.split(C.NAMED_DATA_CTX_SPLTR),e=t[0].trim(),r=t[1].trim();if(e&&r){let n=$.getCtx(e,!1);n||(n=$.registerCtx({},e)),n.add(r,this.init$[i])}}else this.localCtx.add(i,this.init$[i]);for(let i in this.cssInit$)this.bindCssData(i,this.cssInit$[i]);this.__dataCtxInitialized=!0}connectedCallback(){var s;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let i=(s=this.getAttribute(C.CTX_NAME_ATTR))==null?void 0:s.trim();if(i&&this.style.setProperty(C.CSS_CTX_PROP,`'${i}'`),this.__initDataCtx(),this[C.SET_LATER_KEY]){for(let t in this[C.SET_LATER_KEY])ns(this,t,this[C.SET_LATER_KEY][t]);delete this[C.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Wr)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t==null?void 0:t.querySelector(`link[${C.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let r=this.constructor.__rootStylesLink.cloneNode(!0);r.setAttribute(C.ROOT_STYLE_ATTR_NAME,this.constructor.is),r.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(r):t.prepend(r)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let s of this.allSubs)s.remove(),this.allSubs.delete(s);for(let s of this.tplProcessors)this.tplProcessors.delete(s);dt==null||dt.delete(this.updateCssData),dt!=null&&dt.size||(Nt==null||Nt.disconnect(),Nt=null,dt=null)},100)))}static reg(s,i=!1){s||(ss++,s=`${C.AUTO_TAG_PRFX}-${ss}`),this.__tag=s;let t=window.customElements.get(s);if(t){!i&&t!==this&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(s){this.observedAttributes=Object.keys(s),this.__attrDesc=s}attributeChangedCallback(s,i,t){var e;if(i===t)return;let r=(e=this.constructor.__attrDesc)==null?void 0:e[s];r?this.__dataCtxInitialized?this.$[r]=t:this.init$[r]=t:this[s]=t}getCssData(s,i=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(s)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(s).trim();try{this.__cssDataCache[s]=Yr(t)}catch{!i&&console.warn(`CSS Data error: ${s}`),this.__cssDataCache[s]=null}}return this.__cssDataCache[s]}__extractCssName(s){return s.split("--").map((i,t)=>t===0?"":i).join("--")}__initStyleAttrObserver(){dt||(dt=new Set),dt.add(this.updateCssData),Nt||(Nt=new MutationObserver(s=>{s[0].type==="attributes"&&dt.forEach(i=>{i()})}),Nt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(s,i=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(s);let t=this.getCssData(this.__extractCssName(s),!0);t===null&&(t=i),this.add(s,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(s,i,t){let e="__"+s;this[e]=this[s],Object.defineProperty(this,s,{set:r=>{this[e]=r,t?window.setTimeout(()=>{i==null||i(r)}):i==null||i(r)},get:()=>this[e]}),this[s]=this[e]}static set shadowStyles(s){let i=new Blob([s],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(i)}static set rootStyles(s){if(!this.__rootStylesLink){let i=new Blob([s],{type:"text/css"}),t=URL.createObjectURL(i),e=document.createElement("link");e.href=t,e.rel="stylesheet",this.__rootStylesLink=e}}},Ft=vt;bi(Ft,"template");var _i=class{static _print(s){console.warn(s)}static setDefaultTitle(s){this.defaultTitle=s}static setRoutingMap(s){Object.assign(this.appMap,s);for(let i in this.appMap)!this.defaultRoute&&this.appMap[i].default===!0?this.defaultRoute=i:!this.errorRoute&&this.appMap[i].error===!0&&(this.errorRoute=i)}static set routingEventName(s){this.__routingEventName=s}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let s={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))s.route=t.replace("?","");else if(t.includes("=")){let e=t.split("=");s.options[e[0]]=decodeURI(e[1])}else s.options[t]=!0}),s}static notify(){let s=this.readAddressBar(),i=this.appMap[s.route];if(i&&i.title&&(document.title=i.title),s.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!i&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!i){this._print(`Route "${s.route}" not found...`);return}let t=new CustomEvent(_i.routingEventName,{detail:{route:s.route,options:Object.assign(i||{},s.options)}});window.dispatchEvent(t)}static reflect(s,i={}){let t=this.appMap[s];if(!t){this._print("Wrong route: "+s);return}let e="?"+s;for(let n in i)i[n]===!0?e+=this.separator+n:e+=this.separator+n+`=${i[n]}`;let r=t.title||this.defaultTitle||"";window.history.pushState(null,r,e),document.title=r}static applyRoute(s,i={}){this.reflect(s,i),this.notify()}static setSeparator(s){this._separator=s}static get separator(){return this._separator||"&"}static createRouterData(s,i){this.setRoutingMap(i);let t=$.registerCtx({route:null,options:null,title:null},s);return window.addEventListener(this.routingEventName,e=>{var r;t.multiPub({route:e.detail.route,options:e.detail.options,title:((r=e.detail.options)==null?void 0:r.title)||this.defaultTitle||""})}),_i.notify(),this.initPopstateListener(),t}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};_i.appMap=Object.create(null);function yi(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}function Zr(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}function Qt(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&Zr(i,s.attributes),s.styles&&yi(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=Qt(t);i.appendChild(e)}),i}var os="idb-store-ready",Jr="symbiote-db",Qr="symbiote-idb-update_",tn=class{_notifyWhenReady(s=null){window.dispatchEvent(new CustomEvent(os,{detail:{dbName:this.name,storeName:this.storeName,event:s}}))}get _updEventName(){return Qr+this.name}_getUpdateEvent(s){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:s}})}_notifySubscribers(s){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,s),window.dispatchEvent(this._getUpdateEvent(s))}constructor(s,i){this.name=s,this.storeName=i,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=t=>{this.db=t.target.result,this.objStore=this.db.createObjectStore(i,{keyPath:"_key"}),this.objStore.transaction.oncomplete=e=>{this._notifyWhenReady(e)}},this.request.onsuccess=t=>{this.db=t.target.result,this._notifyWhenReady(t)},this.request.onerror=t=>{console.error(t)},this._subscriptionsMap={},this._updateHandler=t=>{t.key===this.name&&this._subscriptionsMap[t.newValue]&&this._subscriptionsMap[t.newValue].forEach(async r=>{r(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(s){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(s);return new Promise((e,r)=>{t.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?e(n.target.result._value):(e(null),console.warn(`IDB: cannot read "${s}"`))},t.onerror=n=>{r(n)}})}write(s,i,t=!1){let e={_key:s,_value:i},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e);return new Promise((o,l)=>{n.onsuccess=a=>{t||this._notifySubscribers(s),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(s,i=!1){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(s);return new Promise((r,n)=>{e.onsuccess=o=>{i||this._notifySubscribers(s),r(o)},e.onerror=o=>{n(o)}})}getAll(){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,e)=>{i.onsuccess=r=>{let n=r.target.result;t(n.map(o=>o._value))},i.onerror=r=>{e(r)}})}subscribe(s,i){this._subscriptionsMap[s]||(this._subscriptionsMap[s]=new Set);let t=this._subscriptionsMap[s];return t.add(i),{remove:()=>{t.delete(i),t.size||delete this._subscriptionsMap[s]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,ls.clear(this.name)}},ls=class{static get readyEventName(){return os}static open(s=Jr,i="store"){let t=s+"/"+i;return this._reg[t]||(this._reg[t]=new tn(s,i)),this._reg[t]}static clear(s){window.indexedDB.deleteDatabase(s);for(let i in this._reg)i.split("/")[0]===s&&delete this._reg[i]}};bi(ls,"_reg",Object.create(null));function S(s,i){let t,e=(...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)};return e.cancel=()=>{clearTimeout(t)},e}var en="--uploadcare-blocks-window-height",xe="__UPLOADCARE_BLOCKS_WINDOW_HEIGHT_TRACKER_ENABLED__";function vi(){return typeof window[xe]=="undefined"?!1:!!window[xe]}function as(){if(vi())return;let s=()=>{document.documentElement.style.setProperty(en,`${window.innerHeight}px`),window[xe]=!0},i=S(s,100);return window.addEventListener("resize",i,{passive:!0}),s(),()=>{window[xe]=!1,window.removeEventListener("resize",i)}}var sn=s=>s,Ci="{{",hs="}}",cs="plural:";function te(s,i,t={}){var o;let{openToken:e=Ci,closeToken:r=hs,transform:n=sn}=t;for(let l in i){let a=(o=i[l])==null?void 0:o.toString();s=s.replaceAll(e+l+r,typeof a=="string"?n(a):a)}return s}function us(s){let i=[],t=s.indexOf(Ci);for(;t!==-1;){let e=s.indexOf(hs,t),r=s.substring(t+2,e);if(r.startsWith(cs)){let n=s.substring(t+2,e).replace(cs,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));i.push({variable:r,pluralKey:o,countVariable:l})}t=s.indexOf(Ci,e)}return i}function ds(s){return Object.prototype.toString.call(s)==="[object Object]"}var rn=/\W|_/g;function nn(s){return s.split(rn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function ps(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>mt(t,{ignoreKeys:i})):s}function mt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return ps(s,{ignoreKeys:i});if(!ds(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}ds(r)?r=mt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=ps(r,{ignoreKeys:i})),t[nn(e)]=r}return t}var on=s=>new Promise(i=>setTimeout(i,s));function Si({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:n,integration:r});let o=[s,i,e].filter(Boolean).join("/"),l=[n,r].filter(Boolean).join("; ");return`${o} (${l})`}var ln={factor:2,time:100};function an(s,i=ln){let t=0;function e(r){let n=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l=>on(l!=null?l:n).then(()=>(t+=1,e(r)))})}return e(s)}var Vt=class extends Error{constructor(t){super();h(this,"originalProgressEvent");this.name="UploadcareNetworkError",this.message="Network error",Object.setPrototypeOf(this,Vt.prototype),this.originalProgressEvent=t}},Ae=(s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},Ct=class extends Error{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);Object.setPrototypeOf(this,Ct.prototype)}},cn=500,ms=({check:s,interval:i=cn,timeout:t,signal:e})=>new Promise((r,n)=>{let o,l;Ae(e,()=>{o&&clearTimeout(o),n(new Ct("Poll cancelled"))}),t&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new Ct("Timed out"))},t));let a=()=>{try{Promise.resolve(s(e)).then(c=>{c?(l&&clearTimeout(l),r(c)):o=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),E={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},$e="application/octet-stream",gs="original",wt=({method:s,url:i,data:t,headers:e={},signal:r,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(s==null?void 0:s.toUpperCase())||"GET",u=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(d=>{let[p,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(p,m)}),a.responseType="text",Ae(r,()=>{u=!0,a.abort(),l(new Ct)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:n},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};p.forEach(function(A){let x=A.split(": "),T=x.shift(),w=x.join(": ");T&&typeof T!="undefined"&&(m[T]=w)});let f=a.response,_=a.status;o({request:d,data:f,headers:m,status:_})}},a.onerror=d=>{u||l(new Vt(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),t?a.send(t):a.send()});function hn(s,...i){return s}var un=({name:s})=>s?[s]:[],dn=hn,pn=()=>new FormData,_s=s=>!1,Se=s=>typeof Blob!="undefined"&&s instanceof Blob,ke=s=>typeof File!="undefined"&&s instanceof File,Ie=s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string",Bt=s=>Se(s)||ke(s)||_s()||Ie(s),fn=s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined",mn=s=>!!s&&typeof s=="object"&&!Array.isArray(s),gn=s=>!!s&&typeof s=="object"&&"data"in s&&Bt(s.data);function _n(s,i,t){if(gn(t)){let{name:e,contentType:r}=t,n=dn(t.data,e,r!=null?r:$e),o=un({name:e,contentType:r});s.push([i,n,...o])}else if(mn(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else fn(t)&&t&&s.push([i,t.toString()])}function bn(s){let i=[];for(let[t,e]of Object.entries(s))_n(i,t,e);return i}function ki(s){let i=pn(),t=bn(s);for(let e of t){let[r,n,...o]=e;i.append(r,n,...o)}return i}var U=class extends Error{constructor(t,e,r,n,o){super();h(this,"isCancel");h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadClientError",this.message=t,this.code=e,this.request=r,this.response=n,this.headers=o,Object.setPrototypeOf(this,U.prototype)}},yn=s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var n;return(n=r[1])!=null?n:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},pt=(s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=yn(t)),e.toString()},vn="6.7.0",Cn="UploadcareUploadClient",wn=vn;function Ot(s){return Si({libraryName:Cn,libraryVersion:wn,...s})}var Tn="RequestThrottledError",fs=15e3,xn=1e3;function En(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return fs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:fs}function Tt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return an(({attempt:r,retry:n})=>s().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Tn&&r{let i="";return(Se(s)||ke(s)||Ie(s))&&(i=s.type),i||$e},ys=s=>{let i="";return ke(s)&&s.name?i=s.name:Se(s)||_s()?i="":Ie(s)&&s.name&&(i=s.name),i||gs};function Ii(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}function An(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=E.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({file:{data:s,name:t||ys(s),contentType:e||bs(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ii(l),signature:n,expire:o,source:u,metadata:_}),signal:a,onProgress:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var xi;(function(s){s.Token="token",s.FileInfo="file_info"})(xi||(xi={}));function $n(s,{publicKey:i,baseURL:t=E.baseURL,store:e,fileName:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},url:pt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Ii(e),filename:r,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:_}),signal:u}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w}),{retryNetworkErrorMaxTimes:f,retryThrottledRequestMaxTimes:m})}var H;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(H||(H={}));var Sn=s=>"status"in s&&s.status===H.Error;function kn(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=E.retryNetworkErrorMaxTimes}={}){return Tt(()=>wt({method:"GET",headers:i?{"X-UC-User-Agent":Ot({publicKey:i,integration:r,userAgent:n})}:void 0,url:pt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:a,headers:c,request:u})=>{let d=mt(JSON.parse(a));if("error"in d&&!Sn(d))throw new U(d.error.content,void 0,u,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function In(s,{publicKey:i,baseURL:t=E.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:a,userAgent:c})},url:pt(t,"/group/",{jsonerrors:1,pub_key:i,files:s,callback:e,signature:r,expire:n,source:l}),signal:o}).then(({data:p,headers:m,request:f})=>{let _=mt(JSON.parse(p));if("error"in _)throw new U(_.error.content,_.error.errorCode,f,_,m);return _}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function vs(s,{publicKey:i,baseURL:t=E.baseURL,signal:e,source:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"GET",headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},url:pt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function On(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=E.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:m=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:f=E.retryNetworkErrorMaxTimes,metadata:_}){return Tt(()=>wt({method:"POST",url:pt(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:d,userAgent:p})},data:ki({filename:e||gs,size:s,content_type:t||$e,part_size:r,UPLOADCARE_STORE:Ii(a),UPLOADCARE_PUB_KEY:i,signature:o,expire:l,source:u,metadata:_}),signal:c}).then(({data:A,headers:x,request:T})=>{let w=mt(JSON.parse(A));if("error"in w)throw new U(w.error.content,w.error.errorCode,T,w,x);return w.parts=Object.keys(w.parts).map(z=>w.parts[z]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})}function Ln(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:n=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||$e}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Un(s,{publicKey:i,baseURL:t=E.baseURL,source:e="local",signal:r,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=E.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=E.retryNetworkErrorMaxTimes}){return Tt(()=>wt({method:"POST",url:pt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ot({publicKey:i,integration:n,userAgent:o})},data:ki({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=mt(JSON.parse(c));if("error"in p)throw new U(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Oi({file:s,publicKey:i,baseURL:t,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return ms({check:u=>vs(s,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function Rn(s){return"defaultEffects"in s}var ft=class{constructor(i,{baseCDN:t=E.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:n}=i,o=pt(t,`${r}/`),l=n?pt(`https://${n}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=o,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Rn(i)&&(this.defaultEffects=i.defaultEffects)}},Pn=(s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:_,metadata:A})=>An(s,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:A}).then(({file:x})=>Oi({file:x,publicKey:i,baseURL:e,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(x=>new ft(x,{baseCDN:_})),Mn=(s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>vs(s,{publicKey:i,baseURL:e,signal:r,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new ft(p,{baseCDN:d,fileName:t})).then(p=>(n&&n({isComputable:!0,value:1}),p)),Nn=(s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),n=o=>()=>{e=o,r.forEach((l,a)=>a!==o&&l.abort())};return Ae(i,()=>{r.forEach(o=>o.abort())}),Promise.all(s.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:r[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(o=>{if(e===null)throw t;return o[e]})},Dn=window.WebSocket,Ei=class{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},Fn=(s,i)=>s==="success"?{status:H.Success,...i}:s==="progress"?{status:H.Progress,...i}:{status:H.Error,...i},Ai=class{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Ei);h(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Dn(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,Fn(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},wi=null,Li=s=>{if(!wi){let i=typeof window=="undefined"?0:3e4;wi=new Ai(s,i)}return wi},Vn=s=>{Li(s).connect()};function Bn({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return ms({check:c=>kn(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(u=>{switch(u.status){case H.Error:return new U(u.error,u.errorCode);case H.Waiting:return!1;case H.Unknown:return new U(`Token "${s}" was not found.`);case H.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case H.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:a})}var zn=({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,n)=>{let o=Li(i),l=o.onError(n),a=()=>{l(),o.unsubscribe(s)};Ae(t,()=>{a(),n(new Ct("pusher cancelled"))}),o.subscribe(s,c=>{switch(c.status){case H.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case H.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),r(c);break}case H.Error:a(),n(new U(c.msg,c.error_code))}})}),jn=(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,onProgress:d,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,pusherKey:A=E.pusherKey,metadata:x})=>Promise.resolve(Vn(A)).then(()=>$n(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:u,source:p,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,metadata:x})).catch(T=>{let w=Li(A);return w==null||w.disconnect(),Promise.reject(T)}).then(T=>T.type===xi.FileInfo?T:Nn([({signal:w})=>Bn({token:T.token,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:w}),({signal:w})=>zn({token:T.token,pusherKey:A,signal:w,onProgress:d})],{signal:u})).then(T=>{if(T instanceof U)throw T;return T}).then(T=>Oi({file:T.uuid,publicKey:i,baseURL:e,integration:m,userAgent:f,retryThrottledRequestMaxTimes:_,onProgress:d,signal:u})).then(T=>new ft(T,{baseCDN:r})),Ti=new WeakMap,Hn=async s=>{if(Ti.has(s))return Ti.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Ti.set(s,i),i},Cs=async s=>{if(ke(s)||Se(s))return s.size;if(Ie(s))return(await Hn(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},Wn=(s,i=E.multipartMinFileSize)=>s>=i,ws=s=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!Bt(s)&&t.test(s)},Ui=s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!Bt(s)&&t.test(s)},Xn=(s,i)=>new Promise((t,e)=>{let r=[],n=!1,o=i.length,l=[...i],a=()=>{let c=i.length-l.length,u=l.shift();u&&u().then(d=>{n||(r[c]=d,o-=1,o?a():t(r))}).catch(d=>{n=!0,e(d)})};for(let c=0;c{let r=e*i,n=Math.min(r+e,t);return s.slice(r,n)},Gn=async(s,i,t)=>e=>qn(s,e,i,t),Kn=(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Ln(s,i,{publicKey:t,contentType:e,onProgress:r,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Yn=async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:_,multipartChunkSize:A=E.multipartChunkSize,maxConcurrentRequests:x=E.maxConcurrentRequests,baseCDN:T,metadata:w})=>{let z=e!=null?e:await Cs(s),ht,It=(L,j)=>{if(!c)return;ht||(ht=Array(L).fill(0));let tt=it=>it.reduce((ut,gi)=>ut+gi,0);return it=>{it.isComputable&&(ht[j]=it.value,c({isComputable:!0,value:tt(ht)/L}))}};return _||(_=bs(s)),On(z,{publicKey:i,contentType:_,fileName:t||ys(s),baseURL:r,secureSignature:n,secureExpire:o,store:l,signal:a,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,metadata:w}).then(async({uuid:L,parts:j})=>{let tt=await Gn(s,z,A);return Promise.all([L,Xn(x,j.map((it,ut)=>()=>Kn(tt(ut),it,{publicKey:i,contentType:_,onProgress:It(j.length,ut),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})))])}).then(([L])=>Un(L,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f})).then(L=>L.isReady?L:Oi({file:L.uuid,publicKey:i,baseURL:r,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,onProgress:c,signal:a})).then(L=>new ft(L,{baseCDN:T}))};async function Ri(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartMinFileSize:_,multipartChunkSize:A,maxConcurrentRequests:x,baseCDN:T=E.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,pusherKey:ht,metadata:It}){if(Bt(s)){let L=await Cs(s);return Wn(L,_)?Yn(s,{publicKey:i,contentType:f,multipartChunkSize:A,fileSize:L,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It}):Pn(s,{publicKey:i,fileName:t,contentType:f,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T,metadata:It})}if(Ui(s))return jn(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:z,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,pusherKey:ht,metadata:It});if(ws(s))return Mn(s,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:T});throw new TypeError(`File uploading from "${s}" is not supported`)}var $i=class{constructor(i,{baseCDN:t=E.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,n)=>r+n.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new ft(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Zn=s=>{for(let i of s)if(!Bt(i))return!1;return!0},Jn=s=>{for(let i of s)if(!ws(i))return!1;return!0},Qn=s=>{for(let i of s)if(!Ui(i))return!1;return!0};function Ts(s,{publicKey:i,fileName:t,baseURL:e=E.baseURL,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_=E.multipartChunkSize,baseCDN:A=E.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T,jsonpCallback:w}){if(!Zn(s)&&!Qn(s)&&!Jn(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let z,ht=!0,It=s.length,L=(j,tt)=>{if(!a)return;z||(z=Array(j).fill(0));let it=ut=>ut.reduce((gi,Ir)=>gi+Ir)/j;return ut=>{if(!ut.isComputable||!ht){ht=!1,a({isComputable:!1});return}z[tt]=ut.value,a({isComputable:!0,value:it(z)})}};return Promise.all(s.map((j,tt)=>Bt(j)||Ui(j)?Ri(j,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:n,store:o,signal:l,onProgress:L(It,tt),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:f,multipartChunkSize:_,baseCDN:A,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:T}).then(it=>it.uuid):j)).then(j=>In(j,{publicKey:i,baseURL:e,jsonpCallback:w,secureSignature:r,secureExpire:n,signal:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m}).then(tt=>new $i(tt,{baseCDN:A})).then(tt=>(a&&a({isComputable:!0,value:1}),tt)))}var Ee=class{constructor(i){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(o=>r(o)).catch(o=>n(o))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var Pi=()=>({"*blocksRegistry":new Set}),Mi=s=>({...Pi(),"*currentActivity":"","*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*modalActive":!1,"*currentActivity":""})}}),Oe=s=>({...Mi(s),"*commonProgress":0,"*uploadList":[],"*outputData":null,"*focusedEntry":null,"*uploadMetadata":null,"*uploadQueue":new Ee(1)});function xs(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n"),r="textContent";if(e.includes(":")){let o=e.split(":");r=o[0],e=o[1]}let n="l10n:"+e;i.__l10nKeys.push(n),i.add(n,e),i.sub(n,o=>{t[r]=i.l10n(o)}),t.removeAttribute("l10n")})}var W=s=>`*cfg/${s}`;var gt=s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var Es=new Set;function Le(s){Es.has(s)||(Es.add(s),console.warn(s))}var Ue=(s,i)=>new Intl.PluralRules(s).select(i);var Re=({element:s,attribute:i,onSuccess:t,onTimeout:e,timeout:r=300})=>{let n=setTimeout(()=>{a.disconnect(),e()},r),o=c=>{let u=s.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(n),a.disconnect(),t(u))},l=s.getAttribute(i);l!==null&&(clearTimeout(n),t(l));let a=new MutationObserver(c=>{let u=c[c.length-1];o(u)});a.observe(s,{attributes:!0,attributeFilter:[i]})};var Ni="lr-",b=class extends Ft{constructor(){super();h(this,"requireCtxName",!1);h(this,"allowCustomTemplate",!0);h(this,"init$",Pi());h(this,"updateCtxCssData",()=>{let t=this.$["*blocksRegistry"];for(let e of t)e.isConnected&&e.updateCssData()});this.activityType=null,this.addTemplateProcessor(xs),this.__l10nKeys=[]}l10n(t,e={}){if(!t)return"";let r=this.getCssData("--l10n-"+t,!0)||t,n=us(r);for(let l of n)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return te(r,e)}pluralize(t,e){let r=this.l10n("locale-name")||"en-US",n=Ue(r,e);return this.l10n(`${t}__${n}`)}applyL10nKey(t,e){let r="l10n:"+t;this.$[r]=e,this.__l10nKeys.push(t)}hasBlockInCtx(t){let e=this.$["*blocksRegistry"];for(let r of e)if(t(r))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}setActivity(t){if(this.hasBlockInCtx(e=>e.activityType===t)){this.$["*currentActivity"]=t;return}console.warn(`Activity type "${t}" not found in the context`)}connectedCallback(){let t=this.constructor.className;t&&this.classList.toggle(`${Ni}${t}`,!0),vi()||(this._destroyInnerHeightTracker=as()),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Re({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._destroyInnerHeightTracker)==null||t.call(this)}initCallback(){this.$["*blocksRegistry"].add(this)}destroyCallback(){this.$["*blocksRegistry"].delete(this)}fileSizeFmt(t,e=2){let r=["B","KB","MB","GB","TB"],n=c=>this.getCssData("--l10n-unit-"+c.toLowerCase(),!0)||c;if(t===0)return`0 ${n(r[0])}`;let o=1024,l=e<0?0:e,a=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/o**a).toFixed(l))+" "+n(r[a])}proxyUrl(t){let e=this.cfg.secureDeliveryProxy;return e?te(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}parseCfgProp(t){return{ctx:this.nodeCtx,name:t.replace("*","")}}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,n)=>{if(typeof r!="string")return!1;let o=W(r);return this.$[o]=n,!0},get:(e,r)=>{let n=W(r),o=this.parseCfgProp(n);return o.ctx.has(o.name)?o.ctx.read(o.name):(Le("Using CSS variables for configuration is deprecated. Please use `lr-config` instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.getCssData(`--cfg-${gt(r)}`))}})}return this.__cfgProxy}subConfigValue(t,e){let r=this.parseCfgProp(W(t));r.ctx.has(r.name)?this.sub(W(t),e):(this.bindCssData(`--cfg-${gt(t)}`),this.sub(`--cfg-${gt(t)}`,e))}static reg(t){if(!t){super.reg();return}super.reg(t.startsWith(Ni)?t:Ni+t)}};h(b,"StateConsumerScope",null),h(b,"className","");var ee=class extends b{constructor(){super();h(this,"_handleBackdropClick",()=>{this._closeDialog()});h(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});h(this,"_handleDialogClose",()=>{this._closeDialog()});h(this,"_handleDialogPointerUp",t=>{t.target===this.ref.dialog&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("pointerup",this._handleDialogPointerUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("click",this._handleDialogPointerUp)}};h(ee,"StateConsumerScope","modal");ee.template=``;var As="active",ie="___ACTIVITY_IS_ACTIVE___",st=class extends b{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",Mi(this));h(this,"_debouncedHistoryFlush",S(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=st._activityRegistry[this.activityKey];this[ie]=!1,this.removeAttribute(As),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=st._activityRegistry[this.activityKey];this.$["*historyBack"]=this.historyBack.bind(this),this[ie]=!0,this.setAttribute(As,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush()}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType!==t&&this[ie]?this._deactivate():this.activityType===t&&!this[ie]&&this._activate(),t||(this.$["*history"]=[])}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&!!st._activityRegistry[this.activityKey]}get isActivityActive(){return this[ie]}registerActivity(t,e={}){let{onActivate:r,onDeactivate:n}=e;st._activityRegistry||(st._activityRegistry=Object.create(null)),st._activityRegistry[this.activityKey]={activateCallback:r,deactivateCallback:n}}unregisterActivity(){this.isActivityActive&&this._deactivate(),st._activityRegistry[this.activityKey]=void 0}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity(),Object.keys(st._activityRegistry).length===0&&(this.$["*currentActivity"]=null)}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();this.$["*currentActivity"]=e,this.$["*history"]=t,e||this.setOrAddState("*modalActive",!1)}}},g=st;h(g,"_activityRegistry",Object.create(null));g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CONFIRMATION:"confirmation",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var se=33.333333333333336,y=1,Di=24,$s=6;function Lt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}function J(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return Lt(t,i),t}function Ss(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],d=[e+l*n+1.5*c,r+a*o+1.5*u-24*t*u],p=[e+l*n+1.5*c,r+a*o+1.5*u],m=[e+l*n-24*t*c+1.5*c,r+a*o+1.5*u];return{d:`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:p}}function ks(s,i,t){let{x:e,y:r,width:n,height:o}=s,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],u=[-1,1][a],d,p;["n","s"].includes(i)?(d=[e+l*n-34*t/2,r+a*o+1.5*u],p=[e+l*n+34*t/2,r+a*o+1.5*u]):(d=[e+l*n+1.5*c,r+a*o-34*t/2],p=[e+l*n+1.5*c,r+a*o+34*t/2]);let m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]}`,f=[p[0]-(p[0]-d[0])/2,p[1]-(p[1]-d[1])/2];return{d:m,center:f}}function Is(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function Os({rect:s,delta:[i,t],imageBox:e}){return jt({...s,x:s.x+i,y:s.y+t},e)}function jt(s,i){let{x:t}=s,{y:e}=s;return s.xi.x+i.width&&(t=i.x+i.width-s.width),s.yi.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function to({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:n,width:o,height:l}=s;n+=r,l-=r,t&&(o=l*t);let a=s.x+s.width/2-o/2;return n<=e.y&&(n=e.y,l=s.y+s.height-n,t&&(o=l*t,a=s.x+s.width/2-o/2)),a<=e.x&&(a=e.x,n=s.y+s.height-l),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y+s.height-l),l=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x+s.width-o),l=e.y+e.height&&(l=e.y+e.height-n,t&&(o=l*t),a=s.x+s.width/2-o/2),a<=e.x&&(a=e.x,n=s.y),a+o>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-o),o=e.x+e.width-a,t&&(l=o/t),n=s.y),l=e.x+e.width&&(o=e.x+e.width-n,t&&(l=o/t),a=s.y+s.height/2-l/2),a<=e.y&&(a=e.y,n=s.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(o=l*t),n=s.x),lt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x+s.width-a,l=e.y)):t&&(r=c*t-a,a=a+r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y+s.height-c)),ce.x+e.width&&(r=e.x+e.width-o-a),l+nt?(n=a/t-c,c+=n,l-=n,l<=e.y&&(c=c-(e.y-l),a=c*t,o=s.x,l=e.y)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y+s.height-c)),ce.y+e.height&&(n=e.y+e.height-l-c),o+=r,a-=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x+s.width-a,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o-=r,o<=e.x&&(a=a-(e.x-o),c=a/t,o=e.x,l=s.y)),ce.x+e.width&&(r=e.x+e.width-o-a),l+c+n>e.y+e.height&&(n=e.y+e.height-l-c),a+=r,c+=n,t&&Math.abs(a/c)>t?(n=a/t-c,c+=n,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,o=s.x,l=e.y+e.height-c)):t&&(r=c*t-a,a+=r,o+a>=e.x+e.width&&(a=e.x+e.width-o,c=a/t,o=e.x+e.width-a,l=s.y)),c=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function Ps(s,i){return Math.abs(s.width/s.height-i)<.1}function Ht({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}function Ms(s,i,t){let e=s/i,r,n;e>t?(r=Math.round(i*t),n=i):(r=s,n=Math.round(s/t));let o=Math.round((s-r)/2),l=Math.round((i-n)/2);return o+r>s&&(r=s-o),l+n>i&&(n=i-l),{x:o,y:l,width:r,height:n}}function Wt(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function xt(s,i,t){return Math.min(Math.max(s,i),t)}var Me=s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var Q=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Ns=s=>s?s.split(",").map(i=>i.trim()):[],Ut=s=>s?s.join(","):"";var Ds="blocks",Fs="0.27.6";function Vs(s){return Si({...s,libraryName:Ds,libraryVersion:Fs})}var Bs=s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Ne=(...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Bs(i)).join("/-/"),R=(...s)=>{let i=Ne(...s);return i?`-/${i}/`:""};function zs(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):r>=0&&(n=t.slice(r+1)),n}function js(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Hs(s){let i=Ws(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?[]:t.pathname.substring(e).split("/-/").filter(Boolean).map(n=>Bs(n))}function Ws(s){let i=new URL(s),t=zs(s),e=Xs(t)?qs(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Xs(s){return s.startsWith("http")}function qs(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var I=(s,i,t)=>{let e=new URL(Ws(s));if(t=t||zs(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Xs(t)){let r=qs(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},Et=(s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()};var P=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var re=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Fi=s=>s?s.filter(i=>typeof i=="string").map(i=>P(i)).flat():[],Vi=(s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),Gs=(s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),ne=s=>{let i=s==null?void 0:s.type;return i?Vi(i,re):!1};var nt=1e3,Rt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),oe=s=>Math.ceil(s*100)/100,Ks=(s,i=Rt.AUTO)=>{let t=i===Rt.AUTO;if(i===Rt.BYTE||t&&s{t.dispatchEvent(new CustomEvent(this.eName(i.type),{detail:i}))};if(!e){r();return}let n=i.type+i.ctx;this._timeoutStore[n]&&window.clearTimeout(this._timeoutStore[n]),this._timeoutStore[n]=window.setTimeout(()=>{r(),delete this._timeoutStore[n]},20)}};h(M,"_timeoutStore",Object.create(null));var Ys="[Typed State] Wrong property name: ",ao="[Typed State] Wrong property type: ",De=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||Jt.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(ao+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Ys+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Fe=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||Jt.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){this.__collectionObservers.delete(i)}add(i){let t=new De(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),this.__items.add(t.uid),this.notify(),t}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){this.__propertyObservers.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__data),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var Zs=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},uploadError:{type:Error,value:null,nullable:!0},validationErrorMsg:{type:String,value:null,nullable:!0},validationMultipleLimitMsg:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:ft,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silentUpload:{type:Boolean,value:!1},source:{type:String,value:!1,nullable:!0},fullPath:{type:String,value:null,nullable:!0}});var v=class extends g{constructor(){super(...arguments);h(this,"couldBeUploadCollectionOwner",!1);h(this,"isUploadCollectionOwner",!1);h(this,"init$",Oe(this));h(this,"__initialUploadMetadata",null);h(this,"_validators",[this._validateMultipleLimit.bind(this),this._validateIsImage.bind(this),this._validateFileType.bind(this),this._validateMaxSizeLimit.bind(this)]);h(this,"_debouncedRunValidators",S(this._runValidators.bind(this),100));h(this,"_flushOutputItems",S(()=>{let t=this.getOutputData();t.length===this.uploadCollection.size&&(M.emit(new F({type:X.DATA_OUTPUT,ctx:this.ctxName,data:t})),this.$["*outputData"]=t)},100));h(this,"_handleCollectonUpdate",(t,e,r)=>{var n;this._runValidators();for(let o of r)(n=o==null?void 0:o.getValue("abortController"))==null||n.abort(),o==null||o.setValue("abortController",null),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl"));this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushOutputItems()});h(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.values(t).map(n=>[...n]).flat())].map(n=>e.read(n)).filter(Boolean);for(let n of r)this._runValidatorsForEntry(n);if(t.uploadProgress){let n=0,o=e.findItems(a=>!a.getValue("uploadError"));o.forEach(a=>{n+=e.readProp(a,"uploadProgress")});let l=Math.round(n/o.length);this.$["*commonProgress"]=l,M.emit(new F({type:X.UPLOAD_PROGRESS,ctx:this.ctxName,data:l}),void 0,l===100)}if(t.fileInfo){this.cfg.cropPreset&&this.setInitialCrop();let n=e.findItems(l=>!!l.getValue("fileInfo")),o=e.findItems(l=>!!l.getValue("uploadError")||!!l.getValue("validationErrorMsg"));if(e.size-o.length===n.length){let l=this.getOutputData(a=>!!a.getValue("fileInfo")&&!a.getValue("silentUpload"));l.length>0&&M.emit(new F({type:X.UPLOAD_FINISH,ctx:this.ctxName,data:l}))}}t.uploadError&&e.findItems(o=>!!o.getValue("uploadError")).forEach(o=>{M.emit(new F({type:X.UPLOAD_ERROR,ctx:this.ctxName,data:e.readProp(o,"uploadError")}),void 0,!1)}),t.validationErrorMsg&&e.findItems(o=>!!o.getValue("validationErrorMsg")).forEach(o=>{M.emit(new F({type:X.VALIDATION_ERROR,ctx:this.ctxName,data:e.readProp(o,"validationErrorMsg")}),void 0,!1)}),t.cdnUrlModifiers&&e.findItems(o=>!!o.getValue("cdnUrlModifiers")).forEach(o=>{M.emit(new F({type:X.CLOUD_MODIFICATION,ctx:this.ctxName,data:$.getCtx(o).store}),void 0,!1)})})}setUploadMetadata(t){Le("setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/"),this.connectedOnce?this.$["*uploadMetadata"]=t:this.__initialUploadMetadata=t}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Fe({typedSchema:Zs,watchList:["uploadProgress","fileInfo","uploadError","validationErrorMsg","validationMultipleLimitMsg","cdnUrlModifiers"]});this.add("*uploadCollection",e)}let t=()=>this.hasBlockInCtx(e=>e instanceof v?e.isUploadCollectionOwner&&e.isConnected&&e!==this:!1);this.couldBeUploadCollectionOwner&&!t()&&(this.isUploadCollectionOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectonUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxLocalFileSizeBytes",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMin",()=>this._debouncedRunValidators()),this.subConfigValue("multipleMax",()=>this._debouncedRunValidators()),this.subConfigValue("multiple",()=>this._debouncedRunValidators()),this.subConfigValue("imgOnly",()=>this._debouncedRunValidators()),this.subConfigValue("accept",()=>this._debouncedRunValidators())),this.__initialUploadMetadata&&(this.$["*uploadMetadata"]=this.__initialUploadMetadata),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1})}destroyCallback(){var t,e;super.destroyCallback(),this.isUploadCollectionOwner&&((t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this))}addFileFromUrl(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({externalUrl:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromUuid(t,{silent:e,fileName:r,source:n}={}){this.uploadCollection.add({uuid:t,fileName:r!=null?r:null,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API})}addFileFromObject(t,{silent:e,fileName:r,source:n,fullPath:o}={}){this.uploadCollection.add({file:t,isImage:ne(t),mimeType:t.type,fileName:r!=null?r:t.name,fileSize:t.size,silentUpload:e!=null?e:!1,source:n!=null?n:Q.API,fullPath:o!=null?o:null})}addFiles(t){console.warn("`addFiles` method is deprecated. Please use `addFileFromObject`, `addFileFromUrl` or `addFileFromUuid` instead."),t.forEach(e=>{this.uploadCollection.add({file:e,isImage:ne(e),mimeType:e.type,fileName:e.name,fileSize:e.size})})}uploadAll(){this.$["*uploadTrigger"]={}}openSystemDialog(t={}){var r;let e=Ut(Fi([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?re:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=this.cfg.multiple,t.captureCamera?(this.fileInput.capture="",this.fileInput.accept=Ut(re)):this.fileInput.accept=e,this.fileInput.dispatchEvent(new MouseEvent("click")),this.fileInput.onchange=()=>{[...this.fileInput.files].forEach(n=>this.addFileFromObject(n,{source:Q.LOCAL})),this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.setOrAddState("*modalActive",!0),this.fileInput.value="",this.fileInput=null}}get sourceList(){let t=[];return this.cfg.sourceList&&(t=P(this.cfg.sourceList)),t}initFlow(t=!1){var e;if(this.uploadCollection.size>0&&!t)this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0);else if(((e=this.sourceList)==null?void 0:e.length)===1){let r=this.sourceList[0];r==="local"?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this==null||this.openSystemDialog()):(Object.values(v.extSrcList).includes(r)?this.set$({"*currentActivityParams":{externalSourceType:r},"*currentActivity":g.activities.EXTERNAL}):this.$["*currentActivity"]=r,this.setOrAddState("*modalActive",!0))}else this.set$({"*currentActivity":g.activities.START_FROM}),this.setOrAddState("*modalActive",!0);M.emit(new F({type:X.INIT_FLOW,ctx:this.ctxName}),void 0,!1)}doneFlow(){this.set$({"*currentActivity":this.doneActivity,"*history":this.doneActivity?[this.doneActivity]:[]}),this.$["*currentActivity"]||this.setOrAddState("*modalActive",!1),M.emit(new F({type:X.DONE_FLOW,ctx:this.ctxName}),void 0,!1)}get uploadCollection(){return this.$["*uploadCollection"]}_validateFileType(t){let e=this.cfg.imgOnly,r=this.cfg.accept,n=Fi([...e?re:[],r]);if(!n.length)return;let o=t.getValue("mimeType"),l=t.getValue("fileName");if(!o||!l)return;let a=Vi(o,n),c=Gs(l,n);if(!a&&!c)return this.l10n("file-type-not-allowed")}_validateMaxSizeLimit(t){let e=this.cfg.maxLocalFileSizeBytes,r=t.getValue("fileSize");if(e&&r&&r>e)return this.l10n("files-max-size-limit-error",{maxFileSize:Ks(e)})}_validateMultipleLimit(t){let e=this.uploadCollection.items(),r=e.indexOf(t.uid),n=this.cfg.multiple?this.cfg.multipleMin:1,o=this.cfg.multiple?this.cfg.multipleMax:1;if(n&&e.length=o)return this.l10n("files-count-allowed",{count:o})}_validateIsImage(t){let e=this.cfg.imgOnly,r=t.getValue("isImage");if(!(!e||r)&&!(!t.getValue("fileInfo")&&t.getValue("externalUrl"))&&!(!t.getValue("fileInfo")&&!t.getValue("mimeType")))return this.l10n("images-only-accepted")}_runValidatorsForEntry(t){for(let e of this._validators){let r=e(t);if(r){t.setValue("validationErrorMsg",r);return}}t.setValue("validationErrorMsg",null)}_runValidators(){for(let t of this.uploadCollection.items())setTimeout(()=>{let e=this.uploadCollection.read(t);e&&this._runValidatorsForEntry(e)})}setInitialCrop(){let t=Me(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of r){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=e.width/e.height,u=Ms(l,a,c),d=R(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:I(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=n,this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}}}async getMetadata(){var e;let t=(e=this.cfg.metadata)!=null?e:this.$["*uploadMetadata"];return typeof t=="function"?await t():t}async getUploadClientOptions(){let t={store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Vs,integration:this.cfg.userAgentIntegration,secureSignature:this.cfg.secureSignature,secureExpire:this.cfg.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads,metadata:await this.getMetadata()};return console.log("Upload client options:",t),t}getOutputData(t){let e=[];return(t?this.uploadCollection.findItems(t):this.uploadCollection.items()).forEach(n=>{var c,u;let o=$.getCtx(n).store,l=o.fileInfo||{name:o.fileName,originalFilename:o.fileName,size:o.fileSize,isImage:o.isImage,mimeType:o.mimeType},a={...l,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:(u=(c=o.cdnUrl)!=null?c:l.cdnUrl)!=null?u:null,validationErrorMessage:o.validationErrorMsg,uploadError:o.uploadError,isUploaded:!!o.uuid&&!!o.fileInfo,isValid:!o.validationErrorMsg&&!o.uploadError};e.push(a)}),e}};v.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});v.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...v.extSrcList});var Y={brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0};function co(s,i){if(typeof i=="number")return Y[s]!==i?`${s}/${i}`:"";if(typeof i=="boolean")return i&&Y[s]!==i?`${s}`:"";if(s==="filter"){if(!i||Y[s]===i.amount)return"";let{name:t,amount:e}=i;return`${s}/${t}/${e}`}if(s==="crop"){if(!i)return"";let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}var Qs=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function At(s){return Ne(...Qs.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return co(i,t)}).filter(i=>!!i))}var Ve=Ne("format/auto","progressive/yes"),_t=([s])=>typeof s!="undefined"?Number(s):void 0,Js=()=>!0,ho=([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),uo=([s,i])=>({dimensions:P(s,"x").map(Number),coords:P(i).map(Number)}),po={enhance:_t,brightness:_t,exposure:_t,gamma:_t,contrast:_t,saturation:_t,vibrance:_t,warmth:_t,filter:ho,mirror:Js,flip:Js,rotate:_t,crop:uo};function tr(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!Qs.includes(e))continue;let n=po[e],o=n(r);i[e]=o}return i}var N=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),q=[N.CROP,N.TUNING,N.FILTERS],er=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],ir=["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"],sr=["rotate","mirror","flip"],ot=Object.freeze({brightness:{zero:Y.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Y.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Y.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Y.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Y.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Y.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Y.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Y.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Y.filter,range:[0,100],keypointsNumber:1}});var fo="https://ucarecdn.com",mo="https://upload.uploadcare.com",go="https://social.uploadcare.com",$t={pubkey:"",multiple:!0,multipleMin:0,multipleMax:0,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Ut(q),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:fo,baseUrl:mo,socialBaseUrl:go,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",metadata:null};var G=s=>String(s),lt=s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},k=s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},_o=s=>s==="auto"?s:k(s),bo={pubkey:G,multiple:k,multipleMin:lt,multipleMax:lt,confirmUpload:k,imgOnly:k,accept:G,externalSourcesPreferredTypes:G,store:_o,cameraMirror:k,sourceList:G,maxLocalFileSizeBytes:lt,thumbSize:lt,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:G,removeCopyright:k,cropPreset:G,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:G,cdnCname:G,baseUrl:G,socialBaseUrl:G,secureSignature:G,secureExpire:G,secureDeliveryProxy:G,retryThrottledRequestMaxTimes:lt,multipartMinFileSize:lt,multipartChunkSize:lt,maxConcurrentRequests:lt,multipartMaxConcurrentRequests:lt,multipartMaxAttempts:lt,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:G},rr=(s,i)=>{if(!(typeof i=="undefined"||i===null))try{return bo[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),$t[s]}};var Be=Object.keys($t),yo=["metadata"],vo=s=>yo.includes(s),ze=Be.filter(s=>!vo(s)),Co={...Object.fromEntries(ze.map(s=>[gt(s),s])),...Object.fromEntries(ze.map(s=>[s.toLowerCase(),s]))},wo={...Object.fromEntries(Be.map(s=>[gt(s),W(s)])),...Object.fromEntries(Be.map(s=>[s.toLowerCase(),W(s)]))},je=class extends b{constructor(){super();h(this,"ctxOwner",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries($t).map(([t,e])=>[W(t),e]))}}initCallback(){super.initCallback();let t=this;for(let e of ze)this.sub(W(e),r=>{r!==$t[e]&&(t[e]=r)},!1);for(let e of Be){let r="__"+e;t[r]=t[e],Object.defineProperty(this,e,{set:n=>{if(t[r]=n,ze.includes(e)){let o=[...new Set([gt(e),e.toLowerCase()])];for(let l of o)typeof n=="undefined"||n===null?this.removeAttribute(l):this.setAttribute(l,n.toString())}this.$[W(e)]!==n&&(typeof n=="undefined"||n===null?this.$[W(e)]=$t[e]:this.$[W(e)]=n)},get:()=>this.$[W(e)]}),typeof t[e]!="undefined"&&t[e]!==null&&(t[e]=t[r])}}attributeChangedCallback(t,e,r){if(e===r)return;let n=Co[t],o=rr(n,r),l=o!=null?o:$t[n],a=this;a[n]=l}};je.bindAttributes(wo);var le=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,name:"",path:"",size:"24",viewBox:""})}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=this.getCssData(`--icon-${t}`);e&&(this.$.path=e)}),this.sub("path",t=>{if(!t)return;t.trimStart().startsWith("<")?(this.setAttribute("raw",""),this.ref.svg.innerHTML=t):(this.removeAttribute("raw"),this.ref.svg.innerHTML=``)}),this.sub("size",t=>{this.$.viewBox=`0 0 ${t} ${t}`})}};le.template=``;le.bindAttributes({name:"name",size:"size"});var To="https://ucarecdn.com",Pt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:To},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{default:"auto"},"cdn-operations":{},progressive:{},quality:{default:"smart"},"is-background-for":{}});var nr=s=>[...new Set(s)];var ae="--lr-img-",or="unresolved",Xt=2,qt=3,lr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),cr=Object.create(null),ar;for(let s in Pt)cr[ae+s]=((ar=Pt[s])==null?void 0:ar.default)||"";var He=class extends Ft{constructor(){super(...arguments);h(this,"cssInit$",cr)}$$(t){return this.$[ae+t]}set$$(t){for(let e in t)this.$[ae+e]=t[e]}sub$$(t,e){this.sub(ae+t,r=>{r===null||r===""||e(r)})}_fmtAbs(t){return!t.includes("//")&&!lr&&(t=new URL(t,document.baseURI).href),t}_getCdnModifiers(t=""){return R(t&&`resize/${t}`,this.$$("cdn-operations")||"",`format/${this.$$("format")||Pt.format.default}`,`quality/${this.$$("quality")||Pt.quality.default}`)}_getUrlBase(t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(lr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let e=this._getCdnModifiers(t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return I(this.$$("src"),e);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("uuid"))return this._proxyUrl(I(Et(this.$$("cdn-cname"),this.$$("uuid")),e));if(this.$$("proxy-cname"))return this._proxyUrl(I(this.$$("proxy-cname"),e,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(I(`https://${this.$$("pubkey")}.ucr.io/`,e,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?te(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let n=t.getBoundingClientRect(),o=e*Math.round(n.width),l=r?"":e*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},r=["load","error"];for(let n of r)t.addEventListener(n,e)}get img(){return this._img||(this._img=new Image,this._setupEventProxy(this.img),this._img.setAttribute(or,""),this.img.onload=()=>{this.img.removeAttribute(or)},this.initAttributes(),this.appendChild(this._img)),this._img}get bgSelector(){return this.$$("is-background-for")}initAttributes(){[...this.attributes].forEach(t=>{Pt[t.name]||this.img.setAttribute(t.name,t.value)})}get breakpoints(){return this.$$("breakpoints")?nr(P(this.$$("breakpoints")).map(t=>Number(t))):null}renderBg(t){let e=new Set;this.breakpoints?this.breakpoints.forEach(n=>{e.add(`url("${this._getUrlBase(n+"x")}") ${n}w`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(n*Xt+"x")}") ${n*Xt}w`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(n*qt+"x")}") ${n*qt}w`)}):(e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,Xt))}") ${Xt}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,qt))}") ${qt}x`));let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${e}w`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*Xt+"x")+` ${e*Xt}w`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*qt+"x")+` ${e*qt}w`)}):(t.add(this._getUrlBase(this._getElSize(this.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}init(){this.bgSelector?[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)}):this.$$("intersection")?this.initIntersection(this.img,()=>{this.img.srcset=this.getSrcset(),this.img.src=this.getSrc()}):(this.img.srcset=this.getSrcset(),this.img.src=this.getSrc())}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null)}static get observedAttributes(){return Object.keys(Pt)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[ae+t]=r})}};var Bi=class extends He{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{this.$$("is-background-for")||(this.img.loading=i?"lazy":"eager")})}};var ce=class extends v{constructor(){super(),this.init$={...this.init$,"*simpleButtonText":"",withDropZone:!0,onClick:()=>{this.initFlow()}}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",i=>{typeof i!="undefined"&&(this.$.withDropZone=k(i))}),this.subConfigValue("multiple",i=>{this.$["*simpleButtonText"]=i?this.l10n("upload-files"):this.l10n("upload-file")})}};ce.template=``;ce.bindAttributes({dropzone:null});var zi=class extends g{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};function xo(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}function Eo(s,i){return new Promise(t=>{let e=0,r=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});r.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(r)})):l.isDirectory&&o(l.createReader())},o=l=>{e++,l.readEntries(a=>{e--;for(let c of a)n(c);e===0&&t(r)})};n(s)})}function hr(s){let i=[],t=[];for(let e=0;e{a&&i.push(...a)}));continue}let o=r.getAsFile();o&&t.push(xo(o).then(l=>{l||i.push({type:"file",file:o})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(n=>{r.getAsString(o=>{i.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(t).then(()=>i)}var V={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},ur=["focus"],Ao=100,ji=new Map;function $o(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}function Hi(s){let i=0,t=document.body,e=new Set,r=f=>e.add(f),n=V.INACTIVE,o=f=>{s.shouldIgnore()&&f!==V.INACTIVE||(n!==f&&e.forEach(_=>_(f)),n=f)},l=()=>i>0;r(f=>s.onChange(f));let a=()=>{i=0,o(V.INACTIVE)},c=()=>{i+=1,n===V.INACTIVE&&o(V.ACTIVE)},u=()=>{i-=1,l()||o(V.INACTIVE)},d=f=>{f.preventDefault(),i=0,o(V.INACTIVE)},p=f=>{if(s.shouldIgnore())return;l()||(i+=1);let _=[f.x,f.y],A=s.element.getBoundingClientRect(),x=Math.floor($o(_,A)),T=x{if(s.shouldIgnore())return;f.preventDefault();let _=await hr(f.dataTransfer);s.onItems(_),o(V.INACTIVE)};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),s.element.addEventListener("drop",m),ur.forEach(f=>{window.addEventListener(f,a)}),()=>{ji.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),s.element.removeEventListener("drop",m),ur.forEach(f=>{window.removeEventListener(f,a)})}}var he=class extends v{constructor(){super(),this.init$={...this.init$,state:V.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:this.l10n("drop-files-here"),"lr-drop-area/targets":null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),n=r.visibility!=="hidden"&&r.display!=="none";return t&&n&&e}initCallback(){super.initCallback(),this.$["lr-drop-area/targets"]||(this.$["lr-drop-area/targets"]=new Set),this.$["lr-drop-area/targets"].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!k(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:k(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:k(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:k(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.set$({text:this.l10n(t)||t}):this.set$({text:this.l10n("drop-files-here")})}),this._destroyDropzone=Hi({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.addFileFromUrl(e.url,{source:Q.DROP_AREA}):e.type==="file"&&this.addFileFromObject(e.file,{source:Q.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Hi({element:i,onChange:t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(V).find(([,n])=>n===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=P(t);this.$.isEnabled=e.includes(v.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.$.isClickable&&(this._onAreaClicked=()=>{this.openSystemDialog()},this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$["lr-drop-area/targets"]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var i,t,e,r;super.destroyCallback(),(t=(i=this.$["lr-drop-area/targets"])==null?void 0:i.remove)==null||t.call(i,this),(e=this._destroyDropzone)==null||e.call(this),(r=this._destroyContentWrapperDropzone)==null||r.call(this),this._onAreaClicked&&this.removeEventListener("click",this._onAreaClicked)}};he.template=`
{{text}}
`;he.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var So="src-type-",ue=class extends v{constructor(){super(...arguments);h(this,"_registeredTypes",{});h(this,"init$",{...this.init$,iconName:"default"})}initTypes(){this.registerType({type:v.sourceTypes.LOCAL,onClick:()=>{this.openSystemDialog()}}),this.registerType({type:v.sourceTypes.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:v.sourceTypes.CAMERA,activity:g.activities.CAMERA,onClick:()=>{var e=document.createElement("input").capture!==void 0;return e&&this.openSystemDialog({captureCamera:!0}),!e}}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(v.extSrcList))this.registerType({type:t,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.setAttribute("role","button"),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:n=t,activity:o,onClick:l,activityParams:a={}}=e;this.applyL10nKey("src-type",`${So}${r}`),this.$.iconName=n,this.onclick=c=>{(l?l(c):!!o)&&this.set$({"*currentActivityParams":a,"*currentActivity":o})}}};ue.template=`
`;ue.bindAttributes({type:null});var Wi=class extends b{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=P(i),e="";t.forEach(r=>{e+=``}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};function dr(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}function pr(s="#fff",i="rgba(0, 0, 0, .1)"){return dr(``)}function de(s="hsl(209, 21%, 65%)",i=32,t=32){return dr(``)}function fr(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,n=new Promise((o,l)=>{r.onload=()=>{let a=r.height/r.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let u=URL.createObjectURL(c);o(u)})},r.onerror=a=>{l(a)}});return r.src=URL.createObjectURL(s),n}var B=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3),LIMIT_OVERFLOW:Symbol(4)}),bt=class extends v{constructor(){super();h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",S(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",S(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,progressUnknown:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,isLimitOverflow:!1,state:B.IDLE,"*uploadTrigger":null,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===g.activities.DETAILS)?this.$["*currentActivity"]=g.activities.DETAILS:this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT},onRemove:()=>{let t=this._entry.getValue("uuid");if(t){let e=this.getOutputData(r=>r.getValue("uuid")===t);M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:e}))}this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=B.IDLE;t.getValue("uploadError")||t.getValue("validationErrorMsg")?e=B.FAILED:t.getValue("validationMultipleLimitMsg")?e=B.LIMIT_OVERFLOW:t.getValue("isUploading")?e=B.UPLOADING:t.getValue("fileInfo")&&(e=B.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,n=this.proxyUrl(I(Et(this.cfg.cdnCname,this._entry.getValue("uuid")),R(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),o=t.getValue("thumbUrl");o!==n&&(t.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await fr(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let n=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(n))}else{let r=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon");t.setValue("thumbUrl",de(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,n=>{this.isConnected&&e(n)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=e.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("uuid",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),this._subEntry("validationMultipleLimitMsg",()=>this._debouncedCalculateState()),this._subEntry("validationErrorMsg",()=>this._debouncedCalculateState()),this._subEntry("uploadError",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{bt.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.$["*uploadTrigger"]=null,this.sub("*uploadTrigger",t=>{t&&setTimeout(()=>this.isConnected&&this.upload())}),bt.activeInstances.add(this)}_handleState(t){var e,r,n;this.set$({isFailed:t===B.FAILED,isLimitOverflow:t===B.LIMIT_OVERFLOW,isUploading:t===B.UPLOADING,isFinished:t===B.FINISHED,progressVisible:t===B.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:((n=this._entry.getValue("uploadError"))==null?void 0:n.message)||this._entry.getValue("validationErrorMsg")||this._entry.getValue("validationMultipleLimitMsg")}),t===B.FAILED||t===B.LIMIT_OVERFLOW?this.$.badgeIcon="badge-error":t===B.FINISHED&&(this.$.badgeIcon="badge-success"),t===B.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0}destroyCallback(){super.destroyCallback(),bt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{root:this.parentElement,rootMargin:"50% 0px 50% 0px",threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}async upload(){var n,o,l;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("uploadError")||t.getValue("validationErrorMsg")||t.getValue("validationMultipleLimitMsg"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(e&&this.uploadCollection.size>e)return;let r=this.getOutputData(a=>!a.getValue("fileInfo"));M.emit(new F({type:X.UPLOAD_START,ctx:this.ctxName,data:r})),this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("uploadError",null),t.setValue("validationErrorMsg",null),t.setValue("validationMultipleLimitMsg",null),!t.getValue("file")&&t.getValue("externalUrl")&&(this.$.progressUnknown=!0);try{let a=new AbortController;t.setValue("abortController",a);let c=async()=>{let d=await this.getUploadClientOptions();return Ri(t.getValue("file")||t.getValue("externalUrl")||t.getValue("uuid"),{...d,fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:p=>{if(p.isComputable){let m=p.value*100;t.setValue("uploadProgress",m)}this.$.progressUnknown=!p.isComputable},signal:a.signal})},u=await this.$["*uploadQueue"].add(c);t.setMultipleValues({fileInfo:u,isUploading:!1,fileName:u.originalFilename,fileSize:u.size,isImage:u.isImage,mimeType:(l=(o=(n=u.contentInfo)==null?void 0:n.mime)==null?void 0:o.mime)!=null?l:u.mimeType,uuid:u.uuid,cdnUrl:u.cdnUrl}),t===this._entry&&this._debouncedCalculateState()}catch(a){console.warn("Upload error",a),t.setMultipleValues({abortController:null,isUploading:!1,uploadProgress:0}),t===this._entry&&this._debouncedCalculateState(),a instanceof U?a.isCancel||t.setValue("uploadError",a):t.setValue("uploadError",new Error("Unexpected error"))}}};bt.template=`
{{itemName}}{{errorText}}
`;bt.activeInstances=new Set;var We=class{constructor(){h(this,"caption","");h(this,"text","");h(this,"iconName","");h(this,"isError",!1)}},Xe=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,iconName:"info",captionTxt:"Message caption",msgTxt:"Message...","*message":null,onClose:()=>{this.$["*message"]=null}})}initCallback(){super.initCallback(),this.sub("*message",t=>{t?(this.setAttribute("active",""),this.set$({captionTxt:t.caption||"",msgTxt:t.text||"",iconName:t.isError?"error":"info"}),t.isError?this.setAttribute("error",""):this.removeAttribute("error")):this.removeAttribute("active")})}};Xe.template=`
{{captionTxt}}
{{msgTxt}}
`;var qe=class extends v{constructor(){super();h(this,"couldBeUploadCollectionOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",g.activities.UPLOAD_LIST);h(this,"_debouncedHandleCollectionUpdate",S(()=>{var t;this.isConnected&&(this._updateUploadsState(),this._updateCountLimitMessage(),((t=this.$["*uploadList"])==null?void 0:t.length)===0&&!this.cfg.showEmptyList&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},0));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",hasFiles:!1,onAdd:()=>{this.initFlow(!0)},onUpload:()=>{this.uploadAll(),this._updateUploadsState()},onDone:()=>{this.doneFlow()},onCancel:()=>{let t=this.getOutputData(e=>!!e.getValue("fileInfo"));M.emit(new F({type:X.REMOVE,ctx:this.ctxName,data:t})),this.uploadCollection.clearAll()}}}_validateFilesCount(){var u,d;let t=!!this.cfg.multiple,e=t?(u=this.cfg.multipleMin)!=null?u:0:1,r=t?(d=this.cfg.multipleMax)!=null?d:0:1,n=this.uploadCollection.size,o=e?nr:!1;return{passed:!o&&!l,tooFew:o,tooMany:l,min:e,max:r,exact:r===n}}_updateCountLimitMessage(){let t=this.uploadCollection.size,e=this._validateFilesCount();if(t&&!e.passed){let r=new We,n=e.tooFew?"files-count-limit-error-too-few":"files-count-limit-error-too-many";r.caption=this.l10n("files-count-limit-error-title"),r.text=this.l10n(n,{min:e.min,max:e.max,total:t}),r.isError=!0,this.set$({"*message":r})}else this.set$({"*message":null})}_updateUploadsState(){let t=this.uploadCollection.items(),r={total:t.length,succeed:0,uploading:0,failed:0,limitOverflow:0};for(let m of t){let f=this.uploadCollection.read(m);f.getValue("fileInfo")&&!f.getValue("validationErrorMsg")&&(r.succeed+=1),f.getValue("isUploading")&&(r.uploading+=1),(f.getValue("validationErrorMsg")||f.getValue("uploadError"))&&(r.failed+=1),f.getValue("validationMultipleLimitMsg")&&(r.limitOverflow+=1)}let{passed:n,tooMany:o,exact:l}=this._validateFilesCount(),a=r.failed===0&&r.limitOverflow===0,c=!1,u=!1,d=!1;r.total-r.succeed-r.uploading-r.failed>0&&n?c=!0:(u=!0,d=r.total===r.succeed&&n&&a),this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:r.total===0||!o&&!l,addMoreBtnVisible:!l||this.cfg.multiple,headerText:this._getHeaderText(r)})}_getHeaderText(t){let e=r=>{let n=t[r];return this.l10n(`header-${r}`,{count:n})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMin",this._debouncedHandleCollectionUpdate),this.subConfigValue("multipleMax",this._debouncedHandleCollectionUpdate),this.sub("*currentActivity",t=>{var e;((e=this.uploadCollection)==null?void 0:e.size)===0&&!this.cfg.showEmptyList&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._debouncedHandleCollectionUpdate),this.sub("*uploadList",t=>{this._debouncedHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.add$({"*uploadTrigger":{}},!0)})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._debouncedHandleCollectionUpdate)}};qe.template=`{{headerText}}
`;var Ge=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.addFileFromUrl(e,{source:Q.URL_TAB}),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};Ge.template=`
`;var Xi=()=>typeof navigator.permissions!="undefined";var Ke=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:Xi(),l10nMessage:null,originalErrorMessage:null,cameraSelectOptions:null,cameraSelectHidden:!0,onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",()=>{Xi()&&this._subscribePermissions(),this._capture()});h(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});h(this,"_handlePermissionsChange",()=>{this._capture()});h(this,"_setPermissionsState",S(t=>{this.$.originalErrorMessage=null,this.classList.toggle("initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage=this.l10n("camera-permissions-prompt"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage=this.l10n("camera-permissions-denied"),this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),this.$.originalErrorMessage=e.message}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.png`;this._canvas.toBlob(r=>{let n=new File([r],e,{lastModified:t,type:"image/png"});this.addFileFromObject(n,{source:Q.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})})}async initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",t=>{this.$.videoTransformCss=t?"scaleX(-1)":null});try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput").map((r,n)=>({text:r.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:r.deviceId}));e.length>1&&(this.$.cameraSelectOptions=e,this.$.cameraSelectHidden=!1)}catch{}}};Ke.template=`
{{l10nMessage}}{{originalErrorMessage}}
`;var qi=class extends v{constructor(){super(...arguments);h(this,"requireCtxName",!0)}};var Ye=class extends v{constructor(){super(...arguments);h(this,"activityType",g.activities.DETAILS);h(this,"pauseRender",!0);h(this,"init$",{...this.init$,checkerboard:!1,fileSize:null,fileName:"",cdnUrl:"",errorTxt:"",cloudEditBtnHidden:!0,onNameInput:null,onBack:()=>{this.historyBack()},onRemove:()=>{this.uploadCollection.remove(this.entry.uid),this.historyBack()},onCloudEdit:()=>{this.entry.getValue("uuid")&&(this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT)}})}showNonImageThumb(){let t=window.getComputedStyle(this).getPropertyValue("--clr-generic-file-icon"),e=de(t,108,108);this.ref.filePreview.setImageUrl(e),this.set$({checkerboard:!1})}initCallback(){super.initCallback(),this.render(),this.$.fileSize=this.l10n("file-size-unknown"),this.registerActivity(this.activityType,{onDeactivate:()=>{this.ref.filePreview.clear()}}),this.sub("*focusedEntry",t=>{if(!t)return;this._entrySubs?this._entrySubs.forEach(n=>{this._entrySubs.delete(n),n.remove()}):this._entrySubs=new Set,this.entry=t;let e=t.getValue("file");if(e){this._file=e;let n=ne(this._file);n&&!t.getValue("cdnUrl")&&(this.ref.filePreview.setImageFile(this._file),this.set$({checkerboard:!0})),n||this.showNonImageThumb()}let r=(n,o)=>{this._entrySubs.add(this.entry.subscribe(n,o))};r("fileName",n=>{this.$.fileName=n,this.$.onNameInput=()=>{let o=this.ref.file_name_input.value;Object.defineProperty(this._file,"name",{writable:!0,value:o}),this.entry.setValue("fileName",o)}}),r("fileSize",n=>{this.$.fileSize=Number.isFinite(n)?this.fileSizeFmt(n):this.l10n("file-size-unknown")}),r("uploadError",n=>{this.$.errorTxt=n==null?void 0:n.message}),r("externalUrl",n=>{n&&(this.entry.getValue("uuid")||this.showNonImageThumb())}),r("cdnUrl",n=>{let o=this.cfg.useCloudImageEditor&&n&&this.entry.getValue("isImage");if(n&&this.ref.filePreview.clear(),this.set$({cdnUrl:n,cloudEditBtnHidden:!o}),n&&this.entry.getValue("isImage")){let l=I(n,R("format/auto","preview"));this.ref.filePreview.setImageUrl(this.proxyUrl(l))}})})}};Ye.template=`
{{fileSize}}
{{errorTxt}}
`;var Gi=class{constructor(){h(this,"captionL10nStr","confirm-your-action");h(this,"messageL10Str","are-you-sure");h(this,"confirmL10nStr","yes");h(this,"denyL10nStr","no")}confirmAction(){console.log("Confirmed")}denyAction(){this.historyBack()}},Ze=class extends g{constructor(){super(...arguments);h(this,"activityType",g.activities.CONFIRMATION);h(this,"_defaults",new Gi);h(this,"init$",{...this.init$,activityCaption:"",messageTxt:"",confirmBtnTxt:"",denyBtnTxt:"","*confirmation":null,onConfirm:this._defaults.confirmAction,onDeny:this._defaults.denyAction.bind(this)})}initCallback(){super.initCallback(),this.set$({messageTxt:this.l10n(this._defaults.messageL10Str),confirmBtnTxt:this.l10n(this._defaults.confirmL10nStr),denyBtnTxt:this.l10n(this._defaults.denyL10nStr)}),this.sub("*confirmation",t=>{t&&this.set$({"*currentActivity":g.activities.CONFIRMATION,activityCaption:this.l10n(t.captionL10nStr),messageTxt:this.l10n(t.messageL10Str),confirmBtnTxt:this.l10n(t.confirmL10nStr),denyBtnTxt:this.l10n(t.denyL10nStr),onDeny:()=>{t.denyAction()},onConfirm:()=>{t.confirmAction()}})})}};Ze.template=`{{activityCaption}}
{{messageTxt}}
`;var Je=class extends v{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,unknown:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};Je.template=``;var Qe=class extends b{constructor(){super(...arguments);h(this,"_value",0);h(this,"_unknownMode",!1);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{t!==void 0&&(this._value=t,this._unknownMode||this.style.setProperty("--l-width",this._value.toString()))}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("progress--hidden",!t)}),this.defineAccessor("unknown",t=>{this._unknownMode=t,this.ref.line.classList.toggle("progress--unknown",t)})}};Qe.template='
';var Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";var pe=class extends b{constructor(){super();h(this,"init$",{...this.init$,checkerboard:!1,src:Z})}initCallback(){super.initCallback(),this.sub("checkerboard",()=>{this.style.backgroundImage=this.hasAttribute("checkerboard")?`url(${pr()})`:"unset"})}destroyCallback(){super.destroyCallback(),URL.revokeObjectURL(this._lastObjectUrl)}setImage(t){this.$.src=t.src}setImageFile(t){let e=URL.createObjectURL(t);this.$.src=e,this._lastObjectUrl=e}setImageUrl(t){this.$.src=t}clear(){URL.revokeObjectURL(this._lastObjectUrl),this.$.src=Z}};pe.template='';pe.bindAttributes({checkerboard:"checkerboard"});var mr="--cfg-ctx-name",O=class extends b{get cfgCssCtxName(){return this.getCssData(mr,!0)}get cfgCtxName(){var t;let i=((t=this.getAttribute("ctx-name"))==null?void 0:t.trim())||this.cfgCssCtxName||this.__cachedCfgCtxName;return this.__cachedCfgCtxName=i,i}connectedCallback(){var i;if(!this.connectedOnce){let t=(i=this.getAttribute("ctx-name"))==null?void 0:i.trim();t&&this.style.setProperty(mr,`'${t}'`)}super.connectedCallback()}parseCfgProp(i){return{...super.parseCfgProp(i),ctx:$.getCtx(this.cfgCtxName)}}};function gr(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function D(...s){let i=gr(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function _r(s,...i){let t=gr(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}var br=s=>{if(!s)return q;let i=Ns(s).filter(t=>q.includes(t));return i.length===0?q:i};function yr(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":q,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:Z,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Ut(q),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Z,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=R(At(i),"preview"),r=I(t,e),n={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var vr=`
Network error
{{fileType}}
{{msg}}
`;var at=class extends O{constructor(){super();h(this,"_debouncedShowLoader",S(this._showLoader.bind(this),300));this.init$={...this.init$,...yr(this)}}get ctxName(){return this.autoCtxName}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),o=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(n),o.disconnect())});o.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(await this._waitForSize(),this.$["*tabId"]===N.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate(),this.$["*editorTransformations"]={},this.$.cdnUrl){let t=js(this.$.cdnUrl);this.$["*originalUrl"]=Et(this.$.cdnUrl,t);let e=Hs(this.$.cdnUrl),r=tr(e);this.$["*editorTransformations"]=r}else if(this.$.uuid)this.$["*originalUrl"]=Et(this.cfg.cdnCname,this.$.uuid);else throw new Error("No UUID nor CDN URL provided");try{let t=I(this.$["*originalUrl"],R("json")),e=await fetch(t).then(o=>o.json()),{width:r,height:n}=e;this.$["*imageSize"]={width:r,height:n},this.$["*tabId"]===N.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==Z&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||Z)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Me(t)}),this.sub("tabs",t=>{this.$["*tabList"]=br(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=D("image",{image_hidden_to_cropper:t===N.CROP,image_hidden_effects:t!==N.CROP})}),this.classList.add("editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=R(At(t),"preview"),n=I(e,r),o={originalUrl:e,cdnUrlModifiers:r,cdnUrl:n,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};h(at,"className","cloud-image-editor");at.template=vr;at.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ti=class extends O{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=y&&t.width<=y)return!0;let e=t.height<=y&&(i.includes("n")||i.includes("s")),r=t.width<=y&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i,o=this.ref["svg-el"],l=J("mask",{id:"backdrop-mask"}),a=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=J("rect",{x:t,y:e,width:r,height:n,fill:"black"});l.appendChild(a),l.appendChild(c);let u=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});o.appendChild(u),o.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:n}=i;this._backdropMaskInner&&Lt(this._backdropMaskInner,{x:t,y:e,width:r,height:n})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:n,groupNode:o}=t,l=e==="",a=e.length===2,{x:c,y:u,width:d,height:p}=i;if(l){let f={x:c+d/3,y:u+p/3,width:d/3,height:p/3};Lt(n,f)}else{let f=xt(Math.min(d,p)/(24*2+34)/2,0,1),{d:_,center:A}=a?Ss(i,e,f):ks(i,e,f),x=Math.max(Di*xt(Math.min(d,p)/Di/3,0,1),$s);Lt(n,{x:A[0]-x,y:A[1]-x,width:x*2,height:x*2}),Lt(r,{d:_})}let m=this._shouldThumbBeDisabled(e);o.setAttribute("class",D("thumb",{"thumb--hidden":m,"thumb--visible":!m}))}Lt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,n=J("g");n.classList.add("thumb"),n.setAttribute("with-effects","");let o=J("rect",{fill:"transparent"}),l=J("path",{stroke:"currentColor",fill:"none","stroke-width":3});n.appendChild(l),n.appendChild(o),i[r]={direction:r,pathNode:l,interactionNode:o,groupNode:n},o.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=J("svg"),t=J("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"#000000","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=J("line",{x1:`${se*e}%`,y1:"0%",x2:`${se*e}%`,y2:"100%",stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=J("line",{x1:"0%",y1:`${se*e}%`,x2:"100%",y2:`${se*e}%`,stroke:"#000000","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("guides","guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:n}of Object.values(r))t.appendChild(n);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:n,y:o}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-n,a=t.y-o;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),n=i.x-e,o=i.y-r,l=n-this._dragStartPoint[0],a=o-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,t){var c,u;let[e,r]=t,n=this.$["*imageBox"],o=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?o=Os({rect:o,delta:[e,r],imageBox:n}):o=Ls({rect:o,delta:[e,r],direction:i,aspectRatio:a,imageBox:n}),!Object.values(o).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:o});return}return jt(Wt(o),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let n=e.interactionNode.getBoundingClientRect(),o={x:n.x,y:n.y,width:n.width,height:n.height};return Us(o,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Is(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",D("thumb",{"thumb--hidden":!i,"thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=y||i.width<=y,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",D({"guides--hidden":this._guidesHidden,"guides--visible":!this._guidesHidden&&i,"guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};ti.template='';var yt=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=D({active:t,not_active:!t})}),this.sub("on.click",t=>{this.onclick=t})}};yt.template=`
{{title}}
`;function Io(s){let i=s+90;return i=i>=360?0:i,i}function Oo(s,i){return s==="rotate"?Io(i):["mirror","flip"].includes(s)?!i:null}var fe=class extends yt{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=i=>{let t=this.$["*cropperEl"].getValue(this._operation),e=Oo(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};var me={FILTER:"filter",COLOR_OPERATION:"color_operation"},ct="original",ei=class extends O{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?me.FILTER:me.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===ct?void 0:this.$.value,filter:this._filter===ct?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ot[this._operation],[r,n]=t;this.$.min=r,this.$.max=n,this.$.zero=e;let o=this.$["*editorTransformations"][this._operation];if(this._controlType===me.FILTER){let l=n;if(o){let{name:a,amount:c}=o;l=a===this._filter?c:n}this.$.value=l,this.$.defaultValue=l}if(this._controlType===me.COLOR_OPERATION){let l=typeof o!="undefined"?o:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===me.FILTER?this._filter===ct?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};ei.template=``;function ge(s){let i=new Image;return{promise:new Promise((r,n)=>{i.src=s,i.onload=r,i.onerror=n}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Z)}}}function _e(s){let i=[];for(let n of s){let o=ge(n);i.push(o)}let t=i.map(n=>n.image);return{promise:Promise.allSettled(i.map(n=>n.promise)),images:t,cancel:()=>{i.forEach(n=>{n.cancel()})}}}var Gt=class extends yt{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null})}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,r=Math.ceil(e*t),n=e>=2?"lightest":"normal",o=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ct?{name:this._filter,amount:o}:void 0,I(this._originalUrl,R(Ve,At(l),`quality/${n}`,`scale_crop/${r}x${r}/center`))}_observerCallback(t,e){if(t[0].isIntersecting){let n=this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"],{promise:l,cancel:a}=ge(n);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{o.style.backgroundImage=`url(${n})`,o.setAttribute("loaded",""),e.unobserve(this)})}else this._cancelPreload&&this._cancelPreload()}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===ct,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=e?"1":"0";let n=this.ref["preview-el"];e?n.style.opacity="0":n.style.backgroundImage&&(n.style.opacity="1")}),this.sub("*networkProblems",e=>{if(!e){let r=this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"];n.style.backgroundImage&&(n.style.backgroundImage="none",n.style.backgroundImage=`url(${r})`)}})}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),this._cancelPreload&&this._cancelPreload()}};Gt.template=`
`;var be=class extends yt{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=t=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.$.title=this.l10n(t))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ot[this._operation],r=t[this._operation],n=typeof r!="undefined"?r!==e:!1;this.$.active=n})}};var Cr=(s,i)=>{let t,e,r;return(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)}};function wr(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}function Kt(s,i,t){let r=window.devicePixelRatio,n=Math.min(Math.ceil(i*r),3e3),o=r>=2?"lightest":"normal";return I(s,R(Ve,At(t),`quality/${o}`,`stretch/off/-/resize/${n}x`))}function Lo(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}var ii=class extends O{constructor(){super(),this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=S(this._commit.bind(this),300),this._handleResizeThrottled=Cr(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let i=this.$["*editorTransformations"],t=wr(i,Object.keys(this.$["*operations"])),e={...this.$["*operations"],...t};this.$["*operations"]=e}_initCanvas(){let i=this.ref["canvas-el"],t=i.getContext("2d"),e=this.offsetWidth,r=this.offsetHeight,n=window.devicePixelRatio;i.style.width=`${e}px`,i.style.height=`${r}px`,i.width=e*n,i.height=r*n,t==null||t.scale(n,n),this._canvas=i,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let i=this.$.image,t=this.$["*padding"],e=this.$["*operations"],{rotate:r}=e,n={width:this.offsetWidth,height:this.offsetHeight},o=Ht({width:i.naturalWidth,height:i.naturalHeight},r),l;if(o.width>n.width-t*2||o.height>n.height-t*2){let a=o.width/o.height,c=n.width/n.height;if(a>c){let u=n.width-t*2,d=u/a,p=0+t,m=t+(n.height-t*2)/2-d/2;l={x:p,y:m,width:u,height:d}}else{let u=n.height-t*2,d=u*a,p=t+(n.width-t*2)/2-d/2,m=0+t;l={x:p,y:m,width:d,height:u}}}else{let{width:a,height:c}=o,u=t+(n.width-t*2)/2-a/2,d=t+(n.height-t*2)/2-c/2;l={x:u,y:d,width:a,height:c}}this.$["*imageBox"]=Wt(l)}_alignCrop(){var d;let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,n=this.$["*editorTransformations"].crop,{width:o,x:l,y:a}=this.$["*imageBox"];if(n){let{dimensions:[p,m],coords:[f,_]}=n,{width:A}=Ht(this._imageSize,r),x=o/A;i=jt(Wt({x:l+f*x,y:a+_*x,width:p*x,height:m*x}),this.$["*imageBox"])}let c=(d=this.$["*cropPresetList"])==null?void 0:d[0],u=c?c.width/c.height:void 0;if(!Rs(i,t)||u&&!Ps(i,u)){let p=t.width/t.height,m=t.width,f=t.height;u&&(p>u?m=Math.min(t.height*u,t.width):f=Math.min(t.width/u,t.height)),i={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f}}this.$["*cropBox"]=jt(Wt(i),this.$["*imageBox"])}_drawImage(){let i=this._ctx;if(!i)return;let t=this.$.image,e=this.$["*imageBox"],r=this.$["*operations"],{mirror:n,flip:o,rotate:l}=r,a=Ht({width:e.width,height:e.height},l);i.save(),i.translate(e.x+e.width/2,e.y+e.height/2),i.rotate(l*Math.PI*-1/180),i.scale(n?-1:1,o?-1:1),i.drawImage(t,-a.width/2,-a.height/2,a.width,a.height),i.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let i=this._canvas;this._ctx.clearRect(0,0,i.width,i.height),this._drawImage()}_animateIn({fromViewer:i}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=D({active_from_viewer:i,active_from_editor:!i,inactive_to_editor:!1})}))}_getCropDimensions(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o}=t,{width:l,height:a}=Ht(this._imageSize,r),{width:c,height:u}=i,d=n/l,p=o/a;return[xt(Math.round(c/d),1,l),xt(Math.round(u/p),1,a)]}_getCropTransformation(){let i=this.$["*cropBox"],t=this.$["*imageBox"],e=this.$["*operations"],{rotate:r}=e,{width:n,height:o,x:l,y:a}=t,{width:c,height:u}=Ht(this._imageSize,r),{x:d,y:p}=i,m=n/c,f=o/u,_=this._getCropDimensions(),A={dimensions:_,coords:[xt(Math.round((d-l)/m),0,c-_[0]),xt(Math.round((p-a)/f),0,u-_[1])]};if(!Lo(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(_[0]===c&&_[1]===u))return A}_commit(){if(!this.isConnected)return;let i=this.$["*operations"],{rotate:t,mirror:e,flip:r}=i,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:e,flip:r};this.$["*editorTransformations"]=l}setValue(i,t){console.log(`Apply cropper operation [${i}=${t}]`),this.$["*operations"]={...this.$["*operations"],[i]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(i){return this.$["*operations"][i]}async activate(i,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=i,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(e){console.error("Failed to activate cropper",{error:e})}this._observer=new ResizeObserver(([e])=>{e.contentRect.width>0&&e.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:i=!1}={}){var t;this._isActive&&(!i&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=D({active_from_viewer:!1,active_from_editor:!1,inactive_to_editor:!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let i=this._getCropDimensions(),t=Math.min(this.offsetWidth,i[0])/this.$["*cropBox"].width,e=Math.min(this.offsetHeight,i[1])/this.$["*cropBox"].height,r=Math.min(t,e),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,o=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${r}) translate(${(this.offsetWidth/2-n)/r}px, ${(this.offsetHeight/2-o)/r}px)`,this.style.transformOrigin=`${n}px ${o}px`}_transitionToImage(){let i=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${i}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}_waitForImage(i,t){let e=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=this.proxyUrl(Kt(i,e,t)),{promise:n,cancel:o,image:l}=ge(r),a=this._handleImageLoading(r);return l.addEventListener("load",a,{once:!0}),l.addEventListener("error",a,{once:!0}),this._cancelPreload&&this._cancelPreload(),this._cancelPreload=o,n.then(()=>l).catch(c=>(console.error("Failed to load image",{error:c}),this.$["*networkProblems"]=!0,Promise.resolve(l)))}_handleImageLoading(i){let t="crop",e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",i=>{i||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var i;super.destroyCallback(),(i=this._observer)==null||i.disconnect()}};ii.template=``;function Ki(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}function Uo(s){return s.reduce((i,t,e)=>er<=i&&i<=n);return s.map(r=>{let n=Math.abs(e[0]-e[1]),o=Math.abs(i-e[0])/n;return e[0]===r?i>t?1:1-o:e[1]===r?i>=t?o:1:0})}function Po(s,i){return s.map((t,e)=>tn-o)}var Yi=class extends O{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=S(this._addKeypoint.bind(this),600),this.classList.add("inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}_imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let n={...this._transformations};e&&(n[e]=t?{name:t,amount:r}:r);let o=this.offsetWidth;return this.proxyUrl(Kt(i,o,n))}_constructKeypoint(i,t){return{src:this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}_addKeypoint(i,t,e){let r=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(r())return;let n=this._constructKeypoint(i,e),o=new Image;o.src=n.src;let l=this._handleImageLoading(n.src);o.addEventListener("load",l,{once:!0}),o.addEventListener("error",l,{once:!0}),n.image=o,o.classList.add("fader-image"),o.addEventListener("load",()=>{if(r())return;let a=this._keypoints,c=a.findIndex(d=>d.value>e),u=c{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ot[i],r=this._keypoints.map(l=>l.value),n=Ro(r,t,e),o=Po(r,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=n[l],a.zIndex=o[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("fader-image","fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:r,promise:n,cancel:o}=_e(e);r.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),this._cancelLastImages=()=>{o(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await n,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,u)=>{let d=r[u];d.classList.add("fader-image"),c.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}setTransformations(i){if(this._transformations=i,this._previewImage){let t=this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Tr(e,r).map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a})),{cancel:l}=_e(o);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=D({active_from_viewer:this._fromViewer,active_from_cropper:!this._fromViewer,inactive_to_cropper:!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}activate({url:i,operation:t,value:e,filter:r,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=n,typeof e!="number"&&!r){let l=this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=Tr(t,e).map(l=>this._constructKeypoint(t,l)),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=D({active_from_viewer:!1,active_from_cropper:!1,inactive_to_cropper:!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Mo=1,si=class extends O{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Mo?this.scrollLeft+=e:this.scrollLeft+=t})}};si.template=" ";function No(s){return``}function Do(s){return`
`}var ri=class extends O{constructor(){super();h(this,"_updateInfoTooltip",S(()=>{var o,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",n=!1;if(this.$["*tabId"]===N.FILTERS)if(n=!0,this.$["*currentFilter"]&&((o=t==null?void 0:t.filter)==null?void 0:o.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;r=this.l10n(this.$["*currentFilter"])+" "+a}else r=this.l10n(ct);else if(this.$["*tabId"]===N.TUNING&&e){n=!0;let a=(t==null?void 0:t[e])||ot[e].zero;r=e+" "+a}n&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",n)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":ct,"*currentOperation":null,"*tabId":N.CROP,showLoader:!1,filters:ir,colorOperations:er,cropOperations:sr,"*operationTooltip":null,"l10n.cancel":this.l10n("cancel"),"l10n.apply":this.l10n("apply"),"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"sub-toolbar--top-hidden",visible:"sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"sub-toolbar--bottom-hidden",visible:"sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"tab-content--hidden",visible:"tab-content--visible"},"presence.tabToggleStyles":{hidden:"tab-toggle--hidden",visible:"tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"tab-toggles--hidden",visible:"tab-toggles--visible"},"on.cancel":()=>{this._cancelPreload&&this._cancelPreload(),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})}},this._debouncedShowLoader=S(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===N.TUNING&&this.ref["tooltip-el"].classList.toggle("info-tooltip_visible",!1)}_createOperationControl(t){let e=new be;return e.operation=t,e}_createFilterControl(t){let e=new Gt;return e.filter=t,e}_createToggleControl(t){let e=new fe;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===N.CROP?this.$.cropOperations.forEach(n=>{let o=this._createToggleControl(n);r.appendChild(o)}):t===N.FILTERS?[ct,...this.$.filters].forEach(n=>{let o=this._createFilterControl(n);r.appendChild(o)}):t===N.TUNING&&this.$.colorOperations.forEach(n=>{let o=this._createOperationControl(n);r.appendChild(o)}),[...r.children].forEach((n,o)=>{o===r.childNodes.length-1&&n.classList.add("controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===N.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of q){let n=r===t,o=this.ref[`tab-toggle-${r}`];o.active=n,n?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=n}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}_preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=this.proxyUrl(Kt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._cancelPreload&&this._cancelPreload();let{cancel:r}=_e([e]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,n]of r.entries())if(n){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of q){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};ri.template=`
{{*operationTooltip}}
${q.map(Do).join("")}
${q.map(No).join("")}
`;var ye=class extends b{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return D("icon",{icon_left:!this._iconReversed,icon_right:this._iconReversed,icon_hidden:this._iconHidden,icon_single:this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=i)}),this.sub("text",i=>{this._iconSingle=!1}),this.setAttribute("role","button"),this.tabIndex===-1&&(this.tabIndex=0),this.hasAttribute("theme")||this.setAttribute("theme","default")}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};ye.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});ye.template=`
{{text}}
`;var ni=class extends b{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};ni.template=`
`;var oi={transition:"transition",visible:"visible",hidden:"hidden"},li=class extends b{constructor(){super(),this._visible=!1,this._visibleStyle=oi.visible,this._hiddenStyle=oi.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",_r(this,{[oi.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.setAttribute("hidden",""),this._externalTransitions||this.classList.add(oi.transition),this._handleVisible(),setTimeout(()=>this.removeAttribute("hidden"),0)}};li.template=" ";var ai=class extends b{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${o}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),o=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${o}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),n=Math.ceil(r/2),o=Math.ceil(n/15)-2;if(this._stepsCount===o)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="minor-step",c.className="border-step",l.appendChild(c);for(let d=0;d
`;var Zi=class extends v{constructor(){super();h(this,"activityType",g.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new at,e=this.$.cdnUrl,r=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;t.setAttribute("ctx-name",this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),n&&t.setAttribute("tabs",n),t.addEventListener("apply",o=>this.handleApply(o)),t.addEventListener("cancel",()=>this.handleCancel()),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};var Fo=function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},xr=function(s,i="i"){let t=s.split("*").map(Fo);return new RegExp("^"+t.join(".+")+"$",i)};var Vo=s=>Object.keys(s).reduce((t,e)=>{let r=s[e],n=Object.keys(r).reduce((o,l)=>{let a=r[l];return o+`${l}: ${a};`},"");return t+`${e}{${n}}`},"");function Er({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,shadeColor:r}){let n=`solid 1px ${r}`;return Vo({body:{color:s,"background-color":i},".side-bar":{background:"inherit","border-right":n},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":n},".list-table-body .list-items":{"border-bottom":n},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"}})}var St={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in St){let t=St[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Ar=function(s,i,t){s in St||(St[s]=[]),St[s].push([i,t])},$r=function(s,i){s in St&&(St[s]=St[s].filter(t=>t[0]!==i))};function Sr(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var ci=class extends v{constructor(){super();h(this,"activityType",g.activities.EXTERNAL);h(this,"_iframe",null);h(this,"updateCssData",()=>{this.isActivityActive&&(this._inheritedUpdateCssData(),this.applyStyles())});h(this,"_inheritedUpdateCssData",this.updateCssData);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:n}=this.activityParams;this.addFileFromUrl(e,{fileName:r,source:n})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length})}extractUrlFromMessage(t){if(t.alternatives){let e=P(this.cfg.externalSourcesPreferredTypes);for(let r of e){let n=xr(r);for(let[o,l]of Object.entries(t.alternatives))if(n.test(o))return l}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){this.$.selectedList=[...this.$.selectedList,t]}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={backgroundColor:this.getCssValue("--clr-background-light"),textColor:this.getCssValue("--clr-txt"),shadeColor:this.getCssValue("--clr-shade-lv1"),linkColor:"#157cfc",linkColorHover:"#3891ff"};this.sendMessage({type:"embed-css",style:Er(t)})}remoteUrl(){var l,a;let t=this.cfg.pubkey,e=(!1).toString(),{externalSourceType:r}=this.activityParams,n={lang:((a=(l=this.getCssData("--l10n-locale-name"))==null?void 0:l.split("-"))==null?void 0:a[0])||"en",public_key:t,images_only:e,pass_window_open:!1,session_key:this.cfg.remoteTabSessionKey},o=new URL(this.cfg.socialBaseUrl);return o.pathname=`/window3/${r}`,o.search=Sr(n),o.toString()}mountIframe(){let t=Qt({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Ar("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&$r("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};ci.template=`
{{activityCaption}}
{{counter}}
`;var ve=class extends b{setCurrentTab(i){if(!i)return;[...this.ref.context.querySelectorAll("[tab-ctx]")].forEach(e=>{e.getAttribute("tab-ctx")===i?e.removeAttribute("hidden"):e.setAttribute("hidden","")});for(let e in this._tabMap)e===i?this._tabMap[e].setAttribute("current",""):this._tabMap[e].removeAttribute("current")}initCallback(){super.initCallback(),this._tabMap={},this.defineAccessor("tab-list",i=>{if(!i)return;P(i).forEach(e=>{let r=Qt({tag:"div",attributes:{class:"tab"},properties:{onclick:()=>{this.setCurrentTab(e)}}});r.textContent=this.l10n(e),this.ref.row.appendChild(r),this._tabMap[e]=r})}),this.defineAccessor("default",i=>{this.setCurrentTab(i)}),this.hasAttribute("default")||this.setCurrentTab(Object.keys(this._tabMap)[0])}};ve.bindAttributes({"tab-list":null,default:null});ve.template=`
`;var Yt=class extends v{constructor(){super();h(this,"processInnerHtml",!0);h(this,"requireCtxName",!0);this.init$={...this.init$,output:null}}get dict(){return Yt.dict}get validationInput(){return this._validationInputElement}initCallback(){if(super.initCallback(),this.hasAttribute(this.dict.FORM_INPUT_ATTR)){this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer);let t=document.createElement("input");t.type="text",t.name="__UPLOADCARE_VALIDATION_INPUT__",t.required=this.hasAttribute(this.dict.INPUT_REQUIRED),t.tabIndex=-1,yi(t,{opacity:0,height:0,width:0}),this.appendChild(t),this._validationInputElement=t}this.sub("output",t=>{if(this.hasAttribute(this.dict.FIRE_EVENT_ATTR)&&this.dispatchEvent(new CustomEvent(this.dict.EVENT_NAME,{bubbles:!0,composed:!0,detail:{timestamp:Date.now(),ctxName:this.ctxName,data:t}})),this.hasAttribute(this.dict.FORM_INPUT_ATTR)&&this._dynamicInputsContainer){this._dynamicInputsContainer.innerHTML="";let e;Array.isArray(t)?e=t.map(r=>r.cdnUrl):t!=null&&t.groupData?e=[t.groupData.cdnUrl]:e=[];for(let r of e){let n=document.createElement("input");n.type="hidden",n.name=this.getAttribute(this.dict.INPUT_NAME_ATTR)||this.ctxName,n.value=r!=null?r:"",this._dynamicInputsContainer.appendChild(n)}if(this._validationInputElement){this._validationInputElement.value=e.length?"__VALUE__":"";let r=this.$["*message"];r!=null&&r.isError?this._validationInputElement.setCustomValidity(`${r.caption}. ${r.text}`):this._validationInputElement.setCustomValidity("")}}this.hasAttribute(this.dict.CONSOLE_ATTR)&&console.log(t)},!1),this.sub(this.dict.SRC_CTX_KEY,async t=>{if(!t||!t.length){this.$.output=null;return}if(t.every(r=>r.isUploaded)&&(this.cfg.groupOutput||this.hasAttribute(this.dict.GROUP_ATTR))){let r=t.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:""));if(!t.every(a=>a.isValid)){this.$.output={groupData:void 0,files:t};return}let o=await this.getUploadClientOptions(),l=await Ts(r,o);this.$.output={groupData:l,files:t}}else this.$.output=t},!1)}};Yt.dict=Object.freeze({SRC_CTX_KEY:"*outputData",EVENT_NAME:"lr-data-output",FIRE_EVENT_ATTR:"use-event",CONSOLE_ATTR:"use-console",GROUP_ATTR:"use-group",FORM_INPUT_ATTR:"use-input",INPUT_NAME_ATTR:"input-name",INPUT_REQUIRED:"input-required"});var Ji=class extends g{};var hi=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.sub("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(n=>{e+=``}),this.$.selectHtml=e})}};hi.template=``;var K={PLAY:"play",PAUSE:"pause",FS_ON:"fullscreen-on",FS_OFF:"fullscreen-off",VOL_ON:"unmute",VOL_OFF:"mute",CAP_ON:"captions",CAP_OFF:"captions-off"},kr={requestFullscreen:s=>{s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()},exitFullscreen:()=>{document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},et=class extends b{constructor(){super(...arguments);h(this,"init$",{...this.init$,src:"",ppIcon:K.PLAY,fsIcon:K.FS_ON,volIcon:K.VOL_ON,capIcon:K.CAP_OFF,totalTime:"00:00",currentTime:"00:00",progressCssWidth:"0",hasSubtitles:!1,volumeDisabled:!1,volumeValue:0,onPP:()=>{this.togglePlay()},onFs:()=>{this.toggleFullscreen()},onCap:()=>{this.toggleCaptions()},onMute:()=>{this.toggleSound()},onVolChange:t=>{let e=parseFloat(t.currentTarget.$.value);this.setVolume(e)},progressClicked:t=>{let e=this.progress.getBoundingClientRect();this._video.currentTime=this._video.duration*(t.offsetX/e.width)}})}togglePlay(){this._video.paused||this._video.ended?this._video.play():this._video.pause()}toggleFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement)===this?kr.exitFullscreen():kr.requestFullscreen(this)}toggleCaptions(){this.$.capIcon===K.CAP_OFF?(this.$.capIcon=K.CAP_ON,this._video.textTracks[0].mode="showing",window.localStorage.setItem(et.is+":captions","1")):(this.$.capIcon=K.CAP_OFF,this._video.textTracks[0].mode="hidden",window.localStorage.removeItem(et.is+":captions"))}toggleSound(){this.$.volIcon===K.VOL_ON?(this.$.volIcon=K.VOL_OFF,this.$.volumeDisabled=!0,this._video.muted=!0):(this.$.volIcon=K.VOL_ON,this.$.volumeDisabled=!1,this._video.muted=!1)}setVolume(t){window.localStorage.setItem(et.is+":volume",t);let e=t?t/100:0;this._video.volume=e}get progress(){return this.ref.progress}_getUrl(t){return t.includes("/")?t:`https://ucarecdn.com/${t}/`}_desc2attrs(t){let e=[];for(let r in t){let n=r==="src"?this._getUrl(t[r]):t[r];e.push(`${r}="${n}"`)}return e.join(" ")}_timeFmt(t){let e=new Date(Math.round(t)*1e3);return[e.getMinutes(),e.getSeconds()].map(r=>r<10?"0"+r:r).join(":")}_initTracks(){[...this._video.textTracks].forEach(t=>{t.mode="hidden"}),window.localStorage.getItem(et.is+":captions")&&this.toggleCaptions()}_castAttributes(){let t=["autoplay","loop","muted"];[...this.attributes].forEach(e=>{t.includes(e.name)&&this._video.setAttribute(e.name,e.value)})}initCallback(){super.initCallback(),this._video=this.ref.video,this._castAttributes(),this._video.addEventListener("play",()=>{this.$.ppIcon=K.PAUSE,this.setAttribute("playback","")}),this._video.addEventListener("pause",()=>{this.$.ppIcon=K.PLAY,this.removeAttribute("playback")}),this.addEventListener("fullscreenchange",e=>{console.log(e),document.fullscreenElement===this?this.$.fsIcon=K.FS_OFF:this.$.fsIcon=K.FS_ON}),this.sub("src",e=>{if(!e)return;let r=this._getUrl(e);this._video.src=r}),this.sub("video",async e=>{if(!e)return;let r=await(await window.fetch(this._getUrl(e))).json();r.poster&&(this._video.poster=this._getUrl(r.poster));let n="";r==null||r.sources.forEach(o=>{n+=``}),r.tracks&&(r.tracks.forEach(o=>{n+=``}),this.$.hasSubtitles=!0),this._video.innerHTML+=n,this._initTracks(),console.log(r)}),this._video.addEventListener("loadedmetadata",e=>{this.$.currentTime=this._timeFmt(this._video.currentTime),this.$.totalTime=this._timeFmt(this._video.duration)}),this._video.addEventListener("timeupdate",e=>{let r=Math.round(100*(this._video.currentTime/this._video.duration));this.$.progressCssWidth=r+"%",this.$.currentTime=this._timeFmt(this._video.currentTime)});let t=window.localStorage.getItem(et.is+":volume");if(t){let e=parseFloat(t);this.setVolume(e),this.$.volumeValue=e}}};et.template=`
{{currentTime}} / {{totalTime}}
`;et.bindAttributes({video:"video",src:"src"});var Bo="css-src";function ui(s){return class extends s{constructor(){super(...arguments);h(this,"renderShadow",!0);h(this,"pauseRender",!0);h(this,"requireCtxName",!0)}shadowReadyCallback(){}initCallback(){super.initCallback(),this.setAttribute("hidden",""),Re({element:this,attribute:Bo,onSuccess:t=>{this.attachShadow({mode:"open"});let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onload=()=>{window.requestAnimationFrame(()=>{this.render(),window.setTimeout(()=>{this.removeAttribute("hidden"),this.shadowReadyCallback()})})},this.shadowRoot.prepend(e)},onTimeout:()=>{console.error("Attribute `css-src` is required and it is not set. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/")}})}}}var Ce=class extends ui(b){};var di=class extends b{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};h(di,"template",`Powered by Uploadcare`);var kt=class extends Ce{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Oe(this));h(this,"_template",null)}static set template(t){this._template=t+""}static get template(){return this._template}};var pi=class extends kt{};pi.template=``;var fi=class extends kt{constructor(){super(...arguments);h(this,"pauseRender",!0)}shadowReadyCallback(){let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=g.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||g.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};fi.template=``;var mi=class extends kt{shadowReadyCallback(){let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{((t==null?void 0:t.length)>0&&this.$["*currentActivity"]===i.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)})}};mi.template=``;var Qi=class extends ui(at){shadowReadyCallback(){this.__shadowReady=!0,this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async initEditor(){this.__shadowReady&&await super.initEditor()}};function ts(s){for(let i in s){let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("lr-")||(t="lr-"+t),s[i].reg&&s[i].reg(t)}}var es="LR";async function zo(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[es]){t(window[es]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let n=window[es];i&&ts(n),t(n)},document.head.appendChild(r)})}export{g as ActivityBlock,Ji as ActivityHeader,Ft as BaseComponent,b as Block,Ke as CameraSource,Qi as CloudImageEditor,Zi as CloudImageEditorActivity,at as CloudImageEditorBlock,je as Config,Ze as ConfirmationDialog,di as Copyright,ti as CropFrame,$ as Data,Yt as DataOutput,he as DropArea,fe as EditorCropButtonControl,Gt as EditorFilterControl,ii as EditorImageCropper,Yi as EditorImageFader,be as EditorOperationControl,si as EditorScroller,ei as EditorSlider,ri as EditorToolbar,ci as ExternalSource,bt as FileItem,pe as FilePreview,mi as FileUploaderInline,fi as FileUploaderMinimal,pi as FileUploaderRegular,le as Icon,Bi as Img,ni as LineLoaderUi,ye as LrBtnUi,Xe as MessageBox,ee as Modal,Ds as PACKAGE_NAME,Fs as PACKAGE_VERSION,li as PresenceToggle,Qe as ProgressBar,Je as ProgressBarCommon,hi as Select,Ce as ShadowWrapper,ce as SimpleBtn,ai as SliderUi,ue as SourceBtn,Wi as SourceList,zi as StartFrom,ve as Tabs,qi as UploadCtxProvider,Ye as UploadDetails,qe as UploadList,v as UploaderBlock,Ge as UrlSource,et as Video,zo as connectBlocksFrom,ts as registerBlocks,ui as shadowed,gt as toKebabCase}; \ No newline at end of file