@uploadcare/file-uploader 1.22.0 → 1.24.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.d.ts +14 -0
- package/dist/abstract/loadFileUploaderFrom.js +78 -0
- package/dist/env.d.ts +4 -0
- package/dist/env.js +36 -0
- package/dist/index.css +2714 -0
- package/dist/index.d.ts +2043 -0
- package/dist/index.js +11914 -0
- package/{index.ssr.js → dist/index.ssr.js} +1113 -1082
- package/{locales → dist/locales}/file-uploader/ar.d.ts +5 -3
- package/dist/locales/file-uploader/ar.js +168 -0
- package/{locales → dist/locales}/file-uploader/az.d.ts +5 -3
- package/dist/locales/file-uploader/az.js +160 -0
- package/{locales → dist/locales}/file-uploader/ca.d.ts +5 -3
- package/dist/locales/file-uploader/ca.js +162 -0
- package/{locales → dist/locales}/file-uploader/cs.d.ts +5 -3
- package/dist/locales/file-uploader/cs.js +164 -0
- package/{locales → dist/locales}/file-uploader/da.d.ts +5 -3
- package/dist/locales/file-uploader/da.js +160 -0
- package/{locales → dist/locales}/file-uploader/de.d.ts +5 -3
- package/dist/locales/file-uploader/de.js +160 -0
- package/{locales → dist/locales}/file-uploader/el.d.ts +5 -3
- package/dist/locales/file-uploader/el.js +160 -0
- package/{locales → dist/locales}/file-uploader/en.d.ts +5 -3
- package/dist/locales/file-uploader/en.js +160 -0
- package/{locales → dist/locales}/file-uploader/es.d.ts +5 -3
- package/dist/locales/file-uploader/es.js +162 -0
- package/{locales → dist/locales}/file-uploader/et.d.ts +5 -3
- package/dist/locales/file-uploader/et.js +160 -0
- package/{locales → dist/locales}/file-uploader/fi.d.ts +5 -3
- package/dist/locales/file-uploader/fi.js +160 -0
- package/{locales → dist/locales}/file-uploader/fr.d.ts +5 -3
- package/dist/locales/file-uploader/fr.js +162 -0
- package/{locales → dist/locales}/file-uploader/he.d.ts +5 -3
- package/dist/locales/file-uploader/he.js +162 -0
- package/{locales → dist/locales}/file-uploader/hy.d.ts +5 -3
- package/dist/locales/file-uploader/hy.js +160 -0
- package/{locales → dist/locales}/file-uploader/is.d.ts +5 -3
- package/dist/locales/file-uploader/is.js +160 -0
- package/{locales → dist/locales}/file-uploader/it.d.ts +5 -3
- package/dist/locales/file-uploader/it.js +162 -0
- package/{locales → dist/locales}/file-uploader/ja.d.ts +5 -3
- package/dist/locales/file-uploader/ja.js +160 -0
- package/{locales → dist/locales}/file-uploader/ka.d.ts +5 -3
- package/dist/locales/file-uploader/ka.js +160 -0
- package/{locales → dist/locales}/file-uploader/kk.d.ts +5 -3
- package/dist/locales/file-uploader/kk.js +160 -0
- package/{locales → dist/locales}/file-uploader/ko.d.ts +5 -3
- package/dist/locales/file-uploader/ko.js +160 -0
- package/{locales → dist/locales}/file-uploader/lv.d.ts +5 -3
- package/dist/locales/file-uploader/lv.js +162 -0
- package/{locales → dist/locales}/file-uploader/nb.d.ts +5 -3
- package/dist/locales/file-uploader/nb.js +160 -0
- package/{locales → dist/locales}/file-uploader/nl.d.ts +5 -3
- package/dist/locales/file-uploader/nl.js +160 -0
- package/{locales → dist/locales}/file-uploader/pl.d.ts +5 -3
- package/dist/locales/file-uploader/pl.js +164 -0
- package/{locales → dist/locales}/file-uploader/pt.d.ts +5 -3
- package/dist/locales/file-uploader/pt.js +162 -0
- package/{locales → dist/locales}/file-uploader/ro.d.ts +5 -3
- package/dist/locales/file-uploader/ro.js +162 -0
- package/{locales → dist/locales}/file-uploader/ru.d.ts +5 -3
- package/dist/locales/file-uploader/ru.js +164 -0
- package/{locales → dist/locales}/file-uploader/sk.d.ts +5 -3
- package/dist/locales/file-uploader/sk.js +164 -0
- package/{locales → dist/locales}/file-uploader/sr.d.ts +5 -3
- package/dist/locales/file-uploader/sr.js +162 -0
- package/{locales → dist/locales}/file-uploader/sv.d.ts +5 -3
- package/dist/locales/file-uploader/sv.js +160 -0
- package/{locales → dist/locales}/file-uploader/tr.d.ts +5 -3
- package/dist/locales/file-uploader/tr.js +160 -0
- package/{locales → dist/locales}/file-uploader/uk.d.ts +5 -3
- package/dist/locales/file-uploader/uk.js +164 -0
- package/{locales → dist/locales}/file-uploader/vi.d.ts +5 -3
- package/dist/locales/file-uploader/vi.js +160 -0
- package/{locales → dist/locales}/file-uploader/zh-TW.d.ts +5 -3
- package/dist/locales/file-uploader/zh-TW.js +160 -0
- package/{locales → dist/locales}/file-uploader/zh.d.ts +5 -3
- package/dist/locales/file-uploader/zh.js +160 -0
- package/package.json +110 -63
- package/types/jsx.d.ts +10 -10
- package/web/file-uploader.iife.min.d.ts +2057 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +2057 -0
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +26 -1
- package/web/uc-cloud-image-editor.min.css +26 -1
- package/web/uc-cloud-image-editor.min.d.ts +1544 -0
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +26 -1
- package/web/uc-file-uploader-inline.min.d.ts +2057 -0
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.css +26 -1
- package/web/uc-file-uploader-minimal.min.d.ts +2057 -0
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.css +26 -1
- package/web/uc-file-uploader-regular.min.d.ts +2057 -0
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/{blocks/Img/ImgBase.d.ts → web/uc-img.min.d.ts} +38 -3
- package/web/uc-img.min.js +3 -3
- package/abstract/ActivityBlock.d.ts +0 -79
- package/abstract/ActivityBlock.d.ts.map +0 -1
- package/abstract/ActivityBlock.js +0 -216
- package/abstract/Block.d.ts +0 -113
- package/abstract/Block.d.ts.map +0 -1
- package/abstract/Block.js +0 -410
- package/abstract/CTX.d.ts +0 -30
- package/abstract/CTX.d.ts.map +0 -1
- package/abstract/CTX.js +0 -39
- package/abstract/SolutionBlock.d.ts +0 -22
- package/abstract/SolutionBlock.d.ts.map +0 -1
- package/abstract/SolutionBlock.js +0 -23
- package/abstract/TypedCollection.d.ts +0 -127
- package/abstract/TypedCollection.d.ts.map +0 -1
- package/abstract/TypedCollection.js +0 -265
- package/abstract/TypedData.d.ts +0 -93
- package/abstract/TypedData.d.ts.map +0 -1
- package/abstract/TypedData.js +0 -134
- package/abstract/UploaderBlock.d.ts +0 -121
- package/abstract/UploaderBlock.d.ts.map +0 -1
- package/abstract/UploaderBlock.js +0 -511
- package/abstract/UploaderPublicApi.d.ts +0 -100
- package/abstract/UploaderPublicApi.d.ts.map +0 -1
- package/abstract/UploaderPublicApi.js +0 -399
- package/abstract/buildOutputCollectionState.d.ts +0 -8
- package/abstract/buildOutputCollectionState.d.ts.map +0 -1
- package/abstract/buildOutputCollectionState.js +0 -136
- package/abstract/defineComponents.d.ts +0 -5
- package/abstract/defineComponents.d.ts.map +0 -1
- package/abstract/defineComponents.js +0 -21
- package/abstract/l10nProcessor.d.ts +0 -7
- package/abstract/l10nProcessor.d.ts.map +0 -1
- package/abstract/l10nProcessor.js +0 -93
- package/abstract/loadFileUploaderFrom.d.ts +0 -8
- package/abstract/loadFileUploaderFrom.d.ts.map +0 -1
- package/abstract/loadFileUploaderFrom.js +0 -34
- package/abstract/localeRegistry.d.ts +0 -5
- package/abstract/localeRegistry.d.ts.map +0 -1
- package/abstract/localeRegistry.js +0 -63
- package/abstract/managers/LocaleManager.d.ts +0 -38
- package/abstract/managers/LocaleManager.d.ts.map +0 -1
- package/abstract/managers/LocaleManager.js +0 -130
- package/abstract/managers/ModalManager.d.ts +0 -122
- package/abstract/managers/ModalManager.d.ts.map +0 -1
- package/abstract/managers/ModalManager.js +0 -235
- package/abstract/managers/SecureUploadsManager.d.ts +0 -22
- package/abstract/managers/SecureUploadsManager.d.ts.map +0 -1
- package/abstract/managers/SecureUploadsManager.js +0 -91
- package/abstract/managers/TelemetryManager.d.ts +0 -71
- package/abstract/managers/TelemetryManager.d.ts.map +0 -1
- package/abstract/managers/TelemetryManager.js +0 -218
- package/abstract/managers/ValidationManager.d.ts +0 -150
- package/abstract/managers/ValidationManager.d.ts.map +0 -1
- package/abstract/managers/ValidationManager.js +0 -164
- package/abstract/managers/a11y.d.ts +0 -20
- package/abstract/managers/a11y.d.ts.map +0 -1
- package/abstract/managers/a11y.js +0 -118
- package/abstract/sharedConfigKey.d.ts +0 -2
- package/abstract/sharedConfigKey.d.ts.map +0 -1
- package/abstract/sharedConfigKey.js +0 -8
- package/abstract/testModeProcessor.d.ts +0 -7
- package/abstract/testModeProcessor.d.ts.map +0 -1
- package/abstract/testModeProcessor.js +0 -39
- package/abstract/uploadEntrySchema.d.ts +0 -126
- package/abstract/uploadEntrySchema.d.ts.map +0 -1
- package/abstract/uploadEntrySchema.js +0 -124
- package/blocks/ActivityHeader/ActivityHeader.d.ts +0 -4
- package/blocks/ActivityHeader/ActivityHeader.d.ts.map +0 -1
- package/blocks/ActivityHeader/ActivityHeader.js +0 -3
- package/blocks/ActivityHeader/activity-header.css +0 -14
- package/blocks/CameraSource/CameraSource.d.ts +0 -176
- package/blocks/CameraSource/CameraSource.d.ts.map +0 -1
- package/blocks/CameraSource/CameraSource.js +0 -929
- package/blocks/CameraSource/calcCameraModes.d.ts +0 -5
- package/blocks/CameraSource/calcCameraModes.d.ts.map +0 -1
- package/blocks/CameraSource/calcCameraModes.js +0 -11
- package/blocks/CameraSource/camera-source.css +0 -183
- package/blocks/CameraSource/constants.d.ts +0 -16
- package/blocks/CameraSource/constants.d.ts.map +0 -1
- package/blocks/CameraSource/constants.js +0 -19
- package/blocks/CloudImageEditor/index.css +0 -1
- package/blocks/CloudImageEditor/index.d.ts +0 -2
- package/blocks/CloudImageEditor/index.d.ts.map +0 -1
- package/blocks/CloudImageEditor/index.js +0 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +0 -59
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +0 -243
- package/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -158
- package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/CropFrame.js +0 -569
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +0 -14
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.js +0 -140
- package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +0 -10
- package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +0 -45
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +0 -6
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +0 -52
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +0 -18
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +0 -177
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +0 -106
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +0 -551
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +0 -132
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorImageFader.js +0 -456
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +0 -9
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.js +0 -50
- package/blocks/CloudImageEditor/src/EditorScroller.d.ts +0 -7
- package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorScroller.js +0 -33
- package/blocks/CloudImageEditor/src/EditorSlider.d.ts +0 -24
- package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorSlider.js +0 -118
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +0 -124
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +0 -534
- package/blocks/CloudImageEditor/src/crop-utils.d.ts +0 -123
- package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/crop-utils.js +0 -729
- package/blocks/CloudImageEditor/src/cropper-constants.d.ts +0 -11
- package/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/cropper-constants.js +0 -11
- package/blocks/CloudImageEditor/src/css/common.css +0 -1259
- package/blocks/CloudImageEditor/src/css/icons.css +0 -12
- package/blocks/CloudImageEditor/src/css/index.css +0 -2
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +0 -21
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +0 -99
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +0 -11
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +0 -52
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +0 -17
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +0 -71
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +0 -16
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +0 -179
- package/blocks/CloudImageEditor/src/index.d.ts +0 -16
- package/blocks/CloudImageEditor/src/index.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/index.js +0 -15
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +0 -15
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/FocusVisible.js +0 -33
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +0 -10
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +0 -256
- package/blocks/CloudImageEditor/src/lib/classNames.d.ts +0 -3
- package/blocks/CloudImageEditor/src/lib/classNames.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/classNames.js +0 -34
- package/blocks/CloudImageEditor/src/lib/linspace.d.ts +0 -8
- package/blocks/CloudImageEditor/src/lib/linspace.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/linspace.js +0 -14
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +0 -3
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +0 -80
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +0 -2
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.js +0 -35
- package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +0 -2
- package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseTabs.js +0 -14
- package/blocks/CloudImageEditor/src/lib/pick.d.ts +0 -7
- package/blocks/CloudImageEditor/src/lib/pick.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/pick.js +0 -15
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +0 -14
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/transformationUtils.js +0 -167
- package/blocks/CloudImageEditor/src/state.d.ts +0 -38
- package/blocks/CloudImageEditor/src/state.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/state.js +0 -92
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts +0 -3
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/svg-sprite.js +0 -1
- package/blocks/CloudImageEditor/src/template.d.ts +0 -2
- package/blocks/CloudImageEditor/src/template.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/template.js +0 -36
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -59
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.js +0 -116
- package/blocks/CloudImageEditor/src/types.d.ts +0 -66
- package/blocks/CloudImageEditor/src/types.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/types.js +0 -80
- package/blocks/CloudImageEditor/src/util.d.ts +0 -2
- package/blocks/CloudImageEditor/src/util.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/util.js +0 -21
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -11
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +0 -11
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +0 -29
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +0 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +0 -128
- package/blocks/CloudImageEditorActivity/index.css +0 -13
- package/blocks/CloudImageEditorActivity/test.d.ts +0 -2
- package/blocks/CloudImageEditorActivity/test.d.ts.map +0 -1
- package/blocks/CloudImageEditorActivity/test.js +0 -9
- package/blocks/Config/Config.d.ts +0 -60
- package/blocks/Config/Config.d.ts.map +0 -1
- package/blocks/Config/Config.js +0 -263
- package/blocks/Config/assertions.d.ts +0 -5
- package/blocks/Config/assertions.d.ts.map +0 -1
- package/blocks/Config/assertions.js +0 -37
- package/blocks/Config/config.css +0 -3
- package/blocks/Config/initialConfig.d.ts +0 -7
- package/blocks/Config/initialConfig.d.ts.map +0 -1
- package/blocks/Config/initialConfig.js +0 -91
- package/blocks/Config/normalizeConfigValue.d.ts +0 -2
- package/blocks/Config/normalizeConfigValue.d.ts.map +0 -1
- package/blocks/Config/normalizeConfigValue.js +0 -127
- package/blocks/Config/side-effects.d.ts +0 -11
- package/blocks/Config/side-effects.d.ts.map +0 -1
- package/blocks/Config/side-effects.js +0 -126
- package/blocks/Config/validatorsType.d.ts +0 -37
- package/blocks/Config/validatorsType.d.ts.map +0 -1
- package/blocks/Config/validatorsType.js +0 -134
- package/blocks/Copyright/Copyright.d.ts +0 -4
- package/blocks/Copyright/Copyright.d.ts.map +0 -1
- package/blocks/Copyright/Copyright.js +0 -24
- package/blocks/Copyright/copyright.css +0 -32
- package/blocks/DropArea/DropArea.d.ts +0 -49
- package/blocks/DropArea/DropArea.d.ts.map +0 -1
- package/blocks/DropArea/DropArea.js +0 -292
- package/blocks/DropArea/addDropzone.d.ts +0 -21
- package/blocks/DropArea/addDropzone.d.ts.map +0 -1
- package/blocks/DropArea/addDropzone.js +0 -137
- package/blocks/DropArea/drop-area.css +0 -201
- package/blocks/DropArea/getDropItems.d.ts +0 -16
- package/blocks/DropArea/getDropItems.d.ts.map +0 -1
- package/blocks/DropArea/getDropItems.js +0 -167
- package/blocks/ExternalSource/ExternalSource.d.ts +0 -82
- package/blocks/ExternalSource/ExternalSource.d.ts.map +0 -1
- package/blocks/ExternalSource/ExternalSource.js +0 -320
- package/blocks/ExternalSource/MessageBridge.d.ts +0 -20
- package/blocks/ExternalSource/MessageBridge.d.ts.map +0 -1
- package/blocks/ExternalSource/MessageBridge.js +0 -73
- package/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -3
- package/blocks/ExternalSource/buildThemeDefinition.d.ts.map +0 -1
- package/blocks/ExternalSource/buildThemeDefinition.js +0 -47
- package/blocks/ExternalSource/external-source.css +0 -94
- package/blocks/ExternalSource/query-string.d.ts +0 -8
- package/blocks/ExternalSource/query-string.d.ts.map +0 -1
- package/blocks/ExternalSource/query-string.js +0 -14
- package/blocks/ExternalSource/types.d.ts +0 -106
- package/blocks/ExternalSource/types.d.ts.map +0 -1
- package/blocks/ExternalSource/types.js +0 -133
- package/blocks/FileItem/FileItem.d.ts +0 -76
- package/blocks/FileItem/FileItem.d.ts.map +0 -1
- package/blocks/FileItem/FileItem.js +0 -461
- package/blocks/FileItem/FileItemConfig.d.ts +0 -28
- package/blocks/FileItem/FileItemConfig.d.ts.map +0 -1
- package/blocks/FileItem/FileItemConfig.js +0 -74
- package/blocks/FileItem/file-item.css +0 -243
- package/blocks/FormInput/FormInput.d.ts +0 -7
- package/blocks/FormInput/FormInput.d.ts.map +0 -1
- package/blocks/FormInput/FormInput.js +0 -92
- package/blocks/Icon/Icon.d.ts +0 -11
- package/blocks/Icon/Icon.d.ts.map +0 -1
- package/blocks/Icon/Icon.js +0 -43
- package/blocks/Icon/icon.css +0 -12
- package/blocks/Img/Img.d.ts +0 -4
- package/blocks/Img/Img.d.ts.map +0 -1
- package/blocks/Img/Img.js +0 -21
- package/blocks/Img/ImgBase.d.ts.map +0 -1
- package/blocks/Img/ImgBase.js +0 -408
- package/blocks/Img/ImgConfig.d.ts +0 -31
- package/blocks/Img/ImgConfig.d.ts.map +0 -1
- package/blocks/Img/ImgConfig.js +0 -102
- package/blocks/Img/configurations.d.ts +0 -12
- package/blocks/Img/configurations.d.ts.map +0 -1
- package/blocks/Img/configurations.js +0 -14
- package/blocks/Img/props-map.d.ts +0 -29
- package/blocks/Img/props-map.d.ts.map +0 -1
- package/blocks/Img/props-map.js +0 -34
- package/blocks/Img/test.css +0 -16
- package/blocks/Img/utils/parseObjectToString.d.ts +0 -2
- package/blocks/Img/utils/parseObjectToString.d.ts.map +0 -1
- package/blocks/Img/utils/parseObjectToString.js +0 -13
- package/blocks/Modal/Modal.d.ts +0 -43
- package/blocks/Modal/Modal.d.ts.map +0 -1
- package/blocks/Modal/Modal.js +0 -158
- package/blocks/Modal/modal.css +0 -45
- package/blocks/ProgressBar/ProgressBar.d.ts +0 -17
- package/blocks/ProgressBar/ProgressBar.d.ts.map +0 -1
- package/blocks/ProgressBar/ProgressBar.js +0 -62
- package/blocks/ProgressBar/progress-bar.css +0 -62
- package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +0 -8
- package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +0 -1
- package/blocks/ProgressBarCommon/ProgressBarCommon.js +0 -44
- package/blocks/ProgressBarCommon/progress-bar-common.css +0 -16
- package/blocks/Range/Range.d.ts +0 -16
- package/blocks/Range/Range.d.ts.map +0 -1
- package/blocks/Range/Range.js +0 -44
- package/blocks/Range/range.css +0 -65
- package/blocks/Select/Select.d.ts +0 -9
- package/blocks/Select/Select.d.ts.map +0 -1
- package/blocks/Select/Select.js +0 -35
- package/blocks/Select/select.css +0 -22
- package/blocks/SimpleBtn/SimpleBtn.d.ts +0 -25
- package/blocks/SimpleBtn/SimpleBtn.d.ts.map +0 -1
- package/blocks/SimpleBtn/SimpleBtn.js +0 -54
- package/blocks/SimpleBtn/simple-btn.css +0 -64
- package/blocks/SourceBtn/SourceBtn.d.ts +0 -57
- package/blocks/SourceBtn/SourceBtn.d.ts.map +0 -1
- package/blocks/SourceBtn/SourceBtn.js +0 -172
- package/blocks/SourceBtn/source-btn.css +0 -53
- package/blocks/SourceList/SourceList.d.ts +0 -4
- package/blocks/SourceList/SourceList.d.ts.map +0 -1
- package/blocks/SourceList/SourceList.js +0 -51
- package/blocks/Spinner/Spinner.d.ts +0 -8
- package/blocks/Spinner/Spinner.d.ts.map +0 -1
- package/blocks/Spinner/Spinner.js +0 -5
- package/blocks/Spinner/spinner.css +0 -18
- package/blocks/StartFrom/StartFrom.d.ts +0 -7
- package/blocks/StartFrom/StartFrom.d.ts.map +0 -1
- package/blocks/StartFrom/StartFrom.js +0 -14
- package/blocks/StartFrom/start-from.css +0 -28
- package/blocks/Thumb/Thumb.d.ts +0 -51
- package/blocks/Thumb/Thumb.d.ts.map +0 -1
- package/blocks/Thumb/Thumb.js +0 -235
- package/blocks/Thumb/thumb.css +0 -4
- package/blocks/UploadCtxProvider/EventEmitter.d.ts +0 -125
- package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +0 -1
- package/blocks/UploadCtxProvider/EventEmitter.js +0 -144
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +0 -35
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +0 -1
- package/blocks/UploadCtxProvider/UploadCtxProvider.js +0 -46
- package/blocks/UploadList/UploadList.d.ts +0 -60
- package/blocks/UploadList/UploadList.d.ts.map +0 -1
- package/blocks/UploadList/UploadList.js +0 -263
- package/blocks/UploadList/upload-list.css +0 -88
- package/blocks/UrlSource/UrlSource.d.ts +0 -9
- package/blocks/UrlSource/UrlSource.d.ts.map +0 -1
- package/blocks/UrlSource/UrlSource.js +0 -69
- package/blocks/UrlSource/url-source.css +0 -16
- package/blocks/svg-backgrounds/svg-backgrounds.d.ts +0 -17
- package/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +0 -1
- package/blocks/svg-backgrounds/svg-backgrounds.js +0 -45
- package/blocks/themes/uc-basic/common.css +0 -129
- package/blocks/themes/uc-basic/config.css +0 -4
- package/blocks/themes/uc-basic/index.css +0 -37
- package/blocks/themes/uc-basic/post-reset.css +0 -3
- package/blocks/themes/uc-basic/svg-sprite.d.ts +0 -3
- package/blocks/themes/uc-basic/svg-sprite.d.ts.map +0 -1
- package/blocks/themes/uc-basic/svg-sprite.js +0 -1
- package/blocks/themes/uc-basic/theme.css +0 -291
- package/blocks/utils/UploadSource.d.ts +0 -39
- package/blocks/utils/UploadSource.d.ts.map +0 -1
- package/blocks/utils/UploadSource.js +0 -33
- package/blocks/utils/abilities.d.ts +0 -2
- package/blocks/utils/abilities.d.ts.map +0 -1
- package/blocks/utils/abilities.js +0 -3
- package/blocks/utils/comma-separated.d.ts +0 -3
- package/blocks/utils/comma-separated.d.ts.map +0 -1
- package/blocks/utils/comma-separated.js +0 -22
- package/blocks/utils/debounce.d.ts +0 -12
- package/blocks/utils/debounce.d.ts.map +0 -1
- package/blocks/utils/debounce.js +0 -22
- package/blocks/utils/preloadImage.d.ts +0 -11
- package/blocks/utils/preloadImage.d.ts.map +0 -1
- package/blocks/utils/preloadImage.js +0 -38
- package/blocks/utils/resizeImage.d.ts +0 -6
- package/blocks/utils/resizeImage.d.ts.map +0 -1
- package/blocks/utils/resizeImage.js +0 -40
- package/blocks/utils/throttle.d.ts +0 -6
- package/blocks/utils/throttle.d.ts.map +0 -1
- package/blocks/utils/throttle.js +0 -45
- package/blocks/utils/userAgent.d.ts +0 -6
- package/blocks/utils/userAgent.d.ts.map +0 -1
- package/blocks/utils/userAgent.js +0 -14
- package/env.d.ts +0 -4
- package/env.d.ts.map +0 -1
- package/env.js +0 -3
- package/index.d.ts +0 -43
- package/index.d.ts.map +0 -1
- package/index.js +0 -55
- package/index.ssr.d.ts +0 -1111
- package/index.ssr.d.ts.map +0 -1
- package/locales/file-uploader/ar.d.ts.map +0 -1
- package/locales/file-uploader/ar.js +0 -137
- package/locales/file-uploader/az.d.ts.map +0 -1
- package/locales/file-uploader/az.js +0 -130
- package/locales/file-uploader/ca.d.ts.map +0 -1
- package/locales/file-uploader/ca.js +0 -134
- package/locales/file-uploader/cs.d.ts.map +0 -1
- package/locales/file-uploader/cs.js +0 -136
- package/locales/file-uploader/da.d.ts.map +0 -1
- package/locales/file-uploader/da.js +0 -132
- package/locales/file-uploader/de.d.ts.map +0 -1
- package/locales/file-uploader/de.js +0 -133
- package/locales/file-uploader/el.d.ts.map +0 -1
- package/locales/file-uploader/el.js +0 -133
- package/locales/file-uploader/en.d.ts.map +0 -1
- package/locales/file-uploader/en.js +0 -129
- package/locales/file-uploader/es.d.ts.map +0 -1
- package/locales/file-uploader/es.js +0 -134
- package/locales/file-uploader/et.d.ts.map +0 -1
- package/locales/file-uploader/et.js +0 -131
- package/locales/file-uploader/fi.d.ts.map +0 -1
- package/locales/file-uploader/fi.js +0 -132
- package/locales/file-uploader/fr.d.ts.map +0 -1
- package/locales/file-uploader/fr.js +0 -134
- package/locales/file-uploader/he.d.ts.map +0 -1
- package/locales/file-uploader/he.js +0 -133
- package/locales/file-uploader/hy.d.ts.map +0 -1
- package/locales/file-uploader/hy.js +0 -130
- package/locales/file-uploader/is.d.ts.map +0 -1
- package/locales/file-uploader/is.js +0 -131
- package/locales/file-uploader/it.d.ts.map +0 -1
- package/locales/file-uploader/it.js +0 -134
- package/locales/file-uploader/ja.d.ts.map +0 -1
- package/locales/file-uploader/ja.js +0 -131
- package/locales/file-uploader/ka.d.ts.map +0 -1
- package/locales/file-uploader/ka.js +0 -131
- package/locales/file-uploader/kk.d.ts.map +0 -1
- package/locales/file-uploader/kk.js +0 -131
- package/locales/file-uploader/ko.d.ts.map +0 -1
- package/locales/file-uploader/ko.js +0 -130
- package/locales/file-uploader/lv.d.ts.map +0 -1
- package/locales/file-uploader/lv.js +0 -133
- package/locales/file-uploader/nb.d.ts.map +0 -1
- package/locales/file-uploader/nb.js +0 -131
- package/locales/file-uploader/nl.d.ts.map +0 -1
- package/locales/file-uploader/nl.js +0 -132
- package/locales/file-uploader/pl.d.ts.map +0 -1
- package/locales/file-uploader/pl.js +0 -135
- package/locales/file-uploader/pt.d.ts.map +0 -1
- package/locales/file-uploader/pt.js +0 -134
- package/locales/file-uploader/ro.d.ts.map +0 -1
- package/locales/file-uploader/ro.js +0 -134
- package/locales/file-uploader/ru.d.ts.map +0 -1
- package/locales/file-uploader/ru.js +0 -133
- package/locales/file-uploader/sk.d.ts.map +0 -1
- package/locales/file-uploader/sk.js +0 -135
- package/locales/file-uploader/sr.d.ts.map +0 -1
- package/locales/file-uploader/sr.js +0 -133
- package/locales/file-uploader/sv.d.ts.map +0 -1
- package/locales/file-uploader/sv.js +0 -131
- package/locales/file-uploader/tr.d.ts.map +0 -1
- package/locales/file-uploader/tr.js +0 -131
- package/locales/file-uploader/uk.d.ts.map +0 -1
- package/locales/file-uploader/uk.js +0 -135
- package/locales/file-uploader/vi.d.ts.map +0 -1
- package/locales/file-uploader/vi.js +0 -131
- package/locales/file-uploader/zh-TW.d.ts.map +0 -1
- package/locales/file-uploader/zh-TW.js +0 -131
- package/locales/file-uploader/zh.d.ts.map +0 -1
- package/locales/file-uploader/zh.js +0 -129
- package/solutions/adaptive-image/index.d.ts +0 -3
- package/solutions/adaptive-image/index.d.ts.map +0 -1
- package/solutions/adaptive-image/index.js +0 -5
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -39
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +0 -1
- package/solutions/cloud-image-editor/CloudImageEditor.js +0 -24
- package/solutions/cloud-image-editor/index.css +0 -2
- package/solutions/cloud-image-editor/index.d.ts +0 -6
- package/solutions/cloud-image-editor/index.d.ts.map +0 -1
- package/solutions/cloud-image-editor/index.js +0 -11
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +0 -27
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +0 -1
- package/solutions/file-uploader/inline/FileUploaderInline.js +0 -80
- package/solutions/file-uploader/inline/index.css +0 -54
- package/solutions/file-uploader/inline/index.d.ts +0 -2
- package/solutions/file-uploader/inline/index.d.ts.map +0 -1
- package/solutions/file-uploader/inline/index.js +0 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +0 -43
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +0 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +0 -163
- package/solutions/file-uploader/minimal/index.css +0 -147
- package/solutions/file-uploader/minimal/index.d.ts +0 -2
- package/solutions/file-uploader/minimal/index.d.ts.map +0 -1
- package/solutions/file-uploader/minimal/index.js +0 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +0 -24
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +0 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +0 -69
- package/solutions/file-uploader/regular/index.css +0 -1
- package/solutions/file-uploader/regular/index.d.ts +0 -2
- package/solutions/file-uploader/regular/index.d.ts.map +0 -1
- package/solutions/file-uploader/regular/index.js +0 -1
- package/types/events.d.ts +0 -5
- package/types/events.js +0 -1
- package/types/exported.d.ts +0 -534
- package/types/exported.js +0 -1
- package/types/global.d.ts +0 -8
- package/types/https.d.ts +0 -1
- package/types/index.d.ts +0 -2
- package/types/index.js +0 -3
- package/utils/WindowHeightTracker.d.ts +0 -24
- package/utils/WindowHeightTracker.d.ts.map +0 -1
- package/utils/WindowHeightTracker.js +0 -51
- package/utils/browser-info.d.ts +0 -13
- package/utils/browser-info.d.ts.map +0 -1
- package/utils/browser-info.js +0 -22
- package/utils/browser-info.test.d.ts +0 -2
- package/utils/browser-info.test.d.ts.map +0 -1
- package/utils/browser-info.test.js +0 -109
- package/utils/cdn-utils.d.ts +0 -59
- package/utils/cdn-utils.d.ts.map +0 -1
- package/utils/cdn-utils.js +0 -199
- package/utils/cdn-utils.test.d.ts +0 -2
- package/utils/cdn-utils.test.d.ts.map +0 -1
- package/utils/cdn-utils.test.js +0 -227
- package/utils/delay.d.ts +0 -2
- package/utils/delay.d.ts.map +0 -1
- package/utils/delay.js +0 -4
- package/utils/fileTypes.d.ts +0 -12
- package/utils/fileTypes.d.ts.map +0 -1
- package/utils/fileTypes.js +0 -111
- package/utils/fileTypes.test.d.ts +0 -2
- package/utils/fileTypes.test.d.ts.map +0 -1
- package/utils/fileTypes.test.js +0 -89
- package/utils/get-top-level-origin.d.ts +0 -2
- package/utils/get-top-level-origin.d.ts.map +0 -1
- package/utils/get-top-level-origin.js +0 -11
- package/utils/getLocaleDirection.d.ts +0 -2
- package/utils/getLocaleDirection.d.ts.map +0 -1
- package/utils/getLocaleDirection.js +0 -18
- package/utils/getPluralForm.d.ts +0 -3
- package/utils/getPluralForm.d.ts.map +0 -1
- package/utils/getPluralForm.js +0 -13
- package/utils/getPluralForm.test.d.ts +0 -2
- package/utils/getPluralForm.test.d.ts.map +0 -1
- package/utils/getPluralForm.test.js +0 -16
- package/utils/ifRef.d.ts +0 -7
- package/utils/ifRef.d.ts.map +0 -1
- package/utils/ifRef.js +0 -9
- package/utils/isPromiseLike.d.ts +0 -2
- package/utils/isPromiseLike.d.ts.map +0 -1
- package/utils/isPromiseLike.js +0 -12
- package/utils/isPromiseLike.test.d.ts +0 -2
- package/utils/isPromiseLike.test.d.ts.map +0 -1
- package/utils/isPromiseLike.test.js +0 -20
- package/utils/isSecureTokenExpired.d.ts +0 -4
- package/utils/isSecureTokenExpired.d.ts.map +0 -1
- package/utils/isSecureTokenExpired.js +0 -17
- package/utils/isSecureTokenExpired.test.d.ts +0 -2
- package/utils/isSecureTokenExpired.test.d.ts.map +0 -1
- package/utils/isSecureTokenExpired.test.js +0 -33
- package/utils/memoize.d.ts +0 -2
- package/utils/memoize.d.ts.map +0 -1
- package/utils/memoize.js +0 -23
- package/utils/memoize.test.d.ts +0 -2
- package/utils/memoize.test.d.ts.map +0 -1
- package/utils/memoize.test.js +0 -38
- package/utils/mixinClass.d.ts +0 -10
- package/utils/mixinClass.d.ts.map +0 -1
- package/utils/mixinClass.js +0 -18
- package/utils/parseCdnUrl.d.ts +0 -9
- package/utils/parseCdnUrl.d.ts.map +0 -1
- package/utils/parseCdnUrl.js +0 -23
- package/utils/parseCdnUrl.test.d.ts +0 -2
- package/utils/parseCdnUrl.test.d.ts.map +0 -1
- package/utils/parseCdnUrl.test.js +0 -91
- package/utils/parseShrink.d.ts +0 -5
- package/utils/parseShrink.d.ts.map +0 -1
- package/utils/parseShrink.js +0 -34
- package/utils/parseShrink.test.d.ts +0 -2
- package/utils/parseShrink.test.d.ts.map +0 -1
- package/utils/parseShrink.test.js +0 -26
- package/utils/prettyBytes.d.ts +0 -11
- package/utils/prettyBytes.d.ts.map +0 -1
- package/utils/prettyBytes.js +0 -64
- package/utils/prettyBytes.test.d.ts +0 -2
- package/utils/prettyBytes.test.d.ts.map +0 -1
- package/utils/prettyBytes.test.js +0 -99
- package/utils/stringToArray.d.ts +0 -2
- package/utils/stringToArray.d.ts.map +0 -1
- package/utils/stringToArray.js +0 -11
- package/utils/stringToArray.test.d.ts +0 -2
- package/utils/stringToArray.test.d.ts.map +0 -1
- package/utils/stringToArray.test.js +0 -20
- package/utils/template-utils.d.ts +0 -40
- package/utils/template-utils.d.ts.map +0 -1
- package/utils/template-utils.js +0 -50
- package/utils/template-utils.test.d.ts +0 -2
- package/utils/template-utils.test.d.ts.map +0 -1
- package/utils/template-utils.test.js +0 -56
- package/utils/toKebabCase.d.ts +0 -3
- package/utils/toKebabCase.d.ts.map +0 -1
- package/utils/toKebabCase.js +0 -15
- package/utils/toKebabCase.test.d.ts +0 -2
- package/utils/toKebabCase.test.d.ts.map +0 -1
- package/utils/toKebabCase.test.js +0 -11
- package/utils/transparentPixelSrc.d.ts +0 -2
- package/utils/transparentPixelSrc.d.ts.map +0 -1
- package/utils/transparentPixelSrc.js +0 -2
- package/utils/uniqueArray.d.ts +0 -2
- package/utils/uniqueArray.d.ts.map +0 -1
- package/utils/uniqueArray.js +0 -8
- package/utils/uniqueArray.test.d.ts +0 -2
- package/utils/uniqueArray.test.d.ts.map +0 -1
- package/utils/uniqueArray.test.js +0 -8
- package/utils/validators/collection/index.d.ts +0 -3
- package/utils/validators/collection/index.d.ts.map +0 -1
- package/utils/validators/collection/index.js +0 -2
- package/utils/validators/collection/validateCollectionUploadError.d.ts +0 -3
- package/utils/validators/collection/validateCollectionUploadError.d.ts.map +0 -1
- package/utils/validators/collection/validateCollectionUploadError.js +0 -11
- package/utils/validators/collection/validateMultiple.d.ts +0 -3
- package/utils/validators/collection/validateMultiple.d.ts.map +0 -1
- package/utils/validators/collection/validateMultiple.js +0 -43
- package/utils/validators/file/index.d.ts +0 -5
- package/utils/validators/file/index.d.ts.map +0 -1
- package/utils/validators/file/index.js +0 -4
- package/utils/validators/file/validateFileType.d.ts +0 -3
- package/utils/validators/file/validateFileType.d.ts.map +0 -1
- package/utils/validators/file/validateFileType.js +0 -30
- package/utils/validators/file/validateIsImage.d.ts +0 -3
- package/utils/validators/file/validateIsImage.d.ts.map +0 -1
- package/utils/validators/file/validateIsImage.js +0 -25
- package/utils/validators/file/validateMaxSizeLimit.d.ts +0 -3
- package/utils/validators/file/validateMaxSizeLimit.d.ts.map +0 -1
- package/utils/validators/file/validateMaxSizeLimit.js +0 -15
- package/utils/validators/file/validateUploadError.d.ts +0 -3
- package/utils/validators/file/validateUploadError.d.ts.map +0 -1
- package/utils/validators/file/validateUploadError.js +0 -48
- package/utils/waitForAttribute.d.ts +0 -8
- package/utils/waitForAttribute.d.ts.map +0 -1
- package/utils/waitForAttribute.js +0 -43
- package/utils/waitForAttribute.test.d.ts +0 -2
- package/utils/waitForAttribute.test.d.ts.map +0 -1
- package/utils/waitForAttribute.test.js +0 -78
- package/utils/warnOnce.d.ts +0 -3
- package/utils/warnOnce.d.ts.map +0 -1
- package/utils/warnOnce.js +0 -11
- package/utils/wildcardRegexp.d.ts +0 -2
- package/utils/wildcardRegexp.d.ts.map +0 -1
- package/utils/wildcardRegexp.js +0 -17
- package/utils/wildcardRegexp.test.d.ts +0 -2
- package/utils/wildcardRegexp.test.d.ts.map +0 -1
- package/utils/wildcardRegexp.test.js +0 -19
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
"use strict";var UC=(()=>{var
|
|
27
|
-
`,"\\n"),
|
|
28
|
-
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,e,i){var s;if(e===i)return;let o=(s=this.constructor.__attrDesc)==null?void 0:s[t];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[t]=i}getCssData(t,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=xl(i)}catch{!e&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((e,i)=>i===0?"":e).join("--")}__initStyleAttrObserver(){ve||(ve=new Set),ve.add(this.updateCssData),qe||(qe=new MutationObserver(t=>{t[0].type==="attributes"&&ve.forEach(e=>{e()})}),qe.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let i=this.getCssData(this.__extractCssName(t),!0);i===null&&(i=e),this.add(t,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,e,i){let s="__"+t;this[s]=this[t],Object.defineProperty(this,t,{set:n(o=>{this[s]=o,i?window.setTimeout(()=>{e==null||e(o)}):e==null||e(o)},"set"),get:n(()=>this[s],"get")}),this[t]=this[s]}static set shadowStyles(t){let e=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(t){if(!this.__rootStylesLink){let e=new Blob([t],{type:"text/css"}),i=URL.createObjectURL(e),s=document.createElement("link");s.href=i,s.rel="stylesheet",this.__rootStylesLink=s}}},n(Ye,"_BaseComponent"),Ye),we=$e;Ms(we,"template");var Je,ks=(Je=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))t.route=i.replace("?","");else if(i.includes("=")){let s=i.split("=");t.options[s[0]]=decodeURI(s[1])}else t.options[i]=!0}),t}static notify(){let t=this.readAddressBar(),e=this.appMap[t.route];if(e&&e.title&&(document.title=e.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${t.route}" not found...`);return}let i=new CustomEvent(ks.routingEventName,{detail:{route:t.route,options:Object.assign(e||{},t.options)}});window.dispatchEvent(i)}static reflect(t,e={}){let i=this.appMap[t];if(!i){this._print("Wrong route: "+t);return}let s="?"+t;for(let a in e)e[a]===!0?s+=this.separator+a:s+=this.separator+a+`=${e[a]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,s),document.title=o}static applyRoute(t,e={}){this.reflect(t,e),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,e){this.setRoutingMap(e);let i=S.registerCtx({route:null,options:null,title:null},t);return window.addEventListener(this.routingEventName,s=>{var o;i.multiPub({route:s.detail.route,options:s.detail.options,title:((o=s.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),ks.notify(),this.initPopstateListener(),i}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},n(Je,"AppRouter"),Je);ks.appMap=Object.create(null);function Ft(r,t){for(let e in t)e.includes("-")?r.style.setProperty(e,t[e]):r.style[e]=t[e]}n(Ft,"applyStyles");function Tl(r,t){for(let e in t)t[e].constructor===Boolean?t[e]?r.setAttribute(e,""):r.removeAttribute(e):r.setAttribute(e,t[e])}n(Tl,"applyAttributes");function Ls(r={tag:"div"}){let t=document.createElement(r.tag);if(r.attributes&&Tl(t,r.attributes),r.styles&&Ft(t,r.styles),r.properties)for(let e in r.properties)t[e]=r.properties[e];return r.processors&&r.processors.forEach(e=>{e(t)}),r.children&&r.children.forEach(e=>{let i=Ls(e);t.appendChild(i)}),t}n(Ls,"create");var Ho="idb-store-ready",Sl="symbiote-db",Il="symbiote-idb-update_",Qe,Ol=(Qe=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(Ho,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return Il+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,e){this.name=t,this.storeName=e,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=i=>{this.db=i.target.result,this.objStore=this.db.createObjectStore(e,{keyPath:"_key"}),this.objStore.transaction.oncomplete=s=>{this._notifyWhenReady(s)}},this.request.onsuccess=i=>{this.db=i.target.result,this._notifyWhenReady(i)},this.request.onerror=i=>{console.error(i)},this._subscriptionsMap={},this._updateHandler=i=>{i.key===this.name&&this._subscriptionsMap[i.newValue]&&this._subscriptionsMap[i.newValue].forEach(async o=>{o(await this.read(i.newValue))})},this._localUpdateHandler=i=>{this._updateHandler(i.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(t){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((s,o)=>{i.onsuccess=a=>{var l;(l=a.target.result)!=null&&l._value?s(a.target.result._value):(s(null),console.warn(`IDB: cannot read "${t}"`))},i.onerror=a=>{o(a)}})}write(t,e,i=!1){let s={_key:t,_value:e},a=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(s);return new Promise((l,c)=>{a.onsuccess=u=>{i||this._notifySubscribers(t),l(u.target.result)},a.onerror=u=>{c(u)}})}delete(t,e=!1){let s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((o,a)=>{s.onsuccess=l=>{e||this._notifySubscribers(t),o(l)},s.onerror=l=>{a(l)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,s)=>{e.onsuccess=o=>{let a=o.target.result;i(a.map(l=>l._value))},e.onerror=o=>{s(o)}})}subscribe(t,e){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let i=this._subscriptionsMap[t];return i.add(e),{remove:n(()=>{i.delete(e),i.size||delete this._subscriptionsMap[t]},"remove")}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,jo.clear(this.name)}},n(Qe,"DbInstance"),Qe),et,jo=(et=class{static get readyEventName(){return Ho}static open(t=Sl,e="store"){let i=t+"/"+e;return this._reg[i]||(this._reg[i]=new Ol(t,e)),this._reg[i]}static clear(t){window.indexedDB.deleteDatabase(t);for(let e in this._reg)e.split("/")[0]===t&&delete this._reg[e]}},n(et,"IDB"),et);Ms(jo,"_reg",Object.create(null));var Go=n(r=>{if(typeof r!="string"||!r)return"";let t=r.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},"normalizeCdnOperation"),xi=n((...r)=>r.filter(t=>typeof t=="string"&&t).map(t=>Go(t)).join("/-/"),"joinCdnOperations"),z=n((...r)=>{let t=xi(...r);return t?`-/${t}/`:""},"createCdnUrlModifiers");function Ti(r){let t=new URL(r),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),s=e.lastIndexOf("/"),o="";return i>=0?o=e.slice(i):s>=0&&(o=e.slice(s+1)),o}n(Ti,"extractFilename");function Si(r){let t=new URL(r),{pathname:e}=t,i=e.indexOf("/"),s=e.indexOf("/",i+1);return e.substring(i+1,s)}n(Si,"extractUuid");function Ps(r){let t=Wo(r),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}n(Ps,"extractCdnUrlModifiers");function Us(r){return Ps(r).split("/-/").filter(Boolean).map(e=>Go(e))}n(Us,"extractOperations");function Wo(r){let t=new URL(r),e=Ti(r),i=Xo(e)?qo(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}n(Wo,"trimFilename");function Xo(r){return r.startsWith("http")}n(Xo,"isFileUrl");function qo(r){let t=new URL(r);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}n(qo,"splitFileUrl");var F=n((r,t,e)=>{let i=new URL(Wo(r));if(e=e||Ti(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),Xo(e)){let s=qo(e);i.pathname=i.pathname+(t||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},"createCdnUrl"),ke=n((r,t)=>{let e=new URL(r);return e.pathname=t+"/",e.toString()},"createOriginalUrl");var N=n((r,t=",")=>r.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0),"stringToArray");var ee=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),Zo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function $l(r,t){if(typeof t=="number"){let e=t;return ee[r]!==e?`${r}/${e}`:""}if(typeof t=="boolean"){let e=t;return ee[r]!==e?`${r}`:""}if(r==="filter"&&t){let{name:e,amount:i}=t;return ee.filter===i?"":`${r}/${e}/${i}`}if(r==="crop"&&t){let{dimensions:e,coords:i}=t;return`${r}/${e.join("x")}/${i.join(",")}`}return""}n($l,"transformationToStr");function Me(r){return xi(...Zo.filter(t=>typeof r[t]!="undefined"&&r[t]!==null).map(t=>{let e=r[t];return $l(t,e)}).filter(t=>!!t))}n(Me,"transformationsToOperations");var Ii=xi("format/auto","progressive/yes"),Ce=n(([r])=>typeof r!="undefined"?Number(r):void 0,"asNumber"),Ko=n(()=>!0,"asBoolean"),kl=n(([r,t])=>({name:r,amount:typeof t!="undefined"?Number(t):100}),"asFilter"),Ml=n(([r,t])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:N(r,"x").map(Number),coords:N(t).map(Number)}},"asCrop"),Ll=Object.freeze({enhance:Ce,brightness:Ce,exposure:Ce,gamma:Ce,contrast:Ce,saturation:Ce,vibrance:Ce,warmth:Ce,filter:kl,mirror:Ko,flip:Ko,rotate:Ce,crop:Ml});function Rs(r){let t={};for(let e of r){let[i,...s]=e.split("/");if(!Zo.includes(i))continue;let o=i,a=Ll[o];try{let l=a(s);t[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
-
`))}}return t}n(Rs,"operationsToTransformations");var M=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Z=[M.CROP,M.TUNING,M.FILTERS],Yo=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Jo=["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"],Qo=["rotate","mirror","flip"],ue=Object.freeze({brightness:{zero:ee.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:ee.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:ee.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:ee.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:ee.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:ee.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:ee.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:ee.enhance,range:[0,100],keypointsNumber:1},filter:{zero:ee.filter,range:[0,100],keypointsNumber:1}});var Y=n(r=>r?r.split(",").map(t=>t.trim()).filter(Boolean):[],"deserializeCsv"),Ee=n(r=>r?r.join(","):"","serializeCsv");var Nt="https://ucarecdn.com",Pl="https://upload.uploadcare.com",Ul="https://social.uploadcare.com",Rl="https://ucarecd.net",te=Object.freeze({pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:Ee(Z),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Nt,cdnCnamePrefixed:Rl,baseUrl:Pl,socialBaseUrl:Ul,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:!1,cloudImageEditorAutoOpen:!1,cloudImageEditorMaskHref:null,testMode:!1,qualityInsights:!0});var Ae=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config"}),w=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created",...Ae}),Ds=class Ds{constructor(t){d(this,"_timeoutStore",new Map);d(this,"_targets",new Set);d(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let s of this._targets)s.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,s]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let s=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},s);this._timeoutStore.set(t,o)}};n(Ds,"EventEmitter");var Oi=Ds;function L(r,t){let e,i=n((...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),t)},"debounced");return i.cancel=()=>{clearTimeout(e)},i}n(L,"debounce");var en="--uploadcare-blocks-window-height",Vt=class Vt{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(en)}};n(Vt,"WindowHeightTracker"),d(Vt,"clientsRegistry",new Set),d(Vt,"flush",L(()=>{document.documentElement.style.setProperty(en,`${window.innerHeight}px`)},100));var Bt=Vt;var tn=n(r=>{var i;let t=new Intl.Locale(r),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e},"getLocaleDirection");var $i=n((r,t)=>new Intl.PluralRules(r).select(t),"getPluralForm");var Dl=n(r=>r,"DEFAULT_TRANSFORMER"),Fs="{{",rn="}}",sn="plural:";function zt(r,t,e={}){var a;let{openToken:i=Fs,closeToken:s=rn,transform:o=Dl}=e;for(let l in t){let c=(a=t[l])==null?void 0:a.toString();r=r.replaceAll(i+l+s,typeof c=="string"?o(c):c)}return r}n(zt,"applyTemplateData");function on(r){let t=[],e=r.indexOf(Fs);for(;e!==-1;){let i=r.indexOf(rn,e),s=r.substring(e+2,i);if(s.startsWith(sn)){let o=r.substring(e+2,i).replace(sn,""),a=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));t.push({variable:s,pluralKey:a,countVariable:l})}e=r.indexOf(Fs,i)}return t}n(on,"getPluralObjects");var nn=n(({element:r,attribute:t,onSuccess:e,onTimeout:i,timeout:s=300})=>{let o=r.getAttribute(t);if(o!==null){e(o);return}let a=new MutationObserver(u=>{let p=u[u.length-1];c(p)});a.observe(r,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{a.disconnect(),i()},s),c=n(u=>{let p=r.getAttribute(t);u.type==="attributes"&&u.attributeName===t&&p!==null&&(clearTimeout(l),a.disconnect(),e(p))},"handleMutation")},"waitForAttribute");function an(r){return Object.prototype.toString.call(r)==="[object Object]"}n(an,"isObject");var Fl=/\W|_/g;function Nl(r){return r.split(Fl).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}n(Nl,"camelizeString");function ln(r,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(r)?r.map(e=>Se(e,{ignoreKeys:t})):r}n(ln,"camelizeArrayItems");function Se(r,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(r))return ln(r,{ignoreKeys:t});if(!an(r))return r;let e={};for(let i of Object.keys(r)){let s=r[i];if(t.includes(i)){e[i]=s;continue}an(s)?s=Se(s,{ignoreKeys:t}):Array.isArray(s)&&(s=ln(s,{ignoreKeys:t})),e[Nl(i)]=s}return e}n(Se,"camelizeKeys");var Vl=n(r=>new Promise(t=>setTimeout(t,r)),"delay");function Gs({libraryName:r,libraryVersion:t,userAgent:e,publicKey:i="",integration:s=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:r,libraryVersion:t,languageName:o,integration:s});let a=[r,t,i].filter(Boolean).join("/"),l=[o,s].filter(Boolean).join("; ");return`${a} (${l})`}n(Gs,"getUserAgent$1");var Bl={factor:2,time:100};function zl(r,t=Bl){let e=0;function i(s){let o=Math.round(t.time*t.factor**e);return s({attempt:e,retry:n(l=>Vl(l!=null?l:o).then(()=>(e+=1,i(s))),"retry")})}return n(i,"runAttempt"),i(r)}n(zl,"retrier");var Ys=class Ys extends Error{};n(Ys,"UploadcareError");var Ne=Ys,ki=class ki extends Ne{constructor(e){super();d(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,ki.prototype),this.originalProgressEvent=e}};n(ki,"NetworkError");var it=ki,Pi=n((r,t)=>{r&&(r.aborted?Promise.resolve().then(t):r.addEventListener("abort",()=>t(),{once:!0}))},"onCancel"),Mi=class Mi extends Ne{constructor(e="Request canceled"){super(e);d(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,Mi.prototype)}};n(Mi,"CancelError");var Le=Mi,Hl=500,un=n(({check:r,interval:t=Hl,timeout:e,signal:i})=>new Promise((s,o)=>{let a,l;Pi(i,()=>{a&&clearTimeout(a),o(new Le("Poll cancelled"))}),e&&(l=setTimeout(()=>{a&&clearTimeout(a),o(new Le("Timed out"))},e));let c=n(()=>{try{Promise.resolve(r(i)).then(u=>{u?(l&&clearTimeout(l),s(u)):a=setTimeout(c,t)}).catch(u=>{l&&clearTimeout(l),o(u)})}catch(u){l&&clearTimeout(l),o(u)}},"tick");a=setTimeout(c,0)}),"poll"),O={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"},Ui="application/octet-stream",dn="original",Pe=n(({method:r,url:t,data:e,headers:i={},signal:s,onProgress:o})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=(r==null?void 0:r.toUpperCase())||"GET",p=!1;c.open(u,t,!0),i&&Object.entries(i).forEach(h=>{let[f,m]=h;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",Pi(s,()=>{p=!0,c.abort(),l(new Le)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let h={method:u,url:t,data:e,headers:i||void 0,signal:s,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(E){let y=E.split(": "),A=y.shift(),C=y.join(": ");A&&typeof A!="undefined"&&(m[A]=C)});let g=c.response,_=c.status;a({request:h,data:g,headers:m,status:_})}},c.onerror=h=>{p||l(new it(h))},o&&typeof o=="function"&&(c.upload.onprogress=h=>{h.lengthComputable?o({isComputable:!0,value:h.loaded/h.total}):o({isComputable:!1})}),e?c.send(e):c.send()}),"request");function jl(r,...t){return r}n(jl,"identity");var Gl=n(({name:r})=>r?[r]:[],"getFileOptions"),Wl=jl,Xl=n(()=>new FormData,"getFormData"),hn=n(r=>!1,"isBuffer"),Ri=n(r=>typeof Blob!="undefined"&&r instanceof Blob,"isBlob"),Di=n(r=>typeof File!="undefined"&&r instanceof File,"isFile"),Fi=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),rt=n(r=>Ri(r)||Di(r)||hn()||Fi(r),"isFileData"),ql=n(r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined","isSimpleValue"),Kl=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),Zl=n(r=>!!r&&typeof r=="object"&&"data"in r&&rt(r.data),"isFileValue");function pn(r,t,e){if(Array.isArray(e))for(let i of e)pn(r,`${t}[]`,i);else if(Zl(e)){let{name:i,contentType:s}=e,o=Wl(e.data,i,s!=null?s:Ui),a=Gl({name:i,contentType:s});r.push([t,o,...a])}else if(Kl(e))for(let[i,s]of Object.entries(e))typeof s!="undefined"&&r.push([`${t}[${i}]`,String(s)]);else ql(e)&&e&&r.push([t,e.toString()])}n(pn,"collectParams");function Yl(r){let t=[];for(let[e,i]of Object.entries(r))pn(t,e,i);return t}n(Yl,"getFormDataParams");function Ni(r){let t=Xl(),e=Yl(r);for(let i of e){let[s,o,...a]=i;t.append(s,o,...a)}return t}n(Ni,"buildFormData");var Li=class Li extends Ne{constructor(e,i,s,o,a){super();d(this,"code");d(this,"request");d(this,"response");d(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=s,this.response=o,this.headers=a,Object.setPrototypeOf(this,Li.prototype)}};n(Li,"UploadError");var H=Li,Jl=n(r=>{let t=new URLSearchParams;for(let[e,i]of Object.entries(r))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(s=>{var o;return(o=s[1])!=null?o:!1}).forEach(s=>t.set(`${e}[${s[0]}]`,String(s[1]))):Array.isArray(i)?i.forEach(s=>{t.append(`${e}[]`,s)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},"buildSearchParams"),xe=n((r,t,e)=>{let i=new URL(r);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Jl(e)),i.toString()},"getUrl"),Ql="6.17.0",ec="UploadcareUploadClient",tc=Ql;function Ve(r){return Gs({libraryName:ec,libraryVersion:tc,...r})}n(Ve,"getUserAgent");var ic="RequestThrottledError",cn=15e3,sc=1e3;function rc(r){let{headers:t}=r||{};if(!t||typeof t["retry-after"]!="string")return cn;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:cn}n(rc,"getTimeoutFromThrottledRequest");function Ue(r,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return zl(({attempt:s,retry:o})=>r().catch(a=>{if("response"in a&&(a==null?void 0:a.code)===ic&&s<e)return o(rc(a));if(a instanceof it&&s<i)return o((s+1)*sc);throw a}))}n(Ue,"retryIfFailed");var fn=n(r=>{let t="";return(Ri(r)||Di(r)||Fi(r))&&(t=r.type),t||Ui},"getContentType"),mn=n(r=>{let t="";return Di(r)&&r.name?t=r.name:Ri(r)||hn()?t="":Fi(r)&&r.name&&(t=r.name),t||dn},"getFileName");function Ws(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}n(Ws,"getStoreValue");function oc(r,{publicKey:t,fileName:e,contentType:i,baseURL:s=O.baseURL,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Ue(()=>Pe({method:"POST",url:xe(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:h,userAgent:f})},data:Ni({file:{data:r,name:e||mn(r),contentType:i||fn(r)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:Ws(l),signature:o,expire:a,source:p,metadata:_}),signal:c,onProgress:u}).then(({data:E,headers:y,request:A})=>{let C=Se(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,A,C,y);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(oc,"base");var Bs;(function(r){r.Token="token",r.FileInfo="file_info"})(Bs||(Bs={}));function nc(r,{publicKey:t,baseURL:e=O.baseURL,store:i,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Ue(()=>Pe({method:"POST",headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:h,userAgent:f})},url:xe(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:r,store:Ws(i),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:_}),signal:p}).then(({data:E,headers:y,request:A})=>{let C=Se(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,A,C,y);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(nc,"fromUrl");var J;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(J||(J={}));var ac=n(r=>"status"in r&&r.status===J.Error,"isErrorResponse");function lc(r,{publicKey:t,baseURL:e=O.baseURL,signal:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=O.retryNetworkErrorMaxTimes}={}){return Ue(()=>Pe({method:"GET",headers:t?{"X-UC-User-Agent":Ve({publicKey:t,integration:s,userAgent:o})}:void 0,url:xe(e,"/from_url/status/",{jsonerrors:1,token:r}),signal:i}).then(({data:c,headers:u,request:p})=>{let h=Se(JSON.parse(c));if("error"in h&&!ac(h))throw new H(h.error.content,h.error.errorCode,p,h,u);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(lc,"fromUrlStatus");function cc(r,{publicKey:t,baseURL:e=O.baseURL,jsonpCallback:i,secureSignature:s,secureExpire:o,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=O.retryNetworkErrorMaxTimes}){return Ue(()=>Pe({method:"POST",headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:c,userAgent:u})},url:xe(e,"/group/",{jsonerrors:1}),data:Ni({files:r,callback:i,pub_key:t,signature:s,expire:o,source:l}),signal:a}).then(({data:f,headers:m,request:g})=>{let _=Se(JSON.parse(f));if("error"in _)throw new H(_.error.content,_.error.errorCode,g,_,m);return _}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:p})}n(cc,"group");function gn(r,{publicKey:t,baseURL:e=O.baseURL,signal:i,source:s,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=O.retryNetworkErrorMaxTimes}){return Ue(()=>Pe({method:"GET",headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:o,userAgent:a})},url:xe(e,"/info/",{jsonerrors:1,pub_key:t,file_id:r,source:s}),signal:i}).then(({data:u,headers:p,request:h})=>{let f=Se(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(gn,"info");function uc(r,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:s=O.multipartChunkSize,baseURL:o="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Ue(()=>Pe({method:"POST",url:xe(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:h,userAgent:f})},data:Ni({filename:i||dn,size:r,content_type:e||Ui,part_size:s,UPLOADCARE_STORE:Ws(c),UPLOADCARE_PUB_KEY:t,signature:a,expire:l,source:p,metadata:_}),signal:u}).then(({data:E,headers:y,request:A})=>{let C=Se(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,A,C,y);return C.parts=Object.keys(C.parts).map(R=>C.parts[Number(R)]),C}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}n(uc,"multipartStart");function dc(r,t,{contentType:e,signal:i,onProgress:s,retryThrottledRequestMaxTimes:o=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=O.retryNetworkErrorMaxTimes}){return Ue(()=>Pe({method:"PUT",url:t,data:r,onProgress:s,signal:i,headers:{"Content-Type":e||Ui}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a})}n(dc,"multipartUpload");function hc(r,{publicKey:t,baseURL:e=O.baseURL,source:i="local",signal:s,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=O.retryNetworkErrorMaxTimes}){return Ue(()=>Pe({method:"POST",url:xe(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ve({publicKey:t,integration:o,userAgent:a})},data:Ni({uuid:r,UPLOADCARE_PUB_KEY:t,source:i}),signal:s}).then(({data:u,headers:p,request:h})=>{let f=Se(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(hc,"multipartComplete");function Xs(r,{publicKey:t,baseURL:e,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return un({check:n(p=>gn(r,{publicKey:t,baseURL:e,signal:p,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?h:(u&&u({isComputable:!0,value:1}),!1)),"check"),signal:c})}n(Xs,"isReadyPoll");function pc(r){return"defaultEffects"in r}n(pc,"isGroupFileInfo");var Js=class Js{constructor(t,{baseCDN:e=O.baseCDN,fileName:i}={}){d(this,"uuid");d(this,"name");d(this,"size");d(this,"isStored");d(this,"isImage");d(this,"mimeType");d(this,"cdnUrl");d(this,"s3Url");d(this,"originalFilename");d(this,"imageInfo");d(this,"videoInfo");d(this,"contentInfo");d(this,"metadata");d(this,"s3Bucket");d(this,"defaultEffects",null);let{uuid:s,s3Bucket:o}=t,a=xe(e,`${s}/`),l=o?xe(`https://${o}.s3.amazonaws.com/`,`${s}/${t.filename}`):null;this.uuid=s,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=a,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=o||null,this.s3Url=l,pc(t)&&(this.defaultEffects=t.defaultEffects)}};n(Js,"UploadcareFile");var Te=Js,fc=n((r,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:_,metadata:E})=>oc(r,{publicKey:t,fileName:e,contentType:l,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:E}).then(({file:y})=>Xs(y,{publicKey:t,baseURL:i,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(y=>new Te(y,{baseCDN:_})),"uploadDirect"),mc=n((r,{publicKey:t,fileName:e,baseURL:i,signal:s,onProgress:o,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:h})=>gn(r,{publicKey:t,baseURL:i,signal:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new Te(f,{baseCDN:h,fileName:e})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),gc=n((r,{signal:t}={})=>{let e=null,i=null,s=r.map(()=>new AbortController),o=n(a=>()=>{i=a,s.forEach((l,c)=>c!==a&&l.abort())},"createStopRaceCallback");return Pi(t,()=>{s.forEach(a=>a.abort())}),Promise.all(r.map((a,l)=>{let c=o(l);return Promise.resolve().then(()=>a({stopRace:c,signal:s[l].signal})).then(u=>(c(),u)).catch(u=>(e=u,null))})).then(a=>{if(i===null)throw e;return a[i]})},"race"),bc=window.WebSocket,Qs=class Qs{constructor(){d(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(s=>s(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}};n(Qs,"Events");var zs=Qs,_c=n((r,t)=>r==="success"?{status:J.Success,...t}:r==="progress"?{status:J.Progress,...t}:{status:J.Error,...t},"response"),er=class er{constructor(t,e=3e4){d(this,"key");d(this,"disconnectTime");d(this,"ws");d(this,"queue",[]);d(this,"isConnected",!1);d(this,"subscribers",0);d(this,"emmitter",new zs);d(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new bc(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.data.toString());switch(i.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(i.channel,_c(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=n(()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var s;let i=JSON.stringify({event:t,data:e});(s=this.ws)==null||s.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,s={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(s=>s.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}};n(er,"Pusher");var Hs=er,Ns=null,qs=n(r=>{if(!Ns){let t=typeof window=="undefined"?0:3e4;Ns=new Hs(r,t)}return Ns},"getPusher"),vc=n(r=>{qs(r).connect()},"preconnect");function yc({token:r,publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return un({check:n(u=>lc(r,{publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case J.Error:return new H(p.error,p.errorCode);case J.Waiting:return!1;case J.Unknown:return new H(`Token "${r}" was not found.`);case J.Progress:return l&&(p.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:p.done/p.total})),!1;case J.Success:return l&&l({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(yc,"pollStrategy");var wc=n(({token:r,pusherKey:t,signal:e,onProgress:i})=>new Promise((s,o)=>{let a=qs(t),l=a.onError(o),c=n(()=>{l(),a.unsubscribe(r)},"destroy");Pi(e,()=>{c(),o(new Le("pusher cancelled"))}),a.subscribe(r,u=>{switch(u.status){case J.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case J.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),s(u);break}case J.Error:c(),o(new H(u.msg,u.error_code))}})}),"pushStrategy"),Cc=n((r,{publicKey:t,fileName:e,baseURL:i,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:h,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,pusherKey:E=O.pusherKey,metadata:y})=>Promise.resolve(vc(E)).then(()=>nc(r,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,metadata:y})).catch(A=>{let C=qs(E);return C==null||C.disconnect(),Promise.reject(A)}).then(A=>A.type===Bs.FileInfo?A:gc([({signal:C})=>yc({token:A.token,publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:C}),({signal:C})=>wc({token:A.token,pusherKey:E,signal:C,onProgress:h})],{signal:p})).then(A=>{if(A instanceof H)throw A;return A}).then(A=>Xs(A.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:p})).then(A=>new Te(A,{baseCDN:s})),"uploadFromUrl"),Vs=new WeakMap,Ec=n(async r=>{if(Vs.has(r))return Vs.get(r);let t=await fetch(r.uri).then(e=>e.blob());return Vs.set(r,t),t},"getBlobFromReactNativeAsset"),bn=n(async r=>{if(Di(r)||Ri(r))return r.size;if(Fi(r))return(await Ec(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Ac=n((r,t=O.multipartMinFileSize)=>r>=t,"isMultipart"),_n=n(r=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!rt(r)&&e.test(r)},"isUuid"),Ks=n(r=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!rt(r)&&e.test(r)},"isUrl"),xc=n((r,t)=>new Promise((e,i)=>{let s=[],o=!1,a=t.length,l=[...t],c=n(()=>{let u=t.length-l.length,p=l.shift();p&&p().then(h=>{o||(s[u]=h,a-=1,a?c():e(s))}).catch(h=>{o=!0,i(h)})},"run");for(let u=0;u<r;u++)c()}),"runWithConcurrency"),Tc=n((r,t,e,i)=>{let s=i*t,o=Math.min(s+i,e);return r.slice(s,o)},"sliceChunk"),Sc=n(async(r,t,e)=>i=>Tc(r,i,t,e),"prepareChunks"),Ic=n((r,t,{publicKey:e,contentType:i,onProgress:s,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>dc(r,t,{publicKey:e,contentType:i,onProgress:s,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Oc=n(async(r,{publicKey:t,fileName:e,fileSize:i,baseURL:s,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:_,multipartChunkSize:E=O.multipartChunkSize,maxConcurrentRequests:y=O.maxConcurrentRequests,baseCDN:A,metadata:C})=>{let R=i!=null?i:await bn(r),X,le=n((V,q)=>{if(!u)return;X||(X=Array(V).fill(0));let oe=n(ce=>ce.reduce((_e,$s)=>_e+$s,0),"sum");return ce=>{ce.isComputable&&(X[q]=ce.value,u({isComputable:!0,value:oe(X)/V}))}},"createProgressHandler");return _||(_=fn(r)),uc(R,{publicKey:t,contentType:_,fileName:e||mn(r),baseURL:s,secureSignature:o,secureExpire:a,store:l,signal:c,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:C,multipartChunkSize:E}).then(async({uuid:V,parts:q})=>{let oe=await Sc(r,R,E);return Promise.all([V,xc(y,q.map((ce,_e)=>()=>Ic(oe(_e),ce,{publicKey:t,contentType:_,onProgress:le(q.length,_e),signal:c,integration:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([V])=>hc(V,{publicKey:t,baseURL:s,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(V=>V.isReady?V:Xs(V.uuid,{publicKey:t,baseURL:s,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(V=>new Te(V,{baseCDN:A}))},"uploadMultipart");async function Zs(r,{publicKey:t,fileName:e,baseURL:i=O.baseURL,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:_,multipartChunkSize:E,maxConcurrentRequests:y,baseCDN:A=O.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:R,pusherKey:X,metadata:le}){if(rt(r)){let V=await bn(r);return Ac(V,_)?Oc(r,{publicKey:t,contentType:g,multipartChunkSize:E,fileSize:V,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,maxConcurrentRequests:y,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:le}):fc(r,{publicKey:t,fileName:e,contentType:g,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:le})}if(Ks(r))return Cc(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:A,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:R,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:X,metadata:le});if(_n(r))return mc(r,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A});throw new TypeError(`File uploading from "${r}" is not supported`)}n(Zs,"uploadFile");var tr=class tr{constructor(t,{baseCDN:e=O.baseCDN}={}){d(this,"uuid");d(this,"filesCount");d(this,"totalSize");d(this,"isStored");d(this,"isImage");d(this,"cdnUrl");d(this,"files");d(this,"createdAt");d(this,"storedAt",null);this.uuid=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((s,o)=>s+o.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(s=>s.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(s=>new Te(s,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}};n(tr,"UploadcareGroup");var js=tr,$c=n(r=>{for(let t of r)if(!rt(t))return!1;return!0},"isFileDataArray"),kc=n(r=>{for(let t of r)if(!_n(t))return!1;return!0},"isUuidArray"),Mc=n(r=>{for(let t of r)if(!Ks(t))return!1;return!0},"isUrlArray");function vn(r,{publicKey:t,fileName:e,baseURL:i=O.baseURL,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_=O.multipartChunkSize,baseCDN:E=O.baseCDN,checkForUrlDuplicates:y,saveUrlForRecurrentUploads:A,jsonpCallback:C}){if(!$c(r)&&!Mc(r)&&!kc(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let R,X=!0,le=r.length,V=n((q,oe)=>{if(!c)return;R||(R=Array(q).fill(0));let ce=n(_e=>_e.reduce(($s,Ja)=>$s+Ja)/q,"normalize");return _e=>{if(!_e.isComputable||!X){X=!1,c({isComputable:!1});return}R[oe]=_e.value,c({isComputable:!0,value:ce(R)})}},"createProgressHandler");return Promise.all(r.map((q,oe)=>rt(q)||Ks(q)?Zs(q,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:V(le,oe),source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_,baseCDN:E,checkForUrlDuplicates:y,saveUrlForRecurrentUploads:A}).then(ce=>ce.uuid):q)).then(q=>cc(q,{publicKey:t,baseURL:i,jsonpCallback:C,secureSignature:s,secureExpire:o,signal:l,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(oe=>new js(oe,{baseCDN:E})).then(oe=>(c&&c({isComputable:!0,value:1}),oe)))}n(vn,"uploadFileGroup");var ir=class ir{constructor(t){d(this,"_concurrency",1);d(this,"_pending",[]);d(this,"_running",0);d(this,"_resolvers",new Map);d(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){let i=this._pending.shift();if(!i)return;let s=this._resolvers.get(i),o=this._rejectors.get(i);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(a=>s(a)).catch(a=>o(a))}}add(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};n(ir,"Queue");var st=ir;var sr=n(()=>({}),"blockCtx"),rr=n(r=>({...sr(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{r.modalManager.close(r.$["*currentActivity"]),r.set$({"*currentActivity":null})},"*closeModal")}),"activityBlockCtx"),Vi=n(r=>({...rr(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new st(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var Ht={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}",queued:"Queued","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Bi=new Map,or=new Map,yn=n((r,t)=>{Bi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),Bi.set(r,{...Ht,...t})},"defineLocaleSync"),Lc=n((r,t)=>{or.set(r,t)},"defineLocaleAsync"),nr=n((r,t)=>{typeof t=="function"?Lc(r,t):yn(r,t)},"defineLocale"),wn=n(async r=>{if(!Bi.has(r)){if(!or.has(r))throw new Error(`Locale ${r} is not defined`);let e=await or.get(r)();yn(r,e)}return Bi.get(r)},"resolveLocaleDefinition");nr("en",Ht);var ne=n(r=>`*l10n/${r}`,"localeStateKey"),Pc="en",ar=class ar{constructor(t){d(this,"_blockInstance",null);d(this,"_localeName","");d(this,"_callbacks",new Set);d(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(Ht)){let s=this._blockInstance.has(ne(e))?!this._blockInstance.$[ne(e)]:!0;this._blockInstance.add(ne(e),i,s)}setTimeout(()=>{t.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let i=await wn(e);if(e!==Pc&&this._localeName!==e)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[a,l]of Object.entries(i)){let c=s==null?void 0:s[a];this._blockInstance.add(ne(a),c!=null?c:l,!0);for(let u of this._callbacks)u()}}),t.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let i=e[this._localeName];if(i)for(let[o,a]of Object.entries(i)){(s=this._blockInstance)==null||s.add(ne(o),a,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=L(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var o,a,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(a=(o=this._boundBlocks.get(t))==null?void 0:o.get(e))==null||a();let s=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,s)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};n(ar,"LocaleManager");var zi=ar;function Cn(r,t){[...r.querySelectorAll("[l10n]")].forEach(e=>{let i=e.getAttribute("l10n");if(!i)return;let s=i.split(";");for(let o of s)o&&Uc(e,o,t)})}n(Cn,"l10nProcessor");var Uc=n((r,t,e)=>{let i="textContent",s=!1;if(t.includes(":")){let l=t.split(":");i=l[0],t=l[1],i.startsWith("@")&&(i=i.slice(1),s=!0)}let o=t;e.has(o)&&e.sub(o,l=>{if(!l)return;e.l10nProcessorSubs.has(o)||e.l10nProcessorSubs.set(o,new Set);let c=e.l10nProcessorSubs.get(o);c==null||c.forEach(h=>{h.remove(),c.delete(h),e.allSubs.delete(h)});let u=ne(l).replace("*","");e.nodeCtx.has(u)||e.nodeCtx.add(u,l);let p=e.nodeCtx.sub(u,()=>{r[i]=e.l10n(l)});c==null||c.add(p),e.allSubs.add(p),r.removeAttribute("l10n")});let a=ne(t);e.has(a)||e.add(a,""),e.sub(a,()=>{t=t,s?r.setAttribute(i,e.l10n(t)):r[i]=e.l10n(t)}),r.removeAttribute("l10n")},"locale");var j=n(r=>`*cfg/${r}`,"sharedConfigKey");function En(r,t){let e=r.querySelectorAll("[data-testid]");if(e.length===0)return;let i=new WeakMap;for(let s of e){let o=s.getAttribute("data-testid");o&&i.set(s,o)}t.subConfigValue("testMode",s=>{if(!s){for(let a of e)a.removeAttribute("data-testid");return}let o=t.testId;for(let a of e){let l=i.get(a);l&&a.setAttribute("data-testid",`${o}--${l}`)}})}n(En,"testModeProcessor");var Rc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function jt(r,t){t.tabIndex=0,t.focus(),r.tabIndex=-1}n(jt,"focus");function lr(r){let t=r.role||r.type||r.tagName;if(!t)return null;let e=Rc[t.toLowerCase()];if(!e)return null;for(let i of e){let s=r.closest(`[role=${i}]`);if(s)return s}}n(lr,"findGroupNodeByEventTarget");function cr(r,t){return t.role==="toolbar"?Dc(t):t.querySelectorAll(`[role=${r.role}]`)}n(cr,"getItems");function Dc(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}n(Dc,"getToolbarItems");function Fc(r){let t=r.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}n(Fc,"isHorizontalOrientation");function An(r){return t=>{let e=!1,i=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function a(h){let f=lr(h.target);if(!f){l();return}let m=cr(h.target,f),g=Array.from(m).indexOf(h.target),_="ArrowDown",E="ArrowUp";if(Fc(f)&&(t.document.dir==="rtl"?(_="ArrowLeft",E="ArrowRight"):(_="ArrowRight",E="ArrowLeft")),h.key===_)h.preventDefault(),jt(h.target,m[g+1]||m[0]);else if(h.key===E)h.preventDefault(),jt(h.target,m[g-1]||m[m.length-1]);else if(h.key==="Home")h.preventDefault(),jt(h.target,m[0]);else if(h.key==="End")h.preventDefault(),jt(h.target,m[m.length-1]);else if(h.key.length===1&&f.role!=="tablist"){let y=Date.now();y-s<=i?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=y;let A=Array.from(m).find(C=>{var R,X,le;return(le=(X=(R=C.textContent)==null?void 0:R.trim())==null?void 0:X.toLowerCase())==null?void 0:le.startsWith(o)});A&&(h.preventDefault(),jt(h.target,A))}}n(a,"keyDown");function l(){e=!1,t.removeEventListener("keydown",a)}n(l,"stop");function c(h){let f=lr(h.target);if(f){e||(e=!0,t.addEventListener("keydown",a));let m=cr(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1)}else e&&l()}n(c,"focusIn");function u(h){(!h.relatedTarget||h.relatedTarget===t.document)&&l()}n(u,"focusOut");function p(h){let f=lr(h.target);if(f){let m=cr(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return n(p,"click"),t.addEventListener("click",p),t.addEventListener("focusin",c),t.addEventListener("focusout",u),()=>{l(),t.removeEventListener("click",p),t.removeEventListener("focusin",c),t.removeEventListener("focusout",u)}}}n(An,"focusGroupKeyUX");function xn(){return r=>{let t,e;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){t=o.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.hidden=!1);let a=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0)}}n(i,"jump");function s(o){t&&t.contains(o.target)&&(!o.relatedTarget||!t.contains(o.relatedTarget))&&(o.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return n(s,"focusOut"),r.addEventListener("keyuxJump",i),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",i),r.removeEventListener("focusout",s)}}}n(xn,"hiddenKeyUX");function Tn(){return r=>{let t=[];function e(c){let u=r.document.activeElement;u&&u!==r.document.body&&t.push(new WeakRef(u)),c.focus({focusVisible:!0})}n(e,"focus");function i(){let c=t.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():i()}n(i,"back");let s=0,o;function a(c){clearInterval(o);let u=c.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let p=r.document.getElementById(u);if(p){let h=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');h&&(clearInterval(o),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(h))}},50)}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&i()}return n(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l)}}}n(Tn,"jumpKeyUX");function Sn(r){let t,e=r.split(" "),i;function s(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(o(),l.target.classList.add(...e),t=l.target,i=l.target)}n(s,"keyDown");function o(){t&&t.classList.remove(...e),i=null}n(o,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(o(),l.target.classList.add(...e),t=l.target)}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",s),l.addEventListener("keyup",o),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",s),l.removeEventListener("keyup",o)})}n(Sn,"pressKeyUX");function In(r,t){let e=t.map(i=>i(r));return()=>{e.forEach(i=>i())}}n(In,"startKeyUX");var dr=class dr{constructor(){d(this,"_listeners",new Map);d(this,"_scope",[])}addEventListener(t,e){let i=n(s=>{let o=s.target;o&&this._scope.some(a=>a===s.target||a.contains(o))&&e(s)},"wrappedListener");this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}};n(dr,"ScopedMinimalWindow");var ur=dr,hr=class hr{constructor(){d(this,"_destroyKeyUX");d(this,"_scopedWindow");this._scopedWindow=new ur,this._destroyKeyUX=In(this._scopedWindow,[An(),Sn("is-pressed"),Tn(),xn()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};n(hr,"A11y");var Hi=hr;var D=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),pr=class pr{constructor(t){d(this,"_modals",new Map);d(this,"_activeModals",new Set);d(this,"_subscribers",new Map);this._block=t}_debugPrint(...t){this._block.debugPrint("[modal-manager]",...t)}registerModal(t,e){this._modals.set(t,e),this._notify(D.ADD,{id:t,modal:e})}deleteModal(t){if(!this._modals.has(t))return!1;let e=this._modals.get(t);return this._modals.delete(t),this._activeModals.delete(t),this._notify(D.DELETE,{id:t,modal:e}),!0}open(t){if(!this._modals.has(t))return this._debugPrint(`Modal with ID "${t}" not found`),!1;let e=this._modals.get(t);return this._activeModals.add(t),this._notify(D.OPEN,{modal:e,id:t}),!0}close(t){if(!this._modals.has(t)||!this._activeModals.has(t))return this._debugPrint(`Modal with ID "${t}" not found or not active`),!1;let e=this._modals.get(t);return this._activeModals.delete(t),this._notify(D.CLOSE,{id:t,modal:e}),!0}toggle(t){return this._modals.has(t)?this._activeModals.has(t)?this.close(t):this.open(t):(this._debugPrint(`Modal with ID "${t}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),!1;let t=Array.from(this._activeModals).pop();return this.close(t)}closeAll(){let t=this._activeModals.size;return this._activeModals.clear(),this._notify(D.CLOSE_ALL,{}),t}subscribe(t,e){var i;return this._subscribers.has(t)||this._subscribers.set(t,new Set),(i=this._subscribers.get(t))==null||i.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){var i;this._subscribers.has(t)&&((i=this._subscribers.get(t))==null||i.delete(e))}_notify(t,e){var i;if(this._subscribers.has(t))for(let s of(i=this._subscribers.get(t))!=null?i:new Set)try{s(e)}catch(o){this._block.telemetryManager.sendEventError(o,"modal subscriber"),this._debugPrint("Error in modal subscriber:",o)}}destroy(){this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(D.DESTROY,{})}};n(pr,"ModalManager");var ji=pr;function Nc(r){return r.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`).replace(/__/g,"_")}n(Nc,"i");function mr(r){return Array.isArray(r)?r.map(t=>typeof t=="object"&&t!==null?mr(t):t):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([t,e])=>{let i=Nc(t);return typeof e=="object"&&e!==null?[i,mr(e)]:[i,e]}))}n(mr,"c");function Vc(r){return{ok:!0,value:r}}n(Vc,"u");function fr(r){return{ok:!1,error:r}}n(fr,"a");var Bc="https://tlm.uploadcare.com/api/",br=class br{constructor(t=Bc){this.baseUrl=t}async base(t,e={}){let i=`${this.baseUrl}${t}`;try{let s=await fetch(i,e);if(!s.ok)return fr(new Error(`Got non-200 response from "${i}". Status: ${s.status.toString()}`));try{let o=await s.json();return Vc(o)}catch(o){return fr(new Error(`Error parsing JSON from "${i}". Error: ${o}`))}}catch(s){return fr(new Error(`Error fetching data from "${i}". Error: ${s}`))}}async post(t,e,i={}){return await this.base(t,{...i,method:"POST",body:JSON.stringify(mr(e)),headers:{"Content-Type":"application/json",...i.headers||{}}})}async get(t,e={}){return await this.base(t,{method:"GET",...e})}};n(br,"y");var gr=br,zc=n(async(r,t)=>({success:!0,data:t}),"f"),_r=class _r extends gr{constructor(){super()}async sendEvent(t,e){let i=await zc(void 0,t);if(!i.success)throw console.error("TelemetryAPIService: events: body is invalid",i.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",t,e)}};n(_r,"p");var Gi=_r;var Ie="blocks",Oe="1.22.0";var vr=class vr{constructor(t){d(this,"_sessionId",crypto.randomUUID());d(this,"_telemetryInstance",null);d(this,"_block",null);d(this,"_config",structuredClone(te));d(this,"_initialized",!1);d(this,"_lastPayload",null);d(this,"_queue",null);this._block=t,this._telemetryInstance=new Gi,this._queue=new st(10);for(let e of Object.keys(this._config))this._block.subConfigValue(e,i=>{var s;this._initialized&&this._config[e]!==i&&((s=this._block)==null||s.emit(w.CHANGE_CONFIG,void 0)),this._setConfig(e,i)})}_init(t){t===w.INIT_SOLUTION&&!this._initialized&&(this._initialized=!0)}_setConfig(t,e){this._config[t]!==e&&(this._config[t]=e)}_formattingPayload(t){var s,o;let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let i={...t};return(t.eventType===w.INIT_SOLUTION||t.eventType===w.CHANGE_CONFIG)&&(i.config=this._config),{...i,appVersion:Oe,appName:Ie,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:(s=this._config)==null?void 0:s.pubkey,userAgent:navigator.userAgent,eventType:(o=i.eventType)!=null?o:"",eventTimestamp:this._timestamp,payload:{...e}}}_excludedEvents(t){return!!(t&&[w.CHANGE,w.COMMON_UPLOAD_PROGRESS,w.FILE_ADDED,w.FILE_REMOVED,w.FILE_UPLOAD_START,w.FILE_UPLOAD_PROGRESS,w.FILE_UPLOAD_SUCCESS,w.FILE_UPLOAD_FAILED,w.FILE_URL_CHANGED,w.GROUP_CREATED].includes(t))}sendEvent(t){var o;let e=this._formattingPayload(t);if(this._init(t.eventType),this._excludedEvents(t.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,e))return null;(o=this._queue)==null||o.add(async()=>{var a;this._lastPayload=e,await((a=this._telemetryInstance)==null?void 0:a.sendEvent(e))})}sendEventError(t,e="unknown"){this.sendEvent({payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}})}sendEventCloudImageEditor(t,e,i={}){var s;this.sendEvent({payload:{metadata:{tabId:e,node:(s=t.currentTarget)==null?void 0:s.tagName,event:t.type,...i}}})}_checkObj(t,e){if(JSON.stringify(t)===JSON.stringify(e))return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;let i=Object.keys(t),s=Object.keys(e);if(i.length!==s.length)return!1;for(let o of i)if(!Object.prototype.hasOwnProperty.call(e,o)||!this._checkObj(t[o],e[o]))return!1;return!0}get _timestamp(){return Date.now()}get _solution(){var t,e;return(t=this._block)!=null&&t.has("*solution")?(e=this._block)==null?void 0:e.$["*solution"].toLowerCase():null}get _activity(){var t,e;return(t=this._block)!=null&&t.has("*currentActivity")?(e=this._block)==null?void 0:e.$["*currentActivity"]:null}};n(vr,"TelemetryManager");var Wi=vr;var Hc="uc-",Gt=class Gt extends we{constructor(){super();d(this,"requireCtxName",!1);d(this,"activityType",null);d(this,"init$",sr());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Cn),this.addTemplateProcessor(En)}l10n(e,i={}){if(!e)return"";let s=this.$[ne(e)]||e,o=on(s);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return zt(s,i)}pluralize(e,i){let s=this.l10n("locale-id")||"en",o=$i(s,i);return this.l10n(`${e}__${o}`)}bindL10n(e,i){var s;(s=this.localeManager)==null||s.bindL10n(this,e,i)}emit(e,i,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&(o.emit(e,i,s),this.telemetryManager.sendEvent({eventType:e,payload:typeof i=="function"?i():i}))}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?nn({element:this,attribute:"ctx-name",onSuccess:n(()=>{super.connectedCallback()},"onSuccess"),onTimeout:n(()=>{console.error("Attribute `ctx-name` is required and it is not set.")},"onTimeout")}):super.connectedCallback(),Bt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Bt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Oi(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new zi(this)),this.cfg.qualityInsights&&!this.has("*telemetryManager")&&this.add("*telemetryManager",new Wi(this)),this.has("*a11y")||this.add("*a11y",new Hi),this.has("*modalManager")||this.add("*modalManager",new ji(this)),this.sub(ne("locale-id"),i=>{let s=tn(i);this.style.direction=s==="ltr"?"":s}),this.subConfigValue("testMode",i=>{if(!i||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId)})}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.has("*modalManager")&&this.$["*modalManager"]}get telemetryManager(){return this.cfg.qualityInsights?this.has("*telemetryManager")&&this.$["*telemetryManager"]:{sendEvent:n(()=>{},"sendEvent"),sendEventCloudImageEditor:n(()=>{},"sendEventCloudImageEditor"),sendEventError:n(()=>{},"sendEventError")}}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var i;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,S.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e,i;S.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy(),this.modalManager&&((i=this.modalManager)==null||i.destroy())}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:Si(e),cdnUrlModifiers:Ps(e),fileName:Ti(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),this.telemetryManager.sendEventError(i,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?zt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:n(i=>window.encodeURIComponent(i),"transform")}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:n((i,s,o)=>{if(typeof s!="string")return!1;let a=j(s);return this.has(a)||this.add(a,te[s]),this.$[a]=o,!0},"set"),get:n((i,s)=>{let o=j(s);return this.has(o)||this.add(o,te[s]),this.$[j(s)]},"get")})}return this.__cfgProxy}subConfigValue(e,i){let s=j(e);this.has(s)||this.add(s,te[e]),this.sub(s,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];i=s()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(Hc)&&super.reg(e)}};n(Gt,"Block"),d(Gt,"StateConsumerScope",null),d(Gt,"styleAttrs",[]);var v=Gt;var On="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Xi=class Xi extends v{constructor(){super(...arguments);d(this,"requireCtxName",!0);d(this,"init$",Vi(this));d(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=On+e+"<slot></slot>"}static get template(){return this._template}};n(Xi,"SolutionBlock"),d(Xi,"styleAttrs",["uc-wgt-common"]);var de=Xi;var $n="active",Wt="___ACTIVITY_IS_ACTIVE___",he=class he extends v{constructor(){super(...arguments);d(this,"historyTracked",!1);d(this,"init$",rr(this));d(this,"_debouncedHistoryFlush",L(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=he._activityCallbacks.get(this);this[Wt]=!1,this.removeAttribute($n),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=he._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Wt]=!0,this.setAttribute($n,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(w.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Wt]?this._deactivate():this.activityType===e&&!this[Wt]&&this._activate()}catch(s){this.telemetryManager.sendEventError(s,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&he._activityCallbacks.has(this)}get isActivityActive(){return this[Wt]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:s,onDeactivate:o}=i;he._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),he._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof he&&s.activityType===e)||(this.$["*currentActivity"]=null,this.modalManager.closeAll())}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var i;let e=this.$["*history"];if(e){let s=e.pop();for(;s===this.activityType;)s=e.pop();let o=!!s;if(s){let a=[...this.blocksRegistry].find(l=>l.activityType===s);o=(i=a==null?void 0:a.couldOpenActivity)!=null?i:!1}s=o?s:void 0,s&&this.modalManager.open(s),this.$["*currentActivity"]=s,this.$["*history"]=e,s||this.modalManager.closeAll()}}};n(he,"ActivityBlock"),d(he,"_activityCallbacks",new Map);var b=he;b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Xt=33.333333333333336,x=1,yr=24,kn=6;function Re(r,t){for(let e in t)r.setAttributeNS(null,e,t[e].toString())}n(Re,"setSvgNodeAttrs");function G(r,t={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return Re(e,t),e}n(G,"createSvgNode");function Mn(r,t,e){let{x:i,y:s,width:o,height:a}=r,l=t.includes("w")?0:1,c=t.includes("n")?0:1,u=[-1,1][l],p=[-1,1][c],h=[i+l*o+1.5*u,s+c*a+1.5*p-24*e*p],f=[i+l*o+1.5*u,s+c*a+1.5*p],m=[i+l*o-24*e*u+1.5*u,s+c*a+1.5*p];return{d:`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,center:f}}n(Mn,"cornerPath");function Ln(r,t,e){let{x:i,y:s,width:o,height:a}=r,l=["n","s"].includes(t)?.5:{w:0,e:1}[t],c=["w","e"].includes(t)?.5:{n:0,s:1}[t],u=[-1,1][l],p=[-1,1][c],h,f;["n","s"].includes(t)?(h=[i+l*o-34*e/2,s+c*a+1.5*p],f=[i+l*o+34*e/2,s+c*a+1.5*p]):(h=[i+l*o+1.5*u,s+c*a-34*e/2],f=[i+l*o+1.5*u,s+c*a+34*e/2]);let m=`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,g=[f[0]-(f[0]-h[0])/2,f[1]-(f[1]-h[1])/2];return{d:m,center:g}}n(Ln,"sidePath");function Pn(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}n(Pn,"thumbCursor");function Un({rect:r,delta:[t,e],imageBox:i}){return nt({...r,x:r.x+t,y:r.y+e},i)}n(Un,"moveRect");function nt(r,t){let{x:e}=r,{y:i}=r;return r.x<t.x?e=t.x:r.x+r.width>t.x+t.width&&(e=t.x+t.width-r.width),r.y<t.y?i=t.y:r.y+r.height>t.y+t.height&&(i=t.y+t.height-r.height),{...r,x:e,y:i}}n(nt,"constraintRect");function jc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[,s]=t,{y:o,width:a,height:l}=r;o+=s,l-=s,e&&(a=l*e);let c=r.x+r.width/2-a/2;return o<=i.y&&(o=i.y,l=r.y+r.height-o,e&&(a=l*e,c=r.x+r.width/2-a/2)),c<=i.x&&(c=i.x,o=r.y+r.height-l),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=r.y+r.height-l),l<x&&(l=x,e&&(a=l*e,c=r.x+r.width/2-a/2),o=r.y+r.height-l),a<x&&(a=x,e&&(l=a/e,c=r.x+r.width/2-a/2),o=r.y+r.height-l),{x:c,y:o,width:a,height:l}}n(jc,"resizeNorth");function Gc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s]=t,{x:o,width:a,height:l}=r;o+=s,a-=s,e&&(l=a/e);let c=r.y+r.height/2-l/2;return o<=i.x&&(o=i.x,a=r.x+r.width-o,e&&(l=a/e,c=r.y+r.height/2-l/2)),c<=i.y&&(c=i.y,o=r.x+r.width-a),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=r.x+r.width-a),l<x&&(l=x,e&&(a=l*e),c=r.y+r.height/2-l/2,o=r.x+r.width-a),a<x&&(a=x,e&&(l=a/e),c=r.y+r.height/2-l/2,o=r.x+r.width-a),{x:o,y:c,width:a,height:l}}n(Gc,"resizeWest");function Wc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[,s]=t,{y:o,width:a,height:l}=r;l+=s,e&&(a=l*e);let c=r.x+r.width/2-a/2;return o+l>=i.y+i.height&&(l=i.y+i.height-o,e&&(a=l*e),c=r.x+r.width/2-a/2),c<=i.x&&(c=i.x,o=r.y),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=r.y),l<x&&(l=x,e&&(a=l*e),c=r.x+r.width/2-a/2),a<x&&(a=x,e&&(l=a/e),c=r.x+r.width/2-a/2),{x:c,y:o,width:a,height:l}}n(Wc,"resizeSouth");function Xc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s]=t,{x:o,width:a,height:l}=r;a+=s,e&&(l=a/e);let c=r.y+r.height/2-l/2;return o+a>=i.x+i.width&&(a=i.x+i.width-o,e&&(l=a/e),c=r.y+r.height/2-l/2),c<=i.y&&(c=i.y,o=r.x),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=r.x),l<x&&(l=x,e&&(a=l*e),c=r.y+r.height/2-l/2),a<x&&(a=x,e&&(l=a/e),c=r.y+r.height/2-l/2),{x:o,y:c,width:a,height:l}}n(Xc,"resizeEast");function qc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+s<i.x&&(s=i.x-a),l+o<i.y&&(o=i.y-l),a+=s,c-=s,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=r.x+r.width-c,l=i.y)):e&&(s=u*e-c,c=c+s,a-=s,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=r.y+r.height-u)),u<x&&(u=x,e&&(c=u*e),a=r.x+r.width-c,l=r.y+r.height-u),c<x&&(c=x,e&&(u=c/e),a=r.x+r.width-c,l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(qc,"resizeNorthWest");function Kc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+c+s>i.x+i.width&&(s=i.x+i.width-a-c),l+o<i.y&&(o=i.y-l),c+=s,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=r.x,l=i.y)):e&&(s=u*e-c,c+=s,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=r.y+r.height-u)),u<x&&(u=x,e&&(c=u*e),l=r.y+r.height-u),c<x&&(c=x,e&&(u=c/e),l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(Kc,"resizeNorthEast");function Zc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+s<i.x&&(s=i.x-a),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),a+=s,c-=s,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=r.x+r.width-c,l=i.y+i.height-u)):e&&(s=u*e-c,c+=s,a-=s,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=r.y)),u<x&&(u=x,e&&(c=u*e),a=r.x+r.width-c),c<x&&(c=x,e&&(u=c/e),a=r.x+r.width-c),{x:a,y:l,width:c,height:u}}n(Zc,"resizeSouthWest");function Yc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+c+s>i.x+i.width&&(s=i.x+i.width-a-c),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),c+=s,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=r.x,l=i.y+i.height-u)):e&&(s=u*e-c,c+=s,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=r.y)),u<x&&(u=x,e&&(c=u*e)),c<x&&(c=x,e&&(u=c/e)),{x:a,y:l,width:c,height:u}}n(Yc,"resizeSouthEast");function Rn({direction:r,...t}){switch(r){case"n":return jc(t);case"w":return Gc(t);case"s":return Wc(t);case"e":return Xc(t);case"nw":return qc(t);case"ne":return Kc(t);case"sw":return Zc(t);case"se":return Yc(t);default:return t.rect}}n(Rn,"resizeRect");function Dn(r,[t,e]){return r.x<=t&&t<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}n(Dn,"rectContainsPoint");function Fn(r,t){return r.x>=t.x&&r.y>=t.y&&r.x+r.width<=t.x+t.width&&r.y+r.height<=t.y+t.height}n(Fn,"isRectInsideRect");function Nn(r,t){return Math.abs(r.width/r.height-t)<.1}n(Nn,"isRectMatchesAspectRatio");function at({width:r,height:t},e){let i=e/90%2!==0;return{width:i?t:r,height:i?r:t}}n(at,"rotateSize");function Vn(r,t,e){let i=r/t,s,o;i>e?(s=Math.round(t*e),o=t):(s=r,o=Math.round(r/e));let a=Math.round((r-s)/2),l=Math.round((t-o)/2);return a+s>r&&(s=r-a),l+o>t&&(o=t-l),{x:a,y:l,width:s,height:o}}n(Vn,"calculateMaxCenteredCropFrame");function lt(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}n(lt,"roundRect");function De(r,t,e){return Math.min(Math.max(r,t),e)}n(De,"clamp");var qt=["free"],Ki=n(r=>{let t=N(r);if(!(t!=null&&t.length))return[];let e=[];for(let i=0;i<t.length;i++){let s=t[i].trim();if(!s)continue;let o=s.indexOf(":");if(o===-1&&!qt.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}let a=Number(s.slice(0,o)),l=Number(s.slice(o+1));if((!Number.isFinite(a)||!Number.isFinite(l)||a<=0||l<=0)&&!qt.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}e.push({id:ye.generate(),type:"aspect-ratio",width:qt.includes(s)?0:a,height:qt.includes(s)?0:l,hasFreeform:qt.includes(s)})}return e},"parseCropPreset"),Bn=n((r,t,e,i=.1)=>{let s=r/t,o=null,a=1/0;for(let l of e){let[c,u]=[l.width,l.height],p=c/u,h=Math.abs(s-p);h<a&&(a=h,o=l)}if(o){let[l,c]=[o.width,o.height],u=l/c;if(Math.abs(s-u)/u>i)return null}return o},"getClosestAspectRatio");function zn(r){return Gs({...r,libraryName:Ie,libraryVersion:Oe})}n(zn,"customUserAgent");var Hn=n(r=>Math.floor(r/1e3),"msToUnixTimestamp"),jn=n((r,{threshold:t})=>{let{secureExpire:e}=r,i=Hn(Date.now()),s=Number(e),o=Hn(t);return i+o>=s},"isSecureTokenExpired");var wr=class wr{constructor(t){d(this,"_block");d(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||jn(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let s=await i();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s),this._block.telemetryManager.sendEventError(s,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.")}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};n(wr,"SecureUploadsManager");var Zi=wr;var Gn="[Typed State] Wrong property name: ",Jc="[Typed State] Wrong property type: ",Cr=class Cr{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||ye.generate(),this.__schema=Object.keys(t).reduce((i,s)=>(i[s]=t[s].value,i),{}),this.__data=S.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(Gn+t);return}let i=this.__typedSchema[t],s=(e==null?void 0:e.constructor)===i.type,o=e instanceof i.type,a=i.nullable&&e===null;if(s||o||a){this.__data.pub(t,e);return}console.warn(Jc+t)}setMultipleValues(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}getValue(t){return this.__typedSchema.hasOwnProperty(t)||console.warn(Gn+t),this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){S.deleteCtx(this.__ctxId)}};n(Cr,"TypedData");var Yi=Cr;var Er=class Er{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||ye.generate(),this.__data=S.registerCtx({},this.__ctxId),this.__watchList=t.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let e=Object.create(null);this.__notifyObservers=(i,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(o=>{o({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new Yi(this.__typedSchema);for(let[i,s]of Object.entries(t))e.setValue(i,s);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){let i=this.read(t);return i?i.getValue(e):(console.warn(`Item with id ${t} not found`),null)}publishProp(t,e,i){let s=this.read(t);if(!s){console.warn(`Item with id ${t} not found`);return}s.setValue(e,i)}remove(t){let e=this.read(t);e&&this.__removed.add(e),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let s=this.read(i);s&&t(s)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){S.deleteCtx(this.__ctxId),this.__propertyObservers=new Set,this.__collectionObservers=new Set;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};n(Er,"TypedCollection");var Ji=Er;var I=Object.freeze({PHOTO:"photo",VIDEO:"video"}),se=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Ar=n(r=>({isVideoRecordingEnabled:Y(r.cameraModes).includes(I.VIDEO),isPhotoEnabled:Y(r.cameraModes).includes(I.PHOTO)}),"calcCameraModes");var ae=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),xr=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),U=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...xr,...ae});var Qc=n(()=>{let r=navigator.userAgent;return/Macintosh|Windows/.test(r)&&/Version\/[\d\.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),eu=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),tu=n(()=>({safariDesktop:Qc()}),"calcBrowserInfo"),iu=n(()=>({htmlMediaCapture:eu()}),"calcBrowserFeatures"),Wn=tu(),Be=iu();var Kt="image/*",Tr="video/*",su=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],ru=n(()=>Wn.safariDesktop?[Kt]:[Kt,...su],"calcImageAcceptList"),Zt=ru(),Qi=n(r=>r?r.filter(t=>typeof t=="string").map(t=>N(t)).flat():[],"mergeFileTypes"),Sr=n((r,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),r.startsWith(e)):r===e),"matchMimeType"),Xn=n((r,t)=>t.some(e=>e.startsWith(".")?r.toLowerCase().endsWith(e.toLowerCase()):!1),"matchExtension"),qn=n(r=>{let t=r==null?void 0:r.type;return t?Sr(t,Zt):!1},"fileIsImage");var ou=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,nu=new RegExp(`^/?(${ou.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Kn=n(({url:r,cdnBase:t})=>{let e=new URL(t),i=new URL(Nt),s=new URL(r);if(e.host!==s.host&&i.host!==s.host)return null;let[,o,a,l]=nu.exec(s.pathname);return{uuid:o,cdnUrlModifiers:a||"",filename:l||null}},"parseCdnUrl");var Zn=n(r=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let s=r(...e);return t.set(i,s),s}},"memoize");var Yn=new Set;function es(r){Yn.has(r)||(Yn.add(r),console.warn(r))}n(es,"warnOnce");function au(r){let t=!1;return setTimeout(()=>{t=!0},0),n(i=>(...s)=>(t&&es(r),i(...s)),"withAssert")}n(au,"createAsyncAssertWrapper");function Jn(r){let t={progress:n(()=>r.$["*commonProgress"],"progress"),errors:n(()=>r.$["*collectionErrors"],"errors"),group:n(()=>r.$["*groupInfo"],"group"),totalCount:n(()=>r.uploadCollection.size,"totalCount"),failedCount:n(()=>e.failedEntries.length,"failedCount"),successCount:n(()=>e.successEntries.length,"successCount"),uploadingCount:n(()=>e.uploadingEntries.length,"uploadingCount"),status:n(()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle","status"),isSuccess:n(()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,"isSuccess"),isUploading:n(()=>e.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:n(()=>e.errors.length>0||e.failedEntries.length>0,"isFailed"),allEntries:n(()=>r.getOutputData(),"allEntries"),successEntries:n(()=>e.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:n(()=>e.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:n(()=>e.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>e.allEntries.filter(s=>s.status==="idle"),"idleEntries")},e={},i=au("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,o]of Object.entries(t)){let a=s,c=Zn(i(o));Object.defineProperty(e,a,{get:c,enumerable:!0})}return e}n(Jn,"buildOutputCollectionState");var Ir=class Ir{constructor(t){d(this,"_ctx");d(this,"addFileFromUrl",n((t,{silent:e,fileName:i,source:s}={})=>{let o=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:U.API});return this.getOutputItem(o)},"addFileFromUrl"));d(this,"addFileFromUuid",n((t,{silent:e,fileName:i,source:s}={})=>{let o=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:U.API});return this.getOutputItem(o)},"addFileFromUuid"));d(this,"addFileFromCdnUrl",n((t,{silent:e,fileName:i,source:s}={})=>{var l;let o=Kn({url:t,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let a=this._uploadCollection.add({uuid:o.uuid,cdnUrl:t,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=i!=null?i:o.filename)!=null?l:null,silent:e!=null?e:!1,source:s!=null?s:U.API});return this.getOutputItem(a)},"addFileFromCdnUrl"));d(this,"addFileFromObject",n((t,{silent:e,fileName:i,source:s,fullPath:o}={})=>{let a=this._uploadCollection.add({file:t,isImage:qn(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:s!=null?s:U.API,fullPath:o!=null?o:null});return this.getOutputItem(a)},"addFileFromObject"));d(this,"removeFileByInternalId",n(t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)},"removeFileByInternalId"));d(this,"uploadAll",n(()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return i?!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo"):!1});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(w.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));d(this,"openSystemDialog",n((t={})=>{var o;let e=Ee(Qi([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Zt:[]])),i="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(i,""),Ft(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=Ar(this.cfg);t.modeCamera===I.PHOTO&&a?s.accept=Kt:t.modeCamera===I.VIDEO&&l?s.accept=Tr:s.accept=[Kt,l&&Tr].filter(Boolean).join(",")}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(a=>this.addFileFromObject(a,{source:t.captureCamera?U.CAMERA:U.LOCAL})),this._ctx.modalManager.open(b.activities.UPLOAD_LIST),this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,s.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(a=>a.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))},"openSystemDialog"));d(this,"initFlow",n((t=!1)=>{var e,i,s,o;if(this._uploadCollection.size>0&&!t)(e=this._ctx.modalManager)==null||e.open(b.activities.UPLOAD_LIST),this._ctx.set$({"*currentActivity":b.activities.UPLOAD_LIST});else if(((i=this._sourceList)==null?void 0:i.length)===1){let a=this._sourceList[0];if(a==="local"){this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.openSystemDialog();return}if(a==="camera"&&Be.htmlMediaCapture){let{isPhotoEnabled:p,isVideoRecordingEnabled:h}=Ar(this.cfg);if(p&&h){this._ctx.set$({"*currentActivity":b.activities.START_FROM});return}else if(p||h){this.openSystemDialog({captureCamera:!0,modeCamera:p?I.PHOTO:I.VIDEO});return}else this.openSystemDialog({captureCamera:!0,modeCamera:I.PHOTO})}let l=this._ctx.$["*blocksRegistry"],c=n(p=>"type"in p&&p.type===a,"isSourceBtn"),u=[...l].find(c);u==null||u.activate(),this._ctx.$["*currentActivity"]&&((s=this._ctx.modalManager)==null||s.open(this._ctx.$["*currentActivity"]))}else(o=this._ctx.modalManager)==null||o.open(b.activities.START_FROM),this._ctx.set$({"*currentActivity":b.activities.START_FROM})},"initFlow"));d(this,"doneFlow",n(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.modalManager.closeAll()},"doneFlow"));d(this,"setCurrentActivity",n((t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)},"setCurrentActivity"));d(this,"getCurrentActivity",n(()=>this._ctx.$["*currentActivity"],"getCurrentActivity"));d(this,"setModalState",n(t=>{var e,i;if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?(e=this._ctx.modalManager)==null||e.open(this._ctx.$["*currentActivity"]):((i=this._ctx.modalManager)==null||i.close(this._ctx.$["*currentActivity"]),this._ctx.$["*currentActivity"]=null)},"setModalState"));this._ctx=t}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}getOutputItem(t){var a,l,c,u,p,h,f,m,g,_;let e=S.getCtx(t).store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(a=i==null?void 0:i.uuid)!=null?a:e.uuid)!=null?l:null,internalId:t,name:(c=i==null?void 0:i.originalFilename)!=null?c:e.fileName,size:(u=i==null?void 0:i.size)!=null?u:e.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:e.isImage,mimeType:(h=i==null?void 0:i.mimeType)!=null?h:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(_=(g=e.metadata)!=null?g:i==null?void 0:i.metadata)!=null?_:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:e.errors,status:s,source:e==null?void 0:e.source}}getOutputCollectionState(){return Jn(this._ctx)}get _sourceList(){let t=[];return this.cfg.sourceList&&(t=N(this.cfg.sourceList)),t}};n(Ir,"UploaderPublicApi");var ts=Ir;var Or=n((r,t)=>{let e=t.cfg.imgOnly,i=r.isImage;if(!(!e||i)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var $r=n((r,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,s=Qi([...e?Zt:[],i]);if(!s.length)return;let o=r.mimeType,a=r.name;if(!o||!a)return;let l=Sr(o,s),c=Xn(a,s);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var fe=1e3,ze=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Yt=n(r=>Math.ceil(r*100)/100,"round"),Qn=n((r,t=ze.AUTO)=>{let e=t===ze.AUTO;if(t===ze.BYTE||e&&r<fe**1){let i=$i("en-US",r),s={one:"byte",other:"bytes"}[i];return`${r} ${s}`}return t===ze.KB||e&&r<fe**2?`${Yt(r/fe**1)} KB`:t===ze.MB||e&&r<fe**3?`${Yt(r/fe**2)} MB`:t===ze.GB||e&&r<fe**4?`${Yt(r/fe**3)} GB`:t===ze.TB||e&&r<fe**5?`${Yt(r/fe**4)} TB`:`${Yt(r/fe**5)} PB`},"prettyBytes");var kr=n((r,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=r.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:Qn(e)}),payload:{entry:r}}},"validateMaxSizeLimit");var Mr=n((r,t)=>{let{internalId:e}=r,i=t._uploadCollection.read(e),s=i==null?void 0:i.getValue("uploadError");if(!s)return;if(s instanceof H)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof it)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let o=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:r,error:o}}},"validateUploadError");var Lr=n((r,t)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Pr=n((r,t)=>{let e=r.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,s=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}};if(s&&e>s)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}}},"validateMultiple");var ct={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Ur=class Ur{constructor(t){d(this,"_blockInstance");d(this,"_fileValidators",[Or,$r,kr,Mr]);d(this,"_collectionValidators",[Pr,Lr]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=n(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let s=this._uploadCollection.read(i);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=i(t,this._blockInstance.api);if(!s)continue;s&&(e.push(s),s.message||console.warn(ct.message))}catch(s){console.warn(ct.collection,s),this._blockInstance.telemetryManager.sendEventError(s,`collection validator. ${ct.collection}`)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(w.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=s(e,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(ct.message))}catch(o){console.warn(ct.file,o),this._blockInstance.telemetryManager.sendEventError(o,`file validator. ${ct.file}`)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let s=e(...i);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};n(Ur,"ValidationManager");var is=Ur;var ea=Object.freeze({file:Object.freeze({type:File,value:null,nullable:!0}),externalUrl:Object.freeze({type:String,value:null,nullable:!0}),fileName:Object.freeze({type:String,value:null,nullable:!0}),fileSize:Object.freeze({type:Number,value:null,nullable:!0}),lastModified:Object.freeze({type:Number,value:Date.now()}),uploadProgress:Object.freeze({type:Number,value:0}),uuid:Object.freeze({type:String,value:null,nullable:!0}),isImage:Object.freeze({type:Boolean,value:!1}),mimeType:Object.freeze({type:String,value:null,nullable:!0}),ctxName:Object.freeze({type:String,value:null,nullable:!0}),cdnUrl:Object.freeze({type:String,value:null,nullable:!0}),cdnUrlModifiers:Object.freeze({type:String,value:null,nullable:!0}),fileInfo:Object.freeze({type:Te,value:null,nullable:!0}),isUploading:Object.freeze({type:Boolean,value:!1}),abortController:Object.freeze({type:AbortController,value:null,nullable:!0}),thumbUrl:Object.freeze({type:String,value:null,nullable:!0}),silent:Object.freeze({type:Boolean,value:!1}),source:Object.freeze({type:String,value:null,nullable:!0}),fullPath:Object.freeze({type:String,value:null,nullable:!0}),metadata:Object.freeze({type:Object,value:null,nullable:!0}),errors:Object.freeze({type:Array,value:[]}),uploadError:Object.freeze({type:Error,value:null,nullable:!0}),isRemoved:Object.freeze({type:Boolean,value:!1}),isQueued:Object.freeze({type:Boolean,value:!1})});var ss=class ss extends b{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!1);d(this,"isCtxOwner",!1);d(this,"init$",Vi(this));d(this,"_flushOutputItems",L(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));d(this,"_handleCollectionUpdate",n((e,i,s)=>{var o;(i.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let a of i)a.getValue("silent")||this.emit(w.FILE_ADDED,this.api.getOutputItem(a.uid));for(let a of s){this.$["*uploadTrigger"].delete(a.uid),(o=a.getValue("abortController"))==null||o.abort(),a.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let l=a==null?void 0:a.getValue("thumbUrl");l&&URL.revokeObjectURL(l),this.emit(w.FILE_REMOVED,this.api.getOutputItem(a.uid))}this.$["*uploadList"]=e.map(a=>({uid:a})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));d(this,"_handleCollectionPropertiesUpdate",n(e=>{this._flushOutputItems();let i=this.uploadCollection,s=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this.openCloudImageEditor()}if(e.errors){for(let l of e.errors){let{errors:c}=S.getCtx(l).store;c.length>0&&(this.emit(w.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(w.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(l=>!!l.getValue("fileInfo")),a=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&a.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(w.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(a=>{var l;return!!((l=this.uploadCollection.read(a))!=null&&l.getValue("cdnUrl"))}).forEach(a=>{this.emit(w.FILE_URL_CHANGED,this.api.getOutputItem(a))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));d(this,"_flushCommonUploadProgress",n(()=>{let e=0,s=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));s.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(e+=l)});let o=s.length?Math.round(e/s.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(w.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof ss?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Ji({typedSchema:ea,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new ts(this)),this.has("*validationManager")||this.add("*validationManager",new is(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}disconnectedCallback(){super.disconnectedCallback(),this.isCtxOwner&&this._unobserveUploadCollection()}connectedCallback(){super.connectedCallback(),this.isCtxOwner&&this._observeUploadCollection()}destroyCallback(){super.destroyCallback(),this._flushOutputItems.cancel()}_initCtxOwner(){this.isCtxOwner=!0,this._observeUploadCollection(),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Zi(this))}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate)}_unobserveUploadCollection(){var e,i;(e=this._unobserveCollectionProperties)==null||e.call(this),(i=this._unobserveCollection)==null||i.call(this),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0}async _createGroup(e){let i=await this.getUploadClientOptions(),s=e.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,a=await vn(s,{...i,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit(w.GROUP_CREATED,l),this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}openCloudImageEditor(){let[e]=this.uploadCollection.findItems(i=>!!i.getValue("fileInfo")&&i.getValue("isImage")).map(i=>this.uploadCollection.read(i));e&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(i=>i.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:e.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}setInitialCrop(){let e=Ki(this.cfg.cropPreset);if(e){let[i]=e,s=this.uploadCollection.findItems(o=>{var a;return!!o.getValue("fileInfo")&&o.getValue("isImage")&&!((a=o.getValue("cdnUrlModifiers"))!=null&&a.includes("/crop/"))}).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of s){let a=o.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:l,height:c}=a.imageInfo,u=typeof(i==null?void 0:i.width)=="number"&&typeof(i==null?void 0:i.height)=="number"&&i.width>0&&i.height>0?i.width/i.height:1,p=Vn(l,c,u),h=z(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=o.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:h,cdnUrl:F(f,h)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let s=this.api.getOutputItem(e);return await i(s)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:zn,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(s=>this.api.getOutputItem(s))}};n(ss,"UploaderBlock");var k=ss;k.extSrcList=Object.freeze({...ae});k.sourceTypes=Object.freeze({...U});var ut=n(r=>{var t;return(t=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:t.map(e=>e.toLowerCase()).join("-")},"toKebabCase");var P=n(r=>String(r),"asString"),Q=n(r=>{let t=Number(r);if(Number.isNaN(t))throw new Error(`Invalid number: "${r}"`);return t},"asNumber"),$=n(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}"`)},"asBoolean"),ta=n(r=>r==="auto"?r:$(r),"asStore"),ia=n(r=>{let t=P(r);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid value: "${t}"`);return t},"asCameraCapture"),sa=n(r=>{let t=P(r);if(!Object.values(I).includes(t))throw new Error(`Invalid value: "${t}"`);return t},"asCameraMode"),ra=n(r=>{let t=P(r),e=Y(t);if(e.some(i=>!Object.values(I).includes(i)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return t},"asCameraModes"),oa=n(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Rr=n(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),rs=n(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),Dr=n(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),na=n(r=>{let t=P(r);if(["grid","list"].includes(t))return t;throw new Error(`Invalid value: "${t}"`)},"asFilesViewMode");var lu={pubkey:P,multiple:$,multipleMin:Q,multipleMax:Q,confirmUpload:$,imgOnly:$,accept:P,externalSourcesPreferredTypes:P,externalSourcesEmbedCss:P,store:ta,cameraMirror:$,cameraCapture:ia,sourceList:P,topLevelOrigin:P,maxLocalFileSizeBytes:Q,thumbSize:Q,showEmptyList:$,useLocalImageEditor:$,useCloudImageEditor:$,cloudImageEditorTabs:P,removeCopyright:$,cropPreset:P,imageShrink:P,modalScrollLock:$,modalBackdropStrokes:$,sourceListWrap:$,remoteTabSessionKey:P,cdnCname:P,cdnCnamePrefixed:P,baseUrl:P,socialBaseUrl:P,secureSignature:P,secureExpire:P,secureDeliveryProxy:P,retryThrottledRequestMaxTimes:Q,retryNetworkErrorMaxTimes:Q,multipartMinFileSize:Q,multipartChunkSize:Q,maxConcurrentRequests:Q,multipartMaxConcurrentRequests:Q,multipartMaxAttempts:Q,checkForUrlDuplicates:$,saveUrlForRecurrentUploads:$,groupOutput:$,userAgentIntegration:P,debug:$,localeName:P,metadata:oa,secureUploadsExpireThreshold:Q,localeDefinitionOverride:Rr,secureUploadsSignatureResolver:rs,secureDeliveryProxyUrlResolver:rs,iconHrefResolver:rs,fileValidators:Dr,collectionValidators:Dr,cameraModes:ra,defaultCameraMode:sa,enableAudioRecording:$,enableVideoRecording:$,mediaRecorderOptions:Rr,maxVideoRecordingDuration:Q,filesViewMode:na,gridShowFileNames:$,cloudImageEditorAutoOpen:$,cloudImageEditorMaskHref:P,testMode:$,qualityInsights:$},aa=n((r,t)=>{if(!(typeof t=="undefined"||t===null))try{return lu[r](t)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),te[r]}},"normalizeConfigValue");var cu=[{test:n(r=>r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:n(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],la=L(r=>{for(let{test:t,message:e}of cu)t(r)&&es(e)},0);var ca=n((r,t)=>{let e=new URL(t);return e.hostname=`${r}.${e.hostname}`,e.toString().replace(/\/$/,"")},"o"),uu="0123456789abcdefghijklmnopqrstuvwxyz",ua=n(r=>{if(r<=BigInt(0))return"0";let t="";for(;r>BigInt(0);){let e=r%BigInt(36);t=uu[Number(e)]+t,r=r/BigInt(36)}return t},"a"),Fr=n((r,t)=>{try{let e=new URL(r),i=new URL(t);return e.hostname.endsWith(i.hostname)}catch{return!1}},"c");var du=n(async r=>{let t=new TextEncoder().encode(r),e=await window.crypto.subtle.digest("SHA-256",t),i=Array.from(new Uint8Array(e)).map(s=>s.toString(16).padStart(2,"0")).join("");return BigInt(`0x${i}`)},"c"),hu=10,pu=n(async r=>{let t=await du(r);return ua(t).slice(0,hu)},"d"),da=n(async(r,t)=>{let e=await pu(r);return ca(e,t)},"f");var ha=n(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var fu=[{key:"cameraModes",deps:["enableVideoRecording"],fn:n(({cameraModes:r,enableVideoRecording:t})=>{if(t===null)return r;let e=Y(r);return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(i=>i!=="video")),Ee(e)},"fn")},{key:"cameraModes",deps:["defaultCameraMode"],fn:n(({cameraModes:r,defaultCameraMode:t})=>{if(t===null)return r;let e=Y(r);return e=e.sort((i,s)=>i===t?-1:s===t?1:0),Ee(e)},"fn")},{key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:n(({pubkey:r,cdnCname:t,cdnCnamePrefixed:e})=>r&&(t===Nt||Fr(t,e))?da(r,e):t,"fn")}],Nr=n(({key:r,setValue:t,getValue:e})=>{for(let i of fu)if(i.deps.includes(r)){let s={[i.key]:e(i.key),...i.deps.reduce((a,l)=>({...a,[l]:e(l)}),{})},o=i.fn(s);if(ha(o)){let a=e(i.key);o.then(l=>{e(i.key)===a&&t(i.key,l)}).catch(l=>{console.error(`Failed to compute value for "${i.key}"`,l)})}else t(i.key,o)}},"runSideEffects");var Vr=[...new Set(["debug",...Object.keys(te)])],mu=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],gu=n(r=>mu.includes(r),"isComplexKey"),dt=Vr.filter(r=>!gu(r)),bu={...Object.fromEntries(dt.map(r=>[ut(r),r])),...Object.fromEntries(dt.map(r=>[r.toLowerCase(),r]))},_u={...Object.fromEntries(dt.map(r=>[ut(r),j(r)])),...Object.fromEntries(dt.map(r=>[r.toLowerCase(),j(r)]))},pa=n(r=>"__"+r,"getLocalPropName"),Br=class Br extends v{constructor(){super();d(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(te).map(([e,i])=>[j(e),i]))}}_flushValueToAttribute(e,i){if(dt.includes(e)){let s=[...new Set([ut(e),e.toLowerCase()])];for(let o of s)typeof i=="undefined"||i===null?this.removeAttribute(o):this.getAttribute(o)!==i.toString()&&this.setAttribute(o,i.toString())}}_flushValueToState(e,i){this.$[j(e)]!==i&&(typeof i=="undefined"||i===null?this.$[j(e)]=te[e]:this.$[j(e)]=i)}_setValue(e,i){let s=this,o=aa(e,i),a=pa(e);s[a]!==o&&(this._assertSameValueDifferentReference(e,s[a],o),s[a]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o),la(this.cfg),Nr({key:e,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)}))}_getValue(e){var o;let i=this,s=pa(e);return(o=i[s])!=null?o:this.$[j(e)]}_assertSameValueDifferentReference(e,i,s){this.cfg.debug&&s!==i&&typeof s=="object"&&typeof i=="object"&&JSON.stringify(s)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var i;super.initCallback();let e=this;for(let s of dt)this.sub(j(s),o=>{this._setValue(s,o)},!1);for(let s of Vr){let o=(i=e[s])!=null?i:this.$[j(s)];o!==te[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n(a=>{this._setValue(s,a)},"set"),get:n(()=>this._getValue(s),"get")}),Nr({key:s,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)})}}attributeChangedCallback(e,i,s){if(i===s)return;let o=this,a=bu[e];o[a]=s}};n(Br,"ConfigClass");var Jt=Br;Jt.bindAttributes(_u);for(let r of Vr)Jt.prototype[r]=void 0;var fa=Jt;var zr=class zr extends v{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let s=i(t);e=s!=null?s:e}this.$.href=e})}),this.setAttribute("aria-hidden","true")}};n(zr,"Icon");var ht=zr;ht.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;ht.bindAttributes({name:"name"});var ma=n(r=>[...new Set(r)],"uniqueArray");var ga=n(r=>Object.entries(r).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`),"parseObjectToString");var vu="https://ucarecdn.com",Qt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:vu},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var pt="--uc-img-",Hr="unresolved";var jr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Gr=3e3,Wr=5e3,Xr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var _a=Object.create(null),ba;for(let r in Qt)_a[pt+r]=((ba=Qt[r])==null?void 0:ba.default)||"";var qr=class qr extends we{constructor(){super(...arguments);d(this,"cssInit$",_a)}$$(e){return this.$[pt+e]}set$$(e){for(let i in e)this.$[pt+i]=e[i]}sub$$(e,i){this.sub(pt+e,s=>{s===null||s===""||i(s)})}analyticsParams(){return`-/@clib/${Ie}/${Oe}/uc-img/`}initAttributes(e){[...this.attributes].forEach(i=>{Qt[i.name]||e.setAttribute(i.name,i.value)})}initIntersection(e,i){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(a=>{a.isIntersecting&&(i(),this._isnObserver.unobserve(e))})},s),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),S.deleteCtx(this)}static get observedAttributes(){return Object.keys(Qt)}attributeChangedCallback(e,i,s){window.setTimeout(()=>{this.$[pt+e]=s})}};n(qr,"ImgConfig");var os=qr;var Kr=class Kr extends os{constructor(){super(...arguments);d(this,"_img",new Image);d(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!jr&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let i=e.match(/\d+/)[0],s=e.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>Wr&&this.hasFormatJPG)return Wr+s;if(Number(o)>Gr&&!this.hasFormatJPG)return Gr+s}return e}_getCdnModifiers(e,i){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return z(...ga(s))}_getUrlBase(e="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(jr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(e,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return F(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(F(ke(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(F(ke(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(F(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(F(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?zt(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:n(s=>window.encodeURIComponent(s),"transform")}):e}_getElSize(e,i=1,s=!0){let o=e.getBoundingClientRect(),a=i*Math.round(o.width),l=s?"":i*Math.round(o.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(e){let i=n(o=>{o.stopPropagation();let a=new Event(o.type,o);this.dispatchEvent(a)},"proxifyEvent"),s=["load","error"];for(let o of s)e.addEventListener(o,i)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Xr.PREVIEW,img:this._imgPreview}:{type:Xr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=N(this.$$("breakpoints"));return ma(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let s=`image-set(${[...i].join(", ")})`;e.style.setProperty("background-image",s),e.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{e.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:i,srcset:s}){i&&(e.src=i),s&&(e.srcset=s)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:i,elNode:s}){return new Promise((o,a)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(Hr,""),s.addEventListener("load",()=>{s.removeAttribute(Hr),o(s)}),s.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:s,src:e,srcset:i})})}async renderImage(){var e,i;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((s=this._imgPreview)==null?void 0:s.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};n(Kr,"ImgBase");var ls=Kr;var Zr=class Zr extends ls{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager")})}};n(Zr,"Img");var cs=Zr;var ft=class ft extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:n(()=>{this.api.initFlow()},"onClick"),"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e!="undefined"&&(this.$.withDropZone=$(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};n(ft,"SimpleBtn"),d(ft,"styleAttrs",[...K(ft,ft,"styleAttrs"),"uc-simple-btn"]);var mt=ft;mt.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;mt.bindAttributes({dropzone:null});var Yr=class Yr extends b{constructor(){super(...arguments);d(this,"historyTracked",!0);d(this,"activityType",b.activities.START_FROM)}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};n(Yr,"StartFrom");var ei=Yr;ei.template='<div class="uc-content"><slot></slot></div>';function yu(r){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=n(s=>{s.type!=="loadend"&&e.abort(),t(!1)},"onLoad");e.onloadend=i,e.onprogress=i,e.readAsDataURL(r)}catch{t(!1)}})}n(yu,"checkIsDirectory");function wu(r,t){return new Promise(e=>{let i=0,s=[],o=n(l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(c=>{i--;let u=new File([c],c.name,{type:c.type||t});s.push({type:"file",file:u,fullPath:l.fullPath}),i===0&&e(s)})):l.isDirectory&&a(l.createReader())},"readEntry"),a=n(l=>{i++,l.readEntries(c=>{i--;for(let u of c)o(u);i===0&&e(s)})},"readReaderContent");o(r)})}n(wu,"readEntryContentAsync");function va(r){let t=[],e=[];for(let i=0;i<r.items.length;i++){let s=r.items[i];if(s)if(s.kind==="file"){let o=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();e.push(wu(l,o).then(c=>{c&&t.push(...c)}));continue}let a=s.getAsFile();a&&e.push(yu(a).then(l=>{l||t.push({type:"file",file:a})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&e.push(new Promise(o=>{s.getAsString(a=>{t.push({type:"url",url:a}),o(void 0)})}))}return Promise.all(e).then(()=>t)}n(va,"getDropItems");var W={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},ya=["focus"],Cu=100,Jr=new Map;function Eu(r,t){let e=Math.max(Math.min(r[0],t.x+t.width),t.x),i=Math.max(Math.min(r[1],t.y+t.height),t.y);return Math.sqrt((r[0]-e)*(r[0]-e)+(r[1]-i)*(r[1]-i))}n(Eu,"distance");function Qr(r){let t=0,e=document.body,i=new Set,s=n(g=>i.add(g),"handleSwitch"),o=W.INACTIVE,a=n(g=>{r.shouldIgnore()&&g!==W.INACTIVE||(o!==g&&i.forEach(_=>_(g)),o=g)},"setState"),l=n(()=>t>0,"isDragging");s(g=>r.onChange(g));let c=n(()=>{t=0,a(W.INACTIVE)},"onResetEvent"),u=n(()=>{t+=1,o===W.INACTIVE&&a(W.ACTIVE)},"onDragEnter"),p=n(()=>{t-=1,l()||a(W.INACTIVE)},"onDragLeave"),h=n(g=>{g.preventDefault(),t=0,a(W.INACTIVE)},"onDrop"),f=n(g=>{if(r.shouldIgnore())return;l()||(t+=1);let _=[g.x,g.y],E=r.element.getBoundingClientRect(),y=Math.floor(Eu(_,E)),A=y<Cu,C=g.composedPath().includes(r.element);Jr.set(r.element,y);let R=Math.min(...Jr.values())===y;C&&R?(g.preventDefault(),a(W.OVER)):a(A&&R?W.NEAR:W.ACTIVE)},"onDragOver"),m=n(async g=>{if(r.shouldIgnore())return;g.preventDefault();let _=await va(g.dataTransfer);r.onItems(_),a(W.INACTIVE)},"onElementDrop");return e.addEventListener("drop",h),e.addEventListener("dragleave",p),e.addEventListener("dragenter",u),e.addEventListener("dragover",f),r.element.addEventListener("drop",m),ya.forEach(g=>{window.addEventListener(g,c)}),()=>{Jr.delete(r.element),e.removeEventListener("drop",h),e.removeEventListener("dragleave",p),e.removeEventListener("dragenter",u),e.removeEventListener("dragover",f),r.element.removeEventListener("drop",m),ya.forEach(g=>{window.removeEventListener(g,c)})}}n(Qr,"addDropzone");var wa="uc-drop-area",gt=`${wa}/registry`,bt=class bt extends k{constructor(){super(),this.init$={...this.init$,state:W.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,isInitFlow:!1,text:"",[gt]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),o=s.visibility!=="hidden"&&s.display!=="none";return e&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[gt]||(this.$[gt]=new Set),this.$[gt].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!$(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:$(e)})}),this.defineAccessor("initflow",e=>{this.set$({isInitFlow:$(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:$(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:$(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Qr({element:this,shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore"),onChange:n(e=>{this.$.state=e},"onChange"),onItems:n(e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:U.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:U.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.modalManager.open(b.activities.UPLOAD_LIST),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})))},"onItems")});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=Qr({element:t,onChange:n(e=>{var s;let i=(s=Object.entries(W).find(([,o])=>o===e))==null?void 0:s[0].toLowerCase();i&&t.setAttribute("drag-state",i)},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore")})),this.sub("state",e=>{var s;let i=(s=Object.entries(W).find(([,o])=>o===e))==null?void 0:s[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=N(e);this.$.isEnabled=i.includes(U.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{if(e.type==="keydown"){if(e.code==="Space"||e.code==="Enter"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}}else if(e.type==="click"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[gt]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[gt];t&&(t.delete(this),t.size===0&&S.deleteCtx(wa)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};n(bt,"DropArea"),d(bt,"styleAttrs",[...K(bt,bt,"styleAttrs"),"uc-drop-area"]);var _t=bt;_t.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;_t.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null,initflow:null});var Au="src-type-",eo=class eo extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"type");d(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:U.LOCAL,activate:n(()=>(this.api.openSystemDialog(),!1),"activate")}),this.registerType({type:U.URL,activity:b.activities.URL,textKey:"from-url"}),this.registerType({type:U.CAMERA,activity:b.activities.CAMERA,activate:n(()=>{let e=Be.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:!0}),!e},"activate")}),this.registerType({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(xr))this.registerType({type:e,activity:b.activities.CAMERA,activate:n(()=>{let i=Be.htmlMediaCapture;return i&&this.api.openSystemDialog({captureCamera:!0,modeCamera:e==="mobile-photo-camera"?I.PHOTO:I.VIDEO}),!i},"activate")});for(let e of Object.values(ae))this.registerType({type:e,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type],{activity:i,activate:s,activityParams:o={}}=e;(s?s():!!i)&&(this.modalManager.open(i),this.set$({"*currentActivityParams":o,"*currentActivity":i}))}applyType(e){let i=this._registeredTypes[e];if(!i){console.warn("Unsupported source type: "+e);return}let{textKey:s=e,icon:o=e}=i;this.$["src-type"]=`${Au}${s}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};n(eo,"SourceBtn");var vt=eo;vt.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;vt.bindAttributes({type:null});var to=class to extends v{initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{let e=N(t),i="";e.forEach(s=>{if(s==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");return}if(s==="camera"&&Be.htmlMediaCapture){this.subConfigValue("cameraModes",o=>{let a=Y(o);a.forEach(l=>{i+=`<uc-source-btn role="listitem" type="mobile-${l}-camera"></uc-source-btn>`}),a.length===0&&(i+='<uc-source-btn role="listitem" type="mobile-photo-camera"></uc-source-btn>')});return}i+=`<uc-source-btn role="listitem" type="${s}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};n(to,"SourceList");var us=to;var hs=n(()=>{let r=[];return{stack:r,promiseReadJpegChunks:n(e=>new Promise((i,s)=>{let o=2,a=n((u,p)=>{let h=new FileReader;h.addEventListener("load",()=>{p(new DataView(h.result))}),h.addEventListener("error",f=>{s(`Reader error: ${f}`)}),h.readAsArrayBuffer(u)},"readToView"),l=n(()=>a(e.slice(o,o+128),u=>{let p,h,f;for(p=h=0,f=u.byteLength;f>=0?h<f:h>f;p=f>=0?++h:--h)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=n(()=>{let u=o;return a(e.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){s("Corrupted");return}let h=p.getUint8(1);if(h===218){i(!0);return}let f=p.getUint16(2)-2;return a(e.slice(o,o+=f),m=>{if(m.byteLength!==f){s("Corrupted");return}r.push({startPos:u,length:f,marker:h,view:m}),l()})})},"readNextChunk");FileReader&&DataView||s("Not Support"),a(e.slice(0,2),u=>{u.getUint16(0)!==65496&&s("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),xu=n(async r=>{let t=[],{promiseReadJpegChunks:e,stack:i}=hs();return await e(r),i.forEach(({marker:s,view:o})=>{s===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&t.push(o)}),t},"getIccProfile"),Ea=n(async(r,t,e)=>{{let i=[],s=[],{promiseReadJpegChunks:o,stack:a}=hs();await o(r),a.forEach(u=>{if(u.marker===t)return i.push(u.startPos),s.push(u.length)});let l=[r.slice(0,2)];for(let u of e){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+t),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&l.push(r.slice(c,i[u])),c=i[u]+s[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),Tu=226,Aa=n((r,t)=>Ea(r,Tu,t.map(e=>e.buffer)),"replaceIccProfile"),Su=n(async r=>{try{return await Aa(r,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},"stripIccProfile"),Iu=n((r,t,e)=>new Promise((i,s)=>{let o=n(a=>{if(!a){s("Failed to convert canvas to blob");return}i(a)},"callback");r.toBlob(o,t,e),r.width=r.height=1}),"canvasToBlob"),ti=n(()=>{let r=document.createElement("canvas"),t=r.getContext("2d");return{canvas:r,ctx:t}},"createCanvas"),Ou=n(r=>{let{ctx:e,canvas:i}=ti();i.width=i.height=50,e.drawImage(r,0,0,50,50);let s=e.getImageData(0,0,50,50).data;i.width=i.height=1;for(let o=3;o<s.length;o+=4)if(s[o]<254)return!0;return!1},"hasTransparency"),$u=n(async r=>{let t=null,{promiseReadJpegChunks:e,stack:i}=hs();return await e(r),i.forEach(({marker:s,view:o})=>{if(!t&&s===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){t=o;return}}),t},"getExif"),ku="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ds,Mu=n(()=>new Promise(r=>{if(ds!==void 0)r(ds);else{let t=new Image;t.addEventListener("load",()=>{ds=t.naturalWidth<t.naturalHeight,t.src="//:0",r(ds)}),t.src=ku}}),"isBrowserApplyExifOrientation"),Lu=n((r,t)=>{let e,i,s,o;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)i=!0;else if(r.getUint16(6)===19789)i=!1;else return;if(r.getUint16(8,i)!==42)return;s=8+r.getUint32(10,i);let a=r.getUint16(s-2,i);for(e=0,o=a;o>=0?e<o:e>o;o>=0?++e:--e){if(r.byteLength<s+10)return;r.getUint16(s,i)===274&&t(s+8,i),s+=12}},"findExifOrientation"),Pu=n((r,t)=>{Lu(r,(e,i)=>r.setUint16(e,t,i))},"setExifOrientation"),Uu=n(async(r,t,e)=>(e&&Pu(t,1),Ea(r,225,[t.buffer])),"replaceExif"),Ru=n((r,t)=>new Promise((e,i)=>{t&&(r.src=t),r.complete?e(r):(r.addEventListener("load",()=>{e(r)}),r.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),Du=n(r=>Ru(new Image,r),"imageLoader"),Fu=[1,3],Nu=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ca={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Vu=n(async r=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=hs();return await e(r).then(()=>(i.forEach(({marker:s,view:o})=>{if(!t&&Nu.indexOf(s)>=0){let a=o.getUint8(5);Fu.indexOf(a)<0&&(t=!0)}}),t)).catch(()=>t)},"shouldSkipShrink"),xa=n((r,t)=>{let e={};return(...i)=>{let s=t(i,e);return s in e?e[s]:e[s]=r(...i)}},"memoize"),Ta=n((r,t)=>{let[e]=r,i=Object.keys(t).map(s=>parseInt(s,10)).sort((s,o)=>s-o);for(let s=0;s<i.length;s++){let o=i[s],a=!!t[o];if(o>e&&a||o<e&&!a)return o}return e},"memoKeySerializer"),Fe={R:55,G:110,B:165,A:255},Bu=`rgba(${Fe.R}, ${Fe.G}, ${Fe.B}, ${Fe.A/255})`,Sa=n((r,t)=>{try{let e=[r-1,t-1,1,1],{canvas:i,ctx:s}=ti();i.width=1,i.height=1;let{canvas:o,ctx:a}=ti();o.width=r,o.height=t,a&&(a.fillStyle=Bu,a.fillRect(...e),s.drawImage(o,r-1,t-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Fe.R&&l[1]===Fe.G&&l[2]===Fe.B&&l[3]===Fe.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${t}.`),!1}},"canvasTest");function Ia(r){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=r(...t);e(i)},0)})}n(Ia,"wrapAsync");var zu=Ia(xa(Sa,Ta)),Hu=Ia(xa(Sa,Ta)),Oa=n(async(r,t)=>{let e=Ca.squareSide.find(a=>a*a>=r*t),i=Ca.dimension.find(a=>a>=r&&a>=t);if(!e||!i)throw new Error("Not supported");let[s,o]=await Promise.all([zu(e,e),Hu(i,1)]);if(s&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),$a=n(async(r,t,e)=>{try{let{ctx:i,canvas:s}=ti();return s.width=t,s.height=e,i.imageSmoothingQuality="high",i.drawImage(r,0,0,t,e),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(i){throw new Error("Canvas resize error",{cause:i})}},"canvasResize"),ju=n(({img:r,targetW:t,targetH:e})=>$a(r,t,e),"native"),Gu=n(function({sourceW:r,targetW:t,targetH:e,step:i}){let s=[],o=t,a=e;do s.push([o,a]),o=Math.round(o/i),a=Math.round(a/i);while(o<r*i);return s.reverse()},"calcShrinkSteps"),Wu=n(({img:r,sourceW:t,targetW:e,targetH:i,step:s})=>{let o=Gu({sourceW:t,targetW:e,targetH:i,step:s});return o.reduce((a,[l,c],u)=>a.then(p=>Oa(l,c).then(()=>$a(p,l,c)).catch(()=>{if(u===o.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),Xu=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),qu=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),io=.71,Ku=n((r,t)=>{if(r.width*io*r.height*io<t.size)throw new Error("Not required");let e=r.width,i=r.height,s=e/i,o=Math.floor(Math.sqrt(t.size*s)),a=Math.floor(t.size/Math.sqrt(t.size*s));return Oa(o,a).then(()=>{let{ctx:l}=ti();return"imageSmoothingQuality"in l&&!Xu()&&!qu?ju({img:r,targetW:o,targetH:a}):Wu({img:r,sourceW:e,targetW:o,targetH:a,step:io})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),ka=n(async(r,t)=>{try{if(await Vu(r))throw new Error("Should skipped");let i=await Promise.allSettled([$u(r),Mu(),xu(r)]),o=!i.some(_=>_.status==="rejected"),[a,l,c]=i,u=await Su(r).catch(()=>r),p=await Du(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let h=await Ku(p,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!o&&Ou(h)&&(f="image/png",m=void 0);let g=await Iu(h,f,m);if(o&&a.status==="fulfilled"&&a.value){let _=a.value,E=l.status==="fulfilled"?l.value:!1;g=await Uu(g,_,E)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await Aa(g,c.value)),g}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}},"shrinkFile");var Zu=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ma=n(r=>{let t=Zu.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}},"parseShrink");var yt=n((r,t)=>{let e,i,s,o=n((...a)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=t&&(r(...a),s=Date.now())},Math.max(t-(Date.now()-s),0))):(r(...a),s=Date.now(),e=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:n(()=>{clearTimeout(i)},"value")}),o},"throttle");var so=class so extends k{constructor(){super(...arguments);d(this,"_entrySubs",new Set);d(this,"_entry",null)}_withEntry(e){return n((...s)=>{let o=this._entry;if(!o){console.warn("No entry found");return}return e(o,...s)},"wrapperFn")}_subEntry(e,i){return this._withEntry((s,o,a)=>{let l=s.subscribe(o,c=>{this.isConnected&&a(c)});this._entrySubs.add(l)})(e,i)}_reset(){for(let e of this._entrySubs)e.remove();this._entrySubs=new Set,this._entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}};n(so,"FileItemConfig");var wt=so;var ie=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),Ct=class Ct extends wt{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"pauseRender",!0);d(this,"_renderedOnce",!1);d(this,"_calculateState",this._withEntry(e=>{let i=ie.IDLE;e.getValue("errors").length>0?i=ie.FAILED:e.getValue("isUploading")?i=ie.UPLOADING:e.getValue("fileInfo")&&(i=ie.FINISHED),this.$.state=i}));d(this,"_debouncedCalculateState",L(this._calculateState.bind(this),100));d(this,"_updateHint",this._withEntry(yt(e=>{let i=e.getValue("source"),s=e.getValue("externalUrl"),o=e.getValue("errors").length===0,a=this.$.progressValue===0,l=this.$.state===ie.UPLOADING,c=e.getValue("isQueued");if(!o||!l||!a){this.$.hint="";return}if(c){let u=this.l10n("queued");this.$.hint=u;return}if(s&&i&&Object.values(ae).includes(i)){let u=this.l10n("waiting-for",{source:this.l10n(`src-type-${i}`)});this.$.hint=u;return}this.$.hint=""},100)));d(this,"_handleState",this._withEntry((e,i)=>{var o,a,l,c,u,p;i===ie.FAILED?this.$.badgeIcon="badge-error":i===ie.FINISHED&&(this.$.badgeIcon="badge-success"),i===ie.UPLOADING&&(this.$.isFocused=!1);let s=e.getValue("fileName");this.set$({isFailed:i===ie.FAILED,isUploading:i===ie.UPLOADING,isFinished:i===ie.FINISHED,progressVisible:i===ie.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((o=this._entry)==null?void 0:o.getValue("isImage"))&&((a=this._entry)==null?void 0:a.getValue("cdnUrl")),errorText:(c=(l=e.getValue("errors"))==null?void 0:l[0])==null?void 0:c.message,ariaLabelStatusFile:s&&this.l10n("a11y-file-item-status",{fileName:s,status:this.l10n((p=(u=i==null?void 0:i.description)==null?void 0:u.toLocaleLowerCase())!=null?p:"").toLocaleLowerCase()})}),this._updateHint()}));d(this,"upload",this._withEntry(async e=>{var s,o,a,l,c,u,p;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setMultipleValues({isUploading:!0,errors:[],isQueued:!0});try{let h=new AbortController;e.setValue("abortController",h);let f=n(async()=>{var A,C;e.setValue("isQueued",!1);let g=e.getValue("file");g&&this.cfg.imageShrink&&(g=await this._processShrink(g).catch(()=>g));let _=g||e.getValue("externalUrl")||e.getValue("uuid");if(!_)throw new Error("No file input");let y={...await this.getUploadClientOptions(),fileName:(A=e.getValue("fileName"))!=null?A:void 0,source:(C=e.getValue("source"))!=null?C:void 0,onProgress:n(R=>{if(R.isComputable){let X=R.value*100;e.setValue("uploadProgress",X)}},"onProgress"),signal:h.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",_,y),Zs(_,y)},"uploadTask"),m=await this.$["*uploadQueue"].add(f);e.setMultipleValues({fileInfo:m,isQueued:!1,isUploading:!1,fileName:m.originalFilename,fileSize:m.size,isImage:(s=m.isImage)!=null?s:!1,mimeType:(l=(a=(o=m.contentInfo)==null?void 0:o.mime)==null?void 0:a.mime)!=null?l:m.mimeType,uuid:m.uuid,cdnUrl:(c=e.getValue("cdnUrl"))!=null?c:m.cdnUrl,cdnUrlModifiers:(u=e.getValue("cdnUrlModifiers"))!=null?u:"",uploadProgress:100,source:(p=e.getValue("source"))!=null?p:null}),e===this._entry&&this._debouncedCalculateState()}catch(h){this.telemetryManager.sendEventError(h,"file upload. Failed to upload file"),h instanceof Le&&h.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):h instanceof Ne?e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:h}):(console.error("Unknown upload error",h),e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:h})})),e===this._entry&&this._debouncedCalculateState()}}}));this.init$={...this.init$,uid:"",itemName:"",errorText:"",hint:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,showFileNames:!1,state:ie.IDLE,ariaLabelStatusFile:"",onEdit:this._withEntry(e=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:e.uid},this.modalManager.open(b.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT}),onRemove:n(()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uploadCollection.remove(this.$.uid)},"onRemove"),onUpload:n(()=>{this.upload()},"onUpload")}}_reset(){super._reset(),this._debouncedCalculateState.cancel()}_observerCallback(e){let[i]=e;this._isIntersecting=i.isIntersecting,this._thumbRect=i.boundingClientRect,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0)}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o,this._updateHint()}),this._subEntry("isQueued",()=>{this._updateHint()}),this._subEntry("fileName",o=>{this.$.itemName=o||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=i.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",()=>{this._debouncedCalculateState()}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()))}_updateShowFileNames(e){if(this.cfg.filesViewMode==="list"){this.$.showFileNames=!0;return}this.$.showFileNames=e}initCallback(){super.initCallback(),this.sub("uid",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.subConfigValue("filesViewMode",e=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",e)}),this.subConfigValue("gridShowFileNames",e=>{this._updateShowFileNames(e)}),this.onclick=()=>{Ct.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{this._entry&&!e.has(this._entry.uid)||setTimeout(()=>this.isConnected&&this.upload())}),Ct.activeInstances.add(this)}destroyCallback(){super.destroyCallback(),Ct.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return Ma(this.cfg.imageShrink)}_processShrink(e){return ka(e,this._settingsOfShrink())}};n(Ct,"FileItem");var Et=Ct;Et.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><uc-thumb set="uid:uid;badgeIcon:badgeIcon"></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span><span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button;@aria-label:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button;@aria-label:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames;" ></uc-progress-bar></div>`;Et.activeInstances=new Set;var ro=null,He=class He extends v{constructor(){super();d(this,"_handleBackdropClick",n(()=>{this._closeDialog()},"_handleBackdropClick"));d(this,"_closeDialog",n(()=>{var e;(e=this.modalManager)==null||e.close(this.id),this.modalManager.hasActiveModals||(document.body.style.overflow="")},"_closeDialog"));d(this,"_handleDialogClose",n(()=>{this._closeDialog()},"_handleDialogClose"));d(this,"_handleDialogMouseDown",n(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown"));d(this,"_handleDialogMouseUp",n(e=>{e.target===this.ref.dialog&&e.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?(this.setAttribute("aria-modal","true"),this.ref.dialog.showModal()):this.ref.dialog.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden")}hide(){this.ref.dialog.close?(this.setAttribute("aria-modal","false"),this.ref.dialog.close()):this.ref.dialog.removeAttribute("open")}_handleModalOpen({id:e}){e===this.id?(ro=e,this.show(),this.emit(w.MODAL_OPEN,{modalId:e},{debounce:!0})):this.hide()}_handleModalClose({id:e}){e===this.id&&(this.hide(),this.emit(w.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0}))}_handleModalCloseAll(){this.hide(),ro===this.id&&this.emit(w.MODAL_CLOSE,{modalId:ro,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0})}initCallback(){var e;super.initCallback(),(e=this.modalManager)==null||e.registerModal(this.id,this),this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp),this.subConfigValue("modalBackdropStrokes",i=>{i?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.handleModalCloseAll=this._handleModalCloseAll.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose),this.modalManager.subscribe(D.CLOSE_ALL,this.handleModalCloseAll)}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose),this.modalManager.unsubscribe(D.CLOSE_ALL,this.handleModalCloseAll)}};n(He,"Modal"),d(He,"styleAttrs",[...K(He,He,"styleAttrs"),"uc-modal"]),d(He,"StateConsumerScope","modal");var ii=He;ii.template=`<dialog ref="dialog"><slot></slot></dialog>`;var oo=class oo extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"historyTracked",!0);d(this,"activityType",b.activities.UPLOAD_LIST);d(this,"_throttledHandleCollectionUpdate",yt(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:n(()=>{this.api.initFlow(!0)},"onAdd"),onUpload:n(()=>{this.emit(w.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},"onUpload"),onDone:n(()=>{this.emit(w.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},"onDone"),onCancel:n(()=>{this.uploadCollection.clearAll()},"onCancel")}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},s=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=e.errors.some(f=>f.type==="TOO_MANY_FILES"),a=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.errors.length===0,c=!1,u=!1,p=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&s)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!e.group:!0;p=i.total===i.succeed&&s&&l&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:i.total===0||!o&&!a,addMoreBtnVisible:!a||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(e){let i=n(s=>{let o=e[s];return this.l10n(`header-${s}`,{count:o})},"localizedText");return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.succeed>0?i("succeed"):i("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",e=>{e&&this._throttledHandleCollectionUpdate()}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e)}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};n(oo,"UploadList");var si=oo;si.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files"><div class="uc-files-wrapper" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var no=class no extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.URL);d(this,"init$",{...this.init$,importDisabled:!0,onUpload:n(e=>{e.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:U.URL}),this.modalManager.open(b.activities.UPLOAD_LIST),this.$["*currentActivity"]=b.activities.UPLOAD_LIST},"onUpload"),onCancel:n(()=>{this.historyBack()},"onCancel"),onInput:n(e=>{let i=e.target.value;this.set$({importDisabled:!i})},"onInput")})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{this.ref.input.value="",this.ref.input.focus()},"onActivate")})}};n(no,"UrlSource");var ri=no;ri.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back;@aria-label:back"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><label><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var La=n(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Yu={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Pa=["camera","microphone"];function ps(r){let t=Math.floor(r/60).toString().padStart(2,"0"),e=Math.floor(r%60).toString().padStart(2,"0");return`${t}:${e}`}n(ps,"formatTime");var Ua="image/jpeg",Ra="video/webm",ao=class ao extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CAMERA);d(this,"_unsubPermissions",null);d(this,"_chunks",[]);d(this,"_mediaRecorder",null);d(this,"_stream",null);d(this,"_selectedAudioId",null);d(this,"_selectedCameraId",null);d(this,"_chooseActionWithCamera",n(()=>{var e;if(this._activeTab===I.PHOTO&&this._shot(),this._activeTab===I.VIDEO){if(((e=this._mediaRecorder)==null?void 0:e.state)==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera"));d(this,"_updateTimer",n(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let i=this.cfg.maxVideoRecordingDuration-e;if(i<=0){this.ref.timer.textContent=ps(i),this._stopRecording();return}this.ref.timer.textContent=ps(i)}else this.ref.timer.textContent=ps(e);this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer"));d(this,"_startTimer",n(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer"));d(this,"_stopTimer",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer"));d(this,"_startTimeline",n(()=>{let e=this.ref.video.currentTime,i=this.ref.video.duration;this.ref.line.style.transform=`scaleX(${e/i})`,this.ref.timer.textContent=ps(e),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline"));d(this,"_stopTimeline",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline"));d(this,"_startRecording",n(()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Ra)?this._options.mimeType=Ra:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",i=>{this._chunks.push(i.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(se.PLAY))}catch(e){console.error("Failed to start recording",e),this.telemetryManager.sendEventError(e,"camera recording. Failed to start recording")}},"_startRecording"));d(this,"_stopRecording",n(()=>{var e,i;(e=this._mediaRecorder)==null||e.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(se.STOP)}),(i=this._mediaRecorder)==null||i.stop(),this.classList.remove("uc-recording")},"_stopRecording"));d(this,"_toggleRecording",n(()=>{var e;((e=this._mediaRecorder)==null?void 0:e.state)!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording"));d(this,"_toggleEnableAudio",n(()=>{var e;(e=this._stream)==null||e.getAudioTracks().forEach(i=>{i.enabled=!i.enabled,this.$.toggleMicrophoneIcon=i.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!i.enabled})},"_toggleEnableAudio"));d(this,"_previewVideo",n(()=>{var e;try{let i=new Blob(this._chunks,{type:(e=this._mediaRecorder)==null?void 0:e.mimeType}),s=URL.createObjectURL(i);this.ref.video.muted=!1,this.ref.video.volume=1,this.$.video=null,this.ref.video.src=s,this.ref.video.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),this.ref.video.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(i){console.error("Failed to preview video",i),this.telemetryManager.sendEventError(i,"camera previewing. Failed to preview video")}},"_previewVideo"));d(this,"_retake",n(()=>{this._setCameraState(se.RETAKE),this._activeTab===I.VIDEO&&(this.$.video=this._stream,this.ref.video.muted=!0),this.ref.video.play()},"_retake"));d(this,"_accept",n(()=>{var o,a,l;if(this._setCameraState(se.ACCEPT),this._activeTab===I.PHOTO){(o=this._canvas)==null||o.toBlob(c=>{let u=this._createFile("camera","jpeg",Ua,c);this._toSend(u)},Ua);return}let e=new Blob(this._chunks,{type:(a=this._mediaRecorder)==null?void 0:a.mimeType}),i=this._guessExtensionByMime((l=this._mediaRecorder)==null?void 0:l.mimeType),s=this._createFile("video",i,`video/${i}`,e);this._toSend(s),this._chunks=[]},"_accept"));d(this,"_handlePhoto",n(e=>{e===se.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===se.RETAKE||e===se.ACCEPT)&&this.set$({tabVideoHidden:!this._cameraModes.includes(I.VIDEO),tabCameraHidden:!this._cameraModes.includes(I.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this._cameraDevices.length<=1})},"_handlePhoto"));d(this,"_handleVideo",n(e=>{e===se.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===se.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicrophoneHidden:!0,cameraActionsHidden:!1}),(e===se.RETAKE||e===se.ACCEPT)&&this.set$({timerHidden:!0,tabVideoHidden:!this._cameraModes.includes(I.VIDEO),tabCameraHidden:!this._cameraModes.includes(I.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,cameraSelectHidden:this._cameraDevices.length<=1})},"_handleVideo"));d(this,"_setCameraState",n(e=>{this._activeTab===I.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===I.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState"));d(this,"_handleActiveTab",n(e=>{this.ref.switcher.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e)}),e===I.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicrophoneHidden:!0}),e===I.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab"));d(this,"_createFile",n((e,i,s,o)=>{let a=Date.now(),l=`${e}-${a}.${i}`;return new File([o],l,{lastModified:a,type:s})},"_createFile"));d(this,"_toSend",n(e=>{this.api.addFileFromObject(e,{source:U.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.modalManager.open(b.activities.UPLOAD_LIST)},"_toSend"));d(this,"_setPermissionsState",L(e=>{this.classList.toggle("uc-initialized",e==="granted");let i=this._activeTab===I.VIDEO&&this.cfg.enableAudioRecording,s=this._activeTab===I.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!this._cameraModes.includes(I.PHOTO),tabVideoHidden:!this._cameraModes.includes(I.VIDEO),messageHidden:!0,timerHidden:!0,currentIcon:s,audioToggleMicrophoneHidden:!i,audioSelectHidden:!i}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!this._cameraModes.includes(I.PHOTO),tabVideoHidden:!this._cameraModes.includes(I.VIDEO),cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300));d(this,"_makeStreamInactive",n(()=>{var s,o;if(!this._stream)return!1;let e=(s=this._stream)==null?void 0:s.getAudioTracks(),i=(o=this._stream)==null?void 0:o.getVideoTracks();e.forEach(a=>a.stop()),i.forEach(a=>a.stop())},"_makeStreamInactive"));d(this,"_stopCapture",n(()=>{var e;this._capturing&&(this.ref.video.volume=0,(e=this.$.video)==null||e.getTracks()[0].stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture"));d(this,"_capture",n(async()=>{let e={video:Yu,audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video.volume=0;try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.log("Failed to capture camera",i),this.telemetryManager.sendEventError(i,"camera capturing. Failed to capture camera")}},"_capture"));d(this,"_handlePermissionsChange",n(()=>{this._capture()},"_handlePermissionsChange"));d(this,"_permissionAccess",n(async()=>{try{for(let e of Pa)this[`${e}Response`]=await navigator.permissions.query({name:e}),this[`${e}Response`].addEventListener("change",this._handlePermissionsChange)}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this.telemetryManager.sendEventError(e,"camera permissions. Failed to use permissions API"),this._capture()}},"_permissionAccess"));d(this,"_getPermission",n(()=>{},"_getPermission"));d(this,"_requestDeviceAccess",n(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){this.telemetryManager.sendEventError(e,"camera devices. Failed to get user media"),console.log("Failed to get user media",e)}},"_requestDeviceAccess"));d(this,"_getDevices",n(async()=>{var e,i;try{let s=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=s.filter(o=>o.kind==="videoinput").map((o,a)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${a+1}`,value:o.deviceId})),this._audioDevices=this.cfg.enableAudioRecording&&s.filter(o=>o.kind==="audioinput").map(o=>({text:o.label.trim(),value:o.deviceId})),this._cameraDevices.length>1&&this.set$({cameraSelectOptions:this._cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=(e=this._cameraDevices[0])==null?void 0:e.value,this._audioDevices.length>1&&this.set$({audioSelectOptions:this._audioDevices,audioSelectHidden:!1}),this._selectedAudioId=(i=this._audioDevices[0])==null?void 0:i.value}catch(s){this.telemetryManager.sendEventError(s,"camera devices. Failed to get devices"),console.log("Failed to get devices",s)}},"_getDevices"));d(this,"_onActivate",n(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},"_onActivate"));d(this,"_onDeactivate",n(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate"));d(this,"_handleCameraModes",n(e=>{this.$.tabVideoHidden=!e.includes(I.VIDEO),this.$.tabCameraHidden=!e.includes(I.PHOTO);let i=e[0];(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(i)},"_handleCameraModes"));this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:La(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicrophoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicrophoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:n(e=>{this._selectedCameraId=e.target.value,this._capture()},"onCameraSelectChange"),onAudioSelectChange:n(e=>{this._selectedAudioId=e.target.value,this._capture()},"onAudioSelectChange"),onCancel:n(()=>{this.historyBack()},"onCancel"),onShot:n(()=>this._shot(),"onShot"),onRequestPermissions:n(()=>this._capture(),"onRequestPermissions"),onStartCamera:n(()=>this._chooseActionWithCamera(),"onStartCamera"),onStartRecording:n(()=>this._startRecording(),"onStartRecording"),onStopRecording:n(()=>this._stopRecording(),"onStopRecording"),onToggleRecording:n(()=>this._toggleRecording(),"onToggleRecording"),onToggleAudio:n(()=>this._toggleEnableAudio(),"onToggleAudio"),onRetake:n(()=>this._retake(),"onRetake"),onAccept:n(()=>this._accept(),"onAccept"),onClickTab:n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._handleActiveTab(i)},"onClickTab")}}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_guessExtensionByMime(e){let i={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e&&(e=e.split("/"),(e==null?void 0:e[0])==="video")){e=e.slice(1).join("/");let s=e==null?void 0:e.split(";")[0];if(i[s])return i[s]}return"avi"}get _cameraModes(){return N(this.cfg.cameraModes)}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicrophoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("cameraModes",e=>{if(!this.isActivityActive)return;let i=Y(e);this._handleCameraModes(i)})}_destroy(){var e,i;for(let s of Pa)(e=this[`${s}Response`])==null||e.removeEventListener("change",this._handlePermissionsChange);(i=navigator.mediaDevices)==null||i.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};n(ao,"CameraSource");var oi=ao;oi.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"><button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button><button type="button" class="uc-primary-btn" set="onclick: onAccept" data-testid="accept">Accept</button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicrophoneHidden;"><uc-icon set="@name:toggleMicrophoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var ms=class ms extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};n(ms,"UploadCtxProviderClass"),d(ms,"styleAttrs",["uc-wgt-common"]);var fs=ms;fs.EventType=w;var Da=fs;var lo=class lo extends k{constructor(){super(...arguments);d(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){var e;super.destroyCallback(),(e=this._unobserveCollection)==null||e.call(this)}};n(lo,"ProgressBarCommon");var ni=lo;ni.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var co=class co extends v{constructor(){super();d(this,"_value",0);d(this,"_prevValue",0);d(this,"_visible",!0);this.init$={...this.init$,width:0,opacity:0}}initCallback(){super.initCallback();let e=n(()=>{let i=this.ref.fakeProgressLine;if(!this._visible){i.classList.add("uc-fake-progress--hidden");return}this._value>0&&i.classList.add("uc-fake-progress--hidden")},"handleFakeProgressAnimation");this.ref.fakeProgressLine.addEventListener("animationiteration",e),this.defineAccessor("value",i=>{i!=null&&(this._prevValue=this._value,this._value=i,this._visible&&this.style.setProperty("--l-progress-value",this._value.toString()))}),this.defineAccessor("visible",i=>{this._visible=i,this.classList.toggle("uc-progress-bar--hidden",!i)})}};n(co,"ProgressBar");var ai=co;ai.template=`<div ref="fakeProgressLine" class="uc-fake-progress"></div><div ref="realProgressLine" class="uc-progress"></div>`;var me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Fa(...r){return r.reduce((t,e)=>{if(typeof e=="string")return t[e]=!0,t;for(let i of Object.keys(e))t[i]=e[i];return t},{})}n(Fa,"normalize");function B(...r){let t=Fa(...r);return Object.keys(t).reduce((e,i)=>(t[i]&&e.push(i),e),[]).join(" ")}n(B,"classNames");function Na(r,...t){let e=Fa(...t);for(let i of Object.keys(e))r.classList.toggle(i,e[i])}n(Na,"applyClassNames");var Va=n(r=>{if(!r)return Z;let t=Y(r).filter(e=>Z.includes(e));return t.length===0?Z:t},"parseTabs");function Ba(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":Z,"*tabId":M.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:me,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:Ee(Z),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":n(()=>{let t=r.querySelectorAll("img");for(let e of t){let i=e.src;e.src=me,e.src=i}r.$["*networkProblems"]=!1},"*on.retryNetwork"),"*on.apply":n(t=>{if(!t)return;let e=r.$["*originalUrl"],i=z(Me(t),"preview"),s=F(e,i),o={originalUrl:e,cdnUrlModifiers:i,cdnUrl:s,transformations:t};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.apply"),"*on.cancel":n(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},"*on.cancel")}}n(Ba,"initState");var za="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ha=`${za} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${me}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var gs=class gs extends v{constructor(){super();d(this,"ctxOwner",!0);d(this,"_debouncedShowLoader",L(this._showLoader.bind(this),300));this.init$={...this.init$,...Ba(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((i,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),a=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(i(),clearTimeout(o),a.disconnect())});a.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let e=Si(this.$.cdnUrl),i=ke(this.$.cdnUrl,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let s=Us(this.$.cdnUrl),o=Rs(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=ke(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===M.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let e=await this.proxyUrl(F(this.$["*originalUrl"],z("json"))),i=await fetch(e).then(a=>a.json()),{width:s,height:o}=i;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===M.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e))}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==me&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let i=this.ref["img-el"];i.src!==e&&(this._imgLoading=!0,i.src=e||me)}),this.sub("tabs",e=>{this.$["*tabList"]=Va(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=B("uc-image",{"uc-image_hidden_to_cropper":e===M.CROP,"uc-image_hidden_effects":e!==M.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let i=this.$["*originalUrl"],s=z(Me(e),"preview"),o=F(i,s),a={originalUrl:i,cdnUrlModifiers:s,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage()),this.sub("cropPreset",e=>{var o,a,l;let i=Ki(e),s=null;if(this.$.cdnUrl){let c=Us(this.$.cdnUrl),u=Rs(c);if(Array.isArray((o=u==null?void 0:u.crop)==null?void 0:o.dimensions)){let[p,h]=(a=u==null?void 0:u.crop)==null?void 0:a.dimensions;s=Bn(p,h,i,.1)}}this.$["*cropPresetList"]=i,this.$["*currentAspectRatio"]=(l=s!=null?s:i==null?void 0:i[0])!=null?l:null})}};n(gs,"CloudImageEditorBlock"),d(gs,"styleAttrs",["uc-cloud-image-editor"]);var ge=gs;ge.template=Ha;ge.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var uo=class uo 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(t){let e=this.$["*imageBox"];if(!e)return;if(t===""&&e.height<=x&&e.width<=x)return!0;let i=e.height<=x&&(t.includes("n")||t.includes("s")),s=e.width<=x&&(t.includes("e")||t.includes("w"));return i||s}_createBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:o}=t,a=this.ref["svg-el"],l=G("mask",{id:"backdrop-mask"}),c=G("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=G("rect",{x:e,y:i,width:s,height:o,fill:"black"});l.appendChild(c),l.appendChild(u);let p=G("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});a.appendChild(p),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:o}=t;this._backdropMaskInner&&Re(this._backdropMaskInner,{x:e,y:i,width:s,height:o})}_updateFrame(){let t=this.$["*cropBox"];if(!(!t||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:i,pathNode:s,interactionNode:o,groupNode:a}=e,l=i==="",c=i.length===2,{x:u,y:p,width:h,height:f}=t;if(l)Re(o,{x:u,y:p,width:h,height:f});else{let g=De(Math.min(h,f)/(24*2+34)/2,0,1),{d:_,center:E}=c?Mn(t,i,g):Ln(t,i,g),y=Math.max(yr*De(Math.min(h,f)/yr/3,0,1),kn);Re(o,{x:E[0]-y,y:E[1]-y,width:y*2,height:y*2}),Re(s,{d:_})}let m=this._shouldThumbBeDisabled(i);a.setAttribute("class",B("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Re(this._frameGuides,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1})}}_createThumb(t,e){let i=G("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let s=G("rect",{fill:"transparent"}),o=G("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(o),i.appendChild(s),t[e]={direction:e,pathNode:o,interactionNode:s,groupNode:i},e===""&&(i.style.cursor="move"),s.addEventListener("pointerdown",this._handlePointerDown.bind(this,e))}_createThumbs(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let s=`${["n","","s"][e]}${["w","","e"][i]}`;s!==""&&this._createThumb(t,s)}return this._createThumb(t,""),t}_createGuides(){let t=G("svg"),e=G("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let s=G("line",{x1:`${Xt*i}%`,y1:"0%",x2:`${Xt*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s)}for(let i=1;i<=2;i++){let s=G("line",{x1:"0%",y1:`${Xt*i}%`,x2:"100%",y2:`${Xt*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s)}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_createFrame(){let t=this.ref["svg-el"],e=document.createDocumentFragment(),i=this._createGuides();e.appendChild(i);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))e.appendChild(o);t.appendChild(e),this._frameThumbs=s,this._frameGuides=i}_handlePointerDown(t,e){if(!this._frameThumbs)return;let i=this._frameThumbs[t];if(this._shouldThumbBeDisabled(t))return;let s=this.$["*cropBox"],{x:o,y:a}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,c=e.y-a;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,c],this._dragStartCrop={...s}}_handlePointerUp_(t){this._updateCursor(),this.$.dragging&&(t.stopPropagation(),t.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(t){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;t.stopPropagation(),t.preventDefault();let e=this.ref["svg-el"],{x:i,y:s}=e.getBoundingClientRect(),o=t.x-i,a=t.y-s,l=o-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(t,e){var u;let[i,s]=e,o=this.$["*imageBox"],a=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Un({rect:a,delta:[i,s],imageBox:o}):a=Rn({rect:a,delta:[i,s],direction:t,aspectRatio:c,imageBox:o}),!Object.values(a).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return nt(lt(a),this.$["*imageBox"])}_handleSvgPointerMove_(t){if(!this._frameThumbs)return;let e=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),a={x:o.x,y:o.y,width:o.width,height:o.height};return Dn(a,[t.x,t.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let t=this._hoverThumb;this.ref["svg-el"].style.cursor=t?Pn(t.direction):"initial"}_createMask(t){if(this._frameImage){this._frameImage.setAttribute("href",t);return}let e=this.ref["svg-el"],i=document.createDocumentFragment(),s=G("image",{href:t});s.setAttribute("class","uc-cloud-mask"),i.appendChild(s),e.appendChild(i),this._frameImage=s}_updateMask(){let t=this.$["*cropBox"];if(!t||!this._frameImage)return;let{x:e,y:i,width:s,height:o}=t;Re(this._frameImage,{x:e,y:i,height:o,width:s})}_render(){this._updateBackdrop(),this._updateFrame(),this._updateMask()}toggleThumbs(t){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",B("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",t=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=x||t.width<=x,window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this._createMask(t)}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",B({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};n(uo,"CropFrame");var li=uo;li.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var ho=class ho extends v{constructor(){super(...arguments);d(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=B({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};n(ho,"EditorButtonControl");var re=ho;re.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><uc-icon ref="icon-el" set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Qu(r){let t=r+90;return t=t>=360?0:t,t}n(Qu,"nextAngle");function ed(r,t){return r==="rotate"?Qu(t):["mirror","flip"].includes(r)?!t:null}n(ed,"nextValue");var po=class po extends re{initCallback(){super.initCallback(),this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(t).toLowerCase()})))}),this.$["on.click"]=t=>{let e=this.$["*cropperEl"].getValue(this._operation),i=ed(this._operation,e);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this._operation,next:i,prev:e}),this.$["*cropperEl"].setValue(this._operation,i)}}};n(po,"EditorCropButtonControl");var At=po;var bs=12,ja=16,td=n(r=>{let t=12,e=12;return r.width/r.height>=1?(t=bs,e=Math.round(bs*r.height/r.width)):(e=bs,t=Math.round(bs*r.width/r.height)),{width:t,height:e}},"getAdjustResolutions"),fo=class fo extends re{constructor(){super()}initCallback(){super.initCallback(),this.$.icon="arrow-dropdown",this.$["on.click"]=this.handleClick.bind(this),this.sub("*currentAspectRatio",t=>{this.$.title=t.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}),this.bindL10n("title-prop",()=>this.$.title)})}handleClick(){this.$["*showListAspectRatio"]=!0}};n(fo,"EditorFreeformButtonControl");var Ge=fo;Ge.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><div class="uc-title" ref="title-el">{{title}}</div><uc-icon ref="icon-el" set="@name: icon;"></uc-icon></button>`;var mo=class mo extends re{constructor(){super(),this.init$={...this.init$,active:!1,once:!1}}initCallback(){super.initCallback(),this.defineAccessor("aspectRatio",t=>{if(!t)return;let e=!!t.hasFreeform;this.$.title=e?this.l10n("custom"):`${t.width}:${t.height}`,e||this._renderRectBasedOnAspectRatio(t),e&&this.setAttribute("uc-aspect-ratio-freeform",""),this._aspectRatio=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""}))}),this.sub("*currentAspectRatio",t=>{var e,i,s;this.$.active=t&&t.id===((e=this._aspectRatio)==null?void 0:e.id)||(t==null?void 0:t.width)===((i=this._aspectRatio)==null?void 0:i.width)&&(t==null?void 0:t.height)===((s=this._aspectRatio)==null?void 0:s.height)}),this.$["on.click"]=this.handleClick.bind(this)}handleClick(){var t,e;((t=this.$["*currentAspectRatio"])==null?void 0:t.id)!==((e=this._aspectRatio)==null?void 0:e.id)&&(this.$["*currentAspectRatio"]=this._aspectRatio)}_renderRectBasedOnAspectRatio(t){var a,l;let{width:e,height:i}=td(t),s=G("rect",{"stroke-linejoin":"round",fill:"none",stroke:"currentColor","stroke-width":1.2,"fill-rule":"evenodd",x:(ja-e)/2,y:(ja-i)/2,rx:2,width:e,height:i}),o=(l=(a=this.ref["icon-el"])==null?void 0:a.ref)==null?void 0:l.svg;o&&(o.innerHTML="",o.appendChild(s))}};n(mo,"EditorAspectRatioButtonControl");var xt=mo;var ci={FILTER:"filter",COLOR_OPERATION:"color_operation"},be="original",go=class go extends v{constructor(){super(...arguments);d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":n(e=>{this.$["*faderEl"].set(e),this.$.value=e},"on.input")})}setOperation(e,i){this._controlType=e==="filter"?ci.FILTER:ci.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===be?void 0:this.$.value,filter:this._filter===be?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:i}=ue[this._operation],[s,o]=e;this.$.min=s,this.$.max=o,this.$.zero=i;let a=this.$["*editorTransformations"][this._operation];if(this._controlType===ci.FILTER){let l=o;if(a){let{name:c,amount:u}=a;l=c===this._filter?u:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===ci.COLOR_OPERATION){let l=typeof a!="undefined"?a:i;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===ci.FILTER?this._filter===be?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let i=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=i})}};n(go,"EditorSlider");var ui=go;ui.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function We(r){let t=new Image;return{promise:new Promise((s,o)=>{t.src=r,t.onload=s,t.onerror=o}),image:t,cancel:n(()=>{t.naturalWidth===0&&(t.src=me)},"cancel")}}n(We,"preloadImage");function di(r){let t=[];for(let o of r){let a=We(o);t.push(a)}let e=t.map(o=>o.image);return{promise:Promise.allSettled(t.map(o=>o.promise)),images:e,cancel:n(()=>{t.forEach(o=>{o.cancel()})},"cancel")}}n(di,"batchPreloadImages");function Tt(r){let t=r.match(/^(\w+)\s+(\d+)$/);return t?{filter:t[1],value:Number(t[2])}:null}n(Tt,"parseFilterValue");var bo=class bo extends re{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,i=Math.ceil(e*t),s=e>=2?"lightest":"normal",o=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==be?{name:this._filter,amount:o}:void 0,F(this._originalUrl,z(Ii,Me(a),`quality/${s}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(t,e){var s;if(t[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),a=this.ref["preview-el"],{promise:l,cancel:c}=We(o);this._cancelPreload=c,l.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{a.style.backgroundImage=`url(${o})`,a.setAttribute("loaded",""),e.unobserve(this)})}else(s=this._cancelPreload)==null||s.call(this)}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.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:Tt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===be,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=e?"1":"0";let s=this.ref["preview-el"];e?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){let i=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${i})`)}})}destroyCallback(){var t,e;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};n(bo,"EditorFilterControl");var Xe=bo;Xe.template=`<button type="button" role="option" l10n="@title:title-prop;@aria-label:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var _o=class _o extends re{constructor(){super(...arguments);d(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:Tt(this.$["*operationTooltip"])})},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:i}=ue[this._operation],s=e[this._operation],o=typeof s!="undefined"?s!==i:!1;this.$.active=o})}};n(_o,"EditorOperationControl");var St=_o;function Ga(r,t){let e={};for(let i of t){let s=r[i];(r.hasOwnProperty(i)||s!==void 0)&&(e[i]=s)}return e}n(Ga,"pick");function It(r,t,e){let s=window.devicePixelRatio,o=Math.min(Math.ceil(t*s),3e3),a=s>=2?"lightest":"normal";return F(r,z(Ii,Me(e),`quality/${a}`,`stretch/off/-/resize/${o}x`,`@clib/${Ie}/${Oe}/uc-cloud-image-editor/`))}n(It,"viewerImageSrc");function id(r){return r?[({dimensions:e,coords:i})=>[...e,...i].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:e,coords:i})=>e.every(s=>s>0)&&i.every(s=>s>=0)].every(e=>e(r)):!0}n(id,"validateCrop");var vo=class vo extends v{constructor(){super();d(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=L(this._commit.bind(this),300),this._handleResizeThrottled=yt(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],i=Ga(e,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...i};this.$["*operations"]=s}_initCanvas(){let e=this.ref["canvas-el"],i=e.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,a=window.devicePixelRatio;e.style.width=`${s}px`,e.style.height=`${o}px`,e.width=s*a,e.height=o*a,i==null||i.scale(a,a),this._canvas=e,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,i=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,a={width:this.offsetWidth,height:this.offsetHeight},l=at({width:e.naturalWidth,height:e.naturalHeight},o),c;if(l.width>a.width-i*2||l.height>a.height-i*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let h=a.width-i*2,f=h/u,m=0+i,g=i+(a.height-i*2)/2-f/2;c={x:m,y:g,width:h,height:f}}else{let h=a.height-i*2,f=h*u,m=i+(a.width-i*2)/2-f/2,g=0+i;c={x:m,y:g,width:f,height:h}}}else{let{width:u,height:p}=l,h=i+(a.width-i*2)/2-u/2,f=i+(a.height-i*2)/2-p/2;c={x:h,y:f,width:u,height:p}}this.$["*imageBox"]=lt(c)}_alignCrop(){let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=this.$["*imageBox"];if(a){let{dimensions:[f,m],coords:[g,_]}=a,{width:E}=at(this._imageSize,o),y=l/E;e=nt(lt({x:c+g*y,y:u+_*y,width:f*y,height:m*y}),this.$["*imageBox"])}let p=this.$["*currentAspectRatio"],h=p?p.width/p.height:void 0;if(!Fn(e,i)||h&&!Nn(e,h)){let f=i.width/i.height,m=i.width,g=i.height;h&&(f>h?m=Math.min(i.height*h,i.width):g=Math.min(i.width/h,i.height)),e={x:i.x+i.width/2-m/2,y:i.y+i.height/2-g/2,width:m,height:g}}this.$["*cropBox"]=nt(lt(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let i=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:a,flip:l,rotate:c}=o,u=at({width:s.width,height:s.height},c);e.save(),e.translate(s.x+s.width/2,s.y+s.height/2),e.rotate(c*Math.PI*-1/180),e.scale(a?-1:1,l?-1:1),e.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=B({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:a,height:l}=i,{width:c,height:u}=at(this._imageSize,o),{width:p,height:h}=e,f=a/c,m=l/u;return[De(Math.round(p/f),1,c),De(Math.round(h/m),1,u)]}_getCropTransformation(){let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:a,height:l,x:c,y:u}=i,{width:p,height:h}=at(this._imageSize,o),{x:f,y:m}=e,g=a/p,_=l/h,E=this._getCropDimensions(),y={dimensions:E,coords:[De(Math.round((f-c)/g),0,p-E[0]),De(Math.round((m-u)/_),0,h-E[1])]};if(!id(y)){console.error("Cropper is trying to create invalid crop object",{payload:y});return}if(!(E[0]===p&&E[1]===h))return y}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:i,mirror:s,flip:o}=e,a=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:a,rotate:i,mirror:s,flip:o};this.$["*editorTransformations"]=c}setValue(e,i){this.$["*operations"]={...this.$["*operations"],[e]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:i})}catch(s){console.error("Failed to activate cropper",{error:s}),this.telemetryManager.sendEventError(s,"cloud editor image. Failed to activate cropper")}this._observer=new ResizeObserver(([s])=>{s.contentRect.width>0&&s.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){var i;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=B({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(i=this._observer)==null||i.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),i=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(i,s),a=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-a)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${a}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,i){var p;let s=this.offsetWidth;i={...i,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(It(e,s,i)),{promise:a,cancel:l,image:c}=We(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=l,a.then(()=>c).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(e){let i="crop",s=this.$["*loadingOperations"];return s.get(i)||s.set(i,new Map),s.get(i).get(e)||(s.set(i,s.get(i).set(e,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(i))!=null&&o.has(e)&&(s.get(i).delete(e),this.$["*loadingOperations"]=s)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*currentAspectRatio",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(vo,"EditorImageCropper");var hi=vo;hi.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function yo(r,t,e){let i=Array(e);e--;for(let s=e;s>=0;s--)i[s]=Math.ceil((s*t+(e-s)*r)/e);return i}n(yo,"linspace");function sd(r){return r.reduce((t,e,i)=>i<r.length-1?[...t,[e,r[i+1]]]:t,[])}n(sd,"splitBySections");function rd(r,t,e){let i=sd(r).find(([s,o])=>s<=t&&t<=o);return r.map(s=>{let o=Math.abs(i[0]-i[1]),a=Math.abs(t-i[0])/o;return i[0]===s?t>e?1:1-a:i[1]===s?t>=e?a:1:0})}n(rd,"calculateOpacities");function od(r,t){return r.map((e,i)=>e<t?r.length-i:i)}n(od,"calculateZIndices");function Wa(r,t){let e=ue[r].keypointsNumber,{range:i,zero:s}=ue[r];return[...new Set([...yo(i[0],s,e+1),...yo(s,i[1],e+1),s,t])].sort((o,a)=>o-a)}n(Wa,"keypointsRange");var wo=class wo extends v{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=L(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(t){let e=this._operation,i=this.$["*loadingOperations"];return i.get(e)||i.set(e,new Map),i.get(e).get(t)||(i.set(e,i.get(e).set(t,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(e))!=null&&s.has(t)&&(i.get(e).delete(t),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let t of this._keypoints){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString())}})}async _imageSrc({url:t=this._url,filter:e=this._filter,operation:i,value:s}={}){let o={...this._transformations};i&&(o[i]=e?{name:e,amount:s}:s);let a=this.offsetWidth;return await this.proxyUrl(It(t,a,o))}async _constructKeypoint(t,e){return{src:await this._imageSrc({operation:t,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(t,e){return this._operation===t&&this._filter===e}async _addKeypoint(t,e,i){let s=n(()=>!this._isSame(t,e)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(s())return;let o=await this._constructKeypoint(t,i),a=new Image;a.src=o.src;let l=this._handleImageLoading(o.src);a.addEventListener("load",l,{once:!0}),a.addEventListener("error",l,{once:!0}),o.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this._keypoints,u=c.findIndex(h=>h.value>i),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(a,p),this._update(t,i))},{once:!0}),a.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(t){t=typeof t=="string"?parseInt(t,10):t,this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t)}_update(t,e){this._operation=t,this._value=e;let{zero:i}=ue[t],s=this._keypoints.map(l=>l.value),o=rd(s,e,i),a=od(s,i);for(let[l,c]of Object.entries(this._keypoints))c.opacity=o[l],c.zIndex=a[l];this._flush()}_createPreviewImage(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async _initNodes(){let t=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&t.appendChild(this._previewImage);let e=document.createElement("div");t.appendChild(e);let i=this._keypoints.map(u=>u.src),{images:s,promise:o,cancel:a}=di(i);s.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{a(),this._cancelLastImages=void 0};let l=this._operation,c=this._filter;await o,this._isActive&&this._isSame(l,c)&&(this._container&&this._container.remove(),this._container=e,this._keypoints.forEach((u,p)=>{let h=s[p];h.classList.add("uc-fader-image"),u.image=h,this._container.appendChild(h)}),this.appendChild(t),this._flush())}async setTransformations(t){if(this._transformations=t,this._previewImage){let e=await this._imageSrc(),i=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:t,filter:e,operation:i,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Wa(i,s),a=await Promise.all(o.map(c=>this._imageSrc({url:t,filter:e,operation:i,value:c}))),{cancel:l}=di(a);this._cancelBatchPreload=l}_setOriginalSrc(t){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=B({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let i=this._handleImageLoading(t);e.addEventListener("error",i,{once:!0}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=B({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:t,operation:e,value:i,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=t,this._operation=e||"initial",this._value=i,this._filter=s,this._fromViewer=o,typeof i!="number"&&!s){let l=await this._imageSrc({operation:e,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Wa(e,i).map(l=>this._constructKeypoint(e,l))),this._update(e,i),this._initNodes()}deactivate({hide:t=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),t&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=B({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};n(wo,"EditorImageFader");var _s=wo;var nd=1,Co=class Co extends v{initCallback(){super.initCallback(),this.addEventListener("wheel",t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;Math.abs(i)>nd?this.scrollLeft+=i:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};n(Co,"EditorScroller");var pi=Co;pi.template=" <slot></slot> ";function ad(r){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${r}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${r}" data-id="${r}" icon="${r}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${r}; title-prop: a11y-editor-tab-${r}" ></uc-btn-ui></uc-presence-toggle>`}n(ad,"renderTabToggle");function ld(r){return`<uc-presence-toggle id="tab_${r}" class="uc-tab-content" set="visible: presence.tabContent.${r}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${r}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}n(ld,"renderTabContent");var Eo=class Eo extends v{constructor(){super();d(this,"_updateInfoTooltip",L(()=>{var a,l;let e=this.$["*editorTransformations"],i=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===M.FILTERS)if(o=!0,this.$["*currentFilter"]&&((a=e==null?void 0:e.filter)==null?void 0:a.name)===this.$["*currentFilter"]){let c=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+c}else s=this.l10n(be);else if(this.$["*tabId"]===M.TUNING&&i){o=!0;let c=(e==null?void 0:e[i])||ue[i].zero;s=this.l10n(i)+" "+c}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*listAspectRatioEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*showListAspectRatio":!1,hideSliderOrList:!1,"*currentFilter":be,"*currentOperation":null,showLoader:!1,filters:Jo,colorOperations:Yo,cropOperations:Qo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":n(e=>{var i;this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),(i=this._cancelPreload)==null||i.call(this),this.$["*on.cancel"]()},"on.cancel"),"on.apply":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"}),this.$["*on.apply"](this.$["*editorTransformations"])},"on.apply"),"on.applySlider":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:Tt(this.$["*operationTooltip"])}),this.ref["slider-el"].apply(),this._onSliderClose()},"on.applySlider"),"on.cancelSlider":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this.ref["slider-el"].cancel(),this._onSliderClose()},"on.cancelSlider"),"on.clickTab":n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(e,i),this._activateTab(i,{fromViewer:!1}))},"on.clickTab"),tab_role:"tab",[`tab_${M.TUNING}`]:`tab_${M.TUNING}`,[`tab_${M.CROP}`]:`tab_${M.CROP}`,[`tab_${M.FILTERS}`]:`tab_${M.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=L(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===M.CROP&&(this.$["*showListAspectRatio"]=!1),this.$["*tabId"]===M.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let i=new St;return i.operation=e,i}_createFilterControl(e){let i=new Xe;return i.filter=e,i}_createToggleControl(e){let i=new At;return i.operation=e,i}_createAspectRatioConrol(e){let i=new xt;return i.aspectRatio=e,i}_createFreeformConrol(){return new Ge}_clearListAspectRatio(){this.$["*listAspectRatioEl"].innerHTML=""}_renderControlsList(e){let i=this.ref[`controls-list-${e}`],s=document.createDocumentFragment();if(this._clearListAspectRatio(),e===M.CROP){let o=this.$["*cropPresetList"].length>=3;if(o){let a=this._createFreeformConrol();s.appendChild(a)}this.$["*cropPresetList"].forEach(a=>{let l=this._createAspectRatioConrol(a);s.appendChild(l),o&&this.$["*listAspectRatioEl"].appendChild(l)}),this.$.cropOperations.forEach(a=>{let l=this._createToggleControl(a);s.appendChild(l)})}else e===M.FILTERS?[be,...this.$.filters].forEach(o=>{let a=this._createFilterControl(o);s.appendChild(a)}):e===M.TUNING&&this.$.colorOperations.forEach(o=>{let a=this._createOperationControl(o);s.appendChild(a)});[...s.children].forEach((o,a)=>{a===s.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),i.innerHTML="",i.appendChild(s)}_activateTab(e,{fromViewer:i}){this.$["*tabId"]=e,e===M.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 Z){let o=s===e,a=this.ref[`tab-toggle-${s}`];a.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(e){let i=this.ref[`controls-list-${e}`];i&&(i.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(It(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=di([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.$["*listAspectRatioEl"]=this.ref["list-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var s;let i=(s=e==null?void 0:e.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",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let i=!1;for(let[,s]of e.entries()){if(i)break;for(let[,o]of s.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e,this.$.hideSliderOrList=!0}),this.sub("*showListAspectRatio",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e,this.$.hideSliderOrList=!1}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let i of Z){this.$[`presence.tabToggle.${i}`]=e.includes(i);let s=this.ref[`tab-toggle-${i}`];s.style.gridColumn=e.indexOf(i)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}destroyCallback(){this.$["*showSlider"]=!1,this.$["*showListAspectRatio"]=!1}};n(Eo,"EditorToolbar");var fi=Eo;fi.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Z.map(ld).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Z.map(ad).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider" set="@hidden:!hideSliderOrList"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div set="@hidden:hideSliderOrList" class="uc-list-aspect-ratio-container"><div class="uc-list-aspect-ratio" ref="list-el"></div></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var Ao=class Ao extends v{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return B("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",t=>{this._iconSingle=!this.$.text,this._iconHidden=!t,this.$.iconCss=this._iconCss()}),this.sub("theme",t=>{t!=="custom"&&(this.className=`uc-${t}`)}),this.sub("text",t=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",t=>{this.$["aria-role"]=t||""}),this.defineAccessor("aria-controls",t=>{this.$["aria-controls"]=t||""}),this.defineAccessor("title-prop",t=>{this.$["title-prop"]=t||""})}set reverse(t){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};n(Ao,"BtnUi");var Ot=Ao;Ot.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Ot.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls; @aria-label:title-prop" l10n="@title:title-prop;" ><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var xo=class xo extends v{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let t=this.ref["line-el"];t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",t=>{typeof t=="boolean"&&(t?this._start():this._stop())})}_start(){this._active=!0;let{width:t}=this.getBoundingClientRect(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};n(xo,"LineLoaderUi");var mi=xo;mi.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var vs={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},To=class To extends v{constructor(){super(),this._visible=!1,this._visibleStyle=vs.visible,this._hiddenStyle=vs.hidden,this._externalTransitions=!1,this.defineAccessor("styles",t=>{t&&(this._externalTransitions=!0,this._visibleStyle=t.visible,this._hiddenStyle=t.hidden)}),this.defineAccessor("visible",t=>{typeof t=="boolean"&&(this._visible=t,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Na(this,{[vs.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(vs.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};n(To,"PresenceToggle");var gi=To;gi.template="<slot></slot> ";var So=class So extends v{constructor(){super();d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderInput"),"on.sliderChange":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)},"on.sliderChange")});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 e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(e-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${a}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="1";let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${a}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:s}=i.getBoundingClientRect(),o=Math.ceil(s/2),a=Math.ceil(o/15)-2;if(this._stepsCount===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(l),this._stepsCount=a}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(So,"SliderUi");var bi=So;bi.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var Io=class Io extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CLOUD_IMG_EDIT);d(this,"_entry");d(this,"_instance")}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>this.mountEditor(),"onActivate"),onDeactivate:n(()=>this.unmountEditor(),"onDeactivate")}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let i=e.detail;this._entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}handleCancel(){this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams,i=this.uploadCollection.read(e);if(!i)throw new Error(`Entry with internalId "${e}" not found`);this._entry=i;let s=this._entry.getValue("cdnUrl");if(!s)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let o=new ge,a=this.cfg.cropPreset,l=this.cfg.cloudImageEditorTabs;o.setAttribute("ctx-name",this.ctxName),o.setAttribute("cdn-url",s),a&&o.setAttribute("crop-preset",a),l&&o.setAttribute("tabs",l),o.addEventListener("apply",c=>{let u=c;this.handleApply(u),this.debugPrint('editor event "apply"',u.detail)}),o.addEventListener("cancel",c=>{let u=c;this.handleCancel(),this.debugPrint('editor event "cancel"',u.detail)}),o.addEventListener("change",c=>{let u=c;this.debugPrint('editor event "change"',u.detail)}),this.innerHTML="",this.appendChild(o),this._instance=o}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};n(Io,"CloudImageEditorActivity");var ys=Io;var cd=n(function(r){return r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Xa=n(function(r,t="i"){let e=r.split("*").map(cd);return new RegExp("^"+e.join(".+")+"$",t)},"wildcardRegexp");function ud(r,t){return window.getComputedStyle(r).getPropertyValue(t).trim()}n(ud,"getCssValue");var dd=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"];function qa(r){return dd.reduce((t,e)=>{let i=ud(r,e);return i&&(t[e]=i),t},{})}n(qa,"buildThemeDefinition");var hd=["selected-files-change","toolbar-state-change"],pd=n(r=>!r||typeof r!="object"?!1:"type"in r&&hd.includes(r.type),"isWhitelistedMessage"),Oo=class Oo{constructor(t){d(this,"_handlerMap",new Map);d(this,"_context");d(this,"_handleMessage",n(t=>{if(t.source!==this._context)return;let e=t.data;if(!pd(e))return;let i=this._handlerMap.get(e.type);if(i)for(let s of i)s(e)},"_handleMessage"));this._context=t,window.addEventListener("message",this._handleMessage)}on(t,e){var s;let i=(s=this._handlerMap.get(t))!=null?s:new Set;this._handlerMap.has(t)||this._handlerMap.set(t,i),i.add(e)}send(t){this._context.postMessage(t,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};n(Oo,"MessageBridge");var ws=Oo;function Ka(r){let t=[];for(let[e,i]of Object.entries(r))i==null||typeof i=="string"&&i.length===0||t.push(`${e}=${encodeURIComponent(i)}`);return t.join("&")}n(Ka,"queryString");var Za=n(()=>{var t,e;let r=(e=(t=globalThis.top)!=null?t:globalThis.parent)!=null?e:globalThis.self;try{return r.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var fd={[ae.GDRIVE]:"ngdrive"},$o=class $o extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.EXTERNAL);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",doneBtnTextClass:"uc-hidden",toolbarVisible:!0,onDone:n(()=>{for(let e of this.$.selectedList){let i=this.extractUrlFromSelectedFile(e),{filename:s}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:s,source:o})}this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.modalManager.open(b.activities.UPLOAD_LIST)},"onDone"),onCancel:n(()=>{this.historyBack()},"onCancel"),onSelectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"select-all"})},"onSelectAll"),onDeselectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"deselect-all"})},"onDeselectAll")}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.modalManager.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e==null?void 0:e[0].toUpperCase()}${e==null?void 0:e.slice(1)}`,activityIcon:e}),this.mountIframe()},"onActivate")}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.applyEmbedCss(e)})}extractUrlFromSelectedFile(e){if(e.alternatives){let i=N(this.cfg.externalSourcesPreferredTypes);for(let s of i){let o=Xa(s);for(let[a,l]of Object.entries(e.alternatives))if(o.test(a))return l}}return e.url}handleToolbarStateChange(e){this.set$({toolbarVisible:e.isVisible})}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({doneBtnTextClass:e.isReady?"":"uc-hidden",isSelectionReady:e.isReady,isDoneBtnEnabled:e.isReady&&e.selectedFiles.length>0,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyEmbedCss(this.cfg.externalSourcesEmbedCss),this.applyTheme(),this.setupL10n()}applyTheme(){var e;(e=this._messageBridge)==null||e.send({type:"set-theme-definition",theme:qa(this)})}applyEmbedCss(e){var i;(i=this._messageBridge)==null||i.send({type:"set-embed-css",css:e})}setupL10n(){var e;(e=this._messageBridge)==null||e.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){var h,f,m;let{pubkey:e,remoteTabSessionKey:i,socialBaseUrl:s,multiple:o}=this.cfg,{externalSourceType:a}=this.activityParams,l=(h=fd[a])!=null?h:a,u={lang:((m=(f=this.l10n("social-source-lang"))==null?void 0:f.split("-"))==null?void 0:m[0])||"en",public_key:e,images_only:"false",session_key:i,wait_for_theme:!0,multiple:o.toString(),origin:this.cfg.topLevelOrigin||Za(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,s);return p.search=Ka(u),p.toString()}mountIframe(){var i;let e=Ls({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&((i=this._messageBridge)==null||i.destroy(),this._messageBridge=new ws(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this._messageBridge.on("toolbar-state-change",this.handleToolbarStateChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){var e;(e=this._messageBridge)==null||e.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};n($o,"ExternalSource");var _i=$o;_i.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar" set="@hidden: !toolbarVisible"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;"><uc-spinner set="@hidden: isSelectionReady"></uc-spinner><span l10n="done" set="@class: doneBtnTextClass"></span></button></div></div>`;var ko=class ko extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,Ft(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=e.group?e.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=e.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let a=new DocumentFragment;for(let l of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=l,a.appendChild(c)}this._dynamicInputsContainer.replaceChildren(a)}},!1)}};n(ko,"FormInput");var Cs=ko;var Mo=class Mo extends b{};n(Mo,"ActivityHeader");var Es=Mo;var Lo=class Lo extends v{constructor(){super(...arguments);d(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:n(e=>{var i;e.preventDefault(),e.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((i=this.$.options.find(s=>s.value==this.value))==null?void 0:i.text)||"",this.dispatchEvent(new Event("change"))},"onSelect")})}initCallback(){super.initCallback(),this.sub("options",e=>{var s;this.$.currentText=((s=e==null?void 0:e[0])==null?void 0:s.text)||"";let i="";e==null||e.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};n(Lo,"Select");var vi=Lo;vi.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var xs=class xs extends v{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};n(xs,"Copyright"),d(xs,"template",`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var As=xs;var Po=class Po extends we{};n(Po,"Spinner");var yi=Po;yi.template='<div class="uc-spinner"></div>';function md(r){let t=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(t)}n(md,"createSvgBlobUrl");function Ts(r="hsl(209, 21%, 65%)",t=32,e=32){return md(`<svg width="${t}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}n(Ts,"fileCssBg");function Uo(r,t=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let e=document.createElement("canvas"),i=e.getContext("2d"),s=new Image,o=new Promise((a,l)=>{s.onload=()=>{let c=s.height/s.width;c>1?(e.width=t,e.height=t*c):(e.height=t,e.width=t/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(s,0,0,e.width,e.height),e.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p)})},s.onerror=c=>{l(c)}});return s.src=URL.createObjectURL(r),o}n(Uo,"generateThumb");var gd=3e3,Ro=class Ro extends wt{constructor(){super();d(this,"_renderedGridOnce",!1);d(this,"_thumbRect",null);d(this,"_isIntersecting",!1);d(this,"_firstViewMode",this.cfg.filesViewMode);d(this,"_generateThumbnail",this._withEntry(async(e,i=!1)=>{let s=e.getValue("fileInfo"),o=e.getValue("isImage"),a=e.getValue("uuid"),l=e.getValue("thumbUrl"),c=this._calculateThumbSize(i);if(s&&o&&a){let p=await this.proxyUrl(F(ke(this.cfg.cdnCname,a),z(e.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:h}=We(p);h.then(()=>{e.setValue("thumbUrl",p),l!=null&&l.startsWith("blob:")&&URL.revokeObjectURL(l)}).catch(async()=>{if(!(l!=null&&l.startsWith("blob:")))try{let f=e.getValue("file");if(!f)return;let m=await Uo(f,c);e.setValue("thumbUrl",m)}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Ts(m))}});return}if(e.getValue("thumbUrl"))return;let u=e.getValue("file");if(u!=null&&u.type.includes("image"))try{let p=await Uo(u,c);e.setValue("thumbUrl",p)}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let h=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Ts(h))}else{let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Ts(p))}}));d(this,"_debouncedGenerateThumb",L(this._generateThumbnail.bind(this),100));this.init$={...this.init$,thumbUrl:"",badgeIcon:"",uid:""}}_calculateThumbSize(e=!1){var s,o;e&&(this._thumbRect=this.getBoundingClientRect());let i=Math.max(parseInt(String(((s=this==null?void 0:this._thumbRect)==null?void 0:s.height)||0)),parseInt(String(((o=this==null?void 0:this._thumbRect)==null?void 0:o.width)||0)),this.cfg.thumbSize);return window.devicePixelRatio>1&&(i*=window.devicePixelRatio),Math.min(i,gd)}_observerCallback(e){var s;let[i]=e;this._isIntersecting=i.isIntersecting,i.isIntersecting&&(this._thumbRect=i.boundingClientRect,this._debouncedGenerateThumb(),(s=this._observer)==null||s.disconnect()),i.intersectionRatio===0&&this._debouncedGenerateThumb.cancel()}_reset(){super._reset(),this._debouncedGenerateThumb.cancel()}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("fileInfo",o=>{o!=null&&o.isImage&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.defineAccessor("badgeIcon",e=>this.$.badgeIcon=e),this.defineAccessor("uid",e=>{this.set$({uid:e})}),this.sub("uid",e=>{this._handleEntryId(e)}),this.subConfigValue("filesViewMode",e=>{e==="grid"&&!this._renderedGridOnce&&(this._firstViewMode==="list"&&this._debouncedGenerateThumb(!0),this._renderedGridOnce=!0)}),this.setAttribute("role","img")}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),this._entrySubs=new Set,this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}};n(Ro,"Thumb");var $t=Ro;$t.template=`<div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div>`;$t.bindAttributes({badgeIcon:null,uid:null});var kt=class kt extends de{constructor(){super(),this.init$={...this.init$,isHidden:!1,"*solution":this.tagName}}initCallback(){super.initCallback(),this.emit(Ae.INIT_SOLUTION,void 0),this.defineAccessor("headless",t=>{this.set$({isHidden:$(t)})})}};n(kt,"FileUploaderRegular"),d(kt,"styleAttrs",[...K(kt,kt,"styleAttrs"),"uc-file-uploader-regular"]);var Mt=kt;Mt.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;Mt.bindAttributes({headless:null});var Do="active",Ss="",Lt=class Lt extends de{constructor(){super(),this.init$={...this.init$,singleUpload:!1,isHiddenStartFrom:!1,classUploadList:Ss,classStartFrom:Ss,"*solution":this.tagName}}_handleModalOpen(t){var e;t.id===b.activities.CLOUD_IMG_EDIT&&this.set$({classUploadList:Do}),this.$["*currentActivity"]===b.activities.UPLOAD_LIST&&this.set$({classUploadList:Do,isHiddenStartFrom:!0}),((e=this.$["*uploadList"])==null?void 0:e.length)<=0&&this.set$({classStartFrom:Do})}_handleModalClose(t){t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.set$({isHiddenStartFrom:!1})),t.id===b.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}initCallback(){super.initCallback(),this.emit(Ae.INIT_SOLUTION,void 0);let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e===b.activities.UPLOAD_LIST&&this.modalManager.closeAll(),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.set$({classStartFrom:Ss})):(this.set$({classUploadList:Ss,isHiddenStartFrom:!1}),this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",i=>{e==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.$.singleUpload=!i):(this.style.removeProperty("--uc-grid-col"),this.$.singleUpload=!1)})}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose)}destroyCallback(){super.destroyCallback(),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose)}};n(Lt,"FileUploaderMinimal"),d(Lt,"styleAttrs",[...K(Lt,Lt,"styleAttrs"),"uc-file-uploader-minimal"]);var wi=Lt;wi.template=`<uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom"><uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;var Pt=class Pt extends de{constructor(){super(),this.init$={...this.init$,couldCancel:!1,"*solution":this.tagName,cancel:n(()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)},"cancel")}}get couldHistoryBack(){let t=this.$["*history"];return t.length>1&&t[t.length-1]!==b.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback(),this.emit(Ae.INIT_SOLUTION,void 0);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"]===(t.initActivity||b.activities.START_FROM)&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};n(Pt,"FileUploaderInline"),d(Pt,"styleAttrs",[...K(Pt,Pt,"styleAttrs"),"uc-file-uploader-inline"]);var Ci=Pt;Ci.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var Ut=class Ut extends ge{constructor(){super(),this.init$={...this.init$,"*solution":this.tagName}}initCallback(){var t;super.initCallback(),this.emit(Ae.INIT_SOLUTION,void 0),(t=this.a11y)==null||t.registerBlock(this)}};n(Ut,"CloudImageEditor"),d(Ut,"styleAttrs",[...K(Ut,Ut,"styleAttrs"),"uc-wgt-common"]);var Is=Ut;function Os(r){for(let t in r){let e=[...t].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[t].reg&&r[t].reg(e)}}n(Os,"defineComponents");var Fo="UC";async function Ya(r,t=!1){return new Promise((e,i)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[Fo]){e(window[Fo]);return}let s=document.createElement("script");s.async=!0,s.src=r,s.onerror=()=>{i()},s.onload=()=>{let o=window[Fo];t&&Os(o),e(o)},document.head.appendChild(s)})}n(Ya,"loadFileUploaderFrom");return al(bd);})();
|
|
26
|
+
"use strict";var UC=(()=>{var ii=Object.defineProperty;var xn=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var Sn=Object.prototype.hasOwnProperty;var s=(i,e)=>ii(i,"name",{value:e,configurable:!0});var In=(i,e)=>{for(var t in e)ii(i,t,{get:e[t],enumerable:!0})},kn=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of An(e))!Sn.call(i,o)&&o!==t&&ii(i,o,{get:()=>e[o],enumerable:!(r=xn(e,o))||r.enumerable});return i};var On=i=>kn(ii({},"__esModule",{value:!0}),i);var jc={};In(jc,{ActivityBlock:()=>g,ActivityHeader:()=>Ri,BaseComponent:()=>ge,Block:()=>b,BtnUi:()=>at,CameraSource:()=>Lt,CloudImageEditor:()=>er,CloudImageEditorActivity:()=>Di,CloudImageEditorBlock:()=>de,Config:()=>ut,Copyright:()=>Vi,CropFrame:()=>Rt,Data:()=>T,DropArea:()=>dt,EditorAspectRatioButtonControl:()=>tt,EditorCropButtonControl:()=>it,EditorFilterControl:()=>je,EditorFreeformButtonControl:()=>ze,EditorImageCropper:()=>$t,EditorImageFader:()=>$i,EditorOperationControl:()=>nt,EditorScroller:()=>Dt,EditorSlider:()=>Ut,EditorToolbar:()=>Ft,ExternalSource:()=>Ht,ExternalUploadSource:()=>se,FileItem:()=>ji,FileUploaderInline:()=>ei,FileUploaderMinimal:()=>ti,FileUploaderRegular:()=>yt,FormInput:()=>Ki,Icon:()=>ht,Img:()=>Zi,LineLoaderUi:()=>Vt,Modal:()=>Gt,ModalEvents:()=>U,PACKAGE_NAME:()=>Te,PACKAGE_VERSION:()=>xe,PresenceToggle:()=>Nt,ProgressBar:()=>Wt,ProgressBarCommon:()=>qt,Select:()=>Xt,SimpleBtn:()=>ft,SliderUi:()=>Bt,SolutionBlock:()=>ae,SourceBtn:()=>gt,SourceList:()=>Yi,Spinner:()=>Zt,StartFrom:()=>Yt,Thumb:()=>vt,UID:()=>fe,UploadCtxProvider:()=>Ji,UploadList:()=>Qt,UploadSource:()=>P,UploaderBlock:()=>O,UrlSource:()=>Jt,defineComponents:()=>Ei,defineLocale:()=>Ar,loadFileUploaderFrom:()=>is,toKebabCase:()=>ct});var Mn=Object.defineProperty,Ln=s((i,e,t)=>e in i?Mn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,"__defNormalProp"),or=s((i,e,t)=>(Ln(i,typeof e!="symbol"?e+"":e,t),t),"__publicField");function Rn(i){let e=s(t=>{var r;for(let o in t)((r=t[o])==null?void 0:r.constructor)===Object&&(t[o]=e(t[o]));return{...t}},"clone");return e(i)}s(Rn,"cloneObj");var T=class{static{s(this,"Data")}constructor(i){i.constructor===Object?this.store=Rn(i):(this._storeIsProxy=!0,this.store=i),this.callbackMap=Object.create(null)}static warn(i,e){console.warn(`Symbiote Data: cannot ${i}. Prop name: `+e)}read(i){return!this._storeIsProxy&&!this.store.hasOwnProperty(i)?(T.warn("read",i),null):this.store[i]}has(i){return this._storeIsProxy?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,e,t=!1){!t&&Object.keys(this.store).includes(i)||(this.store[i]=e,this.notify(i))}pub(i,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(i)){T.warn("publish",i);return}this.store[i]=e,this.notify(i)}multiPub(i){for(let e in i)this.pub(e,i[e])}notify(i){this.callbackMap[i]&&this.callbackMap[i].forEach(e=>{e(this.store[i])})}sub(i,e,t=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(i)?(T.warn("subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(e),t&&e(this.store[i]),{remove:s(()=>{this.callbackMap[i].delete(e),this.callbackMap[i].size||delete this.callbackMap[i]},"remove"),callback:e})}static registerCtx(i,e=Symbol()){let t=T.globalStore.get(e);return t?console.warn('State: context UID "'+e+'" already in use'):(t=new T(i),T.globalStore.set(e,t)),t}static deleteCtx(i){T.globalStore.delete(i)}static getCtx(i,e=!0){return T.globalStore.get(i)||(e&&console.warn('State: wrong context UID - "'+i+'"'),null)}};T.globalStore=new Map;var E=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),po="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Pn=po.length-1,fe=class{static{s(this,"UID")}static generate(i="XXXXXXXXX-XXX"){let e="";for(let t=0;t<i.length;t++)e+=i[t]==="-"?i[t]:po.charAt(Math.random()*Pn);return e}};function ho(i,e,t){let r=!0,o,n=e.split(".");return n.forEach((a,l)=>{l<n.length-1?i=i[a]:o=a}),i?i[o]=t:r=!1,r}s(ho,"setNestedProp");function Un(i){return i.split("-").map((e,t)=>e&&t?e[0].toUpperCase()+e.slice(1):e).join("").split("_").map((e,t)=>e&&t?e.toUpperCase():e).join("")}s(Un,"kebabToCamel");function $n(i,e){[...i.querySelectorAll(`[${E.REPEAT_ATTR}]`)].forEach(t=>{let r=t.getAttribute(E.REPEAT_ITEM_TAG_ATTR),o;if(r&&(o=window.customElements.get(r)),!o){o=class extends e.BaseComponent{static{s(this,"itemClass")}constructor(){super(),r||(this.style.display="contents")}};let a=t.innerHTML;o.template=a,o.reg(r)}for(;t.firstChild;)t.firstChild.remove();let n=t.getAttribute(E.REPEAT_ATTR);e.sub(n,a=>{if(!a){for(;t.firstChild;)t.firstChild.remove();return}let l=[...t.children],c,u=s(d=>{d.forEach((h,f)=>{if(l[f])if(l[f].set$)setTimeout(()=>{l[f].set$(h)});else for(let m in h)l[f][m]=h[m];else{c||(c=new DocumentFragment);let m=new o;Object.assign(m.init$,h),c.appendChild(m)}}),c&&t.appendChild(c);let p=l.slice(d.length,l.length);for(let h of p)h.remove()},"fillItems");if(a.constructor===Array)u(a);else if(a.constructor===Object){let d=[];for(let p in a){let h=a[p];Object.defineProperty(h,"_KEY_",{value:p,enumerable:!0}),d.push(h)}u(d)}else console.warn("Symbiote repeat data type error:"),console.log(a)}),t.removeAttribute(E.REPEAT_ATTR),t.removeAttribute(E.REPEAT_ITEM_TAG_ATTR)})}s($n,"repeatProcessor");var co="__default__";function Dn(i,e){if(e.shadowRoot)return;let t=[...i.querySelectorAll("slot")];if(!t.length)return;let r={};t.forEach(o=>{let n=o.getAttribute("name")||co;r[n]={slot:o,fr:document.createDocumentFragment()}}),e.initChildren.forEach(o=>{var n;let a=co;o instanceof Element&&o.hasAttribute("slot")&&(a=o.getAttribute("slot"),o.removeAttribute("slot")),(n=r[a])==null||n.fr.appendChild(o)}),Object.values(r).forEach(o=>{if(o.fr.childNodes.length)o.slot.parentNode.replaceChild(o.fr,o.slot);else if(o.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...o.slot.childNodes),o.slot.parentNode.replaceChild(n,o.slot)}else o.slot.remove()})}s(Dn,"slotProcessor");function Fn(i,e){[...i.querySelectorAll(`[${E.EL_REF_ATTR}]`)].forEach(t=>{let r=t.getAttribute(E.EL_REF_ATTR);e.ref[r]=t,t.removeAttribute(E.EL_REF_ATTR)})}s(Fn,"refProcessor");function Vn(i,e){[...i.querySelectorAll(`[${E.BIND_ATTR}]`)].forEach(t=>{let o=t.getAttribute(E.BIND_ATTR).split(";");[...t.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let a=Un(n.name.replace("-",""));o.push(a+":"+n.value),t.removeAttribute(n.name)}}),o.forEach(n=>{if(!n)return;let a=n.split(":").map(d=>d.trim()),l=a[0],c;l.indexOf(E.ATTR_BIND_PRFX)===0&&(c=!0,l=l.replace(E.ATTR_BIND_PRFX,""));let u=a[1].split(",").map(d=>d.trim());for(let d of u){let p;d.startsWith("!!")?(p="double",d=d.replace("!!","")):d.startsWith("!")&&(p="single",d=d.replace("!","")),e.sub(d,h=>{p==="double"?h=!!h:p==="single"&&(h=!h),c?h?.constructor===Boolean?h?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,h):ho(t,l,h)||(t[E.SET_LATER_KEY]||(t[E.SET_LATER_KEY]=Object.create(null)),t[E.SET_LATER_KEY][l]=h)})}}),t.removeAttribute(E.BIND_ATTR)})}s(Vn,"domSetProcessor");var ri="{{",bt="}}",Nn="skip-text";function Bn(i){let e,t=[],r=document.createTreeWalker(i,NodeFilter.SHOW_TEXT,{acceptNode:s(o=>{var n;return!((n=o.parentElement)!=null&&n.hasAttribute(Nn))&&o.textContent.includes(ri)&&o.textContent.includes(bt)&&1},"acceptNode")});for(;e=r.nextNode();)t.push(e);return t}s(Bn,"getTextNodesWithTokens");var zn=s(function(i,e){Bn(i).forEach(r=>{let o=[],n;for(;r.textContent.includes(bt);)r.textContent.startsWith(ri)?(n=r.textContent.indexOf(bt)+bt.length,r.splitText(n),o.push(r)):(n=r.textContent.indexOf(ri),r.splitText(n)),r=r.nextSibling;o.forEach(a=>{let l=a.textContent.replace(ri,"").replace(bt,"");a.textContent="",e.sub(l,c=>{a.textContent=c})})})},"txtNodesProcessor"),Hn=[$n,Dn,Fn,Vn,zn],oi="'",Ge='"',jn=/\\([0-9a-fA-F]{1,6} ?)/g;function Kn(i){return(i[0]===Ge||i[0]===oi)&&(i[i.length-1]===Ge||i[i.length-1]===oi)}s(Kn,"hasLeadingTrailingQuotes");function Gn(i){return(i[0]===Ge||i[0]===oi)&&(i=i.slice(1)),(i[i.length-1]===Ge||i[i.length-1]===oi)&&(i=i.slice(0,-1)),i}s(Gn,"trimQuotes");function Wn(i){let e="",t="";for(var r=0;r<i.length;r++){let o=i[r+1];i[r]==="\\"&&o==='"'?(e+='\\"',r++):i[r]==='"'&&t!=="\\"?e+='\\"':e+=i[r],t=i[r]}return e}s(Wn,"escapeQuotes");function qn(i){let e=i;Kn(i)&&(e=Gn(e),e=e.replace(jn,(t,r)=>String.fromCodePoint(parseInt(r.trim(),16))),e=e.replaceAll(`\\
|
|
27
|
+
`,"\\n"),e=Wn(e),e=Ge+e+Ge);try{return JSON.parse(e)}catch{throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${i}`)}}s(qn,"parseCssPropertyValue");var uo=0,Ke=null,me=null,Ae=class extends HTMLElement{static{s(this,"_BaseComponent")}constructor(){super(),or(this,"updateCssData",()=>{var i;this.dropCssDataCache(),(i=this.__boundCssProps)==null||i.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 Ae}initCallback(){}__initCallback(){var i;this.__initialized||(this.__initialized=!0,(i=this.initCallback)==null||i.call(this))}render(i,e=this.renderShadow){let t;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(E.USE_TPL);if(o){let n=this.getRootNode(),a=n?.querySelector(o)||document.querySelector(o);a?i=a.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(i||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),i?.constructor===DocumentFragment)t=i;else if(i?.constructor===String){let o=document.createElement("template");o.innerHTML=i,t=o.content.cloneNode(!0)}else this.constructor.__tpl&&(t=this.constructor.__tpl.content.cloneNode(!0));for(let o of this.tplProcessors)o(t,this)}let r=s(()=>{t&&(e&&this.shadowRoot.appendChild(t)||this.appendChild(t)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){e=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=r,this.shadowRoot.prepend(o)}else r()}addTemplateProcessor(i){this.tplProcessors.add(i)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=fe.generate(),this.style.setProperty(E.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(E.CSS_CTX_PROP,!0)}get ctxName(){var i;let e=((i=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:i.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}get localCtx(){return this.__localCtx||(this.__localCtx=T.registerCtx({},this)),this.__localCtx}get nodeCtx(){return T.getCtx(this.ctxName,!1)||T.registerCtx({},this.ctxName)}static __parseProp(i,e){let t,r;if(i.startsWith(E.EXT_DATA_CTX_PRFX))t=e.nodeCtx,r=i.replace(E.EXT_DATA_CTX_PRFX,"");else if(i.includes(E.NAMED_DATA_CTX_SPLTR)){let o=i.split(E.NAMED_DATA_CTX_SPLTR);t=T.getCtx(o[0]),r=o[1]}else t=e.localCtx,r=i;return{ctx:t,name:r}}sub(i,e,t=!0){let r=s(n=>{this.isConnected&&e(n)},"subCb"),o=Ae.__parseProp(i,this);o.ctx.has(o.name)?this.allSubs.add(o.ctx.sub(o.name,r,t)):window.setTimeout(()=>{this.allSubs.add(o.ctx.sub(o.name,r,t))})}notify(i){let e=Ae.__parseProp(i,this);e.ctx.notify(e.name)}has(i){let e=Ae.__parseProp(i,this);return e.ctx.has(e.name)}add(i,e,t=!1){let r=Ae.__parseProp(i,this);r.ctx.add(r.name,e,t)}add$(i,e=!1){for(let t in i)this.add(t,i[t],e)}get $(){if(!this.__stateProxy){let i=Object.create(null);this.__stateProxy=new Proxy(i,{set:s((e,t,r)=>{let o=Ae.__parseProp(t,this);return o.ctx.pub(o.name,r),!0},"set"),get:s((e,t)=>{let r=Ae.__parseProp(t,this);return r.ctx.read(r.name)},"get")})}return this.__stateProxy}set$(i,e=!1){for(let t in i){let r=i[t];e||![String,Number,Boolean].includes(r?.constructor)?this.$[t]=r:this.$[t]!==r&&(this.$[t]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(E.CTX_OWNER_ATTR)&&this.getAttribute(E.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let i=this.constructor.__attrDesc;if(i)for(let e of Object.values(i))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(E.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(E.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(E.NAMED_DATA_CTX_SPLTR)){let t=e.split(E.NAMED_DATA_CTX_SPLTR),r=t[0].trim(),o=t[1].trim();if(r&&o){let n=T.getCtx(r,!1);n||(n=T.registerCtx({},r)),n.add(o,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var i;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(i=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:i.trim();if(e&&this.style.setProperty(E.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[E.SET_LATER_KEY]){for(let t in this[E.SET_LATER_KEY])ho(this,t,this[E.SET_LATER_KEY][t]);delete this[E.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let t of Hn)this.addTemplateProcessor(t);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let t=this.getRootNode();if(!t)return;if(t?.querySelector(`link[${E.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let o=this.constructor.__rootStylesLink.cloneNode(!0);o.setAttribute(E.ROOT_STYLE_ATTR_NAME,this.constructor.is),o.onload=()=>{this.render()},t.nodeType===Node.DOCUMENT_NODE?t.head.appendChild(o):t.prepend(o)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let i of this.allSubs)i.remove(),this.allSubs.delete(i);for(let i of this.tplProcessors)this.tplProcessors.delete(i);me?.delete(this.updateCssData),me?.size||(Ke?.disconnect(),Ke=null,me=null)},100)))}static reg(i,e=!1){i||(uo++,i=`${E.AUTO_TAG_PRFX}-${uo}`),this.__tag=i;let t=window.customElements.get(i);if(t){!e&&t!==this&&console.warn([`Element with tag name "${i}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
|
|
28
|
+
`));return}window.customElements.define(i,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(i){this.observedAttributes=Object.keys(i),this.__attrDesc=i}attributeChangedCallback(i,e,t){var r;if(e===t)return;let o=(r=this.constructor.__attrDesc)==null?void 0:r[i];o?this.__dataCtxInitialized?this.$[o]=t:this.init$[o]=t:this[i]=t}getCssData(i,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(i)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let t=this.__computedStyle.getPropertyValue(i).trim();try{this.__cssDataCache[i]=qn(t)}catch{!e&&console.warn(`CSS Data error: ${i}`),this.__cssDataCache[i]=null}}return this.__cssDataCache[i]}__extractCssName(i){return i.split("--").map((e,t)=>t===0?"":e).join("--")}__initStyleAttrObserver(){me||(me=new Set),me.add(this.updateCssData),Ke||(Ke=new MutationObserver(i=>{i[0].type==="attributes"&&me.forEach(e=>{e()})}),Ke.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(i,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(i);let t=this.getCssData(this.__extractCssName(i),!0);t===null&&(t=e),this.add(i,t),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(i,e,t){let r="__"+i;this[r]=this[i],Object.defineProperty(this,i,{set:s(o=>{this[r]=o,t?window.setTimeout(()=>{e?.(o)}):e?.(o)},"set"),get:s(()=>this[r],"get")}),this[i]=this[r]}static set shadowStyles(i){let e=new Blob([i],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(i){if(!this.__rootStylesLink){let e=new Blob([i],{type:"text/css"}),t=URL.createObjectURL(e),r=document.createElement("link");r.href=t,r.rel="stylesheet",this.__rootStylesLink=r}}},ge=Ae;or(ge,"template");var rr=class{static{s(this,"AppRouter")}static _print(i){console.warn(i)}static setDefaultTitle(i){this.defaultTitle=i}static setRoutingMap(i){Object.assign(this.appMap,i);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(i){this.__routingEventName=i}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let i={route:null,options:{}};return window.location.search.split(this.separator).forEach(t=>{if(t.includes("?"))i.route=t.replace("?","");else if(t.includes("=")){let r=t.split("=");i.options[r[0]]=decodeURI(r[1])}else i.options[t]=!0}),i}static notify(){let i=this.readAddressBar(),e=this.appMap[i.route];if(e&&e.title&&(document.title=e.title),i.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 "${i.route}" not found...`);return}let t=new CustomEvent(rr.routingEventName,{detail:{route:i.route,options:Object.assign(e||{},i.options)}});window.dispatchEvent(t)}static reflect(i,e={}){let t=this.appMap[i];if(!t){this._print("Wrong route: "+i);return}let r="?"+i;for(let n in e)e[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${e[n]}`;let o=t.title||this.defaultTitle||"";window.history.pushState(null,o,r),document.title=o}static applyRoute(i,e={}){this.reflect(i,e),this.notify()}static setSeparator(i){this._separator=i}static get separator(){return this._separator||"&"}static createRouterData(i,e){this.setRoutingMap(e);let t=T.registerCtx({route:null,options:null,title:null},i);return window.addEventListener(this.routingEventName,r=>{var o;t.multiPub({route:r.detail.route,options:r.detail.options,title:((o=r.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),rr.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}};rr.appMap=Object.create(null);function _t(i,e){for(let t in e)t.includes("-")?i.style.setProperty(t,e[t]):i.style[t]=e[t]}s(_t,"applyStyles");function Xn(i,e){for(let t in e)e[t].constructor===Boolean?e[t]?i.setAttribute(t,""):i.removeAttribute(t):i.setAttribute(t,e[t])}s(Xn,"applyAttributes");function sr(i={tag:"div"}){let e=document.createElement(i.tag);if(i.attributes&&Xn(e,i.attributes),i.styles&&_t(e,i.styles),i.properties)for(let t in i.properties)e[t]=i.properties[t];return i.processors&&i.processors.forEach(t=>{t(e)}),i.children&&i.children.forEach(t=>{let r=sr(t);e.appendChild(r)}),e}s(sr,"create");var mo="idb-store-ready",Zn="symbiote-db",Yn="symbiote-idb-update_",Qn=class{static{s(this,"DbInstance")}_notifyWhenReady(i=null){window.dispatchEvent(new CustomEvent(mo,{detail:{dbName:this.name,storeName:this.storeName,event:i}}))}get _updEventName(){return Yn+this.name}_getUpdateEvent(i){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:i}})}_notifySubscribers(i){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,i),window.dispatchEvent(this._getUpdateEvent(i))}constructor(i,e){this.name=i,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=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 o=>{o(await this.read(t.newValue))})},this._localUpdateHandler=t=>{this._updateHandler(t.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(i){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(i);return new Promise((r,o)=>{t.onsuccess=n=>{var a;(a=n.target.result)!=null&&a._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${i}"`))},t.onerror=n=>{o(n)}})}write(i,e,t=!1){let r={_key:i,_value:e},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((a,l)=>{n.onsuccess=c=>{t||this._notifySubscribers(i),a(c.target.result)},n.onerror=c=>{l(c)}})}delete(i,e=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(i);return new Promise((o,n)=>{r.onsuccess=a=>{e||this._notifySubscribers(i),o(a)},r.onerror=a=>{n(a)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((t,r)=>{e.onsuccess=o=>{let n=o.target.result;t(n.map(a=>a._value))},e.onerror=o=>{r(o)}})}subscribe(i,e){this._subscriptionsMap[i]||(this._subscriptionsMap[i]=new Set);let t=this._subscriptionsMap[i];return t.add(e),{remove:s(()=>{t.delete(e),t.size||delete this._subscriptionsMap[i]},"remove")}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,fo.clear(this.name)}},fo=class{static{s(this,"IDB")}static get readyEventName(){return mo}static open(i=Zn,e="store"){let t=i+"/"+e;return this._reg[t]||(this._reg[t]=new Qn(i,e)),this._reg[t]}static clear(i){window.indexedDB.deleteDatabase(i);for(let e in this._reg)e.split("/")[0]===i&&delete this._reg[e]}};or(fo,"_reg",Object.create(null));var ve=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config"}),_=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created",...ve}),si=class{static{s(this,"EventEmitter")}_timeoutStore=new Map;_targets=new Set;_debugPrint=null;constructor(e){this._debugPrint=e}bindTarget(e){this._targets.add(e)}unbindTarget(e){this._targets.delete(e)}_dispatch(e,t){for(let r of this._targets)r.dispatchEvent(new CustomEvent(e,{detail:t}));this._debugPrint?.(()=>{let r=t&&typeof t=="object"?{...t}:t;return[`event "${e}"`,r]})}emit(e,t,r={}){let{debounce:o}=r;if(typeof o!="number"&&!o){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let n=typeof o=="number"?o:20,a=window.setTimeout(()=>{this._dispatch(e,typeof t=="function"?t():t),this._timeoutStore.delete(e)},n);this._timeoutStore.set(e,a)}};function M(i,e){let t,r=s(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>i(...o),e)}),"debounced");return r.cancel=()=>{t&&clearTimeout(t)},r}s(M,"debounce");var q=s(i=>i?i.split(",").map(e=>e.trim()).filter(Boolean):[],"deserializeCsv"),ye=s(i=>i.join(","),"serializeCsv");var go=s(i=>{if(typeof i!="string"||!i)return"";let e=i.trim();return e.startsWith("-/")?e=e.slice(2):e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,e.length-1)),e},"normalizeCdnOperation"),ni=s((...i)=>i.filter(e=>typeof e=="string"&&!!e).map(e=>go(e)).join("/-/"),"joinCdnOperations"),z=s((...i)=>{let e=ni(...i);return e?`-/${e}/`:""},"createCdnUrlModifiers");function ai(i){let e=new URL(i),t=e.pathname+e.search+e.hash,r=t.lastIndexOf("http"),o=t.lastIndexOf("/"),n="";return r>=0?n=t.slice(r):o>=0&&(n=t.slice(o+1)),n}s(ai,"extractFilename");function li(i){let e=new URL(i),{pathname:t}=e,r=t.indexOf("/"),o=t.indexOf("/",r+1);return t.substring(r+1,o)}s(li,"extractUuid");function nr(i){let e=vo(i),t=new URL(e),r=t.pathname.indexOf("/-/");return r===-1?"":t.pathname.substring(r).slice(1)}s(nr,"extractCdnUrlModifiers");function ar(i){return nr(i).split("/-/").filter(Boolean).map(t=>go(t))}s(ar,"extractOperations");function vo(i){let e=new URL(i),t=ai(i),r=yo(t)?bo(t).pathname:t;return e.pathname=e.pathname.replace(r,""),e.search="",e.hash="",e.toString()}s(vo,"trimFilename");function yo(i){return i.startsWith("http")}s(yo,"isFileUrl");function bo(i){let e=new URL(i);return{pathname:`${e.origin}${e.pathname??""}`,search:e.search??"",hash:e.hash??""}}s(bo,"splitFileUrl");var $=s((i,e,t)=>{let r=new URL(vo(i)),o=t??ai(i),n=e??"";if(r.pathname.startsWith("//")&&(r.pathname=r.pathname.replace("//","/")),o&&yo(o)){let a=bo(o);r.pathname=`${r.pathname}${n}${a.pathname||""}`,r.search=a.search,r.hash=a.hash}else r.pathname=`${r.pathname}${n}${o||""}`;return r.toString()},"createCdnUrl"),Se=s((i,e)=>{let t=new URL(i);return t.pathname=`${e}/`,t.toString()},"createOriginalUrl");var D=s((i,e=",")=>i.trim().split(e).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var wt=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),wo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Jn(i,e){if(typeof e=="number"){let t=e;return wt[i]!==t?`${i}/${t}`:""}if(typeof e=="boolean"){let t=e;return wt[i]!==t?`${i}`:""}if(i==="filter"&&e){let{name:t,amount:r}=e;return wt.filter===r?"":`${i}/${t}/${r}`}if(i==="crop"&&e){let{dimensions:t,coords:r}=e;return`${i}/${t.join("x")}/${r.join(",")}`}return""}s(Jn,"transformationToStr");function Ie(i){return ni(...wo.filter(e=>typeof i[e]<"u"&&i[e]!==null).map(e=>{let t=i[e];return Jn(e,t)}).filter(e=>!!e))}s(Ie,"transformationsToOperations");var ci=ni("format/auto","progressive/yes"),be=s(([i])=>typeof i<"u"?Number(i):void 0,"asNumber"),_o=s(()=>!0,"asBoolean"),ea=s(([i,e])=>({name:i,amount:typeof e<"u"?Number(e):100}),"asFilter"),ta=s(([i,e])=>{if(!/\d+x\d+/.test(i)||!/\d+,\d+/.test(e))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:D(i,"x").map(Number),coords:D(e).map(Number)}},"asCrop"),ia=Object.freeze({enhance:be,brightness:be,exposure:be,gamma:be,contrast:be,saturation:be,vibrance:be,warmth:be,filter:ea,mirror:_o,flip:_o,rotate:be,crop:s(i=>{let[e,t]=i,{dimensions:r,coords:o}=ta([e,t]);return{dimensions:r,coords:o}},"crop")});function lr(i){let e={};for(let t of i){let[r,...o]=t.split("/");if(!r||!wo.includes(r))continue;let n=r,a=ia[n];try{let l=a(o);e[n]=l}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
+
`))}}return e}s(lr,"operationsToTransformations");var L=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),X=Object.freeze([L.CROP,L.TUNING,L.FILTERS]),Co=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Eo=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),To=Object.freeze(["rotate","mirror","flip"]),_e=wt,re=Object.freeze({brightness:{zero:_e.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:_e.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:_e.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:_e.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:_e.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:_e.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:_e.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:_e.enhance,range:[0,100],keypointsNumber:1},filter:{zero:_e.filter,range:[0,100],keypointsNumber:1}});var Ct="https://ucarecdn.com",ra="https://upload.uploadcare.com",oa="https://social.uploadcare.com",sa="https://ucarecd.net",na={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:ye(X),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Ct,cdnCnamePrefixed:sa,baseUrl:ra,socialBaseUrl:oa,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:!1,cloudImageEditorAutoOpen:!1,cloudImageEditorMaskHref:null,testMode:!1,qualityInsights:!0},Y=Object.freeze(na);var xo=s(i=>{let e=new Intl.Locale(i),t="ltr",r=e.getTextInfo?.().direction;return r?t=r:e.textInfo?.direction&&(t=e.textInfo.direction),t},"getLocaleDirection");var ui=s((i,e)=>new Intl.PluralRules(i).select(e),"getPluralForm");var aa=s(i=>i,"DEFAULT_TRANSFORMER"),cr="{{",So="}}",Ao="plural:";function Et(i,e={},t={}){let{openToken:r=cr,closeToken:o=So,transform:n=aa}=t;for(let a in e){let l=e[a],c=l?.toString(),u=typeof c=="string"?n(c):String(c);i=i.replaceAll(r+a+o,u)}return i}s(Et,"applyTemplateData");function Io(i){let e=[],t=i.indexOf(cr);for(;t!==-1;){let r=i.indexOf(So,t);if(r===-1)break;let o=i.substring(t+2,r);if(o.startsWith(Ao)){let n=i.substring(t+2,r).replace(Ao,""),a=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));e.push({variable:o,pluralKey:a,countVariable:l})}t=i.indexOf(cr,r)}return e}s(Io,"getPluralObjects");var ko="--uploadcare-blocks-window-height",Tt=class i{static{s(this,"WindowHeightTracker")}static clientsRegistry=new Set;static flush=M(()=>{document.documentElement.style.setProperty(ko,`${window.innerHeight}px`)},100);static registerClient(e){i.clientsRegistry.size===0&&i.attachTracker(),i.clientsRegistry.add(e)}static unregisterClient(e){i.clientsRegistry.delete(e),i.clientsRegistry.size===0&&i.detachTracker()}static attachTracker(){window.addEventListener("resize",i.flush,{passive:!0,capture:!0}),i.flush()}static detachTracker(){window.removeEventListener("resize",i.flush,{capture:!0}),document.documentElement.style.removeProperty(ko)}};var Oo=s(({element:i,attribute:e,onSuccess:t,onTimeout:r,timeout:o=300})=>{let n=i.getAttribute(e);if(n!==null){t(n);return}let a=new MutationObserver(u=>{let d=u[u.length-1];d&&c(d)});a.observe(i,{attributes:!0,attributeFilter:[e]});let l=window.setTimeout(()=>{a.disconnect(),r()},o),c=s(u=>{let d=i.getAttribute(e);u.type==="attributes"&&u.attributeName===e&&d!==null&&(window.clearTimeout(l),a.disconnect(),t(d))},"handleMutation")},"waitForAttribute");function Mo(i){return Object.prototype.toString.call(i)==="[object Object]"}s(Mo,"isObject");var la=/\W|_/g;function ca(i){return i.split(la).map((e,t)=>e.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+e.slice(1)).join("")}s(ca,"camelizeString");function Lo(i,{ignoreKeys:e}={ignoreKeys:[]}){return Array.isArray(i)?i.map(t=>Ee(t,{ignoreKeys:e})):i}s(Lo,"camelizeArrayItems");function Ee(i,{ignoreKeys:e}={ignoreKeys:[]}){if(Array.isArray(i))return Lo(i,{ignoreKeys:e});if(!Mo(i))return i;let t={};for(let r of Object.keys(i)){let o=i[r];if(e.includes(r)){t[r]=o;continue}Mo(o)?o=Ee(o,{ignoreKeys:e}):Array.isArray(o)&&(o=Lo(o,{ignoreKeys:e})),t[ca(r)]=o}return t}s(Ee,"camelizeKeys");var ua=s(i=>new Promise(e=>setTimeout(e,i)),"delay");function gr({libraryName:i,libraryVersion:e,userAgent:t,publicKey:r="",integration:o=""}){let n="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:r,libraryName:i,libraryVersion:e,languageName:n,integration:o});let a=[i,e,r].filter(Boolean).join("/"),l=[n,o].filter(Boolean).join("; ");return`${a} (${l})`}s(gr,"getUserAgent$1");var da={factor:2,time:100};function pa(i,e=da){let t=0;function r(o){let n=Math.round(e.time*e.factor**t);return o({attempt:t,retry:s(l=>ua(l??n).then(()=>(t+=1,r(o))),"retry")})}return s(r,"runAttempt"),r(i)}s(pa,"retrier");var De=class extends Error{static{s(this,"UploadcareError")}},We=class i extends De{static{s(this,"NetworkError")}originalProgressEvent;constructor(e){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,i.prototype),this.originalProgressEvent=e}},di=s((i,e)=>{i&&(i.aborted?Promise.resolve().then(e):i.addEventListener("abort",()=>e(),{once:!0}))},"onCancel"),ke=class i extends De{static{s(this,"CancelError")}isCancel=!0;constructor(e="Request canceled"){super(e),this.name="CancelError",Object.setPrototypeOf(this,i.prototype)}},ha=500,Po=s(({check:i,interval:e=ha,timeout:t,signal:r})=>new Promise((o,n)=>{let a,l;di(r,()=>{a&&clearTimeout(a),n(new ke("Poll cancelled"))}),t&&(l=setTimeout(()=>{a&&clearTimeout(a),n(new ke("Timed out"))},t));let c=s(()=>{try{Promise.resolve(i(r)).then(u=>{u?(l&&clearTimeout(l),o(u)):a=setTimeout(c,e)}).catch(u=>{l&&clearTimeout(l),n(u)})}catch(u){l&&clearTimeout(l),n(u)}},"tick");a=setTimeout(c,0)}),"poll"),I={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"},pi="application/octet-stream",Uo="original",Me=s(({method:i,url:e,data:t,headers:r={},signal:o,onProgress:n})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=i?.toUpperCase()||"GET",d=!1;c.open(u,e,!0),r&&Object.entries(r).forEach(p=>{let[h,f]=p;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(h,f)}),c.responseType="text",di(o,()=>{d=!0,c.abort(),l(new ke)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let p={method:u,url:e,data:t,headers:r||void 0,signal:o,onProgress:n},h=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(y){let S=y.split(": "),x=S.shift(),A=S.join(": ");x&&typeof x<"u"&&(f[x]=A)});let m=c.response,v=c.status;a({request:p,data:m,headers:f,status:v})}},c.onerror=p=>{d||l(new We(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 ma(i,...e){return i}s(ma,"identity");var fa=s(({name:i})=>i?[i]:[],"getFileOptions"),ga=ma,va=s(()=>new FormData,"getFormData"),$o=s(i=>!1,"isBuffer"),hi=s(i=>typeof Blob<"u"&&i instanceof Blob,"isBlob"),mi=s(i=>typeof File<"u"&&i instanceof File,"isFile"),fi=s(i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&"uri"in i&&typeof i.uri=="string","isReactNativeAsset"),qe=s(i=>hi(i)||mi(i)||$o()||fi(i),"isFileData"),ya=s(i=>typeof i=="string"||typeof i=="number"||typeof i>"u","isSimpleValue"),ba=s(i=>!!i&&typeof i=="object"&&!Array.isArray(i),"isObjectValue"),_a=s(i=>!!i&&typeof i=="object"&&"data"in i&&qe(i.data),"isFileValue");function Do(i,e,t){if(Array.isArray(t))for(let r of t)Do(i,`${e}[]`,r);else if(_a(t)){let{name:r,contentType:o}=t,n=ga(t.data,r,o??pi),a=fa({name:r,contentType:o});i.push([e,n,...a])}else if(ba(t))for(let[r,o]of Object.entries(t))typeof o<"u"&&i.push([`${e}[${r}]`,String(o)]);else ya(t)&&t&&i.push([e,t.toString()])}s(Do,"collectParams");function wa(i){let e=[];for(let[t,r]of Object.entries(i))Do(e,t,r);return e}s(wa,"getFormDataParams");function gi(i){let e=va(),t=wa(i);for(let r of t){let[o,n,...a]=r;e.append(o,n,...a)}return e}s(gi,"buildFormData");var H=class i extends De{static{s(this,"UploadError")}code;request;response;headers;constructor(e,t,r,o,n){super(),this.name="UploadError",this.message=e,this.code=t,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,i.prototype)}},Ca=s(i=>{let e=new URLSearchParams;for(let[t,r]of Object.entries(i))r&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).filter(o=>o[1]??!1).forEach(o=>e.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(r)?r.forEach(o=>{e.append(`${t}[]`,o)}):typeof r=="string"&&r?e.set(t,r):typeof r=="number"&&e.set(t,r.toString());return e.toString()},"buildSearchParams"),we=s((i,e,t)=>{let r=new URL(i);return r.pathname=(r.pathname+e).replace("//","/"),t&&(r.search=Ca(t)),r.toString()},"getUrl"),Ea="6.18.0",Ta="UploadcareUploadClient",xa=Ea;function Fe(i){return gr({libraryName:Ta,libraryVersion:xa,...i})}s(Fe,"getUserAgent");var Aa="RequestThrottledError",Ro=15e3,Sa=1e3;function Ia(i){let{headers:e}=i||{};if(!e||typeof e["retry-after"]!="string")return Ro;let t=parseInt(e["retry-after"],10);return Number.isFinite(t)?t*1e3:Ro}s(Ia,"getTimeoutFromThrottledRequest");function Le(i,e){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:r}=e;return pa(({attempt:o,retry:n})=>i().catch(a=>{if("response"in a&&a?.code===Aa&&o<t)return n(Ia(a));if(a instanceof We&&o<r)return n((o+1)*Sa);throw a}))}s(Le,"retryIfFailed");var Fo=s(i=>{let e="";return(hi(i)||mi(i)||fi(i))&&(e=i.type),e||pi},"getContentType"),Vo=s(i=>{let e="";return mi(i)&&i.name?e=i.name:hi(i)||$o()?e="":fi(i)&&i.name&&(e=i.name),e||Uo},"getFileName");function vr(i){return typeof i>"u"||i==="auto"?"auto":i?"1":"0"}s(vr,"getStoreValue");function ka(i,{publicKey:e,fileName:t,contentType:r,baseURL:o=I.baseURL,secureSignature:n,secureExpire:a,store:l,signal:c,onProgress:u,source:d="local",integration:p,userAgent:h,retryThrottledRequestMaxTimes:f=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=I.retryNetworkErrorMaxTimes,metadata:v}){return Le(()=>Me({method:"POST",url:we(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:p,userAgent:h})},data:gi({file:{data:i,name:t||Vo(i),contentType:r||Fo(i)},UPLOADCARE_PUB_KEY:e,UPLOADCARE_STORE:vr(l),signature:n,expire:a,source:d,metadata:v}),signal:c,onProgress:u}).then(({data:y,headers:S,request:x})=>{let A=Ee(JSON.parse(y));if("error"in A)throw new H(A.error.content,A.error.errorCode,x,A,S);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}s(ka,"base");var pr;(function(i){i.Token="token",i.FileInfo="file_info"})(pr||(pr={}));function Oa(i,{publicKey:e,baseURL:t=I.baseURL,store:r,fileName:o,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=I.retryNetworkErrorMaxTimes,metadata:v}){return Le(()=>Me({method:"POST",headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:p,userAgent:h})},url:we(t,"/from_url/",{jsonerrors:1,pub_key:e,source_url:i,store:vr(r),filename:o,check_URL_duplicates:n?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:v}),signal:d}).then(({data:y,headers:S,request:x})=>{let A=Ee(JSON.parse(y));if("error"in A)throw new H(A.error.content,A.error.errorCode,x,A,S);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}s(Oa,"fromUrl");var Z;(function(i){i.Unknown="unknown",i.Waiting="waiting",i.Progress="progress",i.Error="error",i.Success="success"})(Z||(Z={}));var Ma=s(i=>"status"in i&&i.status===Z.Error,"isErrorResponse");function La(i,{publicKey:e,baseURL:t=I.baseURL,signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=I.retryNetworkErrorMaxTimes}={}){return Le(()=>Me({method:"GET",headers:e?{"X-UC-User-Agent":Fe({publicKey:e,integration:o,userAgent:n})}:void 0,url:we(t,"/from_url/status/",{jsonerrors:1,token:i}),signal:r}).then(({data:c,headers:u,request:d})=>{let p=Ee(JSON.parse(c));if("error"in p&&!Ma(p))throw new H(p.error.content,p.error.errorCode,d,p,u);return p}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}s(La,"fromUrlStatus");function Ra(i,{publicKey:e,baseURL:t=I.baseURL,jsonpCallback:r,secureSignature:o,secureExpire:n,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:d=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=I.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"POST",headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:c,userAgent:u})},url:we(t,"/group/",{jsonerrors:1}),data:gi({files:i,callback:r,pub_key:e,signature:o,expire:n,source:l}),signal:a}).then(({data:h,headers:f,request:m})=>{let v=Ee(JSON.parse(h));if("error"in v)throw new H(v.error.content,v.error.errorCode,m,v,f);return v}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:d})}s(Ra,"group");function No(i,{publicKey:e,baseURL:t=I.baseURL,signal:r,source:o,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=I.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"GET",headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:n,userAgent:a})},url:we(t,"/info/",{jsonerrors:1,pub_key:e,file_id:i,source:o}),signal:r}).then(({data:u,headers:d,request:p})=>{let h=Ee(JSON.parse(u));if("error"in h)throw new H(h.error.content,h.error.errorCode,p,h,d);return h}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}s(No,"info");function Pa(i,{publicKey:e,contentType:t,fileName:r,multipartChunkSize:o=I.multipartChunkSize,baseURL:n="",secureSignature:a,secureExpire:l,store:c,signal:u,source:d="local",integration:p,userAgent:h,retryThrottledRequestMaxTimes:f=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=I.retryNetworkErrorMaxTimes,metadata:v}){return Le(()=>Me({method:"POST",url:we(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:p,userAgent:h})},data:gi({filename:r||Uo,size:i,content_type:t||pi,part_size:o,UPLOADCARE_STORE:vr(c),UPLOADCARE_PUB_KEY:e,signature:a,expire:l,source:d,metadata:v}),signal:u}).then(({data:y,headers:S,request:x})=>{let A=Ee(JSON.parse(y));if("error"in A)throw new H(A.error.content,A.error.errorCode,x,A,S);return A.parts=Object.keys(A.parts).map(Q=>A.parts[Number(Q)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})}s(Pa,"multipartStart");function Ua(i,e,{contentType:t,signal:r,onProgress:o,retryThrottledRequestMaxTimes:n=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=I.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"PUT",url:e,data:i,onProgress:o,signal:r,headers:{"Content-Type":t||pi}}).then(l=>(o&&o({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a})}s(Ua,"multipartUpload");function $a(i,{publicKey:e,baseURL:t=I.baseURL,source:r="local",signal:o,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=I.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"POST",url:we(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Fe({publicKey:e,integration:n,userAgent:a})},data:gi({uuid:i,UPLOADCARE_PUB_KEY:e,source:r}),signal:o}).then(({data:u,headers:d,request:p})=>{let h=Ee(JSON.parse(u));if("error"in h)throw new H(h.error.content,h.error.errorCode,p,h,d);return h}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}s($a,"multipartComplete");function yr(i,{publicKey:e,baseURL:t,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Po({check:s(d=>No(i,{publicKey:e,baseURL:t,signal:d,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(p=>p.isReady?p:(u&&u({isComputable:!0,value:1}),!1)),"check"),signal:c})}s(yr,"isReadyPoll");function Da(i){return"defaultEffects"in i}s(Da,"isGroupFileInfo");var Ce=class{static{s(this,"UploadcareFile")}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(e,{baseCDN:t=I.baseCDN,fileName:r}={}){let{uuid:o,s3Bucket:n}=e,a=we(t,`${o}/`),l=n?we(`https://${n}.s3.amazonaws.com/`,`${o}/${e.filename}`):null;this.uuid=o,this.name=r||e.filename,this.size=e.size,this.isStored=e.isStored,this.isImage=e.isImage,this.mimeType=e.mimeType,this.cdnUrl=a,this.originalFilename=e.originalFilename,this.imageInfo=e.imageInfo,this.videoInfo=e.videoInfo,this.contentInfo=e.contentInfo,this.metadata=e.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Da(e)&&(this.defaultEffects=e.defaultEffects)}},Fa=s((i,{publicKey:e,fileName:t,baseURL:r,secureSignature:o,secureExpire:n,store:a,contentType:l,signal:c,onProgress:u,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:y})=>ka(i,{publicKey:e,fileName:t,contentType:l,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:y}).then(({file:S})=>yr(S,{publicKey:e,baseURL:r,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(S=>new Ce(S,{baseCDN:v})),"uploadDirect"),Va=s((i,{publicKey:e,fileName:t,baseURL:r,signal:o,onProgress:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:d,baseCDN:p})=>No(i,{publicKey:e,baseURL:r,signal:o,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:d}).then(h=>new Ce(h,{baseCDN:p,fileName:t})).then(h=>(n&&n({isComputable:!0,value:1}),h)),"uploadFromUploaded"),Na=s((i,{signal:e}={})=>{let t=null,r=null,o=i.map(()=>new AbortController),n=s(a=>()=>{r=a,o.forEach((l,c)=>c!==a&&l.abort())},"createStopRaceCallback");return di(e,()=>{o.forEach(a=>a.abort())}),Promise.all(i.map((a,l)=>{let c=n(l);return Promise.resolve().then(()=>a({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(a=>{if(r===null)throw t;return a[r]})},"race"),Ba=window.WebSocket,hr=class{static{s(this,"Events")}events=Object.create({});emit(e,t){this.events[e]?.forEach(r=>r(t))}on(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}off(e,t){t?this.events[e]=this.events[e].filter(r=>r!==t):this.events[e]=[]}},za=s((i,e)=>i==="success"?{status:Z.Success,...e}:i==="progress"?{status:Z.Progress,...e}:{status:Z.Error,...e},"response"),mr=class{static{s(this,"Pusher")}key;disconnectTime;ws=void 0;queue=[];isConnected=!1;subscribers=0;emmitter=new hr;disconnectTimeoutId=null;constructor(e,t=3e4){this.key=e,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let e=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Ba(e),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let 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,za(r.event,JSON.parse(r.data)))}})}}disconnect(){let e=s(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{e()},this.disconnectTime):e()}send(e,t){let r=JSON.stringify({event:e,data:t});this.ws?.send(r)}subscribe(e,t){this.subscribers+=1,this.connect();let r=`task-status-${e}`,o={event:"pusher:subscribe",data:{channel:r}};this.emmitter.on(r,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o)}unsubscribe(e){this.subscribers-=1;let t=`task-status-${e}`,r={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(r.event,r.data):this.queue=this.queue.filter(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(e){return this.emmitter.on("error",e),()=>this.emmitter.off("error",e)}},ur=null,br=s(i=>{if(!ur){let e=typeof window>"u"?0:3e4;ur=new mr(i,e)}return ur},"getPusher"),Ha=s(i=>{br(i).connect()},"preconnect");function ja({token:i,publicKey:e,baseURL:t,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return Po({check:s(u=>La(i,{publicKey:e,baseURL:t,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:u}).then(d=>{switch(d.status){case Z.Error:return new H(d.error,d.errorCode);case Z.Waiting:return!1;case Z.Unknown:return new H(`Token "${i}" was not found.`);case Z.Progress:return l&&(d.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:d.done/d.total})),!1;case Z.Success:return l&&l({isComputable:!0,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),"check"),signal:c})}s(ja,"pollStrategy");var Ka=s(({token:i,pusherKey:e,signal:t,onProgress:r})=>new Promise((o,n)=>{let a=br(e),l=a.onError(n),c=s(()=>{l(),a.unsubscribe(i)},"destroy");di(t,()=>{c(),n(new ke("pusher cancelled"))}),a.subscribe(i,u=>{switch(u.status){case Z.Progress:{r&&(u.total==="unknown"?r({isComputable:!1}):r({isComputable:!0,value:u.done/u.total}));break}case Z.Success:{c(),r&&r({isComputable:!0,value:u.done/u.total}),o(u);break}case Z.Error:c(),n(new H(u.msg,u.error_code))}})}),"pushStrategy"),Ga=s((i,{publicKey:e,fileName:t,baseURL:r,baseCDN:o,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:d,onProgress:p,source:h,integration:f,userAgent:m,retryThrottledRequestMaxTimes:v,pusherKey:y=I.pusherKey,metadata:S})=>Promise.resolve(Ha(y)).then(()=>Oa(i,{publicKey:e,fileName:t,baseURL:r,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:d,source:h,integration:f,userAgent:m,retryThrottledRequestMaxTimes:v,metadata:S})).catch(x=>(br(y)?.disconnect(),Promise.reject(x))).then(x=>x.type===pr.FileInfo?x:Na([({signal:A})=>ja({token:x.token,publicKey:e,baseURL:r,integration:f,userAgent:m,retryThrottledRequestMaxTimes:v,onProgress:p,signal:A}),({signal:A})=>Ka({token:x.token,pusherKey:y,signal:A,onProgress:p})],{signal:d})).then(x=>{if(x instanceof H)throw x;return x}).then(x=>yr(x.uuid,{publicKey:e,baseURL:r,integration:f,userAgent:m,retryThrottledRequestMaxTimes:v,onProgress:p,signal:d})).then(x=>new Ce(x,{baseCDN:o})),"uploadFromUrl"),dr=new WeakMap,Wa=s(async i=>{if(dr.has(i))return dr.get(i);let e=await fetch(i.uri).then(t=>t.blob());return dr.set(i,e),e},"getBlobFromReactNativeAsset"),Bo=s(async i=>{if(mi(i)||hi(i))return i.size;if(fi(i))return(await Wa(i)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),qa=s((i,e=I.multipartMinFileSize)=>i>=e,"isMultipart"),zo=s(i=>{let e="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(e);return!qe(i)&&t.test(i)},"isUuid"),_r=s(i=>{let e="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(e);return!qe(i)&&t.test(i)},"isUrl"),Xa=s((i,e)=>new Promise((t,r)=>{let o=[],n=!1,a=e.length,l=[...e],c=s(()=>{let u=e.length-l.length,d=l.shift();d&&d().then(p=>{n||(o[u]=p,a-=1,a?c():t(o))}).catch(p=>{n=!0,r(p)})},"run");for(let u=0;u<i;u++)c()}),"runWithConcurrency"),Za=s((i,e,t,r)=>{let o=r*e,n=Math.min(o+r,t);return i.slice(o,n)},"sliceChunk"),Ya=s(async(i,e,t)=>r=>Za(i,r,e,t),"prepareChunks"),Qa=s((i,e,{publicKey:t,contentType:r,onProgress:o,signal:n,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Ua(i,e,{publicKey:t,contentType:r,onProgress:o,signal:n,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Ja=s(async(i,{publicKey:e,fileName:t,fileSize:r,baseURL:o,secureSignature:n,secureExpire:a,store:l,signal:c,onProgress:u,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:y=I.multipartChunkSize,maxConcurrentRequests:S=I.maxConcurrentRequests,baseCDN:x,metadata:A})=>{let Q=r??await Bo(i),J,$e=s((V,W)=>{if(!u)return;J||(J=Array(V).fill(0));let ie=s(ne=>ne.reduce((he,ir)=>he+ir,0),"sum");return ne=>{ne.isComputable&&(J[W]=ne.value,u({isComputable:!0,value:ie(J)/V}))}},"createProgressHandler");return v||=Fo(i),Pa(Q,{publicKey:e,contentType:v,fileName:t||Vo(i),baseURL:o,secureSignature:n,secureExpire:a,store:l,signal:c,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:A,multipartChunkSize:y}).then(async({uuid:V,parts:W})=>{let ie=await Ya(i,Q,y);return Promise.all([V,Xa(S,W.map((ne,he)=>()=>Qa(ie(he),ne,{publicKey:e,contentType:v,onProgress:$e(W.length,he),signal:c,integration:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})))])}).then(([V])=>$a(V,{publicKey:e,baseURL:o,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})).then(V=>V.isReady?V:yr(V.uuid,{publicKey:e,baseURL:o,source:d,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(V=>new Ce(V,{baseCDN:x}))},"uploadMultipart");async function wr(i,{publicKey:e,fileName:t,baseURL:r=I.baseURL,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:m,multipartMinFileSize:v,multipartChunkSize:y,maxConcurrentRequests:S,baseCDN:x=I.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:Q,pusherKey:J,metadata:$e}){if(qe(i)){let V=await Bo(i);return qa(V,v)?Ja(i,{publicKey:e,contentType:m,multipartChunkSize:y,fileSize:V,fileName:t,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,maxConcurrentRequests:S,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:$e}):Fa(i,{publicKey:e,fileName:t,contentType:m,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:$e})}if(_r(i))return Ga(i,{publicKey:e,fileName:t,baseURL:r,baseCDN:x,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:Q,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,pusherKey:J,metadata:$e});if(zo(i))return Va(i,{publicKey:e,fileName:t,baseURL:r,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:x});throw new TypeError(`File uploading from "${i}" is not supported`)}s(wr,"uploadFile");var fr=class{static{s(this,"UploadcareGroup")}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(e,{baseCDN:t=I.baseCDN}={}){this.uuid=e.id,this.filesCount=e.filesCount;let r=e.files.filter(Boolean);this.totalSize=Object.values(r).reduce((o,n)=>o+n.size,0),this.isStored=!!e.datetimeStored,this.isImage=!!Object.values(r).filter(o=>o.isImage).length,this.cdnUrl=e.cdnUrl,this.files=r.map(o=>new Ce(o,{baseCDN:t})),this.createdAt=e.datetimeCreated,this.storedAt=e.datetimeStored}},el=s(i=>{for(let e of i)if(!qe(e))return!1;return!0},"isFileDataArray"),tl=s(i=>{for(let e of i)if(!zo(e))return!1;return!0},"isUuidArray"),il=s(i=>{for(let e of i)if(!_r(e))return!1;return!0},"isUrlArray");function Ho(i,{publicKey:e,fileName:t,baseURL:r=I.baseURL,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:v=I.multipartChunkSize,baseCDN:y=I.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:x,jsonpCallback:A}){if(!el(i)&&!il(i)&&!tl(i))throw new TypeError(`Group uploading from "${i}" is not supported`);let Q,J=!0,$e=i.length,V=s((W,ie)=>{if(!c)return;Q||(Q=Array(W).fill(0));let ne=s(he=>he.reduce((ir,Tn)=>ir+Tn)/W,"normalize");return he=>{if(!he.isComputable||!J){J=!1,c({isComputable:!1});return}Q[ie]=he.value,c({isComputable:!0,value:ne(Q)})}},"createProgressHandler");return Promise.all(i.map((W,ie)=>qe(W)||_r(W)?wr(W,{publicKey:e,fileName:t,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:V($e,ie),source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:v,baseCDN:y,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:x}).then(ne=>ne.uuid):W)).then(W=>Ra(W,{publicKey:e,baseURL:r,jsonpCallback:A,secureSignature:o,secureExpire:n,signal:l,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f}).then(ie=>new fr(ie,{baseCDN:y})).then(ie=>(c&&c({isComputable:!0,value:1}),ie)))}s(Ho,"uploadFileGroup");var Oe=class{static{s(this,"Queue")}_concurrency=1;_pending=[];_running=0;_resolvers=new Map;_rejectors=new Map;constructor(e){this._concurrency=e}run(){let e=this._concurrency-this._running;for(let t=0;t<e;t++){let r=this._pending.shift();if(!r)return;let o=this._resolvers.get(r),n=this._rejectors.get(r);if(!o||!n)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,r().finally(()=>{this._resolvers.delete(r),this._rejectors.delete(r),this._running-=1,this.run()}).then(a=>o(a)).catch(a=>n(a))}}add(e,{autoRun:t}={autoRun:!0}){return new Promise((r,o)=>{this._resolvers.set(e,r),this._rejectors.set(e,o),this._pending.push(e),t&&this.run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(e){this._concurrency=e,this.run()}get concurrency(){return this._concurrency}};var Cr=s(()=>({}),"blockCtx"),Er=s(i=>({...Cr(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":s(()=>{i.modalManager?.close(i.$["*currentActivity"]),i.set$({"*currentActivity":null})},"*closeModal")}),"activityBlockCtx"),Tr=s(i=>({...Er(i),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Oe(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx"),jo=s(i=>({...Tr(i),"*solution":null}),"solutionBlockCtx");var xt={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var vi=new Map,xr=new Map,Ko=s((i,e)=>{vi.has(i)&&console.log(`Locale ${i} is already defined. Overwriting...`),vi.set(i,{...xt,...e})},"defineLocaleSync"),rl=s((i,e)=>{xr.set(i,e)},"defineLocaleAsync"),Ar=s((i,e)=>{typeof e=="function"?rl(i,e):Ko(i,e)},"defineLocale"),Go=s(async i=>{if(!vi.has(i)){if(!xr.has(i))throw new Error(`Locale ${i} is not defined`);let t=await xr.get(i)();Ko(i,t)}return vi.get(i)},"resolveLocaleDefinition");Ar("en",xt);var oe=s(i=>`*l10n/${i}`,"localeStateKey"),ol="en",yi=class{static{s(this,"LocaleManager")}_blockInstance=null;_localeName="";_callbacks=new Set;_boundBlocks=new Map;constructor(e){this._blockInstance=e;for(let[t,r]of Object.entries(xt)){let o=this._blockInstance.has(oe(t))?!this._blockInstance.$[oe(t)]:!0;this._blockInstance.add(oe(t),r,o)}setTimeout(()=>{e.subConfigValue("localeName",async t=>{if(!this._blockInstance||!t)return;this._localeName=t;let r=await Go(t);if(t!==ol&&this._localeName!==t)return;let o=this._blockInstance.cfg.localeDefinitionOverride?.[t];for(let[n,a]of Object.entries(r)){let l=o?.[n];this._blockInstance.add(oe(n),l??a,!0);for(let c of this._callbacks)c()}}),e.subConfigValue("localeDefinitionOverride",t=>{if(!t)return;let r=t[this._localeName];if(r)for(let[o,n]of Object.entries(r)){this._blockInstance?.add(oe(o),n,!0);for(let a of this._callbacks)a()}})})}onLocaleChange(e){let t=M(e,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(e,t,r){e.$[t]=r(),this._boundBlocks.has(e)||this._boundBlocks.set(e,new Map),this._boundBlocks.get(e)?.get(t)?.();let o=this.onLocaleChange(()=>{e.$[t]=r()});this._boundBlocks.get(e)?.set(t,o)}destroyL10nBindings(e){let t=this._boundBlocks.get(e);if(t){for(let r of t.values())r();this._boundBlocks.delete(e)}}destroy(){this._callbacks.clear()}};function Wo(i,e){[...i.querySelectorAll("[l10n]")].forEach(t=>{let r=t.getAttribute("l10n");if(!r)return;let o=r.split(";");for(let n of o)n&&sl(t,n,e)})}s(Wo,"l10nProcessor");var sl=s((i,e,t)=>{let r="textContent",o=!1;if(e.includes(":")){let l=e.split(":");if(l.length!==2){console.warn(`l10n attribute value should be in format "property:key" or "key". Found: ${e}`);return}let c=l;r=c[0],e=c[1],r.startsWith("@")&&(r=r.slice(1),o=!0)}let n=e;t.has(n)&&t.sub(n,l=>{if(!l)return;t.l10nProcessorSubs.has(n)||t.l10nProcessorSubs.set(n,new Set);let c=t.l10nProcessorSubs.get(n);c?.forEach(p=>{p.remove(),c.delete(p),t.allSubs.delete(p)});let u=oe(l).replace("*","");t.nodeCtx.has(u)||t.nodeCtx.add(u,l);let d=t.nodeCtx.sub(u,()=>{i[r]=t.l10n(l)});c?.add(d),t.allSubs.add(d),i.removeAttribute("l10n")});let a=oe(e);t.has(a)||t.add(a,""),t.sub(a,()=>{o?i.setAttribute(r,t.l10n(e)):i[r]=t.l10n(e)}),i.removeAttribute("l10n")},"locale");var nl={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function At(i,e){e.tabIndex=0,e.focus(),i.tabIndex=-1}s(At,"focus");function Sr(i){let e=i.role||i.type||i.tagName;if(!e)return null;let t=nl[e.toLowerCase()];if(!t)return null;for(let r of t){let o=i.closest(`[role=${r}]`);if(o)return o}}s(Sr,"findGroupNodeByEventTarget");function Ir(i,e){return e.role==="toolbar"?al(e):e.querySelectorAll(`[role=${i.role}]`)}s(Ir,"getItems");function al(i){return[...i.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}s(al,"getToolbarItems");function ll(i){let e=i.getAttribute("aria-orientation");if(e==="vertical")return!1;if(e==="horizontal")return!0;let t=i.role;return t==="menubar"||t==="tablist"||t==="toolbar"}s(ll,"isHorizontalOrientation");function qo(i){return e=>{let t=!1,r=i?.searchDelayMs||300,o=0,n="";function a(p){let h=Sr(p.target);if(!h){l();return}let f=Ir(p.target,h),m=Array.from(f).indexOf(p.target),v="ArrowDown",y="ArrowUp";if(ll(h)&&(e.document.dir==="rtl"?(v="ArrowLeft",y="ArrowRight"):(v="ArrowRight",y="ArrowLeft")),p.key===v)p.preventDefault(),At(p.target,f[m+1]||f[0]);else if(p.key===y)p.preventDefault(),At(p.target,f[m-1]||f[f.length-1]);else if(p.key==="Home")p.preventDefault(),At(p.target,f[0]);else if(p.key==="End")p.preventDefault(),At(p.target,f[f.length-1]);else if(p.key.length===1&&h.role!=="tablist"){let S=Date.now();S-o<=r?n+=p.key.toLowerCase():n=p.key.toLowerCase(),o=S;let x=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(n));x&&(p.preventDefault(),At(p.target,x))}}s(a,"keyDown");function l(){t=!1,e.removeEventListener("keydown",a)}s(l,"stop");function c(p){let h=Sr(p.target);if(h){t||(t=!0,e.addEventListener("keydown",a));let f=Ir(p.target,h);for(let m of f)m!==p.target&&m.setAttribute("tabindex",-1)}else t&&l()}s(c,"focusIn");function u(p){(!p.relatedTarget||p.relatedTarget===e.document)&&l()}s(u,"focusOut");function d(p){let h=Sr(p.target);if(h){let f=Ir(p.target,h);for(let m of f)m!==p.target&&m.setAttribute("tabindex",-1);p.target.setAttribute("tabindex",0)}}return s(d,"click"),e.addEventListener("click",d),e.addEventListener("focusin",c),e.addEventListener("focusout",u),()=>{l(),e.removeEventListener("click",d),e.removeEventListener("focusin",c),e.removeEventListener("focusout",u)}}}s(qo,"focusGroupKeyUX");function Xo(){return i=>{let e,t;function r(n){if(n.target.getAttribute("aria-hidden")==="true"){e=n.target,e.setAttribute("aria-hidden","false"),t=e.hidden,t&&(e.hidden=!1);let a=n.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0)}}s(r,"jump");function o(n){e&&e.contains(n.target)&&(!n.relatedTarget||!e.contains(n.relatedTarget))&&(n.target.tabIndex=-1,e.setAttribute("aria-hidden","true"),t&&(e.hidden=!0),e=null)}return s(o,"focusOut"),i.addEventListener("keyuxJump",r),i.addEventListener("focusout",o),()=>{i.removeEventListener("keyuxJump",r),i.removeEventListener("focusout",o)}}}s(Xo,"hiddenKeyUX");function Zo(){return i=>{let e=[];function t(c){let u=i.document.activeElement;u&&u!==i.document.body&&e.push(new WeakRef(u)),c.focus({focusVisible:!0})}s(t,"focus");function r(){let c=e.pop();if(!c){i.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():r()}s(r,"back");let o=0,n;function a(c){clearInterval(n);let u=c.getAttribute("aria-controls");n=setInterval(()=>{if(o++>50){clearInterval(n);return}let d=i.document.getElementById(u);if(d){let p=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');p&&(clearInterval(n),d.dispatchEvent(new i.CustomEvent("keyuxJump",{bubbles:!0})),t(p))}},50)}s(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&r()}return s(l,"keyDown"),i.addEventListener("keydown",l),()=>{i.removeEventListener("keydown",l)}}}s(Zo,"jumpKeyUX");function Yo(i){let e,t=i.split(" "),r;function o(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(n(),l.target.classList.add(...t),e=l.target,r=l.target)}s(o,"keyDown");function n(){e&&e.classList.remove(...t),r=null}s(n,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&r!==l.target&&(n(),l.target.classList.add(...t),e=l.target)}return s(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",o),l.addEventListener("keyup",n),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",o),l.removeEventListener("keyup",n)})}s(Yo,"pressKeyUX");function Qo(i,e){let t=e.map(r=>r(i));return()=>{t.forEach(r=>r())}}s(Qo,"startKeyUX");var kr=class{static{s(this,"ScopedMinimalWindow")}_listeners=new Map;_scope=[];addEventListener(e,t){let r=s(o=>{let n=o.target;n instanceof Node&&this._scope.some(a=>a===n||a.contains(n))&&t(o)},"wrappedListener");this._listeners.set(t,r),window.addEventListener(e,r)}removeEventListener(e,t){let r=this._listeners.get(t);r&&window.removeEventListener(e,r),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(e){this._scope.push(e)}destroy(){this._scope=[];for(let e of this._listeners.values())window.removeEventListener("keydown",e),window.removeEventListener("keyup",e);this._listeners.clear()}},bi=class{static{s(this,"A11y")}_destroyKeyUX;_scopedWindow;constructor(){this._scopedWindow=new kr,this._destroyKeyUX=Qo(this._scopedWindow,[qo(),Yo("is-pressed"),Zo(),Xo()])}registerBlock(e){this._scopedWindow.registerScope(e)}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy()}};var U=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),_i=class{static{s(this,"ModalManager")}_modals=new Map;_activeModals=new Set;_subscribers=new Map;_block;constructor(e){this._block=e}_debugPrint(...e){this._block.debugPrint("[modal-manager]",...e)}registerModal(e,t){this._modals.set(e,t),this._notify(U.ADD,{id:e,modal:t})}deleteModal(e){if(!this._modals.has(e))return!1;let t=this._modals.get(e);return this._modals.delete(e),this._activeModals.delete(e),this._notify(U.DELETE,{id:e,modal:t}),!0}open(e){if(!this._modals.has(e))return this._debugPrint(`Modal with ID "${e}" not found`),!1;let t=this._modals.get(e);return this._activeModals.add(e),this._notify(U.OPEN,{modal:t,id:e}),!0}close(e){if(!this._modals.has(e)||!this._activeModals.has(e))return this._debugPrint(`Modal with ID "${e}" not found or not active`),!1;let t=this._modals.get(e);return this._activeModals.delete(e),this._notify(U.CLOSE,{id:e,modal:t}),!0}toggle(e){return this._modals.has(e)?this._activeModals.has(e)?this.close(e):this.open(e):(this._debugPrint(`Modal with ID "${e}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),!1;let e=Array.from(this._activeModals).pop();return e?this.close(e):!1}closeAll(){let e=this._activeModals.size;return this._activeModals.clear(),this._notify(U.CLOSE_ALL,{}),e}subscribe(e,t){return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.delete(t)}_notify(e,t){if(this._subscribers.has(e))for(let r of this._subscribers.get(e)??new Set)try{r(t)}catch(o){this._block.telemetryManager.sendEventError(o,"modal subscriber"),this._debugPrint("Error in modal subscriber:",o)}}destroy(){this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(U.DESTROY,{})}};function cl(i){return i.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`).replace(/__/g,"_")}s(cl,"i");function Mr(i){return Array.isArray(i)?i.map(e=>typeof e=="object"&&e!==null?Mr(e):e):typeof i!="object"||i===null?i:Object.fromEntries(Object.entries(i).map(([e,t])=>{let r=cl(e);return typeof t=="object"&&t!==null?[r,Mr(t)]:[r,t]}))}s(Mr,"c");function ul(i){return{ok:!0,value:i}}s(ul,"u");function Or(i){return{ok:!1,error:i}}s(Or,"a");var dl="https://tlm.uploadcare.com/api/",Lr=class{static{s(this,"y")}constructor(e=dl){this.baseUrl=e}async base(e,t={}){let r=`${this.baseUrl}${e}`;try{let o=await fetch(r,t);if(!o.ok)return Or(new Error(`Got non-200 response from "${r}". Status: ${o.status.toString()}`));try{let n=await o.json();return ul(n)}catch(n){return Or(new Error(`Error parsing JSON from "${r}". Error: ${n}`))}}catch(o){return Or(new Error(`Error fetching data from "${r}". Error: ${o}`))}}async post(e,t,r={}){return await this.base(e,{...r,method:"POST",body:JSON.stringify(Mr(t)),headers:{"Content-Type":"application/json",...r.headers||{}}})}async get(e,t={}){return await this.base(e,{method:"GET",...t})}},pl=s(async(i,e)=>({success:!0,data:e}),"f"),wi=class extends Lr{static{s(this,"p")}constructor(){super()}async sendEvent(e,t){let r=await pl(void 0,e);if(!r.success)throw console.error("TelemetryAPIService: events: body is invalid",r.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",e,t)}};var Jo="1.24.0-alpha.0";var Te="blocks",xe=Jo;var Ci=class{static{s(this,"TelemetryManager")}_sessionId=crypto.randomUUID();_telemetryInstance;_block;_config=structuredClone(Y);_initialized=!1;_lastPayload=null;_queue;constructor(e){this._block=e,this._telemetryInstance=new wi,this._queue=new Oe(10);for(let t of Object.keys(this._config))this._block.subConfigValue(t,r=>{this._initialized&&this._config[t]!==r&&this._block.emit(_.CHANGE_CONFIG,void 0),this._setConfig(t,r)})}_init(e){e===_.INIT_SOLUTION&&!this._initialized&&(this._initialized=!0)}_setConfig(e,t){this._config[e]!==t&&(this._config[e]=t)}_formattingPayload(e){let t=e.payload?{...e.payload}:{};t.activity&&(t.activity=void 0);let r={...e};return(e.eventType===_.INIT_SOLUTION||e.eventType===_.CHANGE_CONFIG)&&(r.config=this._config),{...r,appVersion:xe,appName:Te,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this._timestamp,payload:{...t}}}_excludedEvents(e){return!!(e&&[_.CHANGE,_.COMMON_UPLOAD_PROGRESS,_.FILE_ADDED,_.FILE_REMOVED,_.FILE_UPLOAD_START,_.FILE_UPLOAD_PROGRESS,_.FILE_UPLOAD_SUCCESS,_.FILE_UPLOAD_FAILED,_.FILE_URL_CHANGED,_.GROUP_CREATED].includes(e))}sendEvent(e){let t=this._formattingPayload({eventType:e.eventType,payload:e.payload,config:e.config});this._init(e.eventType),!(this._excludedEvents(e.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,t))&&this._queue.add(async()=>{this._lastPayload=t,await this._telemetryInstance.sendEvent(t)})}sendEventError(e,t="unknown"){this.sendEvent({payload:{metadata:{event:"error",text:`Error in ${t}`,error:e.message}}})}sendEventCloudImageEditor(e,t,r={}){this.sendEvent({payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...r}}})}_checkObj(e,t){if(JSON.stringify(e)===JSON.stringify(t))return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let n of r)if(!Object.hasOwn(t,n)||!this._checkObj(e[n],t[n]))return!1;return!0}get _timestamp(){return Date.now()}get _solution(){if(!this._block.has("*solution"))return null;let e=this._block.$["*solution"];return e?e.toLowerCase():null}get _activity(){return this._block.has("*currentActivity")?this._block.$["*currentActivity"]??null:null}};var j=s(i=>`*cfg/${i}`,"sharedConfigKey");function es(i,e){let t=i.querySelectorAll("[data-testid]");if(t.length===0)return;let r=new WeakMap;for(let o of t){let n=o.getAttribute("data-testid");n&&r.set(o,n)}e.subConfigValue("testMode",o=>{if(!o){for(let a of t)a.removeAttribute("data-testid");return}let n=e.testId;for(let a of t){let l=r.get(a);l&&a.setAttribute("data-testid",`${n}--${l}`)}})}s(es,"testModeProcessor");var ml="uc-",b=class extends ge{static{s(this,"Block")}__cfgProxy;l10nProcessorSubs=new Map;static StateConsumerScope=null;static styleAttrs=[];requireCtxName=!1;activityType=null;init$=Cr();l10n(e,t={}){if(!e)return"";let r=this.$[oe(e)]||e,o=Io(r);for(let a of o)t[a.variable]=this.pluralize(a.pluralKey,Number(t[a.countVariable]));return Et(r,t)}pluralize(e,t){let r=this.l10n("locale-id")||"en",o=ui(r,t);return this.l10n(`${e}__${o}`)}bindL10n(e,t){this.localeManager?.bindL10n(this,e,t)}constructor(){super(),this.addTemplateProcessor(Wo),this.addTemplateProcessor(es)}emit(e,t,r){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;o&&(o.emit(e,t,r),this.telemetryManager.sendEvent({eventType:e,payload:typeof t=="function"?t():t}))}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return!0;return!1}setOrAddState(e,t){this.add$({[e]:t},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Oo({element:this,attribute:"ctx-name",onSuccess:s(()=>{super.connectedCallback()},"onSuccess"),onTimeout:s(()=>{console.error("Attribute `ctx-name` is required and it is not set.")},"onTimeout")}):super.connectedCallback(),Tt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Tt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new si(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new yi(this)),this.cfg.qualityInsights&&!this.has("*telemetryManager")&&this.add("*telemetryManager",new Ci(this)),this.has("*a11y")||this.add("*a11y",new bi),this.has("*modalManager")||this.add("*modalManager",new _i(this)),this.sub(oe("locale-id"),t=>{let r=xo(t);this.style.direction=r==="ltr"?"":r}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId)})}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.has("*modalManager")&&this.$["*modalManager"]}get telemetryManager(){return this.cfg.qualityInsights?this.has("*telemetryManager")&&this.$["*telemetryManager"]:{sendEvent:s(()=>{},"sendEvent"),sendEventCloudImageEditor:s(()=>{},"sendEventCloudImageEditor"),sendEventError:s(()=>{},"sendEventError")}}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){super.destroyCallback();let e=this.blocksRegistry;e?.delete(this),this.localeManager?.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),e?.size===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){T.deleteCtx(this.ctxName),this.localeManager?.destroy(),this.modalManager&&this.modalManager?.destroy()}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:li(e),cdnUrlModifiers:nr(e),fileName:ai(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),this.telemetryManager.sendEventError(t,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?Et(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:s(t=>window.encodeURIComponent(t),"transform")}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:s((t,r,o)=>{if(typeof r!="string")return!1;let n=j(r);return this.has(n)||this.add(n,Y[r]),this.$[n]=o,!0},"set"),get:s((t,r)=>{let o=j(r);return this.has(o)||this.add(o,Y[r]),this.$[j(r)]},"get")})}return this.__cfgProxy}subConfigValue(e,t){let r=j(e);this.has(r)||this.add(r,Y[e]),this.sub(r,t)}debugPrint(...e){if(!this.cfg.debug)return;let t=e;if(typeof e?.[0]=="function"){let r=e[0];t=r()}console.log(`[${this.ctxName}]`,...t)}static reg(e){if(!e){super.reg();return}e.startsWith(ml)&&super.reg(e)}};var ts="active",Xe="___ACTIVITY_IS_ACTIVE___",g=class i extends b{static{s(this,"ActivityBlock")}historyTracked=!1;[Xe];init$=Er(this);_debouncedHistoryFlush=M(this._historyFlush.bind(this),10);_deactivate(){let e=i._activityCallbacks.get(this);this[Xe]=!1,this.removeAttribute(ts),e?.deactivateCallback?.()}_activate(){let e=i._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Xe]=!0,this.setAttribute(ts,""),e?.activateCallback?.(),this._debouncedHistoryFlush(),this.emit(_.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{try{this.activityType!==e&&this[Xe]?this._deactivate():this.activityType===e&&!this[Xe]&&this._activate()}catch(t){this.telemetryManager.sendEventError(t,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,t),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null}e||(this.$["*history"]=[])}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&i._activityCallbacks.has(this)}static _activityCallbacks=new Map;static activities;get isActivityActive(){return!!this[Xe]}get couldOpenActivity(){return!0}registerActivity(e,t={}){let{onActivate:r,onDeactivate:o}=t;i._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),i._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof i&&r.activityType===e)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll())}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 e=this.$["*history"];if(e){let t=e.pop();for(;t===this.activityType;)t=e.pop();let r=!!t;t&&(r=[...this.blocksRegistry].find(n=>n.activityType===t)?.couldOpenActivity??!1),t=r?t:void 0,t&&this.modalManager?.open(t),this.$["*currentActivity"]=t,this.$["*history"]=e,t||this.modalManager?.closeAll()}}};g.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});function Ei(i){for(let e in i){let t=[...e].reduce((r,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),r+=o,r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),i[e].reg&&i[e].reg(t)}}s(Ei,"defineComponents");var Rr="UC";function is(i,e=!1){return new Promise((t,r)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Rr]){t(window[Rr]);return}let o=document.createElement("script");o.async=!0,o.src=i,o.onerror=()=>{r()},o.onload=()=>{let n=window[Rr];e&&Ei(n),t(n)},document.head.appendChild(o)})}s(is,"loadFileUploaderFrom");var rs="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var ae=class extends b{static{s(this,"SolutionBlock")}static styleAttrs=["uc-wgt-common"];requireCtxName=!0;init$=jo(this);static _template="";initCallback(){super.initCallback(),this.a11y?.registerBlock(this)}static set template(e){this._template=`${rs+e}<slot></slot>`}static get template(){return this._template}};var St=33.333333333333336,w=1,Pr=24,os=6;function Re(i,e){for(let[t,r]of Object.entries(e))i.setAttributeNS(null,t,r.toString())}s(Re,"setSvgNodeAttrs");function K(i,e={}){let t=document.createElementNS("http://www.w3.org/2000/svg",i);return Re(t,e),t}s(K,"createSvgNode");function ss(i,e,t){let{x:r,y:o,width:n,height:a}=i,l=e.includes("w")?0:1,c=e.includes("n")?0:1,u=l===0?-1:1,d=c===0?-1:1,p=[r+l*n+1.5*u,o+c*a+1.5*d-24*t*d],h=[r+l*n+1.5*u,o+c*a+1.5*d],f=[r+l*n-24*t*u+1.5*u,o+c*a+1.5*d],m=`M ${p[0]} ${p[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,v=[h[0],h[1]];return{d:m,center:v}}s(ss,"cornerPath");function ns(i,e,t){let{x:r,y:o,width:n,height:a}=i,l=e==="n"||e==="s",c=e==="w"||e==="e",u=l?.5:e==="w"?0:1,d=c?.5:e==="n"?0:1,p=e==="w"?-1:e==="e"?1:0,h=e==="n"?-1:e==="s"?1:0,f,m;l?(f=[r+u*n-34*t/2,o+d*a+1.5*h],m=[r+u*n+34*t/2,o+d*a+1.5*h]):(f=[r+u*n+1.5*p,o+d*a-34*t/2],m=[r+u*n+1.5*p,o+d*a+34*t/2]);let v=`M ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,y=[(f[0]+m[0])/2,(f[1]+m[1])/2];return{d:v,center:y}}s(ns,"sidePath");function as(i){return i===""?"move":["e","w"].includes(i)?"ew-resize":["n","s"].includes(i)?"ns-resize":["nw","se"].includes(i)?"nwse-resize":"nesw-resize"}s(as,"thumbCursor");function ls({rect:i,delta:[e,t],imageBox:r}){return Ye({...i,x:i.x+e,y:i.y+t},r)}s(ls,"moveRect");function Ye(i,e){let{x:t}=i,{y:r}=i;return i.x<e.x?t=e.x:i.x+i.width>e.x+e.width&&(t=e.x+e.width-i.width),i.y<e.y?r=e.y:i.y+i.height>e.y+e.height&&(r=e.y+e.height-i.height),{...i,x:t,y:r}}s(Ye,"constraintRect");function fl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[,o]=e,{y:n,width:a,height:l}=i;n+=o,l-=o,t&&(a=l*t);let c=i.x+i.width/2-a/2;return n<=r.y&&(n=r.y,l=i.y+i.height-n,t&&(a=l*t,c=i.x+i.width/2-a/2)),c<=r.x&&(c=r.x,n=i.y+i.height-l),c+a>=r.x+r.width&&(c=Math.max(r.x,r.x+r.width-a),a=r.x+r.width-c,t&&(l=a/t),n=i.y+i.height-l),l<w&&(l=w,t&&(a=l*t,c=i.x+i.width/2-a/2),n=i.y+i.height-l),a<w&&(a=w,t&&(l=a/t,c=i.x+i.width/2-a/2),n=i.y+i.height-l),{x:c,y:n,width:a,height:l}}s(fl,"resizeNorth");function gl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o]=e,{x:n,width:a,height:l}=i;n+=o,a-=o,t&&(l=a/t);let c=i.y+i.height/2-l/2;return n<=r.x&&(n=r.x,a=i.x+i.width-n,t&&(l=a/t,c=i.y+i.height/2-l/2)),c<=r.y&&(c=r.y,n=i.x+i.width-a),c+l>=r.y+r.height&&(c=Math.max(r.y,r.y+r.height-l),l=r.y+r.height-c,t&&(a=l*t),n=i.x+i.width-a),l<w&&(l=w,t&&(a=l*t),c=i.y+i.height/2-l/2,n=i.x+i.width-a),a<w&&(a=w,t&&(l=a/t),c=i.y+i.height/2-l/2,n=i.x+i.width-a),{x:n,y:c,width:a,height:l}}s(gl,"resizeWest");function vl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[,o]=e,{y:n,width:a,height:l}=i;l+=o,t&&(a=l*t);let c=i.x+i.width/2-a/2;return n+l>=r.y+r.height&&(l=r.y+r.height-n,t&&(a=l*t),c=i.x+i.width/2-a/2),c<=r.x&&(c=r.x,n=i.y),c+a>=r.x+r.width&&(c=Math.max(r.x,r.x+r.width-a),a=r.x+r.width-c,t&&(l=a/t),n=i.y),l<w&&(l=w,t&&(a=l*t),c=i.x+i.width/2-a/2),a<w&&(a=w,t&&(l=a/t),c=i.x+i.width/2-a/2),{x:c,y:n,width:a,height:l}}s(vl,"resizeSouth");function yl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o]=e,{x:n,width:a,height:l}=i;a+=o,t&&(l=a/t);let c=i.y+i.height/2-l/2;return n+a>=r.x+r.width&&(a=r.x+r.width-n,t&&(l=a/t),c=i.y+i.height/2-l/2),c<=r.y&&(c=r.y,n=i.x),c+l>=r.y+r.height&&(c=Math.max(r.y,r.y+r.height-l),l=r.y+r.height-c,t&&(a=l*t),n=i.x),l<w&&(l=w,t&&(a=l*t),c=i.y+i.height/2-l/2),a<w&&(a=w,t&&(l=a/t),c=i.y+i.height/2-l/2),{x:n,y:c,width:a,height:l}}s(yl,"resizeEast");function bl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o,n]=e,{x:a,y:l,width:c,height:u}=i;return a+o<r.x&&(o=r.x-a),l+n<r.y&&(n=r.y-l),a+=o,c-=o,l+=n,u-=n,t&&Math.abs(c/u)>t?(n=c/t-u,u+=n,l-=n,l<=r.y&&(u=u-(r.y-l),c=u*t,a=i.x+i.width-c,l=r.y)):t&&(o=u*t-c,c=c+o,a-=o,a<=r.x&&(c=c-(r.x-a),u=c/t,a=r.x,l=i.y+i.height-u)),u<w&&(u=w,t&&(c=u*t),a=i.x+i.width-c,l=i.y+i.height-u),c<w&&(c=w,t&&(u=c/t),a=i.x+i.width-c,l=i.y+i.height-u),{x:a,y:l,width:c,height:u}}s(bl,"resizeNorthWest");function _l({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o,n]=e,{x:a,y:l,width:c,height:u}=i;return a+c+o>r.x+r.width&&(o=r.x+r.width-a-c),l+n<r.y&&(n=r.y-l),c+=o,l+=n,u-=n,t&&Math.abs(c/u)>t?(n=c/t-u,u+=n,l-=n,l<=r.y&&(u=u-(r.y-l),c=u*t,a=i.x,l=r.y)):t&&(o=u*t-c,c+=o,a+c>=r.x+r.width&&(c=r.x+r.width-a,u=c/t,a=r.x+r.width-c,l=i.y+i.height-u)),u<w&&(u=w,t&&(c=u*t),l=i.y+i.height-u),c<w&&(c=w,t&&(u=c/t),l=i.y+i.height-u),{x:a,y:l,width:c,height:u}}s(_l,"resizeNorthEast");function wl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o,n]=e,{x:a,y:l,width:c,height:u}=i;return a+o<r.x&&(o=r.x-a),l+u+n>r.y+r.height&&(n=r.y+r.height-l-u),a+=o,c-=o,u+=n,t&&Math.abs(c/u)>t?(n=c/t-u,u+=n,l+u>=r.y+r.height&&(u=r.y+r.height-l,c=u*t,a=i.x+i.width-c,l=r.y+r.height-u)):t&&(o=u*t-c,c+=o,a-=o,a<=r.x&&(c=c-(r.x-a),u=c/t,a=r.x,l=i.y)),u<w&&(u=w,t&&(c=u*t),a=i.x+i.width-c),c<w&&(c=w,t&&(u=c/t),a=i.x+i.width-c),{x:a,y:l,width:c,height:u}}s(wl,"resizeSouthWest");function Cl({rect:i,delta:e,aspectRatio:t,imageBox:r}){let[o,n]=e,{x:a,y:l,width:c,height:u}=i;return a+c+o>r.x+r.width&&(o=r.x+r.width-a-c),l+u+n>r.y+r.height&&(n=r.y+r.height-l-u),c+=o,u+=n,t&&Math.abs(c/u)>t?(n=c/t-u,u+=n,l+u>=r.y+r.height&&(u=r.y+r.height-l,c=u*t,a=i.x,l=r.y+r.height-u)):t&&(o=u*t-c,c+=o,a+c>=r.x+r.width&&(c=r.x+r.width-a,u=c/t,a=r.x+r.width-c,l=i.y)),u<w&&(u=w,t&&(c=u*t)),c<w&&(c=w,t&&(u=c/t)),{x:a,y:l,width:c,height:u}}s(Cl,"resizeSouthEast");function cs({direction:i,...e}){switch(i){case"n":return fl(e);case"w":return gl(e);case"s":return vl(e);case"e":return yl(e);case"nw":return bl(e);case"ne":return _l(e);case"sw":return wl(e);case"se":return Cl(e);default:return e.rect}}s(cs,"resizeRect");function us(i,[e,t]){return i.x<=e&&e<=i.x+i.width&&i.y<=t&&t<=i.y+i.height}s(us,"rectContainsPoint");function ds(i,e){return i.x>=e.x&&i.y>=e.y&&i.x+i.width<=e.x+e.width&&i.y+i.height<=e.y+e.height}s(ds,"isRectInsideRect");function ps(i,e){return Math.abs(i.width/i.height-e)<.1}s(ps,"isRectMatchesAspectRatio");function Qe({width:i,height:e},t){let r=t/90%2!==0;return{width:r?e:i,height:r?i:e}}s(Qe,"rotateSize");function hs(i,e,t){let r=i/e,o,n;r>t?(o=Math.round(e*t),n=e):(o=i,n=Math.round(i/t));let a=Math.round((i-o)/2),l=Math.round((e-n)/2);return a+o>i&&(o=i-a),l+n>e&&(n=e-l),{x:a,y:l,width:o,height:n}}s(hs,"calculateMaxCenteredCropFrame");function Je(i){return{x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)}}s(Je,"roundRect");function Pe(i,e,t){return Math.min(Math.max(i,e),t)}s(Pe,"clamp");var It=["free"],xi=s(i=>{let e=D(i);if(!e||e.length===0)return[];let t=[];for(let r of e){let o=r.trim();if(!o)continue;let n=o.indexOf(":");if(n===-1&&!It.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let a=Number(o.slice(0,n)),l=Number(o.slice(n+1));if((!Number.isFinite(a)||!Number.isFinite(l)||a<=0||l<=0)&&!It.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:fe.generate(),type:"aspect-ratio",width:It.includes(o)?0:a,height:It.includes(o)?0:l,hasFreeform:It.includes(o)})}return t},"parseCropPreset"),ms=s((i,e,t,r=.1)=>{let o=i/e,n=null,a=1/0;for(let l of t){let[c,u]=[l.width,l.height],d=c/u,p=Math.abs(o-d);p<a&&(a=p,n=l)}if(n){let[l,c]=[n.width,n.height],u=l/c;if(Math.abs(o-u)/u>r)return null}return n},"getClosestAspectRatio");var se=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Ur=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),P=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Ur,...se});function fs(i){return gr({...i,libraryName:Te,libraryVersion:xe})}s(fs,"customUserAgent");var gs=s(i=>typeof i!="number"?0:Math.floor(i/1e3),"msToUnixTimestamp"),vs=s((i,{threshold:e})=>{let{secureExpire:t}=i,r=gs(Date.now()),o=Number(t),n=gs(e);return r+n>=o},"isSecureTokenExpired");var Ai=class{static{s(this,"SecureUploadsManager")}_block;_secureToken=null;constructor(e){this._block=e}_debugPrint(...e){this._block.debugPrint("[secure-uploads]",...e)}async getSecureToken(){let{secureSignature:e,secureExpire:t,secureUploadsSignatureResolver:r}=this._block.cfg;if((e||t)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this._secureToken||vs(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let o=await r();o?!o.secureSignature||!o.secureExpire?console.error("Secure signature resolver returned an invalid result:",o):(this._debugPrint("Secure signature resolved:",o),this._debugPrint("Secure signature will expire in",new Date(Number(o.secureExpire)*1e3).toISOString()),this._secureToken=o):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(o){console.error("Secure signature resolving failed. Falling back to the previous one.",o),this._block.telemetryManager.sendEventError(o,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.")}}return this._secureToken}return e&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:e,secureExpire:t}),{secureSignature:e,secureExpire:t}):null}};var $r=s((i,e)=>{if(i.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:e.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Dr=s((i,e)=>{let t=i.totalCount,r=e.cfg.multiple?e.cfg.multipleMin:0,o=e.cfg.multiple?e.cfg.multipleMax:1;if(r&&t<r)return{type:"TOO_FEW_FILES",message:e.l10n("files-count-limit-error-too-few",{min:r,max:o,total:t}),payload:{total:t,min:r,max:o}};if(o&&t>o)return{type:"TOO_MANY_FILES",message:e.l10n("files-count-limit-error-too-many",{min:r,max:o,total:t}),payload:{total:t,min:r,max:o}}},"validateMultiple");var El=s(()=>{let i=navigator.userAgent;return/Macintosh|Windows/.test(i)&&/Version\/[\d.]+.*Safari/.test(i)&&!/Chrome|Chromium|Edg|OPR/.test(i)},"calcIsDesktopSafari"),Tl=s(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),xl=s(()=>({safariDesktop:El()}),"calcBrowserInfo"),Al=s(()=>({htmlMediaCapture:Tl()}),"calcBrowserFeatures"),ys=xl(),Ve=Al();var kt="image/*",Fr="video/*",Sl=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Il=s(()=>ys.safariDesktop?[kt]:[kt,...Sl],"calcImageAcceptList"),Ot=Il(),Si=s(i=>i?i.filter(e=>typeof e=="string").flatMap(e=>D(e)):[],"mergeFileTypes"),Vr=s((i,e)=>e.some(t=>{if(t.endsWith("*")){let r=t.replace("*","");return i.startsWith(r)}return i===t}),"matchMimeType"),bs=s((i,e)=>e.some(t=>t.startsWith(".")?i.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),_s=s(i=>{let e=i?.type;return e?Vr(e,Ot):!1},"fileIsImage");var Nr=s((i,e)=>{let t=e.cfg.imgOnly,r=e.cfg.accept,o=Si([...t?Ot:[],r]);if(!o.length)return;let n=i.mimeType,a=i.name;if(!n||!a)return;let l=Vr(n,o),c=bs(a,o);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:e.l10n("file-type-not-allowed"),payload:{entry:i}}},"validateFileType");var Br=s((i,e)=>{let t=e.cfg.imgOnly,r=i.isImage;if(!(!t||r)&&!(!i.fileInfo&&i.externalUrl)&&!(!i.fileInfo&&!i.mimeType))return{type:"NOT_AN_IMAGE",message:e.l10n("images-only-accepted"),payload:{entry:i}}},"validateIsImage");var ce=1e3,Ne=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Mt=s(i=>Math.ceil(i*100)/100,"round"),ws=s((i,e=Ne.AUTO)=>{let t=e===Ne.AUTO;if(e===Ne.BYTE||t&&i<ce**1){let o=ui("en-US",i)==="one"?"byte":"bytes";return`${i} ${o}`}return e===Ne.KB||t&&i<ce**2?`${Mt(i/ce**1)} KB`:e===Ne.MB||t&&i<ce**3?`${Mt(i/ce**2)} MB`:e===Ne.GB||t&&i<ce**4?`${Mt(i/ce**3)} GB`:e===Ne.TB||t&&i<ce**5?`${Mt(i/ce**4)} TB`:`${Mt(i/ce**5)} PB`},"prettyBytes");var zr=s((i,e)=>{let t=e.cfg.maxLocalFileSizeBytes,r=i.size;if(t&&r&&r>t)return{type:"FILE_SIZE_EXCEEDED",message:e.l10n("files-max-size-limit-error",{maxFileSize:ws(t)}),payload:{entry:i}}},"validateMaxSizeLimit");var Hr=s((i,e)=>{let{internalId:t}=i,o=e._uploadCollection.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof H)return{type:"UPLOAD_ERROR",message:o.message,payload:{entry:i,error:o}};if(o instanceof We)return{type:"NETWORK_ERROR",message:o.message,payload:{entry:i,error:o}};let n=o instanceof Error?o:new Error("Unknown error",{cause:o});return{type:"UNKNOWN_ERROR",message:n.message,payload:{entry:i,error:n}}},"validateUploadError");var Cs=s(()=>{let i=s(()=>{},"resolveFn"),e=s(()=>{},"rejectFn");return{promise:new Promise((r,o)=>{i=r,e=o}),resolve:i,reject:e}},"withResolvers");var et={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},kl=s(i=>typeof i=="function"?{runOn:"change",validator:i}:i,"getValidatorDescriptor"),Ii=class{static{s(this,"ValidationManager")}_blockInstance;_uploadCollection;_commonFileValidators=[Br,Nr,zr,Hr];_commonCollectionValidators=[Dr,$r];_queue=new Oe(20);_runQueueDebounced=M(()=>{this._queue.run()},500);_entryValidationState=new Map;constructor(e){this._blockInstance=e,this._uploadCollection=this._blockInstance.uploadCollection;let t=s(()=>{this.runFileValidators("change"),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t),this._blockInstance.subConfigValue("validationConcurrency",r=>{this._queue.concurrency=r})}runFileValidators(e,t){let r=t??this._uploadCollection.items();for(let o of r){let n=this._uploadCollection.read(o);n&&this._runFileValidatorsForEntry(n,e)}}runCollectionValidators(){let e=this._blockInstance.api.getOutputCollectionState(),t=[];for(let r of[...this._commonCollectionValidators,...this._blockInstance.cfg.collectionValidators])try{let o=r(e,this._blockInstance.api);if(!o)continue;o&&(t.push(this._addCustomTypeToValidationError(o)),o.message||console.warn(et.MISSING_ERROR_MESSAGE))}catch(o){console.warn(et.COLLECTION_VALIDATION_FAILED,o)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit(_.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}cleanupValidationForEntry(e){let t=this._entryValidationState.get(e.uid);t&&(t.abortController?.abort(),this._entryValidationState.delete(e.uid))}async _runFileValidatorsForEntry(e,t){let r=this._getValidatorDescriptorsForEntry(e,t);if(r.length===0)return;e.setMultipleValues({isQueuedForValidation:!0,isValidationPending:!0});let o=this._blockInstance.api.getOutputItem(e.uid),n=this._getEntryValidationState(e);n.promise&&await n.promise;let{promise:a,resolve:l}=Cs();n.promise=a;let c=new AbortController;n.abortController=c;let u=this._blockInstance.cfg.validationTimeout,d=this._getValidatorDescriptors(),p=new Set(r.map(m=>m.validator)),h=[];for(let m of d)if(!p.has(m.validator)){let v=n.lastErrorThrownByValidator.get(m.validator);v&&h.push(v)}let f=r.map(m=>async()=>{if(!this._blockInstance.isConnected)return;let v=setTimeout(()=>{n.skippedValidators.add(m.validator),c.abort(),console.warn(et.FILE_VALIDATION_TIMEOUT)},u);try{let y=await m.validator(o,this._blockInstance.api,{signal:c.signal});if(!y||c.signal.aborted){n.lastErrorThrownByValidator.set(m.validator,void 0);return}let S=this._addCustomTypeToValidationError(y);n.lastErrorThrownByValidator.set(m.validator,S),h.push(S),y.message||console.warn(et.MISSING_ERROR_MESSAGE)}catch(y){c.signal.aborted||(n.skippedValidators.add(m.validator),console.warn(et.FILE_VALIDATION_FAILED,y),this._blockInstance.telemetryManager.sendEventError(y,`file validator. ${et.FILE_VALIDATION_FAILED}`))}finally{clearTimeout(v),m.runOn!=="change"&&n.skippedValidators.add(m.validator)}});if(this._runQueueDebounced(),await this._queue.add(async()=>{e.setValue("isQueuedForValidation",!1),await Promise.all(f.map(m=>m())).catch(()=>{})},{autoRun:!1}),c.signal.aborted){e.setMultipleValues({isQueuedForValidation:!1,isValidationPending:!1}),l();return}e.setMultipleValues({isValidationPending:!1,isQueuedForValidation:!1,errors:h}),l()}_addCustomTypeToValidationError(e){return{...e,type:e.type??"CUSTOM_ERROR"}}_getEntryValidationState(e){let t=this._entryValidationState.get(e.uid);if(t)return t;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this._entryValidationState.set(e.uid,r),r}_getValidatorDescriptors(){return[...this._commonFileValidators,...this._blockInstance.cfg.fileValidators].map(kl)}_getValidatorDescriptorsForEntry(e,t){let r=this._getEntryValidationState(e);return this._getValidatorDescriptors().filter(o=>!r.skippedValidators.has(o.validator)).filter(o=>o.runOn===t)}};var Es="[Typed State] Wrong property name: ",Ol="[Typed State] Wrong property type: ",ki=class{static{s(this,"TypedData")}__typedSchema;__ctxId;__schema;__data;constructor(e,t){this.__typedSchema=e,this.__ctxId=t||fe.generate(),this.__schema=Object.keys(e).reduce((r,o)=>(e[o]&&(r[o]=e[o].value),r),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(e,t){if(!Object.hasOwn(this.__typedSchema,e)||!this.__typedSchema[e]){console.warn(Es+e);return}let r=this.__typedSchema[e],o=t?.constructor===r.type,n=t instanceof r.type,a=r.nullable&&t===null;if(o||n||a){this.__data.pub(e,t);return}console.warn(Ol+e)}setMultipleValues(e){for(let[t,r]of Object.entries(e))this.setValue(t,r)}getValue(e){return Object.hasOwn(this.__typedSchema,e)||console.warn(Es+e),this.__data.read(e)}subscribe(e,t){return this.__data.sub(e,t)}remove(){T.deleteCtx(this.__ctxId)}};var Oi=class{static{s(this,"TypedCollection")}__typedSchema;__ctxId;__data;__watchList;__subsMap=Object.create(null);__propertyObservers=new Set;__collectionObservers=new Set;__items=new Set;__removed=new Set;__added=new Set;__observeTimeout;__notifyTimeout;__notifyObservers;constructor(e){this.__typedSchema=e.typedSchema,this.__ctxId=e.ctxName||fe.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=e.watchList||[];let t=Object.create(null);this.__notifyObservers=(r,o)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[r]||(t[r]=new Set),t[r].add(o),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(n=>{n({...t})}),t=Object.create(null))})},e.handler&&this.observeCollection(e.handler)}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let e=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let r of this.__collectionObservers)r?.([...this.__items],e,t)})}observeCollection(e){return this.__collectionObservers.add(e),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(e)}}unobserveCollection(e){this.__collectionObservers.delete(e)}add(e){let t=new ki(this.__typedSchema);for(let[r,o]of Object.entries(e))o!==void 0&&t.setValue(r,o);return this.__items.add(t.uid),this.notify(),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)}))}),t.uid}read(e){return this.__data.read(e)}readProp(e,t){let r=this.read(e);return r?r.getValue(t):(console.warn(`Item with id ${e} not found`),null)}publishProp(e,t,r){let o=this.read(e);if(!o){console.warn(`Item with id ${e} not found`);return}o.setValue(t,r)}remove(e){let t=this.read(e);t&&this.__removed.add(t),this.__items.delete(e),this.notify(),this.__data.pub(e,null),delete this.__subsMap[e]}clearAll(){this.__items.forEach(e=>{this.remove(e)})}observeProperties(e){return this.__propertyObservers.add(e),()=>{this.unobserveProperties(e)}}unobserveProperties(e){this.__propertyObservers.delete(e)}findItems(e){let t=[];return this.__items.forEach(r=>{let o=this.read(r);o&&e(o)&&t.push(r)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=new Set,this.__collectionObservers=new Set;for(let e in this.__subsMap)this.__subsMap[e]?.forEach(t=>{t.remove()}),delete this.__subsMap[e]}};var C=Object.freeze({PHOTO:"photo",VIDEO:"video"}),ee=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var jr=s(i=>({isVideoRecordingEnabled:q(i.cameraModes).includes(C.VIDEO),isPhotoEnabled:q(i.cameraModes).includes(C.PHOTO)}),"calcCameraModes");var Ml=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ll=new RegExp(`^/?(${Ml.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Ts=s(({url:i,cdnBase:e})=>{let t=new URL(e),r=new URL(Ct),o=new URL(i);if(t.host!==o.host&&r.host!==o.host)return null;let n=Ll.exec(o.pathname);if(!n)return null;let[,a,l,c]=n;return a?{uuid:a,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");function xs(i){let e=new Map;return s((...r)=>{let o=JSON.stringify(r);if(e.has(o))return e.get(o);let n=i(...r);return e.set(o,n),n},"memoized")}s(xs,"memoize");var As=new Set;function Mi(i){As.has(i)||(As.add(i),console.warn(i))}s(Mi,"warnOnce");function Rl(i){let e=!1;return setTimeout(()=>{e=!0},0),s(r=>((...o)=>(e&&Mi(i),r(...o))),"withAssert")}s(Rl,"createAsyncAssertWrapper");function Ss(i){let e={},t={progress:s(()=>i.$["*commonProgress"],"progress"),errors:s(()=>i.$["*collectionErrors"],"errors"),group:s(()=>i.$["*groupInfo"],"group"),totalCount:s(()=>i.uploadCollection.size,"totalCount"),failedCount:s(()=>e.failedEntries.length,"failedCount"),successCount:s(()=>e.successEntries.length,"successCount"),uploadingCount:s(()=>e.uploadingEntries.length,"uploadingCount"),status:s(()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle","status"),isSuccess:s(()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,"isSuccess"),isUploading:s(()=>e.allEntries.some(o=>o.status==="uploading"),"isUploading"),isFailed:s(()=>e.errors.length>0||e.failedEntries.length>0,"isFailed"),allEntries:s(()=>i.getOutputData(),"allEntries"),successEntries:s(()=>e.allEntries.filter(o=>o.status==="success"),"successEntries"),failedEntries:s(()=>e.allEntries.filter(o=>o.status==="failed"),"failedEntries"),uploadingEntries:s(()=>e.allEntries.filter(o=>o.status==="uploading"),"uploadingEntries"),idleEntries:s(()=>e.allEntries.filter(o=>o.status==="idle"),"idleEntries")},r=Rl("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[o,n]of Object.entries(t)){let a=o,c=xs(r(n));Object.defineProperty(e,a,{get:c,enumerable:!0})}return e}s(Ss,"buildOutputCollectionState");var Li=class{static{s(this,"UploaderPublicApi")}_ctx;constructor(e){this._ctx=e}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}addFileFromUrl=s((e,{silent:t,fileName:r,source:o}={})=>{let n=this._uploadCollection.add({externalUrl:e,fileName:r??null,silent:t??!1,source:o??P.API});return this.getOutputItem(n)},"addFileFromUrl");addFileFromUuid=s((e,{silent:t,fileName:r,source:o}={})=>{let n=this._uploadCollection.add({uuid:e,fileName:r??null,silent:t??!1,source:o??P.API});return this.getOutputItem(n)},"addFileFromUuid");addFileFromCdnUrl=s((e,{silent:t,fileName:r,source:o}={})=>{let n=Ts({url:e,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this._uploadCollection.add({uuid:n.uuid,cdnUrl:e,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:t??!1,source:o??P.API});return this.getOutputItem(a)},"addFileFromCdnUrl");addFileFromObject=s((e,{silent:t,fileName:r,source:o,fullPath:n}={})=>{let a=this._uploadCollection.add({file:e,isImage:_s(e),mimeType:e.type,fileName:r??e.name,fileSize:e.size,silent:t??!1,source:o??P.API,fullPath:n??null});return this.getOutputItem(a)},"addFileFromObject");removeFileByInternalId=s(e=>{if(!this._uploadCollection.read(e))throw new Error(`File with internalId ${e} not found`);this._uploadCollection.remove(e)},"removeFileByInternalId");removeAllFiles(){this._uploadCollection.clearAll()}uploadAll=s(()=>{let e=this._uploadCollection.items().filter(t=>{let r=this._uploadCollection.read(t);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):!1});e.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(e),this._ctx.emit(_.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll");openSystemDialog=s((e={})=>{let t=ye(Si([this.cfg.accept??"",...this.cfg.imgOnly?Ot:[]])),r="uploadcare-file-input",o=document.createElement("input");if(o.setAttribute(r,""),_t(o,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),o.type="file",o.multiple=this.cfg.multiple,e.captureCamera){o.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=jr(this.cfg);e.modeCamera===C.PHOTO&&n?o.accept=kt:e.modeCamera===C.VIDEO&&a?o.accept=Fr:o.accept=[kt,a&&Fr].filter(Boolean).join(",")}else o.accept=t;o.addEventListener("change",()=>{o.files&&([...o.files].forEach(n=>{this.addFileFromObject(n,{source:e.captureCamera?P.CAMERA:P.LOCAL})}),this._ctx.modalManager?.open(g.activities.UPLOAD_LIST),this._ctx.$["*currentActivity"]=g.activities.UPLOAD_LIST,o.remove())},{once:!0}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove()}),document.body.appendChild(o),o.dispatchEvent(new MouseEvent("click"))},"openSystemDialog");getOutputItem(e){let t=T.getCtx(e).store,r=t.fileInfo,o=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:r?.uuid??t.uuid??null,internalId:e,name:r?.originalFilename??t.fileName,size:r?.size??t.fileSize,isImage:r?.isImage??t.isImage,mimeType:r?.mimeType??t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:t.cdnUrl??r?.cdnUrl??null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:r??null,metadata:t.metadata??r?.metadata??null,isSuccess:o==="success",isUploading:o==="uploading",isFailed:o==="failed",isRemoved:o==="removed",isValidationPending:t.isValidationPending,errors:t.errors,status:o,source:t?.source}}getOutputCollectionState(){return Ss(this._ctx)}initFlow=s((e=!1)=>{if(this._uploadCollection.size>0&&!e)this._ctx.modalManager?.open(g.activities.UPLOAD_LIST),this._ctx.set$({"*currentActivity":g.activities.UPLOAD_LIST});else if(this._sourceList?.length===1){let t=this._sourceList[0];if(t==="local"){this._ctx.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.openSystemDialog();return}if(t==="camera"&&Ve.htmlMediaCapture){let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=jr(this.cfg);if(a&&l){this._ctx.set$({"*currentActivity":g.activities.START_FROM});return}else if(a||l){this.openSystemDialog({captureCamera:!0,modeCamera:a?C.PHOTO:C.VIDEO});return}else this.openSystemDialog({captureCamera:!0,modeCamera:C.PHOTO})}let r=this._ctx.$["*blocksRegistry"],o=s(a=>"type"in a&&a.type===t,"isSourceBtn");[...r].find(o)?.activate(),this._ctx.$["*currentActivity"]&&this._ctx.modalManager?.open(this._ctx.$["*currentActivity"])}else this._ctx.modalManager?.open(g.activities.START_FROM),this._ctx.set$({"*currentActivity":g.activities.START_FROM})},"initFlow");doneFlow=s(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.modalManager?.closeAll()},"doneFlow");setCurrentActivity=s((e,...t)=>{if(this._ctx.hasBlockInCtx(r=>r.activityType===e)){this._ctx.set$({"*currentActivityParams":t??{},"*currentActivity":e});return}console.warn(`Activity type "${e}" not found in the context`)},"setCurrentActivity");getCurrentActivity=s(()=>this._ctx.$["*currentActivity"],"getCurrentActivity");setModalState=s(e=>{if(e&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}e?this._ctx.modalManager?.open(this._ctx.$["*currentActivity"]):(this._ctx.modalManager?.close(this._ctx.$["*currentActivity"]),this._ctx.$["*currentActivity"]=null)},"setModalState");get _sourceList(){let e=[];return this.cfg.sourceList&&(e=D(this.cfg.sourceList)),e}};var Is=Object.freeze({file:Object.freeze({type:File,value:null,nullable:!0}),externalUrl:Object.freeze({type:String,value:null,nullable:!0}),fileName:Object.freeze({type:String,value:null,nullable:!0}),fileSize:Object.freeze({type:Number,value:null,nullable:!0}),lastModified:Object.freeze({type:Number,value:Date.now()}),uploadProgress:Object.freeze({type:Number,value:0}),uuid:Object.freeze({type:String,value:null,nullable:!0}),isImage:Object.freeze({type:Boolean,value:!1}),mimeType:Object.freeze({type:String,value:null,nullable:!0}),ctxName:Object.freeze({type:String,value:null,nullable:!0}),cdnUrl:Object.freeze({type:String,value:null,nullable:!0}),cdnUrlModifiers:Object.freeze({type:String,value:null,nullable:!0}),fileInfo:Object.freeze({type:Ce,value:null,nullable:!0}),isUploading:Object.freeze({type:Boolean,value:!1}),abortController:Object.freeze({type:AbortController,value:null,nullable:!0}),thumbUrl:Object.freeze({type:String,value:null,nullable:!0}),silent:Object.freeze({type:Boolean,value:!1}),source:Object.freeze({type:String,value:null,nullable:!0}),fullPath:Object.freeze({type:String,value:null,nullable:!0}),metadata:Object.freeze({type:Object,value:null,nullable:!0}),errors:Object.freeze({type:Array,value:[]}),uploadError:Object.freeze({type:Error,value:null,nullable:!0}),isRemoved:Object.freeze({type:Boolean,value:!1}),isQueuedForUploading:Object.freeze({type:Boolean,value:!1}),isValidationPending:Object.freeze({type:Boolean,value:!1}),isQueuedForValidation:Object.freeze({type:Boolean,value:!1})});var O=class i extends g{static{s(this,"UploaderBlock")}static extSrcList;static sourceTypes;couldBeCtxOwner=!1;isCtxOwner=!1;_unobserveCollection;_unobserveCollectionProperties;init$=Tr(this);get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof i?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Oi({typedSchema:Is,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new Li(this)),this.has("*validationManager")||this.add("*validationManager",new Ii(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}disconnectedCallback(){super.disconnectedCallback(),this.isCtxOwner&&this._unobserveUploadCollection()}connectedCallback(){super.connectedCallback(),this.isCtxOwner&&this._observeUploadCollection()}destroyCallback(){super.destroyCallback(),this._flushOutputItems.cancel()}_initCtxOwner(){this.isCtxOwner=!0,this._observeUploadCollection(),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Ai(this))}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate)}_unobserveUploadCollection(){this._unobserveCollectionProperties?.(),this._unobserveCollection?.(),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0}async _createGroup(e){let t=await this.getUploadClientOptions(),r=e.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),o=new AbortController,n=await Ho(r,{...t,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(_.GROUP_CREATED,a),this.emit(_.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=a}_flushOutputItems=M(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let t=this.api.getOutputCollectionState();this.$["*collectionState"]=t,this.emit(_.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&t.totalCount>0&&t.status==="success"&&this._createGroup(t)},300);_handleCollectionUpdate=s((e,t,r)=>{(t.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...t].map(o=>o.uid));for(let o of t)o.getValue("silent")||this.emit(_.FILE_ADDED,this.api.getOutputItem(o.uid));this.validationManager.runCollectionValidators();for(let o of r){this.$["*uploadTrigger"].delete(o.uid),this.validationManager.cleanupValidationForEntry(o),o.getValue("abortController")?.abort(),o.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let n=o?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(_.FILE_REMOVED,this.api.getOutputItem(o.uid))}this.$["*uploadList"]=e.map(o=>({uid:o})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate");_handleCollectionPropertiesUpdate=s(e=>{this._flushOutputItems();let t=this.uploadCollection,r=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(o)).flatMap(([,o])=>[...o]))];if(r.length>0&&setTimeout(()=>{let o=r.filter(n=>e.fileInfo?.has(n)&&!!T.getCtx(n).store.fileInfo);o.length>0&&this.validationManager.runFileValidators("upload",o),this.validationManager.runFileValidators("change",r)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit(_.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit(_.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:n,silent:a}=T.getCtx(o).store;n&&!a&&this.emit(_.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this.openCloudImageEditor()}if(e.errors){this.validationManager.runCollectionValidators();for(let a of e.errors){let{errors:l}=T.getCtx(a).store;l.length>0&&(this.emit(_.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(_.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=t.findItems(a=>!!a.getValue("fileInfo")),n=t.findItems(a=>a.getValue("errors").length>0);t.size>0&&n.length===0&&t.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(_.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(_.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate");_flushCommonUploadProgress=s(()=>{let e=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(e+=a)});let o=r.length?Math.round(e/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(_.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress");openCloudImageEditor(){let[e]=this.uploadCollection.findItems(t=>!!t.getValue("fileInfo")&&t.getValue("isImage")).map(t=>this.uploadCollection.read(t));e&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(t=>t.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:e.uid},this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT,this.modalManager?.open(g.activities.CLOUD_IMG_EDIT))}setInitialCrop(){let e=xi(this.cfg.cropPreset);if(e){let[t]=e,r=this.uploadCollection.findItems(o=>!!o.getValue("fileInfo")&&o.getValue("isImage")&&!o.getValue("cdnUrlModifiers")?.includes("/crop/")).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of r){let n=o.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof t?.width=="number"&&typeof t?.height=="number"&&t.width>0&&t.height>0?t.width/t.height:1,u=hs(a,l,c),d=z(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview"),p=o.getValue("cdnUrl");if(!p){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:$(p,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(h=>h.activityType===g.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT,this.modalManager?.open(g.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(e){let t=this.cfg.metadata||void 0;if(typeof t=="function"){let r=this.api.getOutputItem(e);return await t(r)}return t}async getUploadClientOptions(){let t=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:fs,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};O.extSrcList=Object.freeze({...se});O.sourceTypes=Object.freeze({...P});var Ri=class extends g{static{s(this,"ActivityHeader")}};var ks=s(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Pl={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Os=["camera","microphone"];function Pi(i){let e=Math.floor(i/60).toString().padStart(2,"0"),t=Math.floor(i%60).toString().padStart(2,"0");return`${e}:${t}`}s(Pi,"formatTime");var Ms="image/jpeg",Ls="video/webm",Lt=class extends O{static{s(this,"CameraSource")}couldBeCtxOwner=!0;activityType=g.activities.CAMERA;_unsubPermissions=null;_capturing=!1;_chunks=[];_mediaRecorder=null;_stream=null;_selectedAudioId=null;_selectedCameraId=null;_activeTab=null;_options={};_canvas=null;_ctx=null;_cameraDevices=[];_audioDevices=[];_permissionResponses={};constructor(){super(),this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:ks(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicrophoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicrophoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:s(e=>{let t=e.target;t&&(this._selectedCameraId=t.value,this._capture())},"onCameraSelectChange"),onAudioSelectChange:s(e=>{let t=e.target;t&&(this._selectedAudioId=t.value,this._capture())},"onAudioSelectChange"),onCancel:s(()=>{this.historyBack()},"onCancel"),onShot:s(()=>this._shot(),"onShot"),onRequestPermissions:s(()=>this._capture(),"onRequestPermissions"),onStartCamera:s(()=>this._chooseActionWithCamera(),"onStartCamera"),onStartRecording:s(()=>this._startRecording(),"onStartRecording"),onStopRecording:s(()=>this._stopRecording(),"onStopRecording"),onToggleRecording:s(()=>this._toggleRecording(),"onToggleRecording"),onToggleAudio:s(()=>this._toggleEnableAudio(),"onToggleAudio"),onRetake:s(()=>this._retake(),"onRetake"),onAccept:s(()=>this._accept(),"onAccept"),onClickTab:s(e=>{let r=e.currentTarget?.getAttribute("data-id");r&&this._handleActiveTab(r)},"onClickTab")}}_chooseActionWithCamera=s(()=>{if(this._activeTab===C.PHOTO&&this._shot(),this._activeTab===C.VIDEO){if(this._mediaRecorder?.state==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera");_updateTimer=s(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let t=this.cfg.maxVideoRecordingDuration-e;if(t<=0){let o=this.ref.timer;o&&(o.textContent=Pi(t)),this._stopRecording();return}let r=this.ref.timer;r&&(r.textContent=Pi(t))}else{let t=this.ref.timer;t&&(t.textContent=Pi(e))}this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer");_startTimer=s(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer");_stopTimer=s(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer");_startTimeline=s(()=>{let e=this.ref.video;if(!e)return;let t=e.currentTime,r=e.duration||1,o=this.ref.line;o&&(o.style.transform=`scaleX(${t/r})`);let n=this.ref.timer;n&&(n.textContent=Pi(t)),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline");_stopTimeline=s(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline");_animationFrameId=null;_startRecording=s(()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Ls)?this._options.mimeType=Ls:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",t=>{this._chunks.push(t.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(ee.PLAY))}catch(e){console.error("Failed to start recording",e),this.telemetryManager.sendEventError(e,"camera recording. Failed to start recording")}},"_startRecording");_stopRecording=s(()=>{this._mediaRecorder?.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(ee.STOP)}),this._mediaRecorder?.stop(),this.classList.remove("uc-recording")},"_stopRecording");_toggleRecording=s(()=>{this._mediaRecorder?.state!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording");_toggleEnableAudio=s(()=>{this._stream?.getAudioTracks().forEach(e=>{e.enabled=!e.enabled,this.$.toggleMicrophoneIcon=e.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!e.enabled})},"_toggleEnableAudio");_previewVideo=s(()=>{try{let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=URL.createObjectURL(e),r=this.ref.video;if(!r)return;r.muted=!1,r.volume=1,this.$.video=null,r.src=t,r.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),r.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(e){console.error("Failed to preview video",e),this.telemetryManager.sendEventError(e,"camera previewing. Failed to preview video")}},"_previewVideo");_retake=s(()=>{if(this._setCameraState(ee.RETAKE),this._activeTab===C.VIDEO){this.$.video=this._stream;let e=this.ref.video;e&&(e.muted=!0)}this.ref.video?.play?.()},"_retake");_accept=s(()=>{if(this._setCameraState(ee.ACCEPT),this._activeTab===C.PHOTO){this._canvas?.toBlob(o=>{if(!o)return;let n=this._createFile("camera","jpeg",Ms,o);this._toSend(n)},Ms);return}let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=this._guessExtensionByMime(this._mediaRecorder?.mimeType),r=this._createFile("video",t,`video/${t}`,e);this._toSend(r),this._chunks=[]},"_accept");_handlePhoto=s(e=>{e===ee.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===ee.RETAKE||e===ee.ACCEPT)&&this.set$({tabVideoHidden:!this._cameraModes.includes(C.VIDEO),tabCameraHidden:!this._cameraModes.includes(C.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this._cameraDevices.length<=1})},"_handlePhoto");_handleVideo=s(e=>{e===ee.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===ee.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicrophoneHidden:!0,cameraActionsHidden:!1}),(e===ee.RETAKE||e===ee.ACCEPT)&&this.set$({timerHidden:!0,tabVideoHidden:!this._cameraModes.includes(C.VIDEO),tabCameraHidden:!this._cameraModes.includes(C.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,cameraSelectHidden:this._cameraDevices.length<=1})},"_handleVideo");_setCameraState=s(e=>{this._activeTab===C.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===C.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState");_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_handleActiveTab=s(e=>{this.ref.switcher?.querySelectorAll("button").forEach(r=>{r.classList.toggle("uc-active",r.getAttribute("data-id")===e)}),e===C.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicrophoneHidden:!0}),e===C.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab");_createFile=s((e,t,r,o)=>{let n=Date.now(),a=`${e}-${n}.${t}`;return new File([o],a,{lastModified:n,type:r})},"_createFile");_guessExtensionByMime(e){let t={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e){let r=e.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&t[n])return t[n]}}return"avi"}_toSend=s(e=>{this.api.addFileFromObject(e,{source:P.CAMERA}),this.set$({"*currentActivity":g.activities.UPLOAD_LIST}),this.modalManager?.open(g.activities.UPLOAD_LIST)},"_toSend");get _cameraModes(){return D(this.cfg.cameraModes).filter(e=>e===C.PHOTO||e===C.VIDEO)}_setPermissionsState=M(e=>{this.classList.toggle("uc-initialized",e==="granted");let t=this._activeTab===C.VIDEO&&this.cfg.enableAudioRecording,r=this._activeTab===C.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!this._cameraModes.includes(C.PHOTO),tabVideoHidden:!this._cameraModes.includes(C.VIDEO),messageHidden:!0,timerHidden:!0,currentIcon:r,audioToggleMicrophoneHidden:!t,audioSelectHidden:!t}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!this._cameraModes.includes(C.PHOTO),tabVideoHidden:!this._cameraModes.includes(C.VIDEO),cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300);_makeStreamInactive=s(()=>{if(!this._stream)return!1;let e=this._stream?.getAudioTracks(),t=this._stream?.getVideoTracks();return e.forEach(r=>{r.stop()}),t.forEach(r=>{r.stop()}),!0},"_makeStreamInactive");_stopCapture=s(()=>{this._capturing&&(this.ref.video.volume=0,this.$.video?.getTracks?.()?.[0]?.stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture");_capture=s(async()=>{let e={video:{...Pl},audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video&&(this.ref.video.volume=0);try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(t){this._setPermissionsState("denied"),console.log("Failed to capture camera",t),this.telemetryManager.sendEventError(t,"camera capturing. Failed to capture camera")}},"_capture");_handlePermissionsChange=s(()=>{this._capture()},"_handlePermissionsChange");_permissionAccess=s(async()=>{try{for(let e of Os){let t=await navigator.permissions.query({name:e});this._permissionResponses[e]=t,t.addEventListener("change",this._handlePermissionsChange)}}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this.telemetryManager.sendEventError(e,"camera permissions. Failed to use permissions API"),this._capture()}},"_permissionAccess");_getPermission=s(()=>{},"_getPermission");_requestDeviceAccess=s(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){this.telemetryManager.sendEventError(e,"camera devices. Failed to get user media"),console.log("Failed to get user media",e)}},"_requestDeviceAccess");_getDevices=s(async()=>{try{let e=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=e.filter(t=>t.kind==="videoinput").map((t,r)=>({text:t.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:t.deviceId})),this._audioDevices=this.cfg.enableAudioRecording?e.filter(t=>t.kind==="audioinput").map(t=>({text:t.label.trim(),value:t.deviceId})):[],this._cameraDevices.length>1&&this.set$({cameraSelectOptions:this._cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=this._cameraDevices[0]?.value??null,this._audioDevices.length>1&&this.set$({audioSelectOptions:this._audioDevices,audioSelectHidden:!1}),this._selectedAudioId=this._audioDevices[0]?.value??null}catch(e){this.telemetryManager.sendEventError(e,"camera devices. Failed to get devices"),console.log("Failed to get devices",e)}},"_getDevices");_onActivate=s(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},"_onActivate");_onDeactivate=s(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate");_handleCameraModes=s(e=>{this.$.tabVideoHidden=!e.includes(C.VIDEO),this.$.tabCameraHidden=!e.includes(C.PHOTO);let t=e[0];t&&(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(t)},"_handleCameraModes");initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicrophoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("cameraModes",e=>{if(!this.isActivityActive)return;let t=q(e);this._handleCameraModes(t.filter(r=>r===C.PHOTO||r===C.VIDEO))})}_destroy(){for(let e of Os)this._permissionResponses[e]?.removeEventListener("change",this._handlePermissionsChange);navigator.mediaDevices?.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};Lt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back" ><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording" ><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden" ><button type="button" class="uc-secondary-btn" set="onclick: onRetake"> Retake </button><button type="button" class="uc-primary-btn" set="onclick: onAccept" data-testid="accept" > Accept </button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicrophoneHidden;" ><uc-icon set="@name:toggleMicrophoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Rs(...i){return i.reduce((e,t)=>{if(typeof t=="string")return e[t]=!0,e;for(let r of Object.keys(t))e[r]=t[r];return e},{})}s(Rs,"normalize");function N(...i){let e=Rs(...i);return Object.keys(e).reduce((t,r)=>(e[r]&&t.push(r),t),[]).join(" ")}s(N,"classNames");function Ps(i,...e){let t=Rs(...e);for(let r of Object.keys(t))i.classList.toggle(r,!!t[r])}s(Ps,"applyClassNames");var Ul=s(i=>X.includes(i),"isTabIdValue"),Us=s(i=>{if(!i)return X;let e=q(i).filter(Ul);return e.length===0?X:e},"parseTabs");function $s(i){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":X,"*tabId":L.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:ue,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:ye([...X]),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":s(()=>{let e=i.querySelectorAll("img");for(let t of e){let r=t.src;t.src=ue,t.src=r}i.$["*networkProblems"]=!1},"*on.retryNetwork"),"*on.apply":s(e=>{if(!e)return;let t=i.$["*originalUrl"],r=z(Ie(e),"preview"),o=$(t,r),n={originalUrl:t,cdnUrlModifiers:r,cdnUrl:o,transformations:e};i.dispatchEvent(new CustomEvent("apply",{detail:n,bubbles:!0,composed:!0})),i.remove()},"*on.apply"),"*on.cancel":s(()=>{i.remove(),i.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},"*on.cancel")}}s($s,"initState");var Ds="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Fs=`${Ds} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${ue}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var de=class extends b{static{s(this,"CloudImageEditorBlock")}ctxOwner=!0;static styleAttrs=["uc-cloud-image-editor"];_debouncedShowLoader=M(this._showLoader.bind(this),300);constructor(){super(),this.init$={...this.init$,...$s(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((t,r)=>{let o=window.setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(o),n.disconnect(),window.setTimeout(()=>t(),0))});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let e=this.$.cdnUrl,t=li(e),r=Se(e,t);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let o=ar(e),n=lr(o);this.$["*editorTransformations"]=n}else if(this.$.uuid){let e=Se(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===L.CROP?this.$["*cropperEl"]?.deactivate({reset:!0}):this.$["*faderEl"]?.deactivate();try{let e=this.$["*originalUrl"],t=await this.proxyUrl($(e,z("json"))),r=await fetch(t).then(a=>a.json()),{width:o,height:n}=r;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===L.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:e})}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e))}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._debouncedShowLoader(!1),this.$.src!==ue&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let t=this.ref["img-el"];t.src!==e&&(t.src=e||ue)}),this.sub("tabs",e=>{this.$["*tabList"]=Us(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=N("uc-image",{"uc-image_hidden_to_cropper":e===L.CROP,"uc-image_hidden_effects":e!==L.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],r=z(Ie(e),"preview"),o=$(t,r),n={originalUrl:t,cdnUrlModifiers:r,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage()),this.sub("cropPreset",e=>{let t=xi(e),r=null;if(this.$.cdnUrl){let o=ar(this.$.cdnUrl),n=lr(o);if(Array.isArray(n?.crop?.dimensions)){let[a,l]=n.crop.dimensions;r=ms(a,l,t,.1)}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=r??t?.[0]??null})}};de.template=Fs;de.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Rt=class extends b{static{s(this,"CropFrame")}_handlePointerUp;_handlePointerMove;_handleSvgPointerMove;_backdropMask;_backdropMaskInner;_frameThumbs;_frameGuides;_draggingThumb;_hoverThumb;_dragStartPoint;_dragStartCrop;_frameImage;_guidesHidden=!1;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!1;if(e===""&&t.height<=w&&t.width<=w)return!0;let r=t.height<=w&&(e.includes("n")||e.includes("s")),o=t.width<=w&&(e.includes("e")||e.includes("w"));return r||o}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:r,width:o,height:n}=e,a=this.ref["svg-el"],l=K("mask",{id:"backdrop-mask"}),c=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=K("rect",{x:t,y:r,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(u);let d=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});a.appendChild(d),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:r,width:o,height:n}=e;this._backdropMaskInner&&Re(this._backdropMaskInner,{x:t,y:r,width:o,height:n})}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{direction:r,pathNode:o,interactionNode:n,groupNode:a}=t,l=r==="",c=r.length===2,{x:u,y:d,width:p,height:h}=e;if(l)Re(n,{x:u,y:d,width:p,height:h});else{let m=Pe(Math.min(p,h)/82/2,0,1),v=c?ss(e,r,m):ns(e,r,m),y=v.center;if(!y)continue;let S=Math.max(Pr*Pe(Math.min(p,h)/Pr/3,0,1),os);Re(n,{x:y[0]-S,y:y[1]-S,width:S*2,height:S*2}),Re(o,{d:v.d})}let f=this._shouldThumbBeDisabled(r);a.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":f,"uc-thumb--visible":!f}))}Re(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumb(e,t){let r=K("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let o=K("rect",{fill:"transparent"}),n=K("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(o),e[t]={direction:t,pathNode:n,interactionNode:o,groupNode:r},t===""&&(r.style.cursor="move"),o.addEventListener("pointerdown",this._handlePointerDown.bind(this,t))}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let r=0;r<3;r++){let o=`${["n","","s"][t]}${["w","","e"][r]}`;o!==""&&this._createThumb(e,o)}return this._createThumb(e,""),e}_createGuides(){let e=K("svg"),t=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let r=1;r<=2;r++){let o=K("line",{x1:`${St*r}%`,y1:"0%",x2:`${St*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o)}for(let r=1;r<=2;r++){let o=K("line",{x1:"0%",y1:`${St*r}%`,x2:"100%",y2:`${St*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o)}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this.ref["svg-el"],t=document.createDocumentFragment(),r=this._createGuides();t.appendChild(r);let o=this._createThumbs();for(let{groupNode:n}of Object.values(o))t.appendChild(n);e.appendChild(t),this._frameThumbs=o,this._frameGuides=r}_handlePointerDown(e,t){if(!this._frameThumbs)return;let r=this._frameThumbs[e];if(!r||this._shouldThumbBeDisabled(e))return;let o=this.$["*cropBox"],n=this.ref["svg-el"],{x:a,y:l}=n.getBoundingClientRect(),c=t.x-a,u=t.y-l;this.$.dragging=!0,this._draggingThumb=r,this._dragStartPoint=[c,u],this._dragStartCrop={...o}}_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:r,y:o}=t.getBoundingClientRect(),n=e.x-r,a=e.y-o,l=n-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,d=this._calcCropBox(u,[l,c]);d&&(this.$["*cropBox"]=d)}_calcCropBox(e,t){let[r,o]=t,n=this.$["*imageBox"],a=this._dragStartCrop??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(e===""?a=ls({rect:a,delta:[r,o],imageBox:n}):a=cs({rect:a,delta:[r,o],direction:e,aspectRatio:c,imageBox:n}),!Object.values(a).every(u=>Number.isFinite(u)&&u>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ye(Je(a),n)}_handleSvgPointerMove_(e){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(r=>{if(!r||this._shouldThumbBeDisabled(r.direction))return!1;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return us(a,[e.x,e.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let e=this._hoverThumb,t=this.ref["svg-el"];t.style.cursor=e?as(e.direction):"initial"}_createMask(e){if(this._frameImage){this._frameImage.setAttribute("href",e);return}let t=this.ref["svg-el"],r=document.createDocumentFragment(),o=K("image",{href:e});o.setAttribute("class","uc-cloud-mask"),r.appendChild(o),t.appendChild(r),this._frameImage=o}_updateMask(){let e=this.$["*cropBox"];if(!e||!this._frameImage)return;let{x:t,y:r,width:o,height:n}=e;Re(this._frameImage,{x:t,y:r,height:n,width:o})}_render(){this._updateBackdrop(),this._updateFrame(),this._updateMask()}toggleThumbs(e){if(this._frameThumbs)for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{groupNode:r}=t;r.setAttribute("class",N("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}))}}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=w||t.width<=w,window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this._createMask(t)}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",N({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),this.ref["svg-el"].removeEventListener("pointermove",this._handleSvgPointerMove,!0),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};Rt.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var te=class extends b{static{s(this,"EditorButtonControl")}_titleEl;constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""}}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this.sub("title",e=>{let t=this._titleEl;t&&(t.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=N({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e??null})}};te.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><uc-icon ref="icon-el" set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;var Ui=12,Vs=16,Dl=s(i=>{let e=12,t=12;return i.width/i.height>=1?(e=Ui,t=Math.round(Ui*i.height/i.width)):(t=Ui,e=Math.round(Ui*i.width/i.height)),{width:e,height:t}},"getAdjustResolutions"),ze=class extends te{static{s(this,"EditorFreeformButtonControl")}initCallback(){super.initCallback(),this.$.icon="arrow-dropdown",this.$["on.click"]=this.handleClick.bind(this),this.sub("*currentAspectRatio",e=>{this.$.title=e.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}),this.bindL10n("title-prop",()=>this.$.title)})}handleClick(){this.$["*showListAspectRatio"]=!0}};ze.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><div class="uc-title" ref="title-el">{{title}}</div><uc-icon ref="icon-el" set="@name: icon;"></uc-icon></button>`;var tt=class extends te{static{s(this,"EditorAspectRatioButtonControl")}constructor(){super(),this.init$={...this.init$,active:!1,once:!1}}initCallback(){super.initCallback(),this.defineAccessor("aspectRatio",e=>{if(!e)return;let t=!!e.hasFreeform;this.$.title=t?this.l10n("custom"):`${e.width}:${e.height}`,t||this._renderRectBasedOnAspectRatio(e),t&&this.setAttribute("uc-aspect-ratio-freeform",""),this._aspectRatio=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:t?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}).toLowerCase(),value:""}))}),this.sub("*currentAspectRatio",e=>{this.$.active=e&&e.id===this._aspectRatio?.id||e?.width===this._aspectRatio?.width&&e?.height===this._aspectRatio?.height}),this.$["on.click"]=this.handleClick.bind(this)}handleClick(){this.$["*currentAspectRatio"]?.id!==this._aspectRatio?.id&&(this.$["*currentAspectRatio"]=this._aspectRatio)}_renderRectBasedOnAspectRatio(e){let{width:t,height:r}=Dl(e),o=K("rect",{"stroke-linejoin":"round",fill:"none",stroke:"currentColor","stroke-width":1.2,"fill-rule":"evenodd",x:(Vs-t)/2,y:(Vs-r)/2,rx:2,width:t,height:r}),n=this.ref["icon-el"]?.ref?.svg;n&&(n.innerHTML="",n.appendChild(o))}_aspectRatio};function Fl(i){let e=i+90;return e=e>=360?0:e,e}s(Fl,"nextAngle");function Vl(i,e){if(i==="rotate")return Fl(typeof e=="number"?e:0);if(i==="mirror"||i==="flip")return!e;throw new Error(`Unsupported operation: ${i}`)}s(Vl,"nextValue");var it=class extends te{static{s(this,"EditorCropButtonControl")}_operation=void 0;initCallback(){super.initCallback(),this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(e).toLowerCase()})))}),this.$["on.click"]=e=>{if(!this._operation)return;let t=this.$["*cropperEl"],r=t.getValue(this._operation),o=Vl(this._operation,r);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this._operation,next:o,prev:r}),t.setValue(this._operation,o)}}};function He(i){let e=new Image;return{promise:new Promise((o,n)=>{e.src=i,e.onload=()=>o(),e.onerror=a=>n(a)}),image:e,cancel:s(()=>{e.naturalWidth===0&&(e.src=ue)},"cancel")}}s(He,"preloadImage");function Pt(i){let e=[];for(let n of i){let a=He(n);e.push(a)}let t=e.map(n=>n.image);return{promise:Promise.allSettled(e.map(n=>n.promise)),images:t,cancel:s(()=>{e.forEach(n=>{n.cancel()})},"cancel")}}s(Pt,"batchPreloadImages");var pe="original",Ut=class extends b{static{s(this,"EditorSlider")}_operation="filter";_filter;_originalUrl="";constructor(){super(),this.init$={...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":s(e=>{this.$["*faderEl"]?.set(e),this.$.value=e},"on.input")}}setOperation(e,t){this._operation=e,this._filter=t,this._initializeValues();let r=this.$["*faderEl"],o=this._originalUrl||this.$["*originalUrl"];r&&o&&r.activate({url:o,operation:this._operation,value:this._filter===pe?void 0:this.$.value,filter:this._filter===pe?void 0:this._filter,fromViewer:!1})}_initializeValues(){let e=this._operation,{range:t,zero:r}=re[e],[o,n]=t;this.$.min=o,this.$.max=n,this.$.zero=r;let l=this.$["*editorTransformations"][e];if(e==="filter"){let u=Number(n),d=l;if(d){let{name:p,amount:h}=d;u=p===this._filter?h:n}this.$.value=u,this.$.defaultValue=u;return}let c=typeof l<"u"?l:r;this.$.value=c,this.$.defaultValue=c}apply(){let t={...this.$["*editorTransformations"]};this._operation==="filter"?!this._filter||this._filter===pe?delete t.filter:t.filter={name:this._filter,amount:this.$.value}:t[this._operation]=this.$.value,this.$["*editorTransformations"]=t}cancel(){this.$["*faderEl"]?.deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let t=`${this._filter??this._operation} ${e}`;this.$["*operationTooltip"]=t})}};Ut.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function rt(i){let e=i.match(/^([A-Za-z]+)\s+(\d+)$/);if(!e)return null;let[,t,r]=e;return!t||typeof r>"u"?null:{filter:t,value:Number(r)}}s(rt,"parseFilterValue");var je=class extends te{static{s(this,"EditorFilterControl")}_operation="";_filter="";_originalUrl="";_observer;_cancelPreload;constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,r=Math.ceil(t*e),o=t>=2?"lightest":"normal",n=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==pe?{name:this._filter,amount:n}:void 0,$(this._originalUrl,z(ci,Ie(a),`quality/${o}`,`scale_crop/${r}x${r}/center`))}async _observerCallback(e,t){if(e[0]?.isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:a,cancel:l}=He(o);this._cancelPreload=l,a.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else this._cancelPreload?.()}initCallback(){super.initCallback(),this.$["on.click"]=t=>{if(this.$.active)this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0);else{let r=this.$["*sliderEl"];r.setOperation(this._operation,this._filter),r.apply()}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:rt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===pe,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("isOriginal",t=>{this.$.iconSize=t?40:20}),this.sub("active",t=>{if(this.$.isOriginal)return;let r=this.ref["icon-el"];r.style.opacity=t?"1":"0";let o=this.ref["preview-el"];t?o.style.opacity="0":o.style.backgroundImage&&(o.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let r=await this.proxyUrl(this._previewSrc()),o=this.ref["preview-el"];o.style.backgroundImage&&(o.style.backgroundImage="none",o.style.backgroundImage=`url(${r})`)}})}destroyCallback(){super.destroyCallback(),this._observer?.disconnect(),this._cancelPreload?.()}};je.template=`<button type="button" role="option" l10n="@title:title-prop;@aria-label:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var ot=s((i,e)=>{let t=!1,r,o=0,n=s(((...a)=>{t?(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-o>=e&&(i(...a),o=Date.now())},Math.max(e-(Date.now()-o),0))):(i(...a),o=Date.now(),t=!0)}),"throttled");return Object.defineProperty(n,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:s(()=>{r&&clearTimeout(r)},"value")}),n},"throttle");function Ns(i,e){let t={};for(let r of e){let o=i[r];(Object.hasOwn(i,r)||o!==void 0)&&(t[r]=o)}return t}s(Ns,"pick");function st(i,e,t){let o=window.devicePixelRatio,n=Math.min(Math.ceil(e*o),3e3),a=o>=2?"lightest":"normal";return $(i,z(ci,Ie(t),`quality/${a}`,`stretch/off/-/resize/${n}x`,`@clib/${Te}/${xe}/uc-cloud-image-editor/`))}s(st,"viewerImageSrc");function Nl(i){return i?[({dimensions:t,coords:r})=>[...t,...r].every(o=>Number.isInteger(o)&&Number.isFinite(o)),({dimensions:t,coords:r})=>t.every(o=>o>0)&&r.every(o=>o>=0)].every(t=>t(i)):!0}s(Nl,"validateCrop");var $t=class extends b{static{s(this,"EditorImageCropper")}ctxOwner=!0;_commitDebounced;_handleResizeThrottled;_imageSize={width:0,height:0};_canvas;_ctx=null;_isActive=!1;_observer;_cancelPreload;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=M(this._commit.bind(this),300),this._handleResizeThrottled=ot(this._handleResize.bind(this),100)}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],t=Ns(e,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...t};this.$["*operations"]=r}_initCanvas(){let e=this.ref["canvas-el"],t=e.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${r}px`,e.style.height=`${o}px`,e.width=r*n,e.height=o*n,t?.scale(n,n),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,t=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Qe({width:e.naturalWidth,height:e.naturalHeight},o),l;if(a.width>n.width-t*2||a.height>n.height-t*2){let c=a.width/a.height,u=n.width/n.height;if(c>u){let d=n.width-t*2,p=d/c,h=0+t,f=t+(n.height-t*2)/2-p/2;l={x:h,y:f,width:d,height:p}}else{let d=n.height-t*2,p=d*c,h=t+(n.width-t*2)/2-p/2,f=0+t;l={x:h,y:f,width:p,height:d}}}else{let{width:c,height:u}=a,d=t+(n.width-t*2)/2-c/2,p=t+(n.height-t*2)/2-u/2;l={x:d,y:p,width:c,height:u}}this.$["*imageBox"]=Je(l)}_alignCrop(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=t;if(n){let{dimensions:[p,h],coords:[f,m]}=n,{width:v}=Qe(this._imageSize,o),y=a/v;e=Ye(Je({x:l+f*y,y:c+m*y,width:p*y,height:h*y}),t)}let u=this.$["*currentAspectRatio"],d=u?u.width/u.height:void 0;if(!ds(e,t)||d&&!ps(e,d)){let p=t.width/t.height,h=t.width,f=t.height;d&&(p>d?h=Math.min(t.height*d,t.width):f=Math.min(t.width/d,t.height)),e={x:t.x+t.width/2-h/2,y:t.y+t.height/2-f/2,width:h,height:f}}this.$["*cropBox"]=Ye(Je(e),t)}_drawImage(){let e=this._ctx;if(!e)return;let t=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Qe({width:r.width,height:r.height},l);e.save(),e.translate(r.x+r.width/2,r.y+r.height/2),e.rotate(l*Math.PI*-1/180),e.scale(n?-1:1,a?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=N({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=t,{width:l,height:c}=Qe(this._imageSize,o),{width:u,height:d}=e,p=n/l,h=a/c;return[Pe(Math.round(u/p),1,l),Pe(Math.round(d/h),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:l,y:c}=t,{width:u,height:d}=Qe(this._imageSize,o),{x:p,y:h}=e,f=n/u,m=a/d,v=this._getCropDimensions(),y={dimensions:v,coords:[Pe(Math.round((p-l)/f),0,u-v[0]),Pe(Math.round((h-c)/m),0,d-v[1])]};if(!Nl(y)){console.error("Cropper is trying to create invalid crop object",{payload:y});return}if(!(v[0]===u&&v[1]===d))return y}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:r,flip:o}=e,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:r,flip:o};this.$["*editorTransformations"]=l}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{let r=this.$["*originalUrl"],o=this.$["*editorTransformations"];this.$.image=await this._waitForImage(r,o),this._syncTransformations(),this._animateIn({fromViewer:t})}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper")}this._observer=new ResizeObserver(r=>{let[o]=r;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=N({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),this._observer?.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),t=this.$["*cropBox"],r=Math.min(this.offsetWidth,e[0])/t.width,o=Math.min(this.offsetHeight,e[1])/t.height,n=Math.min(r,o),a=t.x+t.width/2,l=t.y+t.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"],t=e.x+e.width/2,r=e.y+e.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${r}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,t){let r=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(st(e,r,t)),{promise:n,cancel:a,image:l}=He(o),c=this._handleImageLoading(o);return l.addEventListener("load",c,{once:!0}),l.addEventListener("error",c,{once:!0}),this._cancelPreload?.(),this._cancelPreload=a,n.then(()=>l).catch(u=>(console.error("Failed to load image",{error:u}),this.$["*networkProblems"]=!0,l))}_handleImageLoading(e){let t="crop",r=this.$["*loadingOperations"],o=r.get(t);return o||(o=new Map,r.set(t,o)),o.get(e)||(o.set(e,!0),this.$["*loadingOperations"]=r),()=>{let n=r.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*currentAspectRatio",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){super.destroyCallback(),this._observer?.disconnect()}};$t.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Kr(i,e,t){let r=t,o=t-1,n=new Array(r);for(let a=o;a>=0;a-=1)n[a]=Math.ceil((a*e+(o-a)*i)/o);return n}s(Kr,"linspace");function Bl(i){return typeof i=="string"&&i in re}s(Bl,"isOperationKey");function zl(i){let e=[];for(let t=0;t<i.length-1;t+=1){let r=i[t],o=i[t+1];typeof r=="number"&&typeof o=="number"&&e.push([r,o])}return e}s(zl,"splitBySections");function Hl(i,e,t){let r=zl(i).find(([a,l])=>a<=e&&e<=l);if(!r)return i.map(()=>0);let[o,n]=r;return i.map(a=>{let l=Math.abs(o-n)||1,c=Math.abs(e-o)/l;return o===a?e>t?1:1-c:n===a?e>=t?c:1:0})}s(Hl,"calculateOpacities");function jl(i,e){return i.map((t,r)=>t<e?i.length-r:r)}s(jl,"calculateZIndices");function Bs(i,e){let t=re[i].keypointsNumber,{range:r,zero:o}=re[i];return[...new Set([...Kr(r[0],o,t+1),...Kr(o,r[1],t+1),o,e])].sort((n,a)=>n-a)}s(Bs,"keypointsRange");var $i=class extends b{static{s(this,"EditorImageFader")}_isActive=!1;_hidden=!0;_operation="initial";_filter;_value;_transformations={};_keypoints=[];_container;_previewImage;_cancelLastImages;_cancelBatchPreload;_url;_fromViewer;_raf=0;_addKeypointDebounced=M(this._addKeypoint.bind(this),600);constructor(){super(),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(e){let t=this._operation,r=this.$["*loadingOperations"];r.has(t)||r.set(t,new Map);let o=r.get(t);return o&&!o.get(e)&&(o.set(e,!0),this.$["*loadingOperations"]=r),()=>{let n=r.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=r)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}_imageSrc({url:e=this._url,filter:t=this._filter??void 0,operation:r,value:o}={}){if(!e)throw new Error("URL is not defined");let n={...this._transformations};r&&(r==="filter"?t&&typeof o=="number"&&(n.filter={name:t,amount:o}):typeof o=="number"&&(n[r]=o));let a=this.offsetWidth;return this.proxyUrl(st(e,a,n))}async _constructKeypoint(e,t){return{src:await this._imageSrc({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}async _addKeypoint(e,t,r){let o=s(()=>!this._isSame(e,t)||this._value!==r||!!this._keypoints.find(c=>c.value===r),"shouldSkip");if(o())return;let n=await this._constructKeypoint(e,r),a=new Image;a.src=n.src;let l=this._handleImageLoading(n.src);a.addEventListener("load",l,{once:!0}),a.addEventListener("error",l,{once:!0}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this._keypoints,u=c.findIndex(f=>f.value>r);u===-1&&(u=c.length);let p=c[u]?.image,h=this._container;!h||p&&!h.contains(p)||(c.splice(u,0,n),p&&h.insertBefore(a,p),this._update(e,r))},{once:!0}),a.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(e){let t=typeof e=="string"?parseInt(e,10):e;!Bl(this._operation)||!Number.isFinite(t)||(this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t))}_update(e,t){this._operation=e,this._value=t;let{zero:r}=re[e],o=this._keypoints.map(l=>l.value),n=Hl(o,t,r),a=jl(o,r);this._keypoints.forEach((l,c)=>{let u=n[c],d=a[c];typeof u=="number"&&(l.opacity=u),typeof d=="number"&&(l.zIndex=d)}),this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){let e=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage();let t=this._previewImage;this.contains(t)||e.appendChild(t);let r=document.createElement("div");e.appendChild(r);let o=this._keypoints.map(d=>d.src),{images:n,promise:a,cancel:l}=Pt(o);n.forEach(d=>{let p=this._handleImageLoading(d.src);d.addEventListener("load",p),d.addEventListener("error",p)}),this._cancelLastImages=()=>{l(),this._cancelLastImages=void 0};let c=this._operation,u=this._filter;await a,this._isActive&&this._isSame(c,u)&&(this._container?.remove(),this._container=r,this._keypoints.forEach((d,p)=>{let h=n[p];h&&(h.classList.add("uc-fader-image"),d.image=h,this._container?.appendChild(h))}),this.appendChild(e),this._flush())}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),r=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",r,{once:!0}),this._previewImage.addEventListener("error",r,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:e,filter:t,operation:r,value:o}){if(!r||typeof o!="number")return;this._cancelBatchPreload?.();let n=Bs(r,o),a=await Promise.all(n.map(c=>this._imageSrc({url:e,filter:t,operation:r,value:c}))),{cancel:l}=Pt(a);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=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let r=this._handleImageLoading(e);t.addEventListener("error",r,{once:!0}),t.src=e,t.addEventListener("load",()=>{r(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=N({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:e,operation:t,value:r,filter:o,fromViewer:n}){if(this._isActive=!0,this._hidden=!1,this._url=e,this._operation=t??"initial",this._value=r,this._filter=o,this._fromViewer=n,typeof r!="number"&&!o){let l=await this._imageSrc({operation:t,value:r});this._setOriginalSrc(l),this._container?.remove();return}!t||typeof r!="number"||(this._keypoints=await Promise.all(Bs(t,r).map(l=>this._constructKeypoint(t,l))),this._update(t,r),this._initNodes())}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages?.(),this._cancelBatchPreload?.(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=N({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container?.remove()},{once:!0})):this._container?.remove()}};var nt=class extends te{static{s(this,"EditorOperationControl")}_operation="";initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:rt(this.$["*operationTooltip"])})},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=re[this._operation],r=e[this._operation],o=typeof r<"u"?r!==t:!1;this.$.active=o})}};var Kl=1,Dt=class extends b{static{s(this,"EditorScroller")}initCallback(){super.initCallback(),this.addEventListener("wheel",e=>{e.preventDefault();let{deltaY:t,deltaX:r}=e;Math.abs(r)>Kl?this.scrollLeft+=r:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};Dt.template=" <slot></slot> ";function Gl(i){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${i}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${i}" data-id="${i}" icon="${i}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${i}; title-prop: a11y-editor-tab-${i}" ></uc-btn-ui></uc-presence-toggle>`}s(Gl,"renderTabToggle");function Wl(i){return`<uc-presence-toggle id="tab_${i}" class="uc-tab-content" set="visible: presence.tabContent.${i}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${i}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}s(Wl,"renderTabContent");var Ft=class extends b{static{s(this,"EditorToolbar")}_debouncedShowLoader;_cancelPreload;_updateInfoTooltip;constructor(){super(),this.init$={...this.init$,"*sliderEl":null,"*listAspectRatioEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*showListAspectRatio":!1,hideSliderOrList:!1,"*currentFilter":pe,"*currentOperation":null,showLoader:!1,filters:Eo,colorOperations:Co,cropOperations:To,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":s(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this._cancelPreload?.();let t=this.$["*on.cancel"];t()},"on.cancel"),"on.apply":s(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let t=this.$["*on.apply"];t(this.$["*editorTransformations"])},"on.apply"),"on.applySlider":s(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:rt(this.$["*operationTooltip"])}),this.ref["slider-el"].apply(),this._onSliderClose()},"on.applySlider"),"on.cancelSlider":s(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this.ref["slider-el"].cancel(),this._onSliderClose()},"on.cancelSlider"),"on.clickTab":s(e=>{let r=e.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(e,r),this._activateTab(r,{fromViewer:!1}))},"on.clickTab"),tab_role:"tab",[`tab_${L.TUNING}`]:`tab_${L.TUNING}`,[`tab_${L.CROP}`]:`tab_${L.CROP}`,[`tab_${L.FILTERS}`]:`tab_${L.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=M(this._showLoader.bind(this),500),this._updateInfoTooltip=M(this._updateInfoTooltipHandler.bind(this),0)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===L.CROP&&(this.$["*showListAspectRatio"]=!1),this.$["*tabId"]===L.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let t=new nt;return t.operation=e,t}_createFilterControl(e){let t=new je;return t.filter=e,t}_createToggleControl(e){let t=new it;return t.operation=e,t}_createAspectRatioControl(e){let t=new tt;return t.aspectRatio=e,t}_createFreeformControl(){return new ze}_clearListAspectRatio(){let e=this.$["*listAspectRatioEl"];e&&(e.innerHTML="")}_renderControlsList(e){let t=this.ref[`controls-list-${e}`],r=document.createDocumentFragment();if(this._clearListAspectRatio(),e===L.CROP){let o=this.$["*cropPresetList"],n=o.length>=3;if(n){let a=this._createFreeformControl();r.appendChild(a)}for(let a of o){let l=this._createAspectRatioControl(a);r.appendChild(l),n&&this.$["*listAspectRatioEl"]?.appendChild(l)}for(let a of this.$.cropOperations){let l=this._createToggleControl(a);r.appendChild(l)}}else if(e===L.FILTERS){let o=this.$.filters;[pe,...o].forEach(n=>{let a=this._createFilterControl(n);r.appendChild(a)})}else if(e===L.TUNING)for(let o of this.$.colorOperations){let n=this._createOperationControl(o);r.appendChild(n)}[...r.children].forEach((o,n)=>{n===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),t.innerHTML="",t.appendChild(r)}_activateTab(e,{fromViewer:t}={}){this.$["*tabId"]=e;let r=this.$["*faderEl"],o=this.$["*cropperEl"];e===L.CROP?(r?.deactivate(),o?.activate(this.$["*imageSize"],{fromViewer:t})):(r?.activate({url:this.$["*originalUrl"],fromViewer:t}),o?.deactivate());for(let n of X){let a=n===e,l=this.ref[`tab-toggle-${n}`];l.active=a,a?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(n),this.$[`presence.tabContent.${n}`]=a}}_unmountTabControls(e){let t=this.ref[`controls-list-${e}`];t&&(t.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],t=this.ref["tabs-indicator"];t.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,t=await this.proxyUrl(st(this.$["*originalUrl"],e,this.$["*editorTransformations"]));this._cancelPreload?.();let{cancel:r}=Pt([t]);this._cancelPreload=()=>{r(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}_updateInfoTooltipHandler(){let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===L.FILTERS)if(o=!0,this.$["*currentFilter"]&&e?.filter?.name===this.$["*currentFilter"]){let n=e?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`}else r=this.l10n(pe);else if(this.$["*tabId"]===L.TUNING&&t){o=!0;let n=e?.[t]||re[t].zero;r=`${this.l10n(t)} ${n}`}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.$["*listAspectRatioEl"]=this.ref["list-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{let t=e?.filter?.name;this.$["*currentFilter"]!==t&&(this.$["*currentFilter"]=t)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate()}),this.sub("*editorTransformations",e=>{this._preloadEditedImage(),this.$["*faderEl"]?.setTransformations(e)}),this.sub("*loadingOperations",e=>{let t=!1;for(let[,r]of e.entries()){if(t)break;for(let[,o]of r.entries())if(o){t=!0;break}}this._debouncedShowLoader(t)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e,this.$.hideSliderOrList=!0}),this.sub("*showListAspectRatio",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e,this.$.hideSliderOrList=!1}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let t of X){this.$[`presence.tabToggle.${t}`]=e.includes(t);let r=this.ref[`tab-toggle-${t}`];r.style.gridColumn=`${e.indexOf(t)+1}`}if(!e.includes(this.$["*tabId"])&&e.length>0){let[t]=e;t&&this._activateTab(t,{fromViewer:!1})}}),this._updateInfoTooltip()}destroyCallback(){this.$["*showSlider"]=!1,this.$["*showListAspectRatio"]=!1}};Ft.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${X.map(Wl).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${X.map(Gl).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider" set="@hidden:!hideSliderOrList"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div set="@hidden:hideSliderOrList" class="uc-list-aspect-ratio-container"><div class="uc-list-aspect-ratio" ref="list-el"></div></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var at=class extends b{static{s(this,"BtnUi")}_iconReversed=!1;_iconSingle=!1;_iconHidden=!1;constructor(){super(),this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return N("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",e=>{this._iconSingle=!this.$.text,this._iconHidden=!e,this.$.iconCss=this._iconCss()}),this.sub("theme",e=>{e&&e!=="custom"&&(this.className=`uc-${e}`)}),this.sub("text",()=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",e=>{this.$["aria-role"]=e||""}),this.defineAccessor("aria-controls",e=>{this.$["aria-controls"]=e||""}),this.defineAccessor("title-prop",e=>{this.$["title-prop"]=e||""})}set reverse(e){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection="")}};at.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});at.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls; @aria-label:title-prop" l10n="@title:title-prop;" ><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var Vt=class extends b{static{s(this,"LineLoaderUi")}_active=!1;_handleTransitionEndRight=s(()=>{let e=this.ref["line-el"];e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)",this._active&&this._start()},"_handleTransitionEndRight");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}};Vt.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var lt={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Nt=class extends b{static{s(this,"PresenceToggle")}_visible=!1;_visibleStyle=lt.visible;_hiddenStyle=lt.hidden;_externalTransitions=!1;constructor(){super(),this.defineAccessor("styles",e=>{e&&(this._externalTransitions=!0,this._visibleStyle=e.visible??lt.visible,this._hiddenStyle=e.hidden??lt.hidden)}),this.defineAccessor("visible",e=>{typeof e=="boolean"&&(this._visible=e,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Ps(this,{[lt.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(lt.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};Nt.template="<slot></slot> ";var Bt=class extends b{static{s(this,"SliderUi")}_observer;_thumbSize=0;_zero=0;_zeroDotEl;_stepsCount;constructor(){super(),this.init$={...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:0,"on.sliderInput":s(()=>{let e=Number.parseInt(this._inputEl().value,10);this._updateValue(e),this.$.onInput?.(e)},"on.sliderInput"),"on.sliderChange":s(()=>{let e=Number.parseInt(this._inputEl().value,10);this.$.onChange?.(e)},"on.sliderChange")},this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",t=>{this.$.disabled=t}),this.defineAccessor("min",t=>{this.$.min=t}),this.defineAccessor("max",t=>{this.$.max=t}),this.defineAccessor("defaultValue",t=>{this.$.defaultValue=t;let r=this._inputEl();r.value=String(t),this._updateValue(t)}),this.defineAccessor("zero",t=>{this._zero=t}),this.defineAccessor("onInput",t=>{t&&(this.$.onInput=t)}),this.defineAccessor("onChange",t=>{t&&(this.$.onChange=t)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let t=Number.parseInt(this._inputEl().value,10);this._updateValue(t)}),this._observer.observe(this),this._thumbSize=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let t=Number.parseInt(this._inputEl().value,10);this._updateValue(t)},0),this.sub("disabled",t=>{let r=this._inputEl();t?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let e=this._inputEl();e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_inputEl(){return this.ref["input-el"]}_thumbEl(){return this.ref["thumb-el"]}_stepsEl(){return this.ref["steps-el"]}_updateValue(e){this._updateZeroDot(e);let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(e-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._thumbEl().style.transform=`translateX(${n}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;this._zeroDotEl.style.opacity=e===this._zero?"0":"1";let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${n}px)`)})}_updateSteps(){let t=this._stepsEl(),{width:r}=t.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let d=0;d<n;d+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let d=0;d<n;d+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let u=document.createElement("div");u.className="uc-zero-dot",a.appendChild(u),this._zeroDotEl=u,t.innerHTML="",t.appendChild(a),this._stepsCount=n}destroyCallback(){super.destroyCallback(),this._observer?.disconnect()}};Bt.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var Di=class extends O{static{s(this,"CloudImageEditorActivity")}couldBeCtxOwner=!0;activityType=g.activities.CLOUD_IMG_EDIT;_entry;_instance;get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:s(()=>this.mountEditor(),"onActivate"),onDeactivate:s(()=>this.unmountEditor(),"onDeactivate")}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let t=e.detail;this._entry.setMultipleValues({cdnUrl:t.cdnUrl,cdnUrlModifiers:t.cdnUrlModifiers}),this.modalManager?.close(g.activities.CLOUD_IMG_EDIT),this.historyBack()}handleCancel(){this.modalManager?.close(g.activities.CLOUD_IMG_EDIT),this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams,t=this.uploadCollection.read(e);if(!t)throw new Error(`Entry with internalId "${e}" not found`);this._entry=t;let r=this._entry.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let o=new de,n=this.cfg.cropPreset,a=this.cfg.cloudImageEditorTabs;o.setAttribute("ctx-name",this.ctxName),o.setAttribute("cdn-url",r),n&&o.setAttribute("crop-preset",n),a&&o.setAttribute("tabs",a),o.addEventListener("apply",l=>{let c=l;this.handleApply(c),this.debugPrint('editor event "apply"',c.detail)}),o.addEventListener("cancel",l=>{let c=l;this.handleCancel(),this.debugPrint('editor event "cancel"',c.detail)}),o.addEventListener("change",l=>{let c=l;this.debugPrint('editor event "change"',c.detail)}),this.innerHTML="",this.appendChild(o),this._instance=o}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};var ct=s(i=>i.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join("-"),"toKebabCase");var ql=[{test:s(i=>!!i.accept&&!!i.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:s(i=>i.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:s(i=>i.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],zs=M(i=>{for(let{test:e,message:t}of ql)e(i)&&Mi(t)},0);var R=s(i=>String(i),"asString"),B=s(i=>{let e=Number(i);if(Number.isNaN(e))throw new Error(`Invalid number: "${i}"`);return e},"asNumber"),k=s(i=>{if(typeof i>"u"||i===null)return!1;if(typeof i=="boolean")return i;if(i==="true"||i==="")return!0;if(i==="false")return!1;throw new Error(`Invalid boolean: "${i}"`)},"asBoolean"),Hs=s(i=>i==="auto"?i:k(i),"asStore"),js=s(i=>{let e=R(i);if(e!=="user"&&e!=="environment"&&e!=="")throw new Error(`Invalid value: "${e}"`);return e},"asCameraCapture"),Ks=s(i=>{let e=R(i);if(!Object.values(C).includes(e))throw new Error(`Invalid value: "${e}"`);return e},"asCameraMode"),Gs=s(i=>{let e=R(i),t=q(e);if(t.some(r=>!Object.values(C).includes(r)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return e},"asCameraModes"),Ws=s(i=>{if(typeof i=="object"&&!Array.isArray(i)||typeof i=="function")return i;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Gr=s(i=>{if(typeof i=="object")return i;throw new Error("Invalid value. Must be an object.")},"asObject"),Fi=s(i=>{if(typeof i=="function")return i;throw new Error("Invalid value. Must be a function.")},"asFunction"),Wr=s(i=>{if(Array.isArray(i))return i;throw new Error("Must be an array.")},"asArray"),qs=s(i=>{let e=R(i);if(["grid","list"].includes(e))return e;throw new Error(`Invalid value: "${e}"`)},"asFilesViewMode");var Xl={pubkey:R,multiple:k,multipleMin:B,multipleMax:B,confirmUpload:k,imgOnly:k,accept:R,externalSourcesPreferredTypes:R,externalSourcesEmbedCss:R,store:Hs,cameraMirror:k,cameraCapture:js,sourceList:R,topLevelOrigin:R,maxLocalFileSizeBytes:B,thumbSize:B,showEmptyList:k,useLocalImageEditor:k,useCloudImageEditor:k,cloudImageEditorTabs:R,removeCopyright:k,cropPreset:R,imageShrink:R,modalScrollLock:k,modalBackdropStrokes:k,sourceListWrap:k,remoteTabSessionKey:R,cdnCname:R,cdnCnamePrefixed:R,baseUrl:R,socialBaseUrl:R,secureSignature:R,secureExpire:R,secureDeliveryProxy:R,retryThrottledRequestMaxTimes:B,retryNetworkErrorMaxTimes:B,multipartMinFileSize:B,multipartChunkSize:B,maxConcurrentRequests:B,multipartMaxConcurrentRequests:B,multipartMaxAttempts:B,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:k,groupOutput:k,userAgentIntegration:R,debug:k,localeName:R,metadata:Ws,secureUploadsExpireThreshold:B,localeDefinitionOverride:s(i=>Gr(i),"localeDefinitionOverride"),secureUploadsSignatureResolver:s(i=>Fi(i),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:s(i=>Fi(i),"secureDeliveryProxyUrlResolver"),iconHrefResolver:s(i=>Fi(i),"iconHrefResolver"),fileValidators:Wr,collectionValidators:Wr,validationTimeout:B,validationConcurrency:B,cameraModes:Gs,defaultCameraMode:Ks,enableAudioRecording:k,enableVideoRecording:k,mediaRecorderOptions:Gr,maxVideoRecordingDuration:B,filesViewMode:qs,gridShowFileNames:k,cloudImageEditorAutoOpen:k,cloudImageEditorMaskHref:R,testMode:k,qualityInsights:k},Xs=s((i,e)=>{if(!(typeof e>"u"||e===null))try{return Xl[i](e)}catch(t){return console.error(`Invalid value for config key "${i}".`,t),Y[i]}},"normalizeConfigValue");var Zs=s((i,e)=>{let t=new URL(e);return t.hostname=`${i}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),Zl="0123456789abcdefghijklmnopqrstuvwxyz",Ys=s(i=>{if(i<=0n)return"0";let e="";for(;i>0n;){let t=i%36n;e=Zl[Number(t)]+e,i=i/36n}return e},"a"),qr=s((i,e)=>{try{let t=new URL(i),r=new URL(e);return t.hostname.endsWith(r.hostname)}catch{return!1}},"c");var Yl=s(async i=>{let e=new TextEncoder().encode(i),t=await window.crypto.subtle.digest("SHA-256",e),r=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${r}`)},"c"),Ql=10,Jl=s(async i=>{let e=await Yl(i);return Ys(e).slice(0,Ql)},"d"),Qs=s(async(i,e)=>{let t=await Jl(i);return Zs(t,e)},"f");var Js=s(i=>i instanceof Promise||!!(i&&typeof i=="object"&&"then"in i&&typeof i.then=="function"),"isPromiseLike");var Xr=s(i=>i,"defineComputedProperty"),ec=[Xr({key:"cameraModes",deps:["enableVideoRecording"],fn:s(({cameraModes:i,enableVideoRecording:e})=>{if(e===null)return i;let t=q(i);return e&&!t.includes("video")?t=t.concat("video"):e||(t=t.filter(r=>r!=="video")),ye(t)},"fn")}),Xr({key:"cameraModes",deps:["defaultCameraMode"],fn:s(({cameraModes:i,defaultCameraMode:e})=>{if(e===null)return i;let t=q(i);return t=t.sort((r,o)=>r===e?-1:o===e?1:0),ye(t)},"fn")}),Xr({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:s(({pubkey:i,cdnCname:e,cdnCnamePrefixed:t})=>i&&(e===Ct||qr(e,t))?Qs(i,t):e,"fn")})],Zr=s(({key:i,setValue:e,getValue:t})=>{for(let r of ec)if(r.deps.includes(i)){let o={[r.key]:t(r.key)};for(let a of r.deps)o[a]=t(a);let n=r.fn(o);if(Js(n)){let a=t(r.key);n.then(l=>{t(r.key)===a&&e(r.key,l)}).catch(l=>{console.error(`Failed to compute value for "${r.key}"`,l)})}else e(r.key,n)}},"runSideEffects");var Yr=[...new Set(["debug",...Object.keys(Y)])],tc=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],tn=s(i=>tc.includes(i),"isComplexKey"),zt=Yr.filter(i=>!tn(i)),ic={...Object.fromEntries(zt.map(i=>[ct(i),i])),...Object.fromEntries(zt.map(i=>[i.toLowerCase(),i]))},rc={...Object.fromEntries(zt.map(i=>[ct(i),j(i)])),...Object.fromEntries(zt.map(i=>[i.toLowerCase(),j(i)]))},en=s(i=>`__${i}`,"getLocalPropName"),ut=class extends b{static{s(this,"Config")}requireCtxName=!0;constructor(){super(),this.init$={...this.init$,...Object.fromEntries(Object.entries(Y).map(([e,t])=>[j(e),t]))}}_flushValueToAttribute(e,t){if(!tn(e)){let r=[...new Set([ct(e),e.toLowerCase()])];for(let o of r)typeof t>"u"||t===null?this.removeAttribute(o):this.getAttribute(o)!==t.toString()&&this.setAttribute(o,t.toString())}}_flushValueToState(e,t){this.$[j(e)]!==t&&(typeof t>"u"||t===null?this.$[j(e)]=Y[e]:this.$[j(e)]=t)}_setValue(e,t){let r=this,o=Xs(e,t),n=en(e);r[n]!==o&&(this._assertSameValueDifferentReference(e,r[n],o),r[n]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o),zs(this.cfg),Zr({key:e,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)}))}_getValue(e){let t=this,r=en(e);return t[r]??this.$[j(e)]}_assertSameValueDifferentReference(e,t,r){this.cfg.debug&&r!==t&&typeof r=="object"&&typeof t=="object"&&JSON.stringify(r)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,r))}initCallback(){super.initCallback();let e=this;for(let t of zt)this.sub(j(t),r=>{this._setValue(t,r)},!1);for(let t of Yr){let r=e[t]??this.$[j(t)];r!==Y[t]&&this._setValue(t,r),Object.defineProperty(this,t,{set:s(o=>{this._setValue(t,o)},"set"),get:s(()=>this._getValue(t),"get")}),Zr({key:t,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)})}}attributeChangedCallback(e,t,r){if(t===r)return;let o=this,n=ic[e];n&&(o[n]=r)}};ut.bindAttributes(rc);for(let i of Yr)ut.prototype[i]=void 0;var Vi=class extends b{static{s(this,"Copyright")}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",e=>{this.toggleAttribute("hidden",!!e)})}static template=`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`};function oc(i){return new Promise(e=>{typeof window.FileReader!="function"&&e(!1);try{let t=new FileReader;t.onerror=()=>{e(!0)};let r=s(o=>{o.type!=="loadend"&&t.abort(),e(!1)},"onLoad");t.onloadend=r,t.onprogress=r,t.readAsDataURL(i)}catch{e(!1)}})}s(oc,"checkIsDirectory");function sc(i,e){return new Promise(t=>{let r=0,o=[],n=s(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(r++,l.file(c=>{r--;let u=new File([c],c.name,{type:c.type||e});o.push({type:"file",file:u,fullPath:l.fullPath}),r===0&&t(o)})):l.isDirectory&&a(l.createReader())},"readEntry"),a=s(l=>{r++,l.readEntries(c=>{r--;for(let u of c)n(u);r===0&&t(o)})},"readReaderContent");n(i)})}s(sc,"readEntryContentAsync");function rn(i){let e=[],t=[];for(let r=0;r<i.items.length;r++){let o=i.items[r];if(o)if(o.kind==="file"){let n=o.type,a=o;if(typeof a.webkitGetAsEntry=="function"||typeof a.getAsEntry=="function"){let c=typeof a.webkitGetAsEntry=="function"?a.webkitGetAsEntry():a.getAsEntry?.();c&&t.push(sc(c,n).then(u=>{u&&e.push(...u)}));continue}let l=o.getAsFile();l&&t.push(oc(l).then(c=>{c||e.push({type:"file",file:l})}))}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(n=>{o.getAsString(a=>{e.push({type:"url",url:a}),n()})}))}return Promise.all(t).then(()=>e)}s(rn,"getDropItems");var G=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),on=["focus"],nc=100,Qr=new Map;function ac(i,e){let t=Math.max(Math.min(i[0],e.x+e.width),e.x),r=Math.max(Math.min(i[1],e.y+e.height),e.y);return Math.sqrt((i[0]-t)*(i[0]-t)+(i[1]-r)*(i[1]-r))}s(ac,"distance");function Jr(i){let e=0,t=document.body,r=new Set,o=s(m=>{r.add(m)},"handleSwitch"),n=G.INACTIVE,a=s(m=>{i.shouldIgnore()&&m!==G.INACTIVE||(n!==m&&r.forEach(v=>{v(m)}),n=m)},"setState"),l=s(()=>e>0,"isDragging");o(m=>i.onChange(m));let c=s(()=>{e=0,a(G.INACTIVE)},"onResetEvent"),u=s(()=>{e+=1,n===G.INACTIVE&&a(G.ACTIVE)},"onDragEnter"),d=s(()=>{e-=1,l()||a(G.INACTIVE)},"onDragLeave"),p=s(m=>{m.preventDefault(),e=0,a(G.INACTIVE)},"onDrop"),h=s(m=>{if(i.shouldIgnore())return;l()||(e+=1);let v=[m.x,m.y],y=i.element.getBoundingClientRect(),S=Math.floor(ac(v,y)),x=S<nc,A=m.composedPath().includes(i.element);Qr.set(i.element,S);let J=Math.min(...Qr.values())===S;A&&J?(m.preventDefault(),a(G.OVER)):a(x&&J?G.NEAR:G.ACTIVE)},"onDragOver"),f=s(async m=>{if(i.shouldIgnore())return;m.preventDefault();let{dataTransfer:v}=m;if(!v)return;let y=await rn(v);i.onItems(y),a(G.INACTIVE)},"onElementDrop");return t.addEventListener("drop",p),t.addEventListener("dragleave",d),t.addEventListener("dragenter",u),t.addEventListener("dragover",h),i.element.addEventListener("drop",f),on.forEach(m=>{window.addEventListener(m,c)}),()=>{Qr.delete(i.element),t.removeEventListener("drop",p),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",h),i.element.removeEventListener("drop",f),on.forEach(m=>{window.removeEventListener(m,c)})}}s(Jr,"addDropzone");var sn="uc-drop-area",Ni=`${sn}/registry`,dt=class extends O{static{s(this,"DropArea")}static styleAttrs=[...super.styleAttrs,"uc-drop-area"];_destroyDropzone=null;_destroyContentWrapperDropzone=null;_onAreaClicked=null;constructor(){super(),this.init$={...this.init$,state:G.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,isInitFlow:!1,text:"",[Ni]:new Set}}isActive(){if(!this.$.isEnabled)return!1;let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,r=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth),o=window.getComputedStyle(this),n=o.visibility!=="hidden"&&o.display!=="none";return t&&n&&r}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[Ni].add(this),this.defineAccessor("disabled",r=>{this.set$({isEnabled:!k(r)})}),this.defineAccessor("clickable",r=>{this.set$({isClickable:k(r)})}),this.defineAccessor("initflow",r=>{this.set$({isInitFlow:k(r)})}),this.defineAccessor("with-icon",r=>{this.set$({withIcon:k(r)})}),this.defineAccessor("fullscreen",r=>{this.set$({isFullscreen:k(r)})}),this.defineAccessor("text",r=>{typeof r=="string"?this.bindL10n("text",()=>this.l10n(r)||r):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Jr({element:this,shouldIgnore:s(()=>this._shouldIgnore(),"shouldIgnore"),onChange:s(r=>{this.$.state=r},"onChange"),onItems:s(r=>{r.length&&(r.forEach(o=>{o.type==="url"?this.api.addFileFromUrl(o.url,{source:P.DROP_AREA}):o.type==="file"&&this.api.addFileFromObject(o.file,{source:P.DROP_AREA,fullPath:o.fullPath})}),this.uploadCollection.size&&(this.modalManager?.open(g.activities.UPLOAD_LIST),this.set$({"*currentActivity":g.activities.UPLOAD_LIST})))},"onItems")});let t=this.ref["content-wrapper"];if(t&&(this._destroyContentWrapperDropzone=Jr({element:t,onChange:s(r=>{let o=Object.entries(G).find(([,n])=>n===r)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o)},"onChange"),onItems:s(()=>{},"onItems"),shouldIgnore:s(()=>this._shouldIgnore(),"shouldIgnore")})),this.sub("state",r=>{let o=Object.entries(G).find(([,n])=>n===r)?.[0].toLowerCase();o&&this.setAttribute("drag-state",o)}),this.subConfigValue("sourceList",r=>{let o=D(r);this.$.isEnabled=o.includes(P.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",r=>{this.toggleAttribute("hidden",!r)}),this.sub("isClickable",r=>{this.toggleAttribute("clickable",r)}),this.$.isClickable){let r=s(o=>{if(o instanceof KeyboardEvent){if(o.code==="Space"||o.code==="Enter"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}}else if(o instanceof MouseEvent){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}},"onAreaClicked");this._onAreaClicked=r,this.addEventListener("keydown",r),this.addEventListener("click",r)}}_shouldIgnore(){if(!this.$.isEnabled||!this._couldHandleFiles())return!0;if(!this.$.isFullscreen)return!1;let e=this.$[Ni];return e.size===0?!1:[...e].filter(o=>o!==this).filter(o=>o.isActive()).length>0}_couldHandleFiles(){let e=this.cfg.multiple,t=this.cfg.multipleMax,r=this.uploadCollection.size;return!(e&&t&&r>=t||!e&&r>0)}destroyCallback(){super.destroyCallback();let e=this.$[Ni];e.delete(this),e.size===0&&T.deleteCtx(sn),this._destroyDropzone?.(),this._destroyContentWrapperDropzone?.(),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked),this._onAreaClicked=null)}};dt.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;dt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null,initflow:null});var nn=s(()=>{let i=globalThis.top??globalThis.parent??globalThis.self;try{return i.location.origin}catch(e){return console.warn("Unable to access top-level window location:",e),globalThis.location.origin}},"getTopLevelOrigin");var lc=s(i=>i.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),an=s((i,e="i")=>{let t=i.split("*").map(lc);return new RegExp(`^${t.join(".+")}$`,e)},"wildcardRegexp");var cc=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],uc=s((i,e)=>window.getComputedStyle(i).getPropertyValue(e).trim(),"getCssValue"),ln=s(i=>{let e={};for(let t of cc){let r=uc(i,t);r&&(e[t]=r)}return e},"buildThemeDefinition");var dc=["selected-files-change","toolbar-state-change"],pc=s(i=>{if(!i||typeof i!="object"||!("type"in i))return!1;let e=i.type;return!(typeof e!="string"||!dc.includes(e))},"isWhitelistedMessage"),Bi=class{static{s(this,"MessageBridge")}_handlerMap=new Map;_context;constructor(e){this._context=e,window.addEventListener("message",this._handleMessage)}_handleMessage=s(e=>{if(e.source!==this._context)return;let t=e.data;if(!pc(t))return;let r=this._handlerMap.get(t.type);if(r)for(let o of r)o(t)},"_handleMessage");on(e,t){let r=this._handlerMap.get(e)??new Set;this._handlerMap.has(e)||this._handlerMap.set(e,r),r.add(t)}send(e){this._context.postMessage(e,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};function cn(i){let e=[];for(let[t,r]of Object.entries(i))r==null||typeof r=="string"&&r.length===0||e.push(`${t}=${encodeURIComponent(r)}`);return e.join("&")}s(cn,"queryString");var hc={[se.GDRIVE]:"ngdrive"},Ht=class extends O{static{s(this,"ExternalSource")}couldBeCtxOwner=!0;activityType=g.activities.EXTERNAL;_messageBridge;constructor(){super(),this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",doneBtnTextClass:"uc-hidden",toolbarVisible:!0,onDone:s(()=>{for(let e of this.$.selectedList){let t=this.extractUrlFromSelectedFile(e),{filename:r}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(t,{fileName:r,source:o})}this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.modalManager?.open(g.activities.UPLOAD_LIST)},"onDone"),onCancel:s(()=>{this.historyBack()},"onCancel"),onSelectAll:s(()=>{this._messageBridge?.send({type:"select-all"})},"onSelectAll"),onDeselectAll:s(()=>{this._messageBridge?.send({type:"deselect-all"})},"onDeselectAll")}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:s(()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e[0]?.toUpperCase()}${e?.slice(1)}`,activityIcon:e}),this.mountIframe()},"onActivate")}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.applyEmbedCss(e)})}extractUrlFromSelectedFile(e){if(e.alternatives){let t=D(this.cfg.externalSourcesPreferredTypes);for(let r of t){let o=an(r);for(let[n,a]of Object.entries(e.alternatives))if(o.test(n))return a}}return e.url}handleToolbarStateChange(e){this.set$({toolbarVisible:e.isVisible})}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({doneBtnTextClass:e.isReady?"":"uc-hidden",isSelectionReady:e.isReady,isDoneBtnEnabled:e.isReady&&e.selectedFiles.length>0,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyEmbedCss(this.cfg.externalSourcesEmbedCss),this.applyTheme(),this.setupL10n()}applyTheme(){this._messageBridge?.send({type:"set-theme-definition",theme:ln(this)})}applyEmbedCss(e){this._messageBridge?.send({type:"set-embed-css",css:e})}setupL10n(){this._messageBridge?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){let{pubkey:e,remoteTabSessionKey:t,socialBaseUrl:r,multiple:o}=this.cfg,{externalSourceType:n}=this.activityParams,a=hc[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:e,images_only:"false",session_key:t,wait_for_theme:!0,multiple:o.toString(),origin:this.cfg.topLevelOrigin||nn(),debug:this.cfg.debug},u=new URL(`/window4/${a}`,r);return u.search=cn(c),u.toString()}mountIframe(){let e=sr({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&(this._messageBridge?.destroy(),this._messageBridge=new Bi(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this._messageBridge.on("toolbar-state-change",this.handleToolbarStateChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){this._messageBridge?.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};Ht.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar" set="@hidden: !toolbarVisible"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;"><uc-spinner set="@hidden: isSelectionReady"></uc-spinner><span l10n="done" set="@class: doneBtnTextClass"></span></button></div></div>`;var Hi=s(()=>{let i=[];return{stack:i,promiseReadJpegChunks:s(t=>new Promise((r,o)=>{let n=2,a=s((u,d)=>{let p=new FileReader;p.addEventListener("load",()=>{d(new DataView(p.result))}),p.addEventListener("error",h=>{o(`Reader error: ${h}`)}),p.readAsArrayBuffer(u)},"readToView"),l=s(()=>a(t.slice(n,n+128),u=>{let d,p,h;for(d=p=0,h=u.byteLength;h>=0?p<h:p>h;d=h>=0?++p:--p)if(u.getUint8(d)===255){n+=d;break}c()}),"readNext"),c=s(()=>{let u=n;return a(t.slice(n,n+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){o("Corrupted");return}let p=d.getUint8(1);if(p===218){r(!0);return}let h=d.getUint16(2)-2;return a(t.slice(n,n+=h),f=>{if(f.byteLength!==h){o("Corrupted");return}i.push({startPos:u,length:h,marker:p,view:f}),l()})})},"readNextChunk");FileReader&&DataView||o("Not Support"),a(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),mc=s(async i=>{let e=[],{promiseReadJpegChunks:t,stack:r}=Hi();return await t(i),r.forEach(({marker:o,view:n})=>{o===226&&n.getUint32(0)===1229144927&&n.getUint32(4)===1347571526&&n.getUint32(8)===1229735168&&e.push(n)}),e},"getIccProfile"),dn=s(async(i,e,t)=>{{let r=[],o=[],{promiseReadJpegChunks:n,stack:a}=Hi();await n(i),a.forEach(u=>{if(u.marker===e)return r.push(u.startPos),o.push(u.length)});let l=[i.slice(0,2)];for(let u of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+e),d.setUint16(2,u.byteLength+2),l.push(d.buffer),l.push(u)}let c=2;for(let u=0;u<r.length;u++)r[u]>c&&l.push(i.slice(c,r[u])),c=r[u]+o[u]+4;return l.push(i.slice(c,i.size)),new Blob(l,{type:i.type})}},"replaceJpegChunk"),fc=226,pn=s((i,e)=>dn(i,fc,e.map(t=>t.buffer)),"replaceIccProfile"),gc=s(async i=>{try{return await pn(i,[])}catch(e){throw new Error(`Failed to strip ICC profile: ${e}`)}},"stripIccProfile"),vc=s((i,e,t)=>new Promise((r,o)=>{let n=s(a=>{if(!a){o("Failed to convert canvas to blob");return}r(a)},"callback");i.toBlob(n,e,t),i.width=i.height=1}),"canvasToBlob"),jt=s(()=>{let i=document.createElement("canvas"),e=i.getContext("2d");return{canvas:i,ctx:e}},"createCanvas"),yc=s(i=>{let{ctx:t,canvas:r}=jt();r.width=r.height=50,t.drawImage(i,0,0,50,50);let o=t.getImageData(0,0,50,50).data;r.width=r.height=1;for(let n=3;n<o.length;n+=4)if(o[n]<254)return!0;return!1},"hasTransparency"),bc=s(async i=>{let e=null,{promiseReadJpegChunks:t,stack:r}=Hi();return await t(i),r.forEach(({marker:o,view:n})=>{if(!e&&o===225&&n.byteLength>=14&&n.getUint32(0)===1165519206&&n.getUint16(4)===0){e=n;return}}),e},"getExif"),_c="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",zi,wc=s(()=>new Promise(i=>{if(zi!==void 0)i(zi);else{let e=new Image;e.addEventListener("load",()=>{zi=e.naturalWidth<e.naturalHeight,e.src="//:0",i(zi)}),e.src=_c}}),"isBrowserApplyExifOrientation"),Cc=s((i,e)=>{let t,r,o,n;if(!i||i.byteLength<14||i.getUint32(0)!==1165519206||i.getUint16(4)!==0)return;if(i.getUint16(6)===18761)r=!0;else if(i.getUint16(6)===19789)r=!1;else return;if(i.getUint16(8,r)!==42)return;o=8+i.getUint32(10,r);let a=i.getUint16(o-2,r);for(t=0,n=a;n>=0?t<n:t>n;n>=0?++t:--t){if(i.byteLength<o+10)return;i.getUint16(o,r)===274&&e(o+8,r),o+=12}},"findExifOrientation"),Ec=s((i,e)=>{Cc(i,(t,r)=>i.setUint16(t,e,r))},"setExifOrientation"),Tc=s(async(i,e,t)=>(t&&Ec(e,1),dn(i,225,[e.buffer])),"replaceExif"),xc=s((i,e)=>new Promise((t,r)=>{e&&(i.src=e),i.complete?t(i):(i.addEventListener("load",()=>{t(i)}),i.addEventListener("error",()=>{r(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),Ac=s(i=>xc(new Image,i),"imageLoader"),Sc=[1,3],Ic=[192,193,194,195,197,198,199,201,202,203,205,206,207],un={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},kc=s(async i=>{let e=!1,{promiseReadJpegChunks:t,stack:r}=Hi();return await t(i).then(()=>(r.forEach(({marker:o,view:n})=>{if(!e&&Ic.indexOf(o)>=0){let a=n.getUint8(5);Sc.indexOf(a)<0&&(e=!0)}}),e)).catch(()=>e)},"shouldSkipShrink"),hn=s((i,e)=>{let t={};return(...r)=>{let o=e(r,t);return o in t?t[o]:t[o]=i(...r)}},"memoize"),mn=s((i,e)=>{let[t]=i,r=Object.keys(e).map(o=>parseInt(o,10)).sort((o,n)=>o-n);for(let o=0;o<r.length;o++){let n=r[o],a=!!e[n];if(n>t&&a||n<t&&!a)return n}return t},"memoKeySerializer"),Ue={R:55,G:110,B:165,A:255},Oc=`rgba(${Ue.R}, ${Ue.G}, ${Ue.B}, ${Ue.A/255})`,fn=s((i,e)=>{try{let t=[i-1,e-1,1,1],{canvas:r,ctx:o}=jt();r.width=1,r.height=1;let{canvas:n,ctx:a}=jt();n.width=i,n.height=e,a&&(a.fillStyle=Oc,a.fillRect(...t),o.drawImage(n,i-1,e-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Ue.R&&l[1]===Ue.G&&l[2]===Ue.B&&l[3]===Ue.A),n.width=n.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${i}x${e}.`),!1}},"canvasTest");function gn(i){return(...e)=>new Promise(t=>{setTimeout(()=>{let r=i(...e);t(r)},0)})}s(gn,"wrapAsync");var Mc=gn(hn(fn,mn)),Lc=gn(hn(fn,mn)),vn=s(async(i,e)=>{let t=un.squareSide.find(a=>a*a>=i*e),r=un.dimension.find(a=>a>=i&&a>=e);if(!t||!r)throw new Error("Not supported");let[o,n]=await Promise.all([Mc(t,t),Lc(r,1)]);if(o&&n)return!0;throw new Error("Not supported")},"testCanvasSize"),yn=s(async(i,e,t)=>{try{let{ctx:r,canvas:o}=jt();return o.width=e,o.height=t,r.imageSmoothingQuality="high",r.drawImage(i,0,0,e,t),i instanceof HTMLImageElement&&(i.src="//:0"),i instanceof HTMLCanvasElement&&(i.width=i.height=1),o}catch(r){throw new Error("Canvas resize error",{cause:r})}},"canvasResize"),Rc=s(({img:i,targetW:e,targetH:t})=>yn(i,e,t),"native"),Pc=s(function({sourceW:i,targetW:e,targetH:t,step:r}){let o=[],n=e,a=t;do o.push([n,a]),n=Math.round(n/r),a=Math.round(a/r);while(n<i*r);return o.reverse()},"calcShrinkSteps"),Uc=s(({img:i,sourceW:e,targetW:t,targetH:r,step:o})=>{let n=Pc({sourceW:e,targetW:t,targetH:r,step:o});return n.reduce((a,[l,c],u)=>a.then(d=>vn(l,c).then(()=>yn(d,l,c)).catch(()=>{if(u===n.length-1)throw new Error("Not supported");return d})),Promise.resolve(i))},"fallback"),$c=s(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Dc=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),eo=.71,Fc=s((i,e)=>{if(i.width*eo*i.height*eo<e.size)throw new Error("Not required");let t=i.width,r=i.height,o=t/r,n=Math.floor(Math.sqrt(e.size*o)),a=Math.floor(e.size/Math.sqrt(e.size*o));return vn(n,a).then(()=>{let{ctx:l}=jt();return"imageSmoothingQuality"in l&&!$c()&&!Dc?Rc({img:i,targetW:n,targetH:a}):Uc({img:i,sourceW:t,targetW:n,targetH:a,step:eo})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),bn=s(async(i,e)=>{try{if(await kc(i))throw new Error("Should skipped");let r=await Promise.allSettled([bc(i),wc(),mc(i)]),n=!r.some(v=>v.status==="rejected"),[a,l,c]=r,u=await gc(i).catch(()=>i),d=await Ac(URL.createObjectURL(u));URL.revokeObjectURL(d.src);let p=await Fc(d,e),h="image/jpeg",f=e?.quality||.8;!n&&yc(p)&&(h="image/png",f=void 0);let m=await vc(p,h,f);if(n&&a.status==="fulfilled"&&a.value){let v=a.value,y=l.status==="fulfilled"?l.value:!1;m=await Tc(m,v,y)}return n&&c.status==="fulfilled"&&c.value.length>0&&(m=await pn(m,c.value)),m}catch(t){let r;throw t instanceof Error&&(r=t.message),typeof t=="string"&&(r=t),new Error(`Failed to shrink image. ${r?`Message: "${r}".`:""}`,{cause:t})}},"shrinkFile");var Vc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,_n=s(i=>{if(typeof i!="string")return!1;let e=Vc.exec(i.toLocaleLowerCase())??[];if(e.length===0)return!1;let t=Number(e[1])*Number(e[2]),r=16384*16384;return t>r?(console.warn(`Shrinked size can not be larger than ${Math.floor(r/1e3/1e3)}MP. You have set ${e[1]}x${e[2]} (${Math.ceil(t/1e3/100)/10}MP).`),!1):{quality:e[3]?Number(e[3])/100:void 0,size:t}},"parseShrink");var pt=class extends O{static{s(this,"FileItemConfig")}_entrySubs=new Set;_entry=null;_withEntry(e){return(...t)=>{let r=this._entry;if(!r){console.warn("No entry found");return}return e(r,...t)}}_subEntry(e,t){this._withEntry((r,o,n)=>{let a=r.subscribe(o,l=>{this.isConnected&&n(l)});this._entrySubs.add(a)})(e,t)}_reset(){for(let e of this._entrySubs)e.remove();this._entrySubs=new Set,this._entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}};var F=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),ji=class i extends pt{static{s(this,"FileItem")}couldBeCtxOwner=!0;pauseRender=!0;_renderedOnce=!1;_observer;_isIntersecting=!1;_thumbRect;constructor(){super(),this.init$={...this.init$,uid:"",itemName:"",errorText:"",hint:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,showFileNames:!1,state:F.IDLE,ariaLabelStatusFile:"",onEdit:this._withEntry(e=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:e.uid},this.modalManager?.open(g.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=g.activities.CLOUD_IMG_EDIT}),onRemove:s(()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uploadCollection.remove(this.$.uid)},"onRemove"),onUpload:s(()=>{this.upload()},"onUpload")}}_calculateState=this._withEntry(e=>{let t=F.IDLE;e.getValue("errors").length>0?t=F.FAILED:e.getValue("isQueuedForUploading")?t=F.QUEUED_UPLOADING:e.getValue("isQueuedForValidation")?t=F.QUEUED_VALIDATION:e.getValue("isValidationPending")?t=F.VALIDATION:e.getValue("isUploading")?t=F.UPLOADING:e.getValue("fileInfo")&&(t=F.FINISHED),this.$.state=t});_debouncedCalculateState=M(this._calculateState.bind(this),100);_updateHintAndProgress=this._withEntry(ot((e,t)=>{let r=e.getValue("errors")?.[0]?.message,o=e.getValue("source"),n=e.getValue("externalUrl"),a=t===F.UPLOADING,l=t===F.QUEUED_UPLOADING,c=t===F.QUEUED_VALIDATION,u=t===F.VALIDATION,d=e.getValue("fileName"),p="";r?p="":n&&o&&Object.values(se).includes(o)&&(p=this.l10n("waiting-for",{source:this.l10n(`src-type-${o}`)})),this.set$({hint:p,errorText:r,progressVisible:a||l||c||u,progressValue:c||u?0:e.getValue("uploadProgress"),ariaLabelStatusFile:d&&this.l10n("a11y-file-item-status",{fileName:d,status:this.l10n(t?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()})})},100));_handleState=this._withEntry((e,t)=>{t===F.FAILED?this.$.badgeIcon="badge-error":t===F.FINISHED&&(this.$.badgeIcon="badge-success"),t===F.UPLOADING&&(this.$.isFocused=!1),this.set$({isFailed:t===F.FAILED,isUploading:t===F.UPLOADING,isFinished:t===F.FINISHED,isEditable:this.cfg.useCloudImageEditor&&e.getValue("isImage")&&e.getValue("cdnUrl")}),this._updateHintAndProgress(t)});_reset(){super._reset(),this._debouncedCalculateState.cancel()}_observerCallback(e){let[t]=e;t&&(this._isIntersecting=t.isIntersecting,this._thumbRect=t.boundingClientRect,t.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0))}_handleEntryId(e){this._reset();let t=this.uploadCollection?.read(e);this._entry=t,t&&(this._subEntry("isQueuedForValidation",()=>{this._debouncedCalculateState()}),this._subEntry("isValidationPending",()=>{this._debouncedCalculateState()}),this._subEntry("uploadProgress",()=>{this._debouncedCalculateState()}),this._subEntry("isQueuedForUploading",()=>{this._debouncedCalculateState()}),this._subEntry("fileName",r=>{this.$.itemName=r||t.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",r=>{this.$.itemName=t.getValue("fileName")||r||this.l10n("file-no-name")}),this._subEntry("fileInfo",()=>{this._debouncedCalculateState()}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()))}_updateShowFileNames(e){if(this.cfg.filesViewMode==="list"){this.$.showFileNames=!0;return}this.$.showFileNames=e}initCallback(){super.initCallback(),this.sub("uid",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.subConfigValue("filesViewMode",e=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",e)}),this.subConfigValue("gridShowFileNames",e=>{this._updateShowFileNames(e)}),this.onclick=()=>{i.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{this._entry&&!e.has(this._entry.uid)||setTimeout(()=>this.isConnected&&this.upload())}),i.activeInstances.add(this)}destroyCallback(){super.destroyCallback(),i.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_settingsOfShrink(){return _n(this.cfg.imageShrink)}async _processShrink(e){let t=this._settingsOfShrink();return t?await bn(e,t):(console.warn("Image shrink settings are invalid, skipping shrinking"),e)}upload=this._withEntry(async e=>{if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0||e.getValue("isValidationPending"))return;let t=this.cfg.multiple?this.cfg.multipleMax:1;if(!(t&&this.uploadCollection.size>t)){e.setMultipleValues({isUploading:!0,errors:[],isQueuedForUploading:!0}),this._debouncedCalculateState();try{let r=new AbortController;e.setValue("abortController",r);let o=s(async()=>{e.setValue("isQueuedForUploading",!1);let a=e.getValue("file");if(a instanceof File&&this.cfg.imageShrink)try{a=await this._processShrink(a)}catch{}let l=a||e.getValue("externalUrl")||e.getValue("uuid");if(!l)throw new Error("No file input");let u={...await this.getUploadClientOptions(),fileName:e.getValue("fileName")??void 0,source:e.getValue("source")??void 0,onProgress:s(d=>{if(d.isComputable){let p=d.value*100;e.setValue("uploadProgress",p)}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",l,u),wr(l,u)},"uploadTask"),n=await this.$["*uploadQueue"].add(o);e.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:e.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:e.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:e.getValue("source")??null}),e===this._entry&&this._debouncedCalculateState()}catch(r){this.telemetryManager.sendEventError(r,"file upload. Failed to upload file"),r instanceof ke&&r.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):r instanceof De?e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),e===this._entry&&this._debouncedCalculateState()}}});static template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><uc-thumb set="uid:uid;badgeIcon:badgeIcon"></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span><span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button;@aria-label:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button;@aria-label:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames;" ></uc-progress-bar></div>`;static activeInstances=new Set};var Ki=class extends O{static{s(this,"FormInput")}requireCtxName=!0;_validationInputElement=null;_dynamicInputsContainer=null;_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,_t(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{{if(!this._dynamicInputsContainer){let n=document.createElement("div");this.appendChild(n),this._dynamicInputsContainer=n}if(!this._validationInputElement){let n=this._createValidationInput();this.appendChild(n),this._validationInputElement=n}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let n=e.errors[0]?.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(n??"");return}let t=e.group?e.group:null;if(t){this._validationInputElement.value=t.cdnUrl??"",this._validationInputElement.setCustomValidity("");return}let r=e.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this._validationInputElement.value=r[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let o=new DocumentFragment;for(let n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=n,o.appendChild(a)}this._dynamicInputsContainer.replaceChildren(o)}},!1)}};var ht=class extends b{static{s(this,"Icon")}constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",e=>{if(!e)return;let t=`#uc-icon-${e}`;this.subConfigValue("iconHrefResolver",r=>{r&&(t=r(e)??t),this.$.href=t})}),this.setAttribute("aria-hidden","true")}};ht.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;ht.bindAttributes({name:"name"});var wn=s(i=>[...new Set(i)],"uniqueArray");var mt="--uc-img-",to="unresolved";var io=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ro=3e3,oo=5e3,so=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Nc="https://ucarecdn.com",Kt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Nc},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var Cn=Object.create(null);for(let i in Kt)Cn[mt+i]=Kt[i]?.default||"";var Gi=class extends ge{static{s(this,"ImgConfig")}cssInit$=Cn;$$(e){return this.$[mt+e]}set$$(e){for(let t in e)this.$[mt+t]=e[t]}sub$$(e,t){this.sub(mt+e,r=>{r===null||r===""||t(r)})}analyticsParams(){return`-/@clib/${Te}/${xe}/uc-img/`}initAttributes(e){[...this.attributes].forEach(t=>{Kt[t.name]||e.setAttribute(t.name,t.value)})}initIntersection(e,t){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(t(),this._isnObserver.unobserve(e))})},r),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Kt)}attributeChangedCallback(e,t,r){window.setTimeout(()=>{this.$[mt+e]=r})}};var En=s(i=>Object.entries(i).filter(([e,t])=>t!==void 0&&t!=="").map(([e,t])=>e==="cdn-operations"||e==="analytics"?t:`${e}/${t}`),"parseObjectToString");var Xi=class extends Gi{static{s(this,"ImgBase")}_img=new Image;_imgPreview=new Image;_fmtAbs(e){return!e.includes("//")&&!io&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if(e?.trim()!==""){let t=e.match(/\d+/)[0],r=e.match(/[a-zA-Z]+/)[0],o=parseInt(t,10);if(Number(o)>oo&&this.hasFormatJPG)return oo+r;if(Number(o)>ro&&!this.hasFormatJPG)return ro+r}return e}_getCdnModifiers(e,t){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:t,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return z(...En(r))}_getUrlBase(e="",t=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(io&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(e,t);if(this.$$("src").startsWith(this.$$("cdn-cname")))return $(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl($(Se(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl($(Se(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl($(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl($(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?Et(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:s(r=>window.encodeURIComponent(r),"transform")}):e}_getElSize(e,t=1,r=!0){let o=e.getBoundingClientRect(),n=t*Math.round(o.width),a=r?"":t*Math.round(o.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(e){let t=s(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)e.addEventListener(o,t)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:so.PREVIEW,img:this._imgPreview}:{type:so.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=D(this.$$("breakpoints"));return wn(e.map(t=>parseInt(t,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let t=new Set;t.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&t.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&t.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let r=`image-set(${[...t].join(", ")})`;e.style.setProperty("background-image",r),e.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(t=>{e.add(this._getUrlBase(t+"x")+` ${this._validateSize(t+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(t*2+"x")+` ${this._validateSize(t*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(t*3+"x")+` ${this._validateSize(t*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:t,srcset:r}){t&&(e.src=t),r&&(e.srcset=r)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:t,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(to,""),r.addEventListener("load",()=>{r.removeAttribute(to),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:e,srcset:t})})}async renderImage(){if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var Zi=class extends Xi{static{s(this,"Img")}initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",e=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=e?"lazy":"eager")})}};var no=null,Gt=class extends b{static{s(this,"Modal")}static styleAttrs=[...super.styleAttrs,"uc-modal"];static StateConsumerScope="modal";_mouseDownTarget;handleModalOpen;handleModalClose;handleModalCloseAll;constructor(){super(),this.init$={...this.init$,closeClicked:this._handleDialogClose}}_handleBackdropClick=s(()=>{this._closeDialog()},"_handleBackdropClick");_closeDialog=s(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="")},"_closeDialog");_handleDialogClose=s(()=>{this._closeDialog()},"_handleDialogClose");_handleDialogMouseDown=s(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown");_handleDialogMouseUp=s(e=>{let t=e.target;t===this.ref.dialog&&t===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp");show(){let e=this.ref.dialog;typeof e.showModal=="function"?(this.setAttribute("aria-modal","true"),e.showModal()):e.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden")}hide(){let e=this.ref.dialog;typeof e.close=="function"?(this.setAttribute("aria-modal","false"),e.close()):e.removeAttribute("open")}_handleModalOpen({id:e}){e===this.id?(no=e,this.show(),this.emit(_.MODAL_OPEN,{modalId:e},{debounce:!0})):this.hide()}_handleModalClose({id:e}){e===this.id&&(this.hide(),this.emit(_.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0}))}_handleModalCloseAll(e){this.hide(),no===this.id&&this.emit(_.MODAL_CLOSE,{modalId:no,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0})}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this);let e=this.ref.dialog;e.addEventListener("close",this._handleDialogClose),e.addEventListener("mousedown",this._handleDialogMouseDown),e.addEventListener("mouseup",this._handleDialogMouseUp),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.handleModalCloseAll=this._handleModalCloseAll.bind(this),this.modalManager?.subscribe(U.OPEN,this.handleModalOpen),this.modalManager?.subscribe(U.CLOSE,this.handleModalClose),this.modalManager?.subscribe(U.CLOSE_ALL,this.handleModalCloseAll)}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0;let e=this.ref.dialog;e.removeEventListener("close",this._handleDialogClose),e.removeEventListener("mousedown",this._handleDialogMouseDown),e.removeEventListener("mouseup",this._handleDialogMouseUp),this.modalManager?.unsubscribe(U.OPEN,this.handleModalOpen),this.modalManager?.unsubscribe(U.CLOSE,this.handleModalClose),this.modalManager?.unsubscribe(U.CLOSE_ALL,this.handleModalCloseAll)}};Gt.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Wt=class extends b{static{s(this,"ProgressBar")}_value=0;_visible=!0;constructor(){super(),this.init$={...this.init$,width:0,opacity:0}}initCallback(){super.initCallback();let e=s(()=>{let t=this.ref.fakeProgressLine;if(!this._visible){t.classList.add("uc-fake-progress--hidden");return}this._value>0&&t.classList.add("uc-fake-progress--hidden")},"handleFakeProgressAnimation");this.ref.fakeProgressLine.addEventListener("animationiteration",e),this.defineAccessor("value",t=>{t!=null&&(this._value=t,this._visible&&this.style.setProperty("--l-progress-value",this._value.toString()))}),this.defineAccessor("visible",t=>{this._visible=t,this.classList.toggle("uc-progress-bar--hidden",!t)})}};Wt.template=`<div ref="fakeProgressLine" class="uc-fake-progress"></div><div ref="realProgressLine" class="uc-progress"></div>`;var qt=class extends O{static{s(this,"ProgressBarCommon")}_unobserveCollectionCb;constructor(){super(),this.init$={...this.init$,visible:!1,value:0,"*commonProgress":0}}initCallback(){super.initCallback(),this._unobserveCollectionCb=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(t=>this.uploadCollection.read(t)?.getValue("isUploading")??!1);this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){super.destroyCallback(),this._unobserveCollectionCb?.(),this._unobserveCollectionCb=void 0}};qt.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var Xt=class extends b{static{s(this,"Select")}constructor(){super(),this.init$={...this.init$,currentText:"",options:[],selectHtml:"",onSelect:s(e=>{e.preventDefault(),e.stopPropagation();let t=this.ref.select;this.value=t.value,this.$.currentText=this.$.options.find(r=>r.value===this.value)?.text||"",this.dispatchEvent(new Event("change"))},"onSelect")}}initCallback(){super.initCallback(),this.sub("options",e=>{this.$.currentText=e?.[0]?.text||"";let t="";e?.forEach(r=>{t+=`<option value="${r.value}">${r.text}</option>`}),this.$.selectHtml=t})}};Xt.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var ft=class extends O{static{s(this,"SimpleBtn")}static styleAttrs=[...super.styleAttrs,"uc-simple-btn"];couldBeCtxOwner=!0;constructor(){super(),this.init$={...this.init$,withDropZone:!0,onClick:s(()=>{this.api.initFlow()},"onClick"),"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e>"u"||(this.$.withDropZone=k(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};ft.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;ft.bindAttributes({dropzone:null});var Bc="src-type-",gt=class extends O{static{s(this,"SourceBtn")}couldBeCtxOwner=!0;type=void 0;_registeredTypes={};constructor(){super(),this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:P.LOCAL,activate:s(()=>(this.api.openSystemDialog(),!1),"activate")}),this.registerType({type:P.URL,activity:g.activities.URL,textKey:"from-url"}),this.registerType({type:P.CAMERA,activity:g.activities.CAMERA,activate:s(()=>{let e=Ve.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:!0}),!e},"activate")}),this.registerType({type:"draw",activity:g.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(Ur))this.registerType({type:e,activity:g.activities.CAMERA,activate:s(()=>{let t=Ve.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:!0,modeCamera:e==="mobile-photo-camera"?C.PHOTO:C.VIDEO}),!t},"activate")});for(let e of Object.values(se))this.registerType({type:e,activity:g.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type];if(!e)return;let{activity:t,activate:r,activityParams:o={}}=e;(r?r():!!t)&&t&&(this.modalManager?.open(t),this.set$({"*currentActivityParams":o,"*currentActivity":t}))}applyType(e){let t=this._registeredTypes[e];if(!t){console.warn(`Unsupported source type: ${e}`);return}let{textKey:r=e,icon:o=e}=t;this.$["src-type"]=`${Bc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};gt.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;gt.bindAttributes({type:null});var Yi=class extends b{static{s(this,"SourceList")}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{let t=D(e),r="";t.forEach(o=>{if(o==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");return}if(o==="camera"&&Ve.htmlMediaCapture){this.subConfigValue("cameraModes",n=>{let a=q(n);a.forEach(l=>{r+=`<uc-source-btn role="listitem" type="mobile-${l}-camera"></uc-source-btn>`}),a.length===0&&(r+='<uc-source-btn role="listitem" type="mobile-photo-camera"></uc-source-btn>')});return}r+=`<uc-source-btn role="listitem" type="${o}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=r:this.outerHTML=r})}};var Zt=class extends ge{static{s(this,"Spinner")}};Zt.template='<div class="uc-spinner"></div>';var Yt=class extends g{static{s(this,"StartFrom")}historyTracked=!0;activityType=g.activities.START_FROM;initCallback(){super.initCallback(),this.registerActivity(this.activityType??"")}};Yt.template='<div class="uc-content"><slot></slot></div>';function ao(i,e=40){if(i.type==="image/svg+xml")return URL.createObjectURL(i);let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)return Promise.reject(new Error("Canvas context not supported"));let o=new Image,n=new Promise((a,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=e,t.height=e*c):(t.height=e,t.width=e/c),r.fillStyle="rgb(240, 240, 240)",r.fillRect(0,0,t.width,t.height),r.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let d=URL.createObjectURL(u);a(d)})},o.onerror=c=>{l(c)}});return o.src=URL.createObjectURL(i),n}s(ao,"generateThumb");function zc(i){let e=new Blob([i],{type:"image/svg+xml"});return URL.createObjectURL(e)}s(zc,"createSvgBlobUrl");function Qi(i="hsl(209, 21%, 65%)",e=32,t=32){return zc(`<svg width="${e}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${i}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}s(Qi,"fileCssBg");var Hc=3e3,vt=class extends pt{static{s(this,"Thumb")}_renderedGridOnce=!1;_thumbRect=null;_isIntersecting=!1;_firstViewMode=this.cfg.filesViewMode;_observer;constructor(){super(),this.init$={...this.init$,thumbUrl:"",badgeIcon:"",uid:""}}_calculateThumbSize(e=!1){e&&(this._thumbRect=this.getBoundingClientRect());let t=Math.max(parseInt(String(this?._thumbRect?.height||0),10),parseInt(String(this?._thumbRect?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(t*=window.devicePixelRatio),Math.min(t,Hc)}_generateThumbnail=this._withEntry(async(e,t=!1)=>{let r=e.getValue("fileInfo"),o=e.getValue("isImage"),n=e.getValue("uuid"),a=e.getValue("thumbUrl"),l=this._calculateThumbSize(t);if(r&&o&&n){let u=await this.proxyUrl($(Se(this.cfg.cdnCname,n),z(e.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===u)return;let{promise:d}=He(u);d.then(()=>{e.setValue("thumbUrl",u),a?.startsWith("blob:")&&URL.revokeObjectURL(a)}).catch(async()=>{if(!a?.startsWith("blob:"))try{let p=e.getValue("file");if(!p)return;let h=await ao(p,l);e.setValue("thumbUrl",h)}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let h=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Qi(h))}});return}if(e.getValue("thumbUrl"))return;let c=e.getValue("file");if(c?.type.includes("image"))try{let u=await ao(c,l);e.setValue("thumbUrl",u)}catch(u){this.telemetryManager.sendEventError(u,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Qi(d))}else{let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",Qi(u))}});_debouncedGenerateThumb=M(this._generateThumbnail.bind(this),100);_observerCallback(e){let[t]=e;t&&(this._isIntersecting=t.isIntersecting,t.isIntersecting&&(this._thumbRect=t.boundingClientRect,this._debouncedGenerateThumb(),this._observer?.disconnect()),t.intersectionRatio===0&&this._debouncedGenerateThumb.cancel())}_reset(){super._reset(),this._debouncedGenerateThumb.cancel()}_handleEntryId(e){this._reset();let t=this.uploadCollection?.read(e);this._entry=t,t&&(this._subEntry("fileInfo",r=>{r?.isImage&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",r=>{this.$.thumbUrl=r?`url(${r})`:""}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.defineAccessor("badgeIcon",e=>{this.$.badgeIcon=e}),this.defineAccessor("uid",e=>{this.set$({uid:e})}),this.sub("uid",e=>{this._handleEntryId(e)}),this.subConfigValue("filesViewMode",e=>{e==="grid"&&!this._renderedGridOnce&&(this._firstViewMode==="list"&&this._debouncedGenerateThumb(!0),this._renderedGridOnce=!0)}),this.setAttribute("role","img")}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set,this._debouncedGenerateThumb.cancel(),this._observer?.disconnect()}};vt.template=`<div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div>`;vt.bindAttributes({badgeIcon:null,uid:null});var Ji=class extends O{static{s(this,"UploadCtxProvider")}static styleAttrs=["uc-wgt-common"];static EventType=_;requireCtxName=!0;initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};var Qt=class extends O{static{s(this,"UploadList")}couldBeCtxOwner=!0;historyTracked=!0;activityType=g.activities.UPLOAD_LIST;constructor(){super(),this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:s(()=>{this.api.initFlow(!0)},"onAdd"),onUpload:s(()=>{this.emit(_.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},"onUpload"),onDone:s(()=>{this.emit(_.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},"onDone"),onCancel:s(()=>{this.uploadCollection.clearAll()},"onCancel")}}_throttledHandleCollectionUpdate=ot(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll())},300);_updateUploadsState(){let e=this.api.getOutputCollectionState(),t={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount,validatingBeforeUploading:e.idleEntries.filter(h=>h.isValidationPending).length},r=!e.errors.some(h=>h.type==="TOO_MANY_FILES"||h.type==="TOO_FEW_FILES"),o=e.errors.some(h=>h.type==="TOO_MANY_FILES"),n=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=e.allEntries.some(h=>h.isValidationPending),l=t.failed===0&&e.errors.length===0&&!a,c=!1,u=!1,d=!1;if(t.total-t.succeed-t.uploading-t.failed>0&&r&&l)c=!0;else{u=!0;let h=this.cfg.groupOutput?!!e.group:!0;d=t.total===t.succeed&&r&&l&&h}this.set$({doneBtnVisible:u,doneBtnEnabled:d,uploadBtnVisible:c,addMoreBtnEnabled:t.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple,hasFiles:t.total>0}),this.bindL10n("headerText",()=>this._getHeaderText(t))}_getHeaderText(e){let t=s(r=>{let o=e[r];return r==="uploading"&&(o+=e.validatingBeforeUploading),this.l10n(`header-${r}`,{count:o})},"localizedText");return e.uploading>0||e.validatingBeforeUploading>0?t("uploading"):e.failed>0?t("failed"):e.succeed>0?t("succeed"):t("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",e=>{e&&this._throttledHandleCollectionUpdate()}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e)}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.observeCollection(this._throttledHandleCollectionUpdate),this.sub("*collectionErrors",e=>{let t=e.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!t){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:t.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.unobserveCollection(this._throttledHandleCollectionUpdate)}};Qt.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files"><div class="uc-files-wrapper" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Jt=class extends O{static{s(this,"UrlSource")}couldBeCtxOwner=!0;activityType=g.activities.URL;constructor(){super(),this.init$={...this.init$,importDisabled:!0,onUpload:s(e=>{e.preventDefault();let t=this.ref.input.value;this.api.addFileFromUrl(t,{source:P.URL}),this.modalManager?.open(g.activities.UPLOAD_LIST),this.$["*currentActivity"]=g.activities.UPLOAD_LIST},"onUpload"),onCancel:s(()=>{this.historyBack()},"onCancel"),onInput:s(e=>{let t=e.target?.value??"";this.set$({importDisabled:!t})},"onInput")}}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:s(()=>{let e=this.ref.input;e.value="",e.focus()},"onActivate")})}};Jt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back;@aria-label:back"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><label><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var er=class extends de{static{s(this,"CloudImageEditor")}static styleAttrs=[...super.styleAttrs,"uc-wgt-common"];constructor(){super(),this.init$={...this.init$,"*solution":this.tagName}}initCallback(){super.initCallback(),this.emit(ve.INIT_SOLUTION,void 0),this.a11y?.registerBlock(this)}};var ei=class extends ae{static{s(this,"FileUploaderInline")}static styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];constructor(){super(),this.init$={...this.init$,couldCancel:!1,"*solution":this.tagName,cancel:s(()=>{if(this.couldHistoryBack){let e=this.$["*historyBack"];e?.();return}this.couldShowList&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)},"cancel")}}get couldHistoryBack(){let e=this.$["*history"];return!e||e.length<=1?!1:e[e.length-1]!==g.activities.START_FROM}get couldShowList(){let e=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(e)&&e.length>0}initCallback(){super.initCallback(),this.emit(ve.INIT_SOLUTION,void 0);let e=this.ref.uBlock;e&&(this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{Array.isArray(t)&&t.length>0&&this.$["*currentActivity"]===(e.initActivity||g.activities.START_FROM)&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList}))}};ei.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var lo="active",tr="",ti=class extends ae{static{s(this,"FileUploaderMinimal")}static styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];handleModalOpen;handleModalClose;constructor(){super(),this.init$={...this.init$,singleUpload:!1,isHiddenStartFrom:!1,classUploadList:tr,classStartFrom:tr,"*solution":this.tagName}}_handleModalOpen(e){e.id===g.activities.CLOUD_IMG_EDIT&&this.set$({classUploadList:lo}),this.$["*currentActivity"]===g.activities.UPLOAD_LIST&&this.set$({classUploadList:lo,isHiddenStartFrom:!0});let t=this.$["*uploadList"];(!t||t.length<=0)&&this.set$({classStartFrom:lo})}_handleModalClose(e){e.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.set$({isHiddenStartFrom:!1})),e.id===g.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=g.activities.UPLOAD_LIST)}initCallback(){super.initCallback(),this.emit(ve.INIT_SOLUTION,void 0);let e=this.ref.uBlock;e&&(this.sub("*currentActivity",t=>{t===g.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),t||(this.$["*currentActivity"]=e.initActivity||g.activities.START_FROM)}),this.sub("*uploadList",t=>{Array.isArray(t)&&t.length>0?(this.$["*currentActivity"]=g.activities.UPLOAD_LIST,this.set$({classStartFrom:tr})):(this.set$({classUploadList:tr,isHiddenStartFrom:!1}),this.$["*currentActivity"]=e.initActivity||g.activities.START_FROM)}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t),this.subConfigValue("multiple",r=>{t==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.$.singleUpload=!r):(this.style.removeProperty("--uc-grid-col"),this.$.singleUpload=!1)})}),this.handleModalOpen=t=>{this._handleModalOpen(t)},this.handleModalClose=t=>{this._handleModalClose(t)},this.modalManager?.subscribe(U.OPEN,this.handleModalOpen),this.modalManager?.subscribe(U.CLOSE,this.handleModalClose))}destroyCallback(){super.destroyCallback(),this.modalManager?.unsubscribe(U.OPEN,this.handleModalOpen),this.modalManager?.unsubscribe(U.CLOSE,this.handleModalClose)}};ti.template=`<uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom"><uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;var yt=class extends ae{static{s(this,"FileUploaderRegular")}static styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];constructor(){super();let e={...this.init$,isHidden:!1,"*solution":this.tagName};this.init$=e}initCallback(){super.initCallback(),this.emit(ve.INIT_SOLUTION,void 0),this.defineAccessor("headless",e=>{this.set$({isHidden:k(e)})})}};yt.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;yt.bindAttributes({headless:null});return On(jc);})();
|