@uploadcare/file-uploader 1.28.0-alpha.0 → 1.28.0-alpha.111
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/CTX.d.ts +5 -3
- package/dist/abstract/CTX.d.ts.map +1 -0
- package/dist/abstract/TypedCollection.d.ts +2 -1
- package/dist/abstract/TypedCollection.d.ts.map +1 -0
- package/dist/abstract/TypedData.d.ts +3 -2
- package/dist/abstract/TypedData.d.ts.map +1 -0
- package/dist/abstract/UploaderPublicApi.d.ts +7 -6
- package/dist/abstract/UploaderPublicApi.d.ts.map +1 -0
- package/dist/abstract/buildOutputCollectionState.d.ts +3 -2
- package/dist/abstract/buildOutputCollectionState.d.ts.map +1 -0
- package/dist/abstract/customConfigOptions.d.ts +1 -0
- package/dist/abstract/customConfigOptions.d.ts.map +1 -0
- package/dist/abstract/defineComponents.d.ts +1 -0
- package/dist/abstract/defineComponents.d.ts.map +1 -0
- package/dist/abstract/features/ClipboardLayer.d.ts +2 -1
- package/dist/abstract/features/ClipboardLayer.d.ts.map +1 -0
- package/dist/abstract/loadFileUploaderFrom.d.ts +1 -0
- package/dist/abstract/loadFileUploaderFrom.d.ts.map +1 -0
- package/dist/abstract/loadFileUploaderFrom.js +1 -8
- package/dist/abstract/localeRegistry.d.ts +1 -0
- package/dist/abstract/localeRegistry.d.ts.map +1 -0
- package/dist/abstract/managers/LocaleManager.d.ts +3 -2
- package/dist/abstract/managers/LocaleManager.d.ts.map +1 -0
- package/dist/abstract/managers/ModalManager.d.ts +3 -2
- package/dist/abstract/managers/ModalManager.d.ts.map +1 -0
- package/dist/abstract/managers/SecureUploadsManager.d.ts +2 -1
- package/dist/abstract/managers/SecureUploadsManager.d.ts.map +1 -0
- package/dist/abstract/managers/TelemetryManager.d.ts +4 -3
- package/dist/abstract/managers/TelemetryManager.d.ts.map +1 -0
- package/dist/abstract/managers/ValidationManager.d.ts +7 -6
- package/dist/abstract/managers/ValidationManager.d.ts.map +1 -0
- package/dist/abstract/managers/a11y.d.ts +3 -2
- package/dist/abstract/managers/a11y.d.ts.map +1 -0
- package/dist/abstract/managers/plugin/PluginManager.d.ts +3 -2
- package/dist/abstract/managers/plugin/PluginManager.d.ts.map +1 -0
- package/dist/abstract/managers/plugin/PluginTypes.d.ts +4 -3
- package/dist/abstract/managers/plugin/PluginTypes.d.ts.map +1 -0
- package/dist/abstract/managers/plugin/index.d.ts +1 -0
- package/dist/abstract/managers/plugin/index.d.ts.map +1 -0
- package/dist/abstract/sharedConfigKey.d.ts +2 -1
- package/dist/abstract/sharedConfigKey.d.ts.map +1 -0
- package/dist/abstract/uploadEntrySchema.d.ts +4 -3
- package/dist/abstract/uploadEntrySchema.d.ts.map +1 -0
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts +2 -0
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts.map +1 -0
- package/dist/blocks/CameraSource/CameraSource.d.ts +7 -2
- package/dist/blocks/CameraSource/CameraSource.d.ts.map +1 -0
- package/dist/blocks/CameraSource/calcCameraModes.d.ts +2 -1
- package/dist/blocks/CameraSource/calcCameraModes.d.ts.map +1 -0
- package/dist/blocks/CameraSource/constants.d.ts +1 -0
- package/dist/blocks/CameraSource/constants.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/index.d.ts +2 -0
- package/dist/blocks/CloudImageEditor/index.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +10 -2
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +5 -3
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +4 -2
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +4 -2
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +4 -2
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts +5 -3
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts +12 -2
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +5 -3
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/index.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/index.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/state.d.ts +3 -2
- package/dist/blocks/CloudImageEditor/src/state.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/types.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/types.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/util.d.ts +2 -1
- package/dist/blocks/CloudImageEditor/src/util.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +1 -0
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +5 -2
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -0
- package/dist/blocks/Config/Config.d.ts +4 -2
- package/dist/blocks/Config/Config.d.ts.map +1 -0
- package/dist/blocks/Config/assertions.d.ts +2 -1
- package/dist/blocks/Config/assertions.d.ts.map +1 -0
- package/dist/blocks/Config/computed-properties.d.ts +2 -1
- package/dist/blocks/Config/computed-properties.d.ts.map +1 -0
- package/dist/blocks/Config/initialConfig.d.ts +2 -1
- package/dist/blocks/Config/initialConfig.d.ts.map +1 -0
- package/dist/blocks/Config/normalizeConfigValue.d.ts +2 -1
- package/dist/blocks/Config/normalizeConfigValue.d.ts.map +1 -0
- package/dist/blocks/Config/validatorsType.d.ts +5 -4
- package/dist/blocks/Config/validatorsType.d.ts.map +1 -0
- package/dist/blocks/Copyright/Copyright.d.ts +3 -1
- package/dist/blocks/Copyright/Copyright.d.ts.map +1 -0
- package/dist/blocks/DropArea/DropArea.d.ts +5 -2
- package/dist/blocks/DropArea/DropArea.d.ts.map +1 -0
- package/dist/blocks/DropArea/addDropzone.d.ts +1 -0
- package/dist/blocks/DropArea/addDropzone.d.ts.map +1 -0
- package/dist/blocks/DropArea/getDropItems.d.ts +1 -0
- package/dist/blocks/DropArea/getDropItems.d.ts.map +1 -0
- package/dist/blocks/ExternalSource/ExternalSource.d.ts +6 -1
- package/dist/blocks/ExternalSource/ExternalSource.d.ts.map +1 -0
- package/dist/blocks/ExternalSource/MessageBridge.d.ts +2 -1
- package/dist/blocks/ExternalSource/MessageBridge.d.ts.map +1 -0
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts +2 -1
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts.map +1 -0
- package/dist/blocks/ExternalSource/query-string.d.ts +1 -0
- package/dist/blocks/ExternalSource/query-string.d.ts.map +1 -0
- package/dist/blocks/ExternalSource/types.d.ts +1 -0
- package/dist/blocks/ExternalSource/types.d.ts.map +1 -0
- package/dist/blocks/FileItem/FileItem.d.ts +8 -3
- package/dist/blocks/FileItem/FileItem.d.ts.map +1 -0
- package/dist/blocks/FileItem/FileItemConfig.d.ts +2 -1
- package/dist/blocks/FileItem/FileItemConfig.d.ts.map +1 -0
- package/dist/blocks/FormInput/FormInput.d.ts +1 -0
- package/dist/blocks/FormInput/FormInput.d.ts.map +1 -0
- package/dist/blocks/Icon/Icon.d.ts +4 -2
- package/dist/blocks/Icon/Icon.d.ts.map +1 -0
- package/dist/blocks/Img/Img.d.ts +1 -0
- package/dist/blocks/Img/Img.d.ts.map +1 -0
- package/dist/blocks/Img/ImgBase.d.ts +1 -0
- package/dist/blocks/Img/ImgBase.d.ts.map +1 -0
- package/dist/blocks/Img/ImgConfig.d.ts +3 -2
- package/dist/blocks/Img/ImgConfig.d.ts.map +1 -0
- package/dist/blocks/Img/configurations.d.ts +1 -0
- package/dist/blocks/Img/configurations.d.ts.map +1 -0
- package/dist/blocks/Img/props-map.d.ts +1 -0
- package/dist/blocks/Img/props-map.d.ts.map +1 -0
- package/dist/blocks/Img/utils/parseObjectToString.d.ts +1 -0
- package/dist/blocks/Img/utils/parseObjectToString.d.ts.map +1 -0
- package/dist/blocks/Modal/Modal.d.ts +4 -2
- package/dist/blocks/Modal/Modal.d.ts.map +1 -0
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +8 -5
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts.map +1 -0
- package/dist/blocks/PluginActivityRenderer/index.d.ts +1 -0
- package/dist/blocks/PluginActivityRenderer/index.d.ts.map +1 -0
- package/dist/blocks/ProgressBar/ProgressBar.d.ts +4 -2
- package/dist/blocks/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +5 -2
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +1 -0
- package/dist/blocks/Select/Select.d.ts +3 -1
- package/dist/blocks/Select/Select.d.ts.map +1 -0
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts +5 -1
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -0
- package/dist/blocks/SourceBtn/SourceBtn.d.ts +5 -2
- package/dist/blocks/SourceBtn/SourceBtn.d.ts.map +1 -0
- package/dist/blocks/SourceList/SourceList.d.ts +4 -2
- package/dist/blocks/SourceList/SourceList.d.ts.map +1 -0
- package/dist/blocks/Spinner/Spinner.d.ts +3 -1
- package/dist/blocks/Spinner/Spinner.d.ts.map +1 -0
- package/dist/blocks/StartFrom/StartFrom.d.ts +4 -2
- package/dist/blocks/StartFrom/StartFrom.d.ts.map +1 -0
- package/dist/blocks/Thumb/Thumb.d.ts +6 -3
- package/dist/blocks/Thumb/Thumb.d.ts.map +1 -0
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts +5 -4
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -0
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +2 -1
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -0
- package/dist/blocks/UploadList/UploadList.d.ts +7 -1
- package/dist/blocks/UploadList/UploadList.d.ts.map +1 -0
- package/dist/blocks/UrlSource/UrlSource.d.ts +5 -1
- package/dist/blocks/UrlSource/UrlSource.d.ts.map +1 -0
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts +1 -0
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +1 -0
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts +1 -0
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -0
- package/dist/cameraPlugin.js +1 -0
- package/dist/cloudImageEditorPlugin.css +1282 -0
- package/dist/cloudImageEditorPlugin.js +1 -0
- package/dist/cloudImageEditorPlugin.layered.css +1289 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +1 -8
- package/dist/externalSourcesPlugin.js +1 -0
- package/dist/imageShrinkPlugin.js +1 -0
- package/dist/index.css +1376 -3328
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -1011
- package/dist/index.layered.css +1046 -3564
- package/dist/index.ssr.js +1290 -0
- package/dist/instagramPlugin.js +1 -0
- package/dist/lit/BaseComponent.d.ts +4 -3
- package/dist/lit/BaseComponent.d.ts.map +1 -0
- package/dist/lit/Constructor.d.ts +1 -0
- package/dist/lit/Constructor.d.ts.map +1 -0
- package/dist/lit/CssDataMixin.d.ts +3 -2
- package/dist/lit/CssDataMixin.d.ts.map +1 -0
- package/dist/lit/LightDomMixin.d.ts +3 -2
- package/dist/lit/LightDomMixin.d.ts.map +1 -0
- package/dist/lit/LitActivityBlock.d.ts +4 -3
- package/dist/lit/LitActivityBlock.d.ts.map +1 -0
- package/dist/lit/LitBlock.d.ts +17 -16
- package/dist/lit/LitBlock.d.ts.map +1 -0
- package/dist/lit/LitSolutionBlock.d.ts +6 -5
- package/dist/lit/LitSolutionBlock.d.ts.map +1 -0
- package/dist/lit/LitUploaderBlock.d.ts +8 -7
- package/dist/lit/LitUploaderBlock.d.ts.map +1 -0
- package/dist/lit/PubSubCompat.d.ts +1 -0
- package/dist/lit/PubSubCompat.d.ts.map +1 -0
- package/dist/lit/RegisterableElementMixin.d.ts +3 -2
- package/dist/lit/RegisterableElementMixin.d.ts.map +1 -0
- package/dist/lit/SharedState.d.ts +23 -22
- package/dist/lit/SharedState.d.ts.map +1 -0
- package/dist/lit/SymbioteCompatMixin.d.ts +3 -2
- package/dist/lit/SymbioteCompatMixin.d.ts.map +1 -0
- package/dist/lit/TestModeController.d.ts +3 -2
- package/dist/lit/TestModeController.d.ts.map +1 -0
- package/dist/lit/Uid.d.ts +1 -0
- package/dist/lit/Uid.d.ts.map +1 -0
- package/dist/lit/activity-constants.d.ts +2 -1
- package/dist/lit/activity-constants.d.ts.map +1 -0
- package/dist/lit/createDebugPrinter.d.ts +3 -2
- package/dist/lit/createDebugPrinter.d.ts.map +1 -0
- package/dist/lit/findBlockInCtx.d.ts +3 -2
- package/dist/lit/findBlockInCtx.d.ts.map +1 -0
- package/dist/lit/getOutputData.d.ts +3 -2
- package/dist/lit/getOutputData.d.ts.map +1 -0
- package/dist/lit/hasBlockInCtx.d.ts +3 -2
- package/dist/lit/hasBlockInCtx.d.ts.map +1 -0
- package/dist/lit/l10n.d.ts +3 -2
- package/dist/lit/l10n.d.ts.map +1 -0
- package/dist/lit/parseCssPropertyValue.d.ts +1 -0
- package/dist/lit/parseCssPropertyValue.d.ts.map +1 -0
- package/dist/lit/shared-instances.d.ts +15 -14
- package/dist/lit/shared-instances.d.ts.map +1 -0
- package/dist/locales/file-uploader/ar.d.ts +1 -0
- package/dist/locales/file-uploader/ar.d.ts.map +1 -0
- package/dist/locales/file-uploader/ar.js +1 -143
- package/dist/locales/file-uploader/az.d.ts +1 -0
- package/dist/locales/file-uploader/az.d.ts.map +1 -0
- package/dist/locales/file-uploader/az.js +1 -135
- package/dist/locales/file-uploader/ca.d.ts +1 -0
- package/dist/locales/file-uploader/ca.d.ts.map +1 -0
- package/dist/locales/file-uploader/ca.js +1 -137
- package/dist/locales/file-uploader/cs.d.ts +1 -0
- package/dist/locales/file-uploader/cs.d.ts.map +1 -0
- package/dist/locales/file-uploader/cs.js +1 -139
- package/dist/locales/file-uploader/da.d.ts +1 -0
- package/dist/locales/file-uploader/da.d.ts.map +1 -0
- package/dist/locales/file-uploader/da.js +1 -135
- package/dist/locales/file-uploader/de.d.ts +1 -0
- package/dist/locales/file-uploader/de.d.ts.map +1 -0
- package/dist/locales/file-uploader/de.js +1 -135
- package/dist/locales/file-uploader/el.d.ts +1 -0
- package/dist/locales/file-uploader/el.d.ts.map +1 -0
- package/dist/locales/file-uploader/el.js +1 -135
- package/dist/locales/file-uploader/en.d.ts +1 -0
- package/dist/locales/file-uploader/en.d.ts.map +1 -0
- package/dist/locales/file-uploader/en.js +1 -8
- package/dist/locales/file-uploader/es.d.ts +1 -0
- package/dist/locales/file-uploader/es.d.ts.map +1 -0
- package/dist/locales/file-uploader/es.js +1 -137
- package/dist/locales/file-uploader/et.d.ts +1 -0
- package/dist/locales/file-uploader/et.d.ts.map +1 -0
- package/dist/locales/file-uploader/et.js +1 -135
- package/dist/locales/file-uploader/fi.d.ts +1 -0
- package/dist/locales/file-uploader/fi.d.ts.map +1 -0
- package/dist/locales/file-uploader/fi.js +1 -135
- package/dist/locales/file-uploader/fr.d.ts +1 -0
- package/dist/locales/file-uploader/fr.d.ts.map +1 -0
- package/dist/locales/file-uploader/fr.js +1 -137
- package/dist/locales/file-uploader/he.d.ts +1 -0
- package/dist/locales/file-uploader/he.d.ts.map +1 -0
- package/dist/locales/file-uploader/he.js +1 -137
- package/dist/locales/file-uploader/hy.d.ts +1 -0
- package/dist/locales/file-uploader/hy.d.ts.map +1 -0
- package/dist/locales/file-uploader/hy.js +1 -135
- package/dist/locales/file-uploader/is.d.ts +1 -0
- package/dist/locales/file-uploader/is.d.ts.map +1 -0
- package/dist/locales/file-uploader/is.js +1 -135
- package/dist/locales/file-uploader/it.d.ts +1 -0
- package/dist/locales/file-uploader/it.d.ts.map +1 -0
- package/dist/locales/file-uploader/it.js +1 -137
- package/dist/locales/file-uploader/ja.d.ts +1 -0
- package/dist/locales/file-uploader/ja.d.ts.map +1 -0
- package/dist/locales/file-uploader/ja.js +1 -135
- package/dist/locales/file-uploader/ka.d.ts +1 -0
- package/dist/locales/file-uploader/ka.d.ts.map +1 -0
- package/dist/locales/file-uploader/ka.js +1 -135
- package/dist/locales/file-uploader/kk.d.ts +1 -0
- package/dist/locales/file-uploader/kk.d.ts.map +1 -0
- package/dist/locales/file-uploader/kk.js +1 -135
- package/dist/locales/file-uploader/ko.d.ts +1 -0
- package/dist/locales/file-uploader/ko.d.ts.map +1 -0
- package/dist/locales/file-uploader/ko.js +1 -135
- package/dist/locales/file-uploader/lv.d.ts +1 -0
- package/dist/locales/file-uploader/lv.d.ts.map +1 -0
- package/dist/locales/file-uploader/lv.js +1 -137
- package/dist/locales/file-uploader/nb.d.ts +1 -0
- package/dist/locales/file-uploader/nb.d.ts.map +1 -0
- package/dist/locales/file-uploader/nb.js +1 -135
- package/dist/locales/file-uploader/nl.d.ts +1 -0
- package/dist/locales/file-uploader/nl.d.ts.map +1 -0
- package/dist/locales/file-uploader/nl.js +1 -135
- package/dist/locales/file-uploader/pl.d.ts +1 -0
- package/dist/locales/file-uploader/pl.d.ts.map +1 -0
- package/dist/locales/file-uploader/pl.js +1 -139
- package/dist/locales/file-uploader/pt.d.ts +1 -0
- package/dist/locales/file-uploader/pt.d.ts.map +1 -0
- package/dist/locales/file-uploader/pt.js +1 -137
- package/dist/locales/file-uploader/ro.d.ts +1 -0
- package/dist/locales/file-uploader/ro.d.ts.map +1 -0
- package/dist/locales/file-uploader/ro.js +1 -137
- package/dist/locales/file-uploader/ru.d.ts +1 -0
- package/dist/locales/file-uploader/ru.d.ts.map +1 -0
- package/dist/locales/file-uploader/ru.js +1 -139
- package/dist/locales/file-uploader/sk.d.ts +1 -0
- package/dist/locales/file-uploader/sk.d.ts.map +1 -0
- package/dist/locales/file-uploader/sk.js +1 -139
- package/dist/locales/file-uploader/sr.d.ts +1 -0
- package/dist/locales/file-uploader/sr.d.ts.map +1 -0
- package/dist/locales/file-uploader/sr.js +1 -137
- package/dist/locales/file-uploader/sv.d.ts +1 -0
- package/dist/locales/file-uploader/sv.d.ts.map +1 -0
- package/dist/locales/file-uploader/sv.js +1 -135
- package/dist/locales/file-uploader/tr.d.ts +1 -0
- package/dist/locales/file-uploader/tr.d.ts.map +1 -0
- package/dist/locales/file-uploader/tr.js +1 -135
- package/dist/locales/file-uploader/uk.d.ts +1 -0
- package/dist/locales/file-uploader/uk.d.ts.map +1 -0
- package/dist/locales/file-uploader/uk.js +1 -139
- package/dist/locales/file-uploader/vi.d.ts +1 -0
- package/dist/locales/file-uploader/vi.d.ts.map +1 -0
- package/dist/locales/file-uploader/vi.js +1 -135
- package/dist/locales/file-uploader/zh-TW.d.ts +1 -0
- package/dist/locales/file-uploader/zh-TW.d.ts.map +1 -0
- package/dist/locales/file-uploader/zh-TW.js +1 -135
- package/dist/locales/file-uploader/zh.d.ts +1 -0
- package/dist/locales/file-uploader/zh.d.ts.map +1 -0
- package/dist/locales/file-uploader/zh.js +1 -135
- package/dist/plugins/cameraPlugin.d.ts +2 -1
- package/dist/plugins/cameraPlugin.d.ts.map +1 -0
- package/dist/plugins/cloudImageEditorPlugin.d.ts +2 -1
- package/dist/plugins/cloudImageEditorPlugin.d.ts.map +1 -0
- package/dist/plugins/externalSourcesPlugin.d.ts +2 -1
- package/dist/plugins/externalSourcesPlugin.d.ts.map +1 -0
- package/dist/plugins/imageShrinkPlugin.d.ts +2 -1
- package/dist/plugins/imageShrinkPlugin.d.ts.map +1 -0
- package/dist/plugins/instagramPlugin.d.ts +2 -1
- package/dist/plugins/instagramPlugin.d.ts.map +1 -0
- package/dist/plugins/unsplashPlugin.d.ts +2 -1
- package/dist/plugins/unsplashPlugin.d.ts.map +1 -0
- package/dist/plugins/urlSourcePlugin.d.ts +2 -1
- package/dist/plugins/urlSourcePlugin.d.ts.map +1 -0
- package/dist/solutions/adaptive-image/index.d.ts +1 -0
- package/dist/solutions/adaptive-image/index.d.ts.map +1 -0
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts +1 -0
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -0
- package/dist/solutions/cloud-image-editor/index.d.ts +2 -0
- package/dist/solutions/cloud-image-editor/index.d.ts.map +1 -0
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts +10 -1
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -0
- package/dist/solutions/file-uploader/inline/index.d.ts +1 -0
- package/dist/solutions/file-uploader/inline/index.d.ts.map +1 -0
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +11 -1
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -0
- package/dist/solutions/file-uploader/minimal/index.d.ts +1 -0
- package/dist/solutions/file-uploader/minimal/index.d.ts.map +1 -0
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts +12 -1
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -0
- package/dist/solutions/file-uploader/regular/index.d.ts +1 -0
- package/dist/solutions/file-uploader/regular/index.d.ts.map +1 -0
- package/dist/types/dom.d.ts +1 -0
- package/dist/types/dom.d.ts.map +1 -0
- package/dist/types/events.d.ts +2 -1
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/exported.d.ts +11 -10
- package/dist/types/exported.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/urlSourcePlugin.js +1 -0
- package/dist/utils/UID.d.ts +2 -1
- package/dist/utils/UID.d.ts.map +1 -0
- package/dist/utils/UploadSource.d.ts +1 -0
- package/dist/utils/UploadSource.d.ts.map +1 -0
- package/dist/utils/WindowHeightTracker.d.ts +2 -1
- package/dist/utils/WindowHeightTracker.d.ts.map +1 -0
- package/dist/utils/abilities.d.ts +1 -0
- package/dist/utils/abilities.d.ts.map +1 -0
- package/dist/utils/applyStyles.d.ts +1 -0
- package/dist/utils/applyStyles.d.ts.map +1 -0
- package/dist/utils/browser-info.d.ts +1 -0
- package/dist/utils/browser-info.d.ts.map +1 -0
- package/dist/utils/cdn-utils.d.ts +1 -0
- package/dist/utils/cdn-utils.d.ts.map +1 -0
- package/dist/utils/comma-separated.d.ts +1 -0
- package/dist/utils/comma-separated.d.ts.map +1 -0
- package/dist/utils/debounce.d.ts +1 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/delay.d.ts.map +1 -0
- package/dist/utils/fileTypes.d.ts +1 -0
- package/dist/utils/fileTypes.d.ts.map +1 -0
- package/dist/utils/get-top-level-origin.d.ts +1 -0
- package/dist/utils/get-top-level-origin.d.ts.map +1 -0
- package/dist/utils/getLocaleDirection.d.ts +1 -0
- package/dist/utils/getLocaleDirection.d.ts.map +1 -0
- package/dist/utils/getPluralForm.d.ts +1 -0
- package/dist/utils/getPluralForm.d.ts.map +1 -0
- package/dist/utils/isPromiseLike.d.ts +1 -0
- package/dist/utils/isPromiseLike.d.ts.map +1 -0
- package/dist/utils/isSecureTokenExpired.d.ts +2 -1
- package/dist/utils/isSecureTokenExpired.d.ts.map +1 -0
- package/dist/utils/memoize.d.ts +1 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/mixinClass.d.ts +1 -0
- package/dist/utils/mixinClass.d.ts.map +1 -0
- package/dist/utils/parseCdnUrl.d.ts +1 -0
- package/dist/utils/parseCdnUrl.d.ts.map +1 -0
- package/dist/utils/parseShrink.d.ts +1 -0
- package/dist/utils/parseShrink.d.ts.map +1 -0
- package/dist/utils/preloadImage.d.ts +1 -0
- package/dist/utils/preloadImage.d.ts.map +1 -0
- package/dist/utils/prettyBytes.d.ts +1 -0
- package/dist/utils/prettyBytes.d.ts.map +1 -0
- package/dist/utils/resizeImage.d.ts +1 -0
- package/dist/utils/resizeImage.d.ts.map +1 -0
- package/dist/utils/stringToArray.d.ts +1 -0
- package/dist/utils/stringToArray.d.ts.map +1 -0
- package/dist/utils/template-utils.d.ts +1 -0
- package/dist/utils/template-utils.d.ts.map +1 -0
- package/dist/utils/throttle.d.ts +1 -0
- package/dist/utils/throttle.d.ts.map +1 -0
- package/dist/utils/toKebabCase.d.ts +1 -0
- package/dist/utils/toKebabCase.d.ts.map +1 -0
- package/dist/utils/transparentPixelSrc.d.ts +1 -0
- package/dist/utils/transparentPixelSrc.d.ts.map +1 -0
- package/dist/utils/uniqueArray.d.ts +1 -0
- package/dist/utils/uniqueArray.d.ts.map +1 -0
- package/dist/utils/userAgent.d.ts +2 -1
- package/dist/utils/userAgent.d.ts.map +1 -0
- package/dist/utils/validators/collection/index.d.ts +1 -0
- package/dist/utils/validators/collection/index.d.ts.map +1 -0
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts +2 -1
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -0
- package/dist/utils/validators/collection/validateMultiple.d.ts +2 -1
- package/dist/utils/validators/collection/validateMultiple.d.ts.map +1 -0
- package/dist/utils/validators/file/index.d.ts +1 -0
- package/dist/utils/validators/file/index.d.ts.map +1 -0
- package/dist/utils/validators/file/validateFileType.d.ts +2 -1
- package/dist/utils/validators/file/validateFileType.d.ts.map +1 -0
- package/dist/utils/validators/file/validateIsImage.d.ts +2 -1
- package/dist/utils/validators/file/validateIsImage.d.ts.map +1 -0
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts +2 -1
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -0
- package/dist/utils/validators/file/validateUploadError.d.ts +2 -1
- package/dist/utils/validators/file/validateUploadError.d.ts.map +1 -0
- package/dist/utils/warnOnce.d.ts +1 -0
- package/dist/utils/warnOnce.d.ts.map +1 -0
- package/dist/utils/wildcardRegexp.d.ts +1 -0
- package/dist/utils/wildcardRegexp.d.ts.map +1 -0
- package/dist/utils/withResolvers.d.ts +1 -0
- package/dist/utils/withResolvers.d.ts.map +1 -0
- package/package.json +3 -5
- package/web/file-uploader.iife.min.js +8 -0
- package/web/file-uploader.min.js +8 -0
- package/web/uc-basic.layered.min.css +3243 -0
- package/web/uc-basic.min.css +3561 -0
- package/web/uc-cloud-image-editor.layered.min.css +1909 -0
- package/web/uc-cloud-image-editor.min.css +1859 -0
- package/web/uc-cloud-image-editor.min.js +8 -0
- package/web/uc-file-uploader-inline.layered.min.css +3243 -0
- package/web/uc-file-uploader-inline.min.css +3561 -0
- package/web/uc-file-uploader-inline.min.js +8 -0
- package/web/uc-file-uploader-minimal.layered.min.css +3243 -0
- package/web/uc-file-uploader-minimal.min.css +3561 -0
- package/web/uc-file-uploader-minimal.min.js +8 -0
- package/web/uc-file-uploader-regular.layered.min.css +3243 -0
- package/web/uc-file-uploader-regular.min.css +3561 -0
- package/web/uc-file-uploader-regular.min.js +8 -0
- package/web/uc-img.min.js +5 -0
- package/dist/CameraSource-DbyO6GoK.js +0 -481
- package/dist/CameraSource-px4BzEMI.js +0 -9
- package/dist/CloudImageEditor-BIxf1V4M.js +0 -2162
- package/dist/CloudImageEditorActivity-CJxP5N0S.js +0 -9
- package/dist/CloudImageEditorActivity-d4DpK6fQ.js +0 -87
- package/dist/Config-DuWre5p3.js +0 -433
- package/dist/ExternalSource-BKTFp95O.js +0 -248
- package/dist/ExternalSource-CR5DG0Jv.js +0 -9
- package/dist/Icon-CqTVC82Q.js +0 -1811
- package/dist/LitUploaderBlock-BA34rzeU.js +0 -998
- package/dist/UrlSource-BxVL9Pve.js +0 -9
- package/dist/UrlSource-DZK5EBwT.js +0 -73
- package/dist/abstract/TypedCollection.test.d.ts +0 -1
- package/dist/abstract/TypedData.test.d.ts +0 -1
- package/dist/abstract/managers/__tests__/ModalManager.test.d.ts +0 -13
- package/dist/abstract/managers/__tests__/SecureUploadsManager.test.d.ts +0 -1
- package/dist/blocks/CameraSource/__tests__/calcCameraModes.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/crop-utils.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/classNames.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/linspace.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/pick.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.test.d.ts +0 -1
- package/dist/blocks/Config/computed-properties.test.d.ts +0 -1
- package/dist/cameraPlugin-dGash48Q.js +0 -8
- package/dist/cloud-image-editor-fNswWrI4.js +0 -11
- package/dist/cloudImageEditorPlugin-2EU0Pm_j.js +0 -8
- package/dist/en-DNCwRJsB.js +0 -135
- package/dist/env-B1nfXy9i.js +0 -8
- package/dist/externalSourcesPlugin-DKQqk3AC.js +0 -8
- package/dist/imageShrinkPlugin-DAx8eRen.js +0 -8
- package/dist/instagramPlugin-k67tMAo3.js +0 -8
- package/dist/loadFileUploaderFrom-BWJM43Yq.js +0 -28
- package/dist/plugins-DxjsQUa8.js +0 -278
- package/dist/urlSourcePlugin-9xdB7Pvw.js +0 -8
- package/dist/utils/UID.test.d.ts +0 -1
- package/dist/utils/browser-info.test.d.ts +0 -1
- package/dist/utils/cdn-utils.test.d.ts +0 -1
- package/dist/utils/fileTypes.test.d.ts +0 -1
- package/dist/utils/get-top-level-origin.test.d.ts +0 -1
- package/dist/utils/getPluralForm.test.d.ts +0 -1
- package/dist/utils/isPromiseLike.test.d.ts +0 -1
- package/dist/utils/isSecureTokenExpired.test.d.ts +0 -1
- package/dist/utils/memoize.test.d.ts +0 -1
- package/dist/utils/parseCdnUrl.test.d.ts +0 -1
- package/dist/utils/parseShrink.test.d.ts +0 -1
- package/dist/utils/prettyBytes.test.d.ts +0 -1
- package/dist/utils/stringToArray.test.d.ts +0 -1
- package/dist/utils/template-utils.test.d.ts +0 -1
- package/dist/utils/toKebabCase.test.d.ts +0 -1
- package/dist/utils/uniqueArray.test.d.ts +0 -1
- package/dist/utils/wildcardRegexp.test.d.ts +0 -1
- package/dist/utils/withResolvers.test.d.ts +0 -1
package/dist/Icon-CqTVC82Q.js
DELETED
|
@@ -1,1811 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.28.0-alpha.0 (MIT)
|
|
4
|
-
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-03-02T14:46:15.080Z
|
|
6
|
-
*/
|
|
7
|
-
import { d as ACTIVITY_TYPES, p as serializeCsv } from "./plugins-DxjsQUa8.js";
|
|
8
|
-
import { t as en_default } from "./en-DNCwRJsB.js";
|
|
9
|
-
import { n as PACKAGE_VERSION, t as PACKAGE_NAME } from "./env-B1nfXy9i.js";
|
|
10
|
-
import { listenKeys, map, subscribeKeys } from "nanostores";
|
|
11
|
-
import { LitElement, html } from "lit";
|
|
12
|
-
import { ContextConsumer, ContextProvider, createContext } from "@lit/context";
|
|
13
|
-
import { property, state } from "lit/decorators.js";
|
|
14
|
-
import { Queue } from "@uploadcare/upload-client";
|
|
15
|
-
import { focusGroupKeyUX, hiddenKeyUX, jumpKeyUX, pressKeyUX, startKeyUX } from "keyux";
|
|
16
|
-
import { TelemetryAPIService } from "@uploadcare/quality-insights";
|
|
17
|
-
import { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
18
|
-
var PubSub = class d {
|
|
19
|
-
static {
|
|
20
|
-
this._contexts = /* @__PURE__ */ new Map();
|
|
21
|
-
}
|
|
22
|
-
constructor(d, B) {
|
|
23
|
-
this._ctxId = d, this._store = B;
|
|
24
|
-
}
|
|
25
|
-
get id() {
|
|
26
|
-
return this._ctxId;
|
|
27
|
-
}
|
|
28
|
-
pub(d, B) {
|
|
29
|
-
d in this._store.get() || console.warn(`PubSub#pub: Key "${String(d)}" not found`), this._store.setKey(d, B);
|
|
30
|
-
}
|
|
31
|
-
sub(d, B, V = !0) {
|
|
32
|
-
return (V ? subscribeKeys : listenKeys)(this._store, [d], (V) => {
|
|
33
|
-
B(V[d]);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
read(d) {
|
|
37
|
-
return d in this._store.get() || console.warn(`PubSub#read: Key "${String(d)}" not found`), this._store.get()[d];
|
|
38
|
-
}
|
|
39
|
-
add(d, B, V = !1) {
|
|
40
|
-
(!(d in this._store.get()) || V) && this._store.setKey(d, B);
|
|
41
|
-
}
|
|
42
|
-
has(d) {
|
|
43
|
-
return d in this._store.get();
|
|
44
|
-
}
|
|
45
|
-
get store() {
|
|
46
|
-
return this._store.get();
|
|
47
|
-
}
|
|
48
|
-
static registerCtx(B, V) {
|
|
49
|
-
if (d._contexts.has(V)) throw Error(`PubSub: Context with id "${V}" already exists`);
|
|
50
|
-
let H = map(B);
|
|
51
|
-
return d._contexts.set(V, H), new d(V, H);
|
|
52
|
-
}
|
|
53
|
-
static deleteCtx(B) {
|
|
54
|
-
d._contexts.delete(B);
|
|
55
|
-
}
|
|
56
|
-
static getCtx(B) {
|
|
57
|
-
let V = d._contexts.get(B);
|
|
58
|
-
return V ? new d(B, V) : null;
|
|
59
|
-
}
|
|
60
|
-
static hasCtx(B) {
|
|
61
|
-
return d._contexts.has(B);
|
|
62
|
-
}
|
|
63
|
-
}, SINGLE_QUOTE = "'", DOUBLE_QUOTE = "\"", ESCAPED_PATTERN = /\\([0-9a-fA-F]{1,6} ?)/g;
|
|
64
|
-
function hasLeadingTrailingQuotes(d) {
|
|
65
|
-
return d.length < 2 ? !1 : (d[0] === DOUBLE_QUOTE || d[0] === SINGLE_QUOTE) && (d[d.length - 1] === DOUBLE_QUOTE || d[d.length - 1] === SINGLE_QUOTE);
|
|
66
|
-
}
|
|
67
|
-
function trimQuotes(d) {
|
|
68
|
-
let B = d;
|
|
69
|
-
return (B[0] === DOUBLE_QUOTE || B[0] === SINGLE_QUOTE) && (B = B.slice(1)), (B[B.length - 1] === DOUBLE_QUOTE || B[B.length - 1] === SINGLE_QUOTE) && (B = B.slice(0, -1)), B;
|
|
70
|
-
}
|
|
71
|
-
function escapeQuotes(d) {
|
|
72
|
-
let B = "", V = "";
|
|
73
|
-
for (let H = 0; H < d.length; H++) {
|
|
74
|
-
let U = d[H + 1];
|
|
75
|
-
d[H] === "\\" && U === "\"" ? (B += "\\\"", H++) : d[H] === "\"" && V !== "\\" ? B += "\\\"" : B += d[H], V = d[H] ?? "";
|
|
76
|
-
}
|
|
77
|
-
return B;
|
|
78
|
-
}
|
|
79
|
-
function parseCssPropertyValue(d) {
|
|
80
|
-
let B = d;
|
|
81
|
-
hasLeadingTrailingQuotes(d) && (B = trimQuotes(B), B = B.replace(ESCAPED_PATTERN, (d, B) => String.fromCodePoint(parseInt(B.trim(), 16))), B = B.replaceAll("\\\n", "\\n"), B = escapeQuotes(B), B = DOUBLE_QUOTE + B + DOUBLE_QUOTE);
|
|
82
|
-
try {
|
|
83
|
-
return JSON.parse(B);
|
|
84
|
-
} catch {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function CssDataMixin(d) {
|
|
89
|
-
class B extends d {
|
|
90
|
-
constructor(...d) {
|
|
91
|
-
super(...d), this._cssDataCache = null, this._computedStyle = null;
|
|
92
|
-
}
|
|
93
|
-
getCssData(d, B = !1) {
|
|
94
|
-
let V = this._cssDataCache ?? Object.create(null);
|
|
95
|
-
if (!Object.keys(V).includes(d) || !V[d]) {
|
|
96
|
-
this._computedStyle ||= window.getComputedStyle(this);
|
|
97
|
-
let H = this._computedStyle.getPropertyValue(d).trim();
|
|
98
|
-
try {
|
|
99
|
-
V[d] = parseCssPropertyValue(H);
|
|
100
|
-
} catch (H) {
|
|
101
|
-
B || console.warn(`CSS Data error: ${d}`, H), V[d] = null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return this._cssDataCache = V, V[d];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return B;
|
|
108
|
-
}
|
|
109
|
-
function LightDomMixin(d) {
|
|
110
|
-
class B extends d {
|
|
111
|
-
constructor(...d) {
|
|
112
|
-
super(...d), this.willYield = !0, this._slotsMap = {}, this._initialLightDomChildren = null, this._hasAdoptedChildren = !1;
|
|
113
|
-
}
|
|
114
|
-
createRenderRoot() {
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
connectedCallback() {
|
|
118
|
-
this._initialLightDomChildren ||= Array.from(this.childNodes), super.connectedCallback();
|
|
119
|
-
}
|
|
120
|
-
_adoptChildren() {
|
|
121
|
-
if (this._hasAdoptedChildren) return;
|
|
122
|
-
this._hasAdoptedChildren = !0, this._slotsMap = {};
|
|
123
|
-
let d = Array.from(this.childNodes), B = d.length ? d : this._initialLightDomChildren ?? [];
|
|
124
|
-
for (let d of B) {
|
|
125
|
-
let B = this._getSlotNameForChild(d), V = this._slotsMap[B] ?? [];
|
|
126
|
-
d instanceof Element && (d.removeAttribute("slot"), d.removeAttribute("content-for")), V.push(d), this._slotsMap[B] = V;
|
|
127
|
-
}
|
|
128
|
-
this._initialLightDomChildren = null;
|
|
129
|
-
}
|
|
130
|
-
_getSlotNameForChild(d) {
|
|
131
|
-
return d instanceof Comment && d.nextSibling instanceof Element ? this._getSlotNameForChild(d.nextSibling) : "contentFor" in d ? d.contentFor || "" : d instanceof Element && d.hasAttribute("content-for") && d.getAttribute("content-for") || "";
|
|
132
|
-
}
|
|
133
|
-
_isTextNodeEmpty(d) {
|
|
134
|
-
return !d.textContent || !d.textContent.trim();
|
|
135
|
-
}
|
|
136
|
-
_isSlotEmpty(d) {
|
|
137
|
-
let B = this._slotsMap[d];
|
|
138
|
-
return !B || B.every((d) => d instanceof Comment || d instanceof Text && this._isTextNodeEmpty(d));
|
|
139
|
-
}
|
|
140
|
-
update(d) {
|
|
141
|
-
!this.hasUpdated && this.willYield && this._adoptChildren(), super.update(d);
|
|
142
|
-
}
|
|
143
|
-
yield(d, B) {
|
|
144
|
-
if (d === "" && !this._slotsMap[d] && !this._hasAdoptedChildren && this._initialLightDomChildren?.length) {
|
|
145
|
-
let B = [];
|
|
146
|
-
for (let d of this._initialLightDomChildren) d instanceof Element && (d.removeAttribute("slot"), d.removeAttribute("content-for")), B.push(d);
|
|
147
|
-
this._slotsMap[d] = B, this._hasAdoptedChildren = !0, this._initialLightDomChildren = null;
|
|
148
|
-
}
|
|
149
|
-
return html`
|
|
150
|
-
${this._slotsMap[d]}
|
|
151
|
-
${this._isSlotEmpty(d) ? B : void 0}
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return B;
|
|
156
|
-
}
|
|
157
|
-
function RegisterableElementMixin(d) {
|
|
158
|
-
class B extends d {
|
|
159
|
-
static reg(d) {
|
|
160
|
-
let B = this, V = window.customElements.get(d);
|
|
161
|
-
if (V) {
|
|
162
|
-
V !== B && console.warn([
|
|
163
|
-
`Element with tag name "${d}" already registered.`,
|
|
164
|
-
`You're trying to override it with another class "${this.name}".`,
|
|
165
|
-
"This is most likely a mistake.",
|
|
166
|
-
"New element will not be registered."
|
|
167
|
-
].join("\n"));
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
window.customElements.define(d, B);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return B;
|
|
174
|
-
}
|
|
175
|
-
function debounce(d, B) {
|
|
176
|
-
let V, H = ((...H) => {
|
|
177
|
-
V && clearTimeout(V), V = setTimeout(() => d(...H), B);
|
|
178
|
-
});
|
|
179
|
-
return H.cancel = () => {
|
|
180
|
-
V && clearTimeout(V);
|
|
181
|
-
}, H;
|
|
182
|
-
}
|
|
183
|
-
function __decorate(d, B, V, H) {
|
|
184
|
-
var U = arguments.length, W = U < 3 ? B : H === null ? H = Object.getOwnPropertyDescriptor(B, V) : H, G;
|
|
185
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") W = Reflect.decorate(d, B, V, H);
|
|
186
|
-
else for (var K = d.length - 1; K >= 0; K--) (G = d[K]) && (W = (U < 3 ? G(W) : U > 3 ? G(B, V, W) : G(B, V)) || W);
|
|
187
|
-
return U > 3 && W && Object.defineProperty(B, V, W), W;
|
|
188
|
-
}
|
|
189
|
-
const ctxNameContext = createContext("ctx-name-context");
|
|
190
|
-
function SymbioteMixin() {
|
|
191
|
-
return function(d) {
|
|
192
|
-
class B extends d {
|
|
193
|
-
static set template(d) {
|
|
194
|
-
console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");
|
|
195
|
-
}
|
|
196
|
-
get _ctxNameAttr() {
|
|
197
|
-
return this._ctxNameAttrValue;
|
|
198
|
-
}
|
|
199
|
-
set _ctxNameAttr(d) {
|
|
200
|
-
let B = d ?? void 0;
|
|
201
|
-
this._ctxNameAttrValue !== B && (this._ctxNameAttrValue = B, this._handleCtxNameSourceChange());
|
|
202
|
-
}
|
|
203
|
-
shouldUpdate(d) {
|
|
204
|
-
return this._isInitialized ? super.shouldUpdate(d) : !1;
|
|
205
|
-
}
|
|
206
|
-
constructor(...d) {
|
|
207
|
-
super(...d), this._symbioteSharedPubSub = null, this._symbioteFirstUpdated = !1, this._needsReconnectInit = !1, this._ctxNameProvider = void 0, this._pendingSharedAdds = /* @__PURE__ */ new Map(), this._symbioteSubscriptions = /* @__PURE__ */ new Set(), this.init$ = {}, this.ctxOwner = !1, this._ctxNameAttrValue = void 0, this._pendingCtxInitOnConnect = !1, this.ctxName = this._effectiveCtxName, this._isInitialized = !1, this._ctxNameAttrValue = this.getAttribute("ctx-name") || void 0, this.ctxName = this._effectiveCtxName, this._ctxNameConsumer = new ContextConsumer(this, {
|
|
208
|
-
context: ctxNameContext,
|
|
209
|
-
callback: (d) => {
|
|
210
|
-
if (!d) {
|
|
211
|
-
console.error("SymbioteMixin: Received invalid ctx-name from context");
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
this._ctxNameFromContext = d, this._handleCtxNameSourceChange();
|
|
215
|
-
},
|
|
216
|
-
subscribe: !0
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
get _effectiveCtxName() {
|
|
220
|
-
return this._ctxNameAttr || this._ctxNameFromContext || void 0;
|
|
221
|
-
}
|
|
222
|
-
_handleCtxNameSourceChange() {
|
|
223
|
-
if (this.ctxName = this._effectiveCtxName, !(!this.ctxName || this._symbioteFirstUpdated)) {
|
|
224
|
-
if (this.isConnected) {
|
|
225
|
-
this._performInitialization();
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
this._pendingCtxInitOnConnect = !0;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
willUpdate(d) {
|
|
232
|
-
super.willUpdate(d), this.ctxName = this._effectiveCtxName, this.ctxName && (this._ctxNameProvider ? this._ctxNameProvider.setValue(this.ctxName) : this._ctxNameProvider = new ContextProvider(this, {
|
|
233
|
-
context: ctxNameContext,
|
|
234
|
-
initialValue: this.ctxName
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
|
-
_applyPendingSharedAdds() {
|
|
238
|
-
if (!(!this._symbioteSharedPubSub || this._pendingSharedAdds.size === 0)) {
|
|
239
|
-
for (let [d, { value: B, rewrite: V }] of this._pendingSharedAdds) this._symbioteSharedPubSub.add(d, B, V);
|
|
240
|
-
this._pendingSharedAdds.clear();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
_getSharedPubSub() {
|
|
244
|
-
return !this._symbioteSharedPubSub && this._effectiveCtxName && this._initSharedContext(), this._symbioteSharedPubSub && this._applyPendingSharedAdds(), this._symbioteSharedPubSub;
|
|
245
|
-
}
|
|
246
|
-
_requireSharedPubSub() {
|
|
247
|
-
let d = this._getSharedPubSub();
|
|
248
|
-
if (!d) throw Error("SymbioteMixin: Shared context is not initialized.");
|
|
249
|
-
return d;
|
|
250
|
-
}
|
|
251
|
-
_initSharedContext() {
|
|
252
|
-
let d = this.init$, B = this._effectiveCtxName;
|
|
253
|
-
if (!B) {
|
|
254
|
-
console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (!this._symbioteSharedPubSub) {
|
|
258
|
-
this._symbioteSharedPubSub = PubSub.getCtx(B) ?? PubSub.registerCtx(d, B);
|
|
259
|
-
for (let [d, B] of Object.entries(this.init$)) this._symbioteSharedPubSub.add(d, B, this.ctxOwner);
|
|
260
|
-
this._applyPendingSharedAdds();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
get $() {
|
|
264
|
-
return this._effectiveCtxName && this._initSharedContext(), new Proxy({}, {
|
|
265
|
-
get: (d, B) => {
|
|
266
|
-
if (typeof B == "string") return this._symbioteSharedPubSub?.read(B);
|
|
267
|
-
},
|
|
268
|
-
set: (d, B, V) => (typeof B == "string" && this._symbioteSharedPubSub?.pub(B, V), !0)
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
sub(d, B, V = !0) {
|
|
272
|
-
let H = this._requireSharedPubSub().sub(d, B, V);
|
|
273
|
-
if (!H || typeof H != "function") return () => {};
|
|
274
|
-
let U = H.bind(H), W = !1, G = () => {
|
|
275
|
-
W || (W = !0, U(), this._symbioteSubscriptions.delete(G));
|
|
276
|
-
};
|
|
277
|
-
return this._symbioteSubscriptions.add(G), G;
|
|
278
|
-
}
|
|
279
|
-
pub(d, B) {
|
|
280
|
-
this._requireSharedPubSub().pub(d, B);
|
|
281
|
-
}
|
|
282
|
-
set$(d) {
|
|
283
|
-
for (let [B, V] of Object.entries(d)) this.pub(B, V);
|
|
284
|
-
}
|
|
285
|
-
get sharedCtx() {
|
|
286
|
-
return this._requireSharedPubSub();
|
|
287
|
-
}
|
|
288
|
-
has(d) {
|
|
289
|
-
return this._symbioteSharedPubSub?.has(d) ?? !1;
|
|
290
|
-
}
|
|
291
|
-
add(d, B, V = !1) {
|
|
292
|
-
let H = this._getSharedPubSub();
|
|
293
|
-
if (!H) {
|
|
294
|
-
if (!V && this._pendingSharedAdds.has(d)) return;
|
|
295
|
-
this._pendingSharedAdds.set(d, {
|
|
296
|
-
value: B,
|
|
297
|
-
rewrite: V
|
|
298
|
-
});
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
this._pendingSharedAdds.delete(d), H.add(d, B, V);
|
|
302
|
-
}
|
|
303
|
-
add$(d, B = !1) {
|
|
304
|
-
for (let [V, H] of Object.entries(d)) this.add(V, H, B);
|
|
305
|
-
}
|
|
306
|
-
connectedCallback() {
|
|
307
|
-
super.connectedCallback(), this._symbioteFirstUpdated ? this._isInitialized && this._needsReconnectInit && (this._needsReconnectInit = !1, this.initCallback()) : (this.ctxName || this._pendingCtxInitOnConnect && this._effectiveCtxName) && (this._pendingCtxInitOnConnect = !1, this._performInitialization());
|
|
308
|
-
}
|
|
309
|
-
_performInitialization() {
|
|
310
|
-
if (this._symbioteFirstUpdated) return;
|
|
311
|
-
this._symbioteFirstUpdated = !0, this._initSharedContext();
|
|
312
|
-
let d = this.init$;
|
|
313
|
-
if (Object.keys(d).length > 0) {
|
|
314
|
-
let B = this._requireSharedPubSub();
|
|
315
|
-
for (let [V, H] of Object.entries(d)) B.read(V) === void 0 && B.pub(V, H), this.sub(V, debounce(async () => {
|
|
316
|
-
this.isConnected && (await this.updateComplete, this.requestUpdate());
|
|
317
|
-
}, 0), !1);
|
|
318
|
-
}
|
|
319
|
-
this.initCallback(), this._isInitialized = !0, this.requestUpdate();
|
|
320
|
-
}
|
|
321
|
-
firstUpdated(d) {
|
|
322
|
-
super.firstUpdated(d);
|
|
323
|
-
}
|
|
324
|
-
disconnectedCallback() {
|
|
325
|
-
this._cleanupSymbioteSubscriptions(), super.disconnectedCallback(), this._symbioteFirstUpdated && (this._needsReconnectInit = !0);
|
|
326
|
-
}
|
|
327
|
-
_cleanupSymbioteSubscriptions() {
|
|
328
|
-
if (this._symbioteSubscriptions.size !== 0) {
|
|
329
|
-
for (let d of [...this._symbioteSubscriptions]) d();
|
|
330
|
-
this._symbioteSubscriptions.clear();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
initCallback() {}
|
|
334
|
-
}
|
|
335
|
-
return __decorate([property({
|
|
336
|
-
type: String,
|
|
337
|
-
attribute: "ctx-name",
|
|
338
|
-
noAccessor: !0
|
|
339
|
-
})], B.prototype, "_ctxNameAttr", null), __decorate([state()], B.prototype, "_ctxNameFromContext", void 0), __decorate([state()], B.prototype, "ctxName", void 0), __decorate([state()], B.prototype, "_isInitialized", void 0), B;
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
var UID = class d {
|
|
343
|
-
static generateFastUid() {
|
|
344
|
-
return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
|
|
345
|
-
}
|
|
346
|
-
static generateRandomUUID() {
|
|
347
|
-
let B = globalThis.crypto;
|
|
348
|
-
return B && typeof B.randomUUID == "function" ? B.randomUUID() : d.generateFastUid();
|
|
349
|
-
}
|
|
350
|
-
}, localeRegistry = /* @__PURE__ */ new Map(), localeResolvers = /* @__PURE__ */ new Map(), defineLocaleSync = (d, B) => {
|
|
351
|
-
localeRegistry.has(d) && console.log(`Locale ${d} is already defined. Overwriting...`);
|
|
352
|
-
let H = {
|
|
353
|
-
...en_default,
|
|
354
|
-
...B
|
|
355
|
-
};
|
|
356
|
-
return localeRegistry.set(d, H), H;
|
|
357
|
-
}, defineLocaleAsync = (d, B) => {
|
|
358
|
-
localeResolvers.set(d, B);
|
|
359
|
-
};
|
|
360
|
-
const defineLocale = (d, B) => {
|
|
361
|
-
typeof B == "function" ? defineLocaleAsync(d, B) : defineLocaleSync(d, B);
|
|
362
|
-
}, resolveLocaleDefinition = async (d) => {
|
|
363
|
-
let B = localeRegistry.get(d);
|
|
364
|
-
if (!B) {
|
|
365
|
-
let V = localeResolvers.get(d);
|
|
366
|
-
if (!V) throw Error(`Locale ${d} is not defined`);
|
|
367
|
-
B = defineLocaleSync(d, await V());
|
|
368
|
-
}
|
|
369
|
-
return B;
|
|
370
|
-
};
|
|
371
|
-
defineLocale("en", en_default);
|
|
372
|
-
const sharedConfigKey = (d) => `*cfg/${d}`, normalizeCdnOperation = (d) => {
|
|
373
|
-
if (typeof d != "string" || !d) return "";
|
|
374
|
-
let B = d.trim();
|
|
375
|
-
return B.startsWith("-/") ? B = B.slice(2) : B.startsWith("/") && (B = B.slice(1)), B.endsWith("/") && (B = B.slice(0, B.length - 1)), B;
|
|
376
|
-
}, joinCdnOperations = (...d) => d.filter((d) => typeof d == "string" && !!d).map((d) => normalizeCdnOperation(d)).join("/-/"), createCdnUrlModifiers = (...d) => {
|
|
377
|
-
let B = joinCdnOperations(...d);
|
|
378
|
-
return B ? `-/${B}/` : "";
|
|
379
|
-
};
|
|
380
|
-
function extractFilename(d) {
|
|
381
|
-
let B = new URL(d), V = B.pathname + B.search + B.hash, H = V.lastIndexOf("http"), U = V.lastIndexOf("/"), W = "";
|
|
382
|
-
return H >= 0 ? W = V.slice(H) : U >= 0 && (W = V.slice(U + 1)), W;
|
|
383
|
-
}
|
|
384
|
-
function extractUuid(d) {
|
|
385
|
-
let { pathname: B } = new URL(d), V = B.indexOf("/"), H = B.indexOf("/", V + 1);
|
|
386
|
-
return B.substring(V + 1, H);
|
|
387
|
-
}
|
|
388
|
-
function extractCdnUrlModifiers(d) {
|
|
389
|
-
let B = trimFilename(d), V = new URL(B), H = V.pathname.indexOf("/-/");
|
|
390
|
-
return H === -1 ? "" : V.pathname.substring(H).slice(1);
|
|
391
|
-
}
|
|
392
|
-
function extractOperations(d) {
|
|
393
|
-
return extractCdnUrlModifiers(d).split("/-/").filter(Boolean).map((d) => normalizeCdnOperation(d));
|
|
394
|
-
}
|
|
395
|
-
function trimFilename(d) {
|
|
396
|
-
let B = new URL(d), V = extractFilename(d), H = isFileUrl(V) ? splitFileUrl(V).pathname : V;
|
|
397
|
-
return B.pathname = B.pathname.replace(H, ""), B.search = "", B.hash = "", B.toString();
|
|
398
|
-
}
|
|
399
|
-
function isFileUrl(d) {
|
|
400
|
-
return d.startsWith("http");
|
|
401
|
-
}
|
|
402
|
-
function splitFileUrl(d) {
|
|
403
|
-
let B = new URL(d);
|
|
404
|
-
return {
|
|
405
|
-
pathname: `${B.origin}${B.pathname ?? ""}`,
|
|
406
|
-
search: B.search ?? "",
|
|
407
|
-
hash: B.hash ?? ""
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
const createCdnUrl = (d, B, V) => {
|
|
411
|
-
let H = new URL(trimFilename(d)), U = V ?? extractFilename(d), W = B ?? "";
|
|
412
|
-
if (H.pathname.startsWith("//") && (H.pathname = H.pathname.replace("//", "/")), U && isFileUrl(U)) {
|
|
413
|
-
let d = splitFileUrl(U);
|
|
414
|
-
H.pathname = `${H.pathname}${W}${d.pathname || ""}`, H.search = d.search, H.hash = d.hash;
|
|
415
|
-
} else H.pathname = `${H.pathname}${W}${U || ""}`;
|
|
416
|
-
return H.toString();
|
|
417
|
-
}, createOriginalUrl = (d, B) => {
|
|
418
|
-
let V = new URL(d);
|
|
419
|
-
return V.pathname = `${B}/`, V.toString();
|
|
420
|
-
}, stringToArray = (d, B = ",") => d.trim().split(B).map((d) => d.trim()).filter((d) => d.length > 0), OPERATIONS_DEFAULTS = Object.freeze({
|
|
421
|
-
brightness: 0,
|
|
422
|
-
exposure: 0,
|
|
423
|
-
gamma: 100,
|
|
424
|
-
contrast: 0,
|
|
425
|
-
saturation: 0,
|
|
426
|
-
vibrance: 0,
|
|
427
|
-
warmth: 0,
|
|
428
|
-
enhance: 0,
|
|
429
|
-
filter: 0,
|
|
430
|
-
rotate: 0,
|
|
431
|
-
mirror: !1,
|
|
432
|
-
flip: !1,
|
|
433
|
-
crop: void 0
|
|
434
|
-
});
|
|
435
|
-
var SUPPORTED_OPERATIONS_ORDERED = [
|
|
436
|
-
"enhance",
|
|
437
|
-
"brightness",
|
|
438
|
-
"exposure",
|
|
439
|
-
"gamma",
|
|
440
|
-
"contrast",
|
|
441
|
-
"saturation",
|
|
442
|
-
"vibrance",
|
|
443
|
-
"warmth",
|
|
444
|
-
"filter",
|
|
445
|
-
"mirror",
|
|
446
|
-
"flip",
|
|
447
|
-
"rotate",
|
|
448
|
-
"crop"
|
|
449
|
-
];
|
|
450
|
-
function transformationToStr(d, B) {
|
|
451
|
-
if (typeof B == "number") {
|
|
452
|
-
let V = B;
|
|
453
|
-
return OPERATIONS_DEFAULTS[d] === V ? "" : `${d}/${V}`;
|
|
454
|
-
}
|
|
455
|
-
if (typeof B == "boolean") {
|
|
456
|
-
let V = B;
|
|
457
|
-
return OPERATIONS_DEFAULTS[d] === V ? "" : `${d}`;
|
|
458
|
-
}
|
|
459
|
-
if (d === "filter" && B) {
|
|
460
|
-
let { name: V, amount: H } = B;
|
|
461
|
-
return OPERATIONS_DEFAULTS.filter === H ? "" : `${d}/${V}/${H}`;
|
|
462
|
-
}
|
|
463
|
-
if (d === "crop" && B) {
|
|
464
|
-
let { dimensions: V, coords: H } = B;
|
|
465
|
-
return `${d}/${V.join("x")}/${H.join(",")}`;
|
|
466
|
-
}
|
|
467
|
-
return "";
|
|
468
|
-
}
|
|
469
|
-
function transformationsToOperations(d) {
|
|
470
|
-
return joinCdnOperations(...SUPPORTED_OPERATIONS_ORDERED.filter((B) => d[B] !== void 0 && d[B] !== null).map((B) => {
|
|
471
|
-
let V = d[B];
|
|
472
|
-
return transformationToStr(B, V);
|
|
473
|
-
}).filter((d) => !!d));
|
|
474
|
-
}
|
|
475
|
-
const COMMON_OPERATIONS = joinCdnOperations("format/auto", "progressive/yes");
|
|
476
|
-
var asNumber = ([d]) => d === void 0 ? void 0 : Number(d), asBoolean = () => !0, asFilter = ([d, B]) => ({
|
|
477
|
-
name: d,
|
|
478
|
-
amount: B === void 0 ? 100 : Number(B)
|
|
479
|
-
}), asCrop = ([d, B]) => {
|
|
480
|
-
if (!/\d+x\d+/.test(d) || !/\d+,\d+/.test(B)) throw Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");
|
|
481
|
-
return {
|
|
482
|
-
dimensions: stringToArray(d, "x").map(Number),
|
|
483
|
-
coords: stringToArray(B).map(Number)
|
|
484
|
-
};
|
|
485
|
-
}, OPERATION_PROCESSORS = Object.freeze({
|
|
486
|
-
enhance: asNumber,
|
|
487
|
-
brightness: asNumber,
|
|
488
|
-
exposure: asNumber,
|
|
489
|
-
gamma: asNumber,
|
|
490
|
-
contrast: asNumber,
|
|
491
|
-
saturation: asNumber,
|
|
492
|
-
vibrance: asNumber,
|
|
493
|
-
warmth: asNumber,
|
|
494
|
-
filter: asFilter,
|
|
495
|
-
mirror: asBoolean,
|
|
496
|
-
flip: asBoolean,
|
|
497
|
-
rotate: asNumber,
|
|
498
|
-
crop: (d) => {
|
|
499
|
-
let [B, V] = d, { dimensions: H, coords: U } = asCrop([B, V]);
|
|
500
|
-
return {
|
|
501
|
-
dimensions: H,
|
|
502
|
-
coords: U
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
function operationsToTransformations(d) {
|
|
507
|
-
let B = {};
|
|
508
|
-
for (let V of d) {
|
|
509
|
-
let [d, ...H] = V.split("/");
|
|
510
|
-
if (!d || !SUPPORTED_OPERATIONS_ORDERED.includes(d)) continue;
|
|
511
|
-
let U = d, W = OPERATION_PROCESSORS[U];
|
|
512
|
-
try {
|
|
513
|
-
B[U] = W(H);
|
|
514
|
-
} catch (d) {
|
|
515
|
-
console.warn([
|
|
516
|
-
`Failed to parse URL operation "${V}". It will be ignored.`,
|
|
517
|
-
d instanceof Error ? `Error message: "${d.message}"` : d,
|
|
518
|
-
"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"
|
|
519
|
-
].join("\n"));
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return B;
|
|
523
|
-
}
|
|
524
|
-
const TabId = Object.freeze({
|
|
525
|
-
CROP: "crop",
|
|
526
|
-
TUNING: "tuning",
|
|
527
|
-
FILTERS: "filters"
|
|
528
|
-
}), ALL_TABS = Object.freeze([
|
|
529
|
-
TabId.CROP,
|
|
530
|
-
TabId.TUNING,
|
|
531
|
-
TabId.FILTERS
|
|
532
|
-
]), ALL_COLOR_OPERATIONS = Object.freeze([
|
|
533
|
-
"brightness",
|
|
534
|
-
"exposure",
|
|
535
|
-
"gamma",
|
|
536
|
-
"contrast",
|
|
537
|
-
"saturation",
|
|
538
|
-
"vibrance",
|
|
539
|
-
"warmth",
|
|
540
|
-
"enhance"
|
|
541
|
-
]), ALL_FILTERS = Object.freeze(/* @__PURE__ */ "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".split(".")), ALL_CROP_OPERATIONS = Object.freeze([
|
|
542
|
-
"rotate",
|
|
543
|
-
"mirror",
|
|
544
|
-
"flip"
|
|
545
|
-
]);
|
|
546
|
-
var NUMERIC_OPERATION_DEFAULTS = OPERATIONS_DEFAULTS;
|
|
547
|
-
const COLOR_OPERATIONS_CONFIG = Object.freeze({
|
|
548
|
-
brightness: {
|
|
549
|
-
zero: NUMERIC_OPERATION_DEFAULTS.brightness,
|
|
550
|
-
range: [-100, 100],
|
|
551
|
-
keypointsNumber: 2
|
|
552
|
-
},
|
|
553
|
-
exposure: {
|
|
554
|
-
zero: NUMERIC_OPERATION_DEFAULTS.exposure,
|
|
555
|
-
range: [-500, 500],
|
|
556
|
-
keypointsNumber: 2
|
|
557
|
-
},
|
|
558
|
-
gamma: {
|
|
559
|
-
zero: NUMERIC_OPERATION_DEFAULTS.gamma,
|
|
560
|
-
range: [0, 1e3],
|
|
561
|
-
keypointsNumber: 2
|
|
562
|
-
},
|
|
563
|
-
contrast: {
|
|
564
|
-
zero: NUMERIC_OPERATION_DEFAULTS.contrast,
|
|
565
|
-
range: [-100, 500],
|
|
566
|
-
keypointsNumber: 2
|
|
567
|
-
},
|
|
568
|
-
saturation: {
|
|
569
|
-
zero: NUMERIC_OPERATION_DEFAULTS.saturation,
|
|
570
|
-
range: [-100, 500],
|
|
571
|
-
keypointsNumber: 1
|
|
572
|
-
},
|
|
573
|
-
vibrance: {
|
|
574
|
-
zero: NUMERIC_OPERATION_DEFAULTS.vibrance,
|
|
575
|
-
range: [-100, 500],
|
|
576
|
-
keypointsNumber: 1
|
|
577
|
-
},
|
|
578
|
-
warmth: {
|
|
579
|
-
zero: NUMERIC_OPERATION_DEFAULTS.warmth,
|
|
580
|
-
range: [-100, 100],
|
|
581
|
-
keypointsNumber: 1
|
|
582
|
-
},
|
|
583
|
-
enhance: {
|
|
584
|
-
zero: NUMERIC_OPERATION_DEFAULTS.enhance,
|
|
585
|
-
range: [0, 100],
|
|
586
|
-
keypointsNumber: 1
|
|
587
|
-
},
|
|
588
|
-
filter: {
|
|
589
|
-
zero: NUMERIC_OPERATION_DEFAULTS.filter,
|
|
590
|
-
range: [0, 100],
|
|
591
|
-
keypointsNumber: 1
|
|
592
|
-
}
|
|
593
|
-
}), DEFAULT_CDN_CNAME = "https://ucarecdn.com";
|
|
594
|
-
var config = {
|
|
595
|
-
pubkey: "",
|
|
596
|
-
multiple: !0,
|
|
597
|
-
multipleMin: 0,
|
|
598
|
-
multipleMax: 2 ** 53 - 1,
|
|
599
|
-
confirmUpload: !1,
|
|
600
|
-
imgOnly: !1,
|
|
601
|
-
accept: "",
|
|
602
|
-
externalSourcesPreferredTypes: "",
|
|
603
|
-
externalSourcesEmbedCss: "",
|
|
604
|
-
store: "auto",
|
|
605
|
-
cameraMirror: !1,
|
|
606
|
-
cameraCapture: "",
|
|
607
|
-
sourceList: "local, url, camera, dropbox, gdrive",
|
|
608
|
-
topLevelOrigin: "",
|
|
609
|
-
maxLocalFileSizeBytes: 0,
|
|
610
|
-
thumbSize: 76,
|
|
611
|
-
showEmptyList: !1,
|
|
612
|
-
useLocalImageEditor: !1,
|
|
613
|
-
removeCopyright: !1,
|
|
614
|
-
cropPreset: "",
|
|
615
|
-
imageShrink: "",
|
|
616
|
-
modalScrollLock: !0,
|
|
617
|
-
modalBackdropStrokes: !1,
|
|
618
|
-
sourceListWrap: !0,
|
|
619
|
-
remoteTabSessionKey: "",
|
|
620
|
-
cdnCname: DEFAULT_CDN_CNAME,
|
|
621
|
-
cdnCnamePrefixed: "https://ucarecd.net",
|
|
622
|
-
baseUrl: "https://upload.uploadcare.com",
|
|
623
|
-
socialBaseUrl: "https://social.uploadcare.com",
|
|
624
|
-
secureSignature: "",
|
|
625
|
-
secureExpire: "",
|
|
626
|
-
secureDeliveryProxy: "",
|
|
627
|
-
retryThrottledRequestMaxTimes: 3,
|
|
628
|
-
retryNetworkErrorMaxTimes: 3,
|
|
629
|
-
multipartMinFileSize: 26214400,
|
|
630
|
-
multipartChunkSize: 5242880,
|
|
631
|
-
maxConcurrentRequests: 10,
|
|
632
|
-
multipartMaxConcurrentRequests: 4,
|
|
633
|
-
multipartMaxAttempts: 3,
|
|
634
|
-
checkForUrlDuplicates: !1,
|
|
635
|
-
saveUrlForRecurrentUploads: !1,
|
|
636
|
-
groupOutput: !1,
|
|
637
|
-
userAgentIntegration: "",
|
|
638
|
-
debug: !1,
|
|
639
|
-
metadata: null,
|
|
640
|
-
localeName: "en",
|
|
641
|
-
localeDefinitionOverride: null,
|
|
642
|
-
secureUploadsExpireThreshold: 600 * 1e3,
|
|
643
|
-
secureUploadsSignatureResolver: null,
|
|
644
|
-
secureDeliveryProxyUrlResolver: null,
|
|
645
|
-
iconHrefResolver: null,
|
|
646
|
-
fileValidators: [],
|
|
647
|
-
collectionValidators: [],
|
|
648
|
-
validationTimeout: 15 * 1e3,
|
|
649
|
-
validationConcurrency: 100,
|
|
650
|
-
cameraModes: "photo, video",
|
|
651
|
-
defaultCameraMode: null,
|
|
652
|
-
enableAudioRecording: !0,
|
|
653
|
-
enableVideoRecording: null,
|
|
654
|
-
maxVideoRecordingDuration: null,
|
|
655
|
-
mediaRecorderOptions: null,
|
|
656
|
-
filesViewMode: "list",
|
|
657
|
-
gridShowFileNames: !1,
|
|
658
|
-
useCloudImageEditor: !0,
|
|
659
|
-
cloudImageEditorAutoOpen: !1,
|
|
660
|
-
cloudImageEditorTabs: serializeCsv(ALL_TABS),
|
|
661
|
-
cloudImageEditorMaskHref: null,
|
|
662
|
-
testMode: !1,
|
|
663
|
-
qualityInsights: !0,
|
|
664
|
-
pasteScope: "local",
|
|
665
|
-
plugins: []
|
|
666
|
-
};
|
|
667
|
-
const initialConfig = Object.freeze(config), createDebugPrinter = (d, B) => (...V) => {
|
|
668
|
-
let H = d();
|
|
669
|
-
if (!H.read(sharedConfigKey("debug"))) return;
|
|
670
|
-
let U = V;
|
|
671
|
-
if (typeof V?.[0] == "function") {
|
|
672
|
-
let d = V[0];
|
|
673
|
-
U = d();
|
|
674
|
-
}
|
|
675
|
-
let W = [H.id, B].filter(Boolean);
|
|
676
|
-
console.log(`[${W.join("][")}]`, ...U);
|
|
677
|
-
};
|
|
678
|
-
var SharedInstance = class {
|
|
679
|
-
constructor(d) {
|
|
680
|
-
this._subscriptions = /* @__PURE__ */ new Set(), this._cfgProxy = null, this._debugPrint = createDebugPrinter(() => this._sharedInstancesBag.ctx, this.constructor.name), this._sharedInstancesBag = d, this._ctx = d.ctx;
|
|
681
|
-
}
|
|
682
|
-
addSub(d) {
|
|
683
|
-
this._subscriptions.add(d);
|
|
684
|
-
}
|
|
685
|
-
get _cfg() {
|
|
686
|
-
return this._cfgProxy ||= new Proxy({}, {
|
|
687
|
-
set: () => {
|
|
688
|
-
throw Error("SharedInstance cfg proxy is read-only");
|
|
689
|
-
},
|
|
690
|
-
get: (d, B) => {
|
|
691
|
-
if (typeof B != "string") return;
|
|
692
|
-
let V = sharedConfigKey(B);
|
|
693
|
-
return this._sharedInstancesBag.ctx.has(V) ? this._sharedInstancesBag.ctx.read(V) : initialConfig[B];
|
|
694
|
-
}
|
|
695
|
-
}), this._cfgProxy;
|
|
696
|
-
}
|
|
697
|
-
destroy() {
|
|
698
|
-
for (let d of this._subscriptions) try {
|
|
699
|
-
d();
|
|
700
|
-
} catch {}
|
|
701
|
-
this._subscriptions.clear();
|
|
702
|
-
}
|
|
703
|
-
}, instanceKeyMap = {
|
|
704
|
-
modalManager: "*modalManager",
|
|
705
|
-
pluginManager: "*pluginManager",
|
|
706
|
-
telemetryManager: "*telemetryManager",
|
|
707
|
-
localeManager: "*localeManager",
|
|
708
|
-
a11y: "*a11y",
|
|
709
|
-
clipboard: "*clipboard",
|
|
710
|
-
blocksRegistry: "*blocksRegistry",
|
|
711
|
-
eventEmitter: "*eventEmitter",
|
|
712
|
-
uploadCollection: "*uploadCollection",
|
|
713
|
-
secureUploadsManager: "*secureUploadsManager",
|
|
714
|
-
api: "*publicApi",
|
|
715
|
-
validationManager: "*validationManager"
|
|
716
|
-
};
|
|
717
|
-
const getSharedInstance = (d, B, V = !0) => {
|
|
718
|
-
let H = d.has(B), U = H ? d.read(B) : null;
|
|
719
|
-
if (H && U || !V) return U;
|
|
720
|
-
throw Error(`Unexpected error: shared instance for key "${String(B)}" is not available`);
|
|
721
|
-
}, createSharedInstancesBag = (d) => ({
|
|
722
|
-
get ctx() {
|
|
723
|
-
return d();
|
|
724
|
-
},
|
|
725
|
-
get modalManager() {
|
|
726
|
-
return getSharedInstance(d(), "*modalManager", !1);
|
|
727
|
-
},
|
|
728
|
-
get pluginManager() {
|
|
729
|
-
return getSharedInstance(d(), "*pluginManager");
|
|
730
|
-
},
|
|
731
|
-
get telemetryManager() {
|
|
732
|
-
return getSharedInstance(d(), "*telemetryManager");
|
|
733
|
-
},
|
|
734
|
-
get localeManager() {
|
|
735
|
-
return getSharedInstance(d(), "*localeManager");
|
|
736
|
-
},
|
|
737
|
-
get a11y() {
|
|
738
|
-
return getSharedInstance(d(), "*a11y");
|
|
739
|
-
},
|
|
740
|
-
get blocksRegistry() {
|
|
741
|
-
return getSharedInstance(d(), "*blocksRegistry");
|
|
742
|
-
},
|
|
743
|
-
get eventEmitter() {
|
|
744
|
-
return getSharedInstance(d(), "*eventEmitter");
|
|
745
|
-
},
|
|
746
|
-
get uploadCollection() {
|
|
747
|
-
return getSharedInstance(d(), "*uploadCollection");
|
|
748
|
-
},
|
|
749
|
-
get secureUploadsManager() {
|
|
750
|
-
return getSharedInstance(d(), "*secureUploadsManager", !1);
|
|
751
|
-
},
|
|
752
|
-
get api() {
|
|
753
|
-
return getSharedInstance(d(), "*publicApi");
|
|
754
|
-
},
|
|
755
|
-
get validationManager() {
|
|
756
|
-
return getSharedInstance(d(), "*validationManager");
|
|
757
|
-
},
|
|
758
|
-
when(B, V) {
|
|
759
|
-
let H = instanceKeyMap[B], U = d(), W = U.has(H) ? U.read(H) : void 0;
|
|
760
|
-
if (W) return V(W), () => {};
|
|
761
|
-
let G = U.sub(H, (d) => {
|
|
762
|
-
d && (V(d), G());
|
|
763
|
-
});
|
|
764
|
-
return G;
|
|
765
|
-
}
|
|
766
|
-
}), ModalEvents = Object.freeze({
|
|
767
|
-
ADD: "modal:add",
|
|
768
|
-
DELETE: "modal:delete",
|
|
769
|
-
OPEN: "modal:open",
|
|
770
|
-
CLOSE: "modal:close",
|
|
771
|
-
CLOSE_ALL: "modal:closeAll",
|
|
772
|
-
DESTROY: "modal:destroy"
|
|
773
|
-
});
|
|
774
|
-
var ModalManager = class extends SharedInstance {
|
|
775
|
-
constructor(...d) {
|
|
776
|
-
super(...d), this._modals = /* @__PURE__ */ new Map(), this._activeModals = /* @__PURE__ */ new Set(), this._subscribers = /* @__PURE__ */ new Map();
|
|
777
|
-
}
|
|
778
|
-
registerModal(d, B) {
|
|
779
|
-
this._modals.set(d, B), this._notify(ModalEvents.ADD, {
|
|
780
|
-
id: d,
|
|
781
|
-
modal: B
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
deleteModal(d) {
|
|
785
|
-
let B = this._modals.get(d);
|
|
786
|
-
return B ? (this._modals.delete(d), this._activeModals.delete(d), this._notify(ModalEvents.DELETE, {
|
|
787
|
-
id: d,
|
|
788
|
-
modal: B
|
|
789
|
-
}), !0) : !1;
|
|
790
|
-
}
|
|
791
|
-
open(d) {
|
|
792
|
-
let B = this._modals.get(d);
|
|
793
|
-
return B ? (this._activeModals.add(d), this._notify(ModalEvents.OPEN, {
|
|
794
|
-
modal: B,
|
|
795
|
-
id: d
|
|
796
|
-
}), !0) : (this._debugPrint(`Modal with ID "${d}" not found`), !1);
|
|
797
|
-
}
|
|
798
|
-
close(d) {
|
|
799
|
-
let B = this._modals.get(d);
|
|
800
|
-
return !B || !this._activeModals.has(d) ? (this._debugPrint(`Modal with ID "${d}" not found or not active`), !1) : (this._activeModals.delete(d), this._notify(ModalEvents.CLOSE, {
|
|
801
|
-
id: d,
|
|
802
|
-
modal: B
|
|
803
|
-
}), !0);
|
|
804
|
-
}
|
|
805
|
-
toggle(d) {
|
|
806
|
-
return this._modals.has(d) ? this._activeModals.has(d) ? this.close(d) : this.open(d) : (this._debugPrint(`Modal with ID "${d}" not found`), !1);
|
|
807
|
-
}
|
|
808
|
-
get hasActiveModals() {
|
|
809
|
-
return this._activeModals.size > 0;
|
|
810
|
-
}
|
|
811
|
-
back() {
|
|
812
|
-
if (this._activeModals.size === 0) return this._debugPrint("No active modals to go back from"), !1;
|
|
813
|
-
let d = Array.from(this._activeModals).pop();
|
|
814
|
-
return d ? this.close(d) : !1;
|
|
815
|
-
}
|
|
816
|
-
closeAll() {
|
|
817
|
-
let d = this._activeModals.size;
|
|
818
|
-
return this._activeModals.clear(), this._notify(ModalEvents.CLOSE_ALL, {}), d;
|
|
819
|
-
}
|
|
820
|
-
subscribe(d, B) {
|
|
821
|
-
return this._subscribers.has(d) || this._subscribers.set(d, /* @__PURE__ */ new Set()), this._subscribers.get(d)?.add(B), () => this.unsubscribe(d, B);
|
|
822
|
-
}
|
|
823
|
-
unsubscribe(d, B) {
|
|
824
|
-
this._subscribers.has(d) && this._subscribers.get(d)?.delete(B);
|
|
825
|
-
}
|
|
826
|
-
_notify(d, B) {
|
|
827
|
-
if (this._subscribers.has(d)) for (let V of this._subscribers.get(d) ?? /* @__PURE__ */ new Set()) try {
|
|
828
|
-
V(B);
|
|
829
|
-
} catch (d) {
|
|
830
|
-
this._sharedInstancesBag.telemetryManager.sendEventError(d, "modal subscriber"), this._debugPrint("Error in modal subscriber:", d);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
destroy() {
|
|
834
|
-
super.destroy(), this.closeAll(), this._modals.clear(), this._subscribers.clear(), this._notify(ModalEvents.DESTROY, {});
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
const blockCtx = () => ({}), activityBlockCtx = (d) => ({
|
|
838
|
-
...blockCtx(),
|
|
839
|
-
"*currentActivity": null,
|
|
840
|
-
"*currentActivityParams": {},
|
|
841
|
-
"*history": [],
|
|
842
|
-
"*historyBack": null,
|
|
843
|
-
"*closeModal": () => {
|
|
844
|
-
d.modalManager?.close(d.$["*currentActivity"]), d.pub("*currentActivity", null);
|
|
845
|
-
}
|
|
846
|
-
}), uploaderBlockCtx = (d) => ({
|
|
847
|
-
...activityBlockCtx(d),
|
|
848
|
-
"*commonProgress": 0,
|
|
849
|
-
"*uploadList": [],
|
|
850
|
-
"*uploadQueue": new Queue(1),
|
|
851
|
-
"*collectionErrors": [],
|
|
852
|
-
"*collectionState": null,
|
|
853
|
-
"*groupInfo": null,
|
|
854
|
-
"*uploadTrigger": /* @__PURE__ */ new Set()
|
|
855
|
-
}), solutionBlockCtx = (d) => ({
|
|
856
|
-
...uploaderBlockCtx(d),
|
|
857
|
-
"*solution": null
|
|
858
|
-
});
|
|
859
|
-
var ClipboardLayer = class extends SharedInstance {
|
|
860
|
-
constructor(d) {
|
|
861
|
-
super(d), this.scopes = /* @__PURE__ */ new Set(), this.listener = this._listener.bind(this), window.addEventListener("paste", this.listener);
|
|
862
|
-
}
|
|
863
|
-
openUploadList() {
|
|
864
|
-
this._sharedInstancesBag.api.setCurrentActivity(ACTIVITY_TYPES.UPLOAD_LIST), this._sharedInstancesBag.api.setModalState(!0);
|
|
865
|
-
}
|
|
866
|
-
async _listener(d) {
|
|
867
|
-
if (d.clipboardData) {
|
|
868
|
-
for (let B of this.scopes) if (B.isConnected) switch (this._cfg.pasteScope) {
|
|
869
|
-
case "global":
|
|
870
|
-
await this.handlePaste(d);
|
|
871
|
-
break;
|
|
872
|
-
case "local":
|
|
873
|
-
if (!B.contains(d.target)) continue;
|
|
874
|
-
await this.handlePaste(d);
|
|
875
|
-
break;
|
|
876
|
-
default: continue;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
async handlePaste(d) {
|
|
881
|
-
let B = Array.from(d.clipboardData.items), V = B.map((d) => d.getAsFile()).filter((d) => d !== null), H = B.filter((d) => d.kind === "string" && d.type === "text/plain").map((d) => new Promise((B) => {
|
|
882
|
-
d.getAsString((d) => {
|
|
883
|
-
B(d);
|
|
884
|
-
});
|
|
885
|
-
}));
|
|
886
|
-
V.length > 0 && (V.forEach((d) => {
|
|
887
|
-
this._sharedInstancesBag.api.addFileFromObject(d, { source: "clipboard" });
|
|
888
|
-
}), this.openUploadList()), H.length > 0 && ((await Promise.all(H)).forEach((d) => {
|
|
889
|
-
this._sharedInstancesBag.api.addFileFromUrl(d, { source: "clipboard" });
|
|
890
|
-
}), this.openUploadList());
|
|
891
|
-
}
|
|
892
|
-
registerBlock(d) {
|
|
893
|
-
return this.scopes.add(d), () => {
|
|
894
|
-
this.scopes.delete(d);
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
destroy() {
|
|
898
|
-
super.destroy(), window.removeEventListener("paste", this.listener), this.scopes.clear();
|
|
899
|
-
}
|
|
900
|
-
}, ScopedMinimalWindow = class {
|
|
901
|
-
constructor() {
|
|
902
|
-
this._listeners = /* @__PURE__ */ new Map(), this._scope = [];
|
|
903
|
-
}
|
|
904
|
-
addEventListener(d, B) {
|
|
905
|
-
let V = (d) => {
|
|
906
|
-
let V = d.target;
|
|
907
|
-
V instanceof Node && this._scope.some((d) => d === V || d.contains(V)) && B(d);
|
|
908
|
-
};
|
|
909
|
-
this._listeners.set(B, V), window.addEventListener(d, V);
|
|
910
|
-
}
|
|
911
|
-
removeEventListener(d, B) {
|
|
912
|
-
let V = this._listeners.get(B);
|
|
913
|
-
V && window.removeEventListener(d, V), this._listeners.delete(B);
|
|
914
|
-
}
|
|
915
|
-
get CustomEvent() {
|
|
916
|
-
return window.CustomEvent;
|
|
917
|
-
}
|
|
918
|
-
get document() {
|
|
919
|
-
return window.document;
|
|
920
|
-
}
|
|
921
|
-
get navigator() {
|
|
922
|
-
return window.navigator;
|
|
923
|
-
}
|
|
924
|
-
registerScope(d) {
|
|
925
|
-
this._scope.push(d);
|
|
926
|
-
}
|
|
927
|
-
destroy() {
|
|
928
|
-
this._scope = [];
|
|
929
|
-
for (let d of this._listeners.values()) window.removeEventListener("keydown", d), window.removeEventListener("keyup", d);
|
|
930
|
-
this._listeners.clear();
|
|
931
|
-
}
|
|
932
|
-
}, A11y = class {
|
|
933
|
-
constructor() {
|
|
934
|
-
this._scopedWindow = new ScopedMinimalWindow(), this._destroyKeyUX = startKeyUX(this._scopedWindow, [
|
|
935
|
-
focusGroupKeyUX(),
|
|
936
|
-
pressKeyUX("is-pressed"),
|
|
937
|
-
jumpKeyUX(),
|
|
938
|
-
hiddenKeyUX()
|
|
939
|
-
]);
|
|
940
|
-
}
|
|
941
|
-
registerBlock(d) {
|
|
942
|
-
this._scopedWindow.registerScope(d);
|
|
943
|
-
}
|
|
944
|
-
destroy() {
|
|
945
|
-
this._destroyKeyUX?.(), this._scopedWindow.destroy();
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
const localeStateKey = (d) => `*l10n/${d}`;
|
|
949
|
-
var LocaleManager = class extends SharedInstance {
|
|
950
|
-
constructor(d) {
|
|
951
|
-
super(d), this._localeName = "";
|
|
952
|
-
for (let [d, B] of Object.entries(en_default)) {
|
|
953
|
-
let V = this._ctx.has(localeStateKey(d)) ? !this._ctx.read(localeStateKey(d)) : !0;
|
|
954
|
-
this._ctx.add(localeStateKey(d), B, V);
|
|
955
|
-
}
|
|
956
|
-
let B = d.pluginManager;
|
|
957
|
-
B?.onPluginsChange && this.addSub(B.onPluginsChange(() => {
|
|
958
|
-
this._localeName && this._applyPluginLocales(this._localeName);
|
|
959
|
-
})), this.addSub(this._ctx.sub(sharedConfigKey("localeName"), async (d) => {
|
|
960
|
-
if (!d) return;
|
|
961
|
-
this._localeName = d;
|
|
962
|
-
let B = await resolveLocaleDefinition(d);
|
|
963
|
-
d !== "en" && this._localeName !== d || (this._applyPluginLocales(d), this._applyOverrides(d, B));
|
|
964
|
-
})), this.addSub(this._ctx.sub(sharedConfigKey("localeDefinitionOverride"), (d) => {
|
|
965
|
-
if (!d) return;
|
|
966
|
-
let B = d[this._localeName];
|
|
967
|
-
B && this._applyOverrides(this._localeName, B);
|
|
968
|
-
}));
|
|
969
|
-
}
|
|
970
|
-
_applyOverrides(d, B) {
|
|
971
|
-
let V = this._cfg.localeDefinitionOverride?.[d];
|
|
972
|
-
for (let [d, H] of Object.entries(B)) {
|
|
973
|
-
let B = V?.[d];
|
|
974
|
-
this._ctx.add(localeStateKey(d), B ?? H, !0);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
_applyPluginLocales(d) {
|
|
978
|
-
let B = this._sharedInstancesBag.pluginManager;
|
|
979
|
-
if (!B) return;
|
|
980
|
-
let V = B.snapshot();
|
|
981
|
-
for (let B of V.i18n) {
|
|
982
|
-
let { pluginId: V, ...H } = B, U = H[d];
|
|
983
|
-
if (U) for (let [d, B] of Object.entries(U)) B !== void 0 && this._ctx.add(localeStateKey(d), B, !0);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}, CustomConfigRegistry = class {
|
|
987
|
-
constructor() {
|
|
988
|
-
this._definitions = /* @__PURE__ */ new Map();
|
|
989
|
-
}
|
|
990
|
-
register(d, B) {
|
|
991
|
-
if (this._definitions.has(B.name)) {
|
|
992
|
-
console.warn(`[CustomConfig] Config option "${B.name}" is already registered`);
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
let V = {
|
|
996
|
-
attribute: !0,
|
|
997
|
-
...B,
|
|
998
|
-
pluginId: d
|
|
999
|
-
};
|
|
1000
|
-
this._definitions.set(B.name, V);
|
|
1001
|
-
}
|
|
1002
|
-
unregister(d) {
|
|
1003
|
-
this._definitions.delete(d);
|
|
1004
|
-
}
|
|
1005
|
-
unregisterByPlugin(d) {
|
|
1006
|
-
for (let [B, V] of this._definitions) V.pluginId === d && this._definitions.delete(B);
|
|
1007
|
-
}
|
|
1008
|
-
get(d) {
|
|
1009
|
-
return this._definitions.get(d);
|
|
1010
|
-
}
|
|
1011
|
-
getAll() {
|
|
1012
|
-
return new Map(this._definitions);
|
|
1013
|
-
}
|
|
1014
|
-
}, PluginManager = class extends SharedInstance {
|
|
1015
|
-
constructor(d) {
|
|
1016
|
-
super(d), this._plugins = /* @__PURE__ */ new Map(), this._sources = [], this._activities = [], this._fileActions = [], this._fileHooks = [], this._icons = [], this._i18n = [], this._subscribers = /* @__PURE__ */ new Set(), this._pluginsUpdate = Promise.resolve(), this.configRegistry = new CustomConfigRegistry(), this.addSub(this._ctx.sub(sharedConfigKey("plugins"), (d) => {
|
|
1017
|
-
this._pluginsUpdate = this._pluginsUpdate.then(() => this._syncPlugins(d));
|
|
1018
|
-
}));
|
|
1019
|
-
}
|
|
1020
|
-
onPluginsChange(d) {
|
|
1021
|
-
return this._subscribers.add(d), () => {
|
|
1022
|
-
this._subscribers.delete(d);
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
async _syncPlugins(d) {
|
|
1026
|
-
let B = new Set(this._plugins.keys()), V = /* @__PURE__ */ new Set();
|
|
1027
|
-
for (let H of d) {
|
|
1028
|
-
if (V.has(H.id)) {
|
|
1029
|
-
this._debugPrint(`Plugin "${H.id}" is already in the list, skipping duplicate`);
|
|
1030
|
-
continue;
|
|
1031
|
-
}
|
|
1032
|
-
V.add(H.id);
|
|
1033
|
-
let d = this._plugins.get(H.id);
|
|
1034
|
-
if (!d || d.plugin !== H) try {
|
|
1035
|
-
await this._registerPlugin(H);
|
|
1036
|
-
} catch (d) {
|
|
1037
|
-
this._purgeRegistrations(H.id), this._notifySubscribers(), this._debugPrint(`Plugin "${H.id}" setup failed`, d);
|
|
1038
|
-
}
|
|
1039
|
-
B.delete(H.id);
|
|
1040
|
-
}
|
|
1041
|
-
for (let d of B) this._unregisterPlugin(d);
|
|
1042
|
-
}
|
|
1043
|
-
async _registerPlugin(d) {
|
|
1044
|
-
this._plugins.has(d.id) && this._unregisterPlugin(d.id);
|
|
1045
|
-
let B = {
|
|
1046
|
-
sources: [],
|
|
1047
|
-
activities: [],
|
|
1048
|
-
fileActions: [],
|
|
1049
|
-
fileHooks: [],
|
|
1050
|
-
icons: [],
|
|
1051
|
-
i18n: []
|
|
1052
|
-
}, V = [], H = {
|
|
1053
|
-
registry: {
|
|
1054
|
-
registerSource: (V) => this._register(this._sources, B.sources, d.id, V),
|
|
1055
|
-
registerActivity: (V) => this._register(this._activities, B.activities, d.id, V),
|
|
1056
|
-
registerFileAction: (V) => this._register(this._fileActions, B.fileActions, d.id, V),
|
|
1057
|
-
registerFileHook: (V) => this._register(this._fileHooks, B.fileHooks, d.id, V),
|
|
1058
|
-
registerIcon: (V) => this._register(this._icons, B.icons, d.id, V),
|
|
1059
|
-
registerI18n: (V) => this._register(this._i18n, B.i18n, d.id, V),
|
|
1060
|
-
registerConfig: (B) => {
|
|
1061
|
-
this.configRegistry.register(d.id, B);
|
|
1062
|
-
}
|
|
1063
|
-
},
|
|
1064
|
-
config: {
|
|
1065
|
-
get: (d) => {
|
|
1066
|
-
let B = sharedConfigKey(d);
|
|
1067
|
-
return this._ctx.read(B);
|
|
1068
|
-
},
|
|
1069
|
-
subscribe: (d, B) => {
|
|
1070
|
-
let H = sharedConfigKey(d), U = this._ctx.sub(H, (d) => {
|
|
1071
|
-
B(d);
|
|
1072
|
-
});
|
|
1073
|
-
return V.push(U), U;
|
|
1074
|
-
}
|
|
1075
|
-
},
|
|
1076
|
-
activity: {
|
|
1077
|
-
getParams: () => this._ctx.read("*currentActivityParams"),
|
|
1078
|
-
subscribeToParams: (d) => {
|
|
1079
|
-
let B = this._ctx.sub("*currentActivityParams", (B) => {
|
|
1080
|
-
d(B);
|
|
1081
|
-
});
|
|
1082
|
-
return V.push(B), B;
|
|
1083
|
-
}
|
|
1084
|
-
},
|
|
1085
|
-
files: { update: (d, B) => {
|
|
1086
|
-
let V = this._sharedInstancesBag.uploadCollection?.read(d);
|
|
1087
|
-
V && (B.file !== void 0 && (V.setValue("file", B.file), V.setValue("fileSize", B.file.size)), B.cdnUrl !== void 0 && V.setValue("cdnUrl", B.cdnUrl), B.cdnUrlModifiers !== void 0 && V.setValue("cdnUrlModifiers", B.cdnUrlModifiers), B.mimeType !== void 0 && V.setValue("mimeType", B.mimeType));
|
|
1088
|
-
} }
|
|
1089
|
-
}, U = this._sharedInstancesBag.api, W;
|
|
1090
|
-
try {
|
|
1091
|
-
W = await d.setup({
|
|
1092
|
-
pluginApi: H,
|
|
1093
|
-
uploaderApi: U
|
|
1094
|
-
}) ?? void 0;
|
|
1095
|
-
} catch (d) {
|
|
1096
|
-
for (let d of V) try {
|
|
1097
|
-
d();
|
|
1098
|
-
} catch (d) {
|
|
1099
|
-
this._debugPrint("Failed to unsubscribe config listener", d);
|
|
1100
|
-
}
|
|
1101
|
-
throw d;
|
|
1102
|
-
}
|
|
1103
|
-
this._plugins.set(d.id, {
|
|
1104
|
-
plugin: d,
|
|
1105
|
-
exports: W,
|
|
1106
|
-
registrations: B,
|
|
1107
|
-
configSubscriptions: V
|
|
1108
|
-
}), this._notifySubscribers();
|
|
1109
|
-
}
|
|
1110
|
-
_unregisterPlugin(d) {
|
|
1111
|
-
let B = this._plugins.get(d);
|
|
1112
|
-
if (B) {
|
|
1113
|
-
this._purgeRegistrations(d);
|
|
1114
|
-
for (let d of B.configSubscriptions) try {
|
|
1115
|
-
d();
|
|
1116
|
-
} catch (d) {
|
|
1117
|
-
this._debugPrint("Failed to unsubscribe config listener", d);
|
|
1118
|
-
}
|
|
1119
|
-
B.exports?.dispose?.(), this._plugins.delete(d), this._notifySubscribers();
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
snapshot() {
|
|
1123
|
-
return {
|
|
1124
|
-
sources: [...this._sources],
|
|
1125
|
-
activities: [...this._activities],
|
|
1126
|
-
fileActions: [...this._fileActions],
|
|
1127
|
-
fileHooks: [...this._fileHooks],
|
|
1128
|
-
icons: [...this._icons],
|
|
1129
|
-
i18n: [...this._i18n]
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
destroy() {
|
|
1133
|
-
for (let d of Array.from(this._plugins.keys())) this._unregisterPlugin(d);
|
|
1134
|
-
super.destroy();
|
|
1135
|
-
}
|
|
1136
|
-
_register(d, B, V, H) {
|
|
1137
|
-
let U = {
|
|
1138
|
-
...H,
|
|
1139
|
-
pluginId: V
|
|
1140
|
-
};
|
|
1141
|
-
return d.push(U), B.push(U), H;
|
|
1142
|
-
}
|
|
1143
|
-
_purgeRegistrations(d) {
|
|
1144
|
-
this._sources = this._sources.filter((B) => B.pluginId !== d), this._activities = this._activities.filter((B) => B.pluginId !== d), this._fileActions = this._fileActions.filter((B) => B.pluginId !== d), this._fileHooks = this._fileHooks.filter((B) => B.pluginId !== d), this._icons = this._icons.filter((B) => B.pluginId !== d), this._i18n = this._i18n.filter((B) => B.pluginId !== d), this.configRegistry.unregisterByPlugin(d);
|
|
1145
|
-
}
|
|
1146
|
-
_notifySubscribers() {
|
|
1147
|
-
for (let d of this._subscribers) try {
|
|
1148
|
-
d();
|
|
1149
|
-
} catch {}
|
|
1150
|
-
}
|
|
1151
|
-
}, DEFAULT_DEBOUNCE_TIMEOUT = 20;
|
|
1152
|
-
const InternalEventType = Object.freeze({
|
|
1153
|
-
INIT_SOLUTION: "init-solution",
|
|
1154
|
-
CHANGE_CONFIG: "change-config",
|
|
1155
|
-
ACTION_EVENT: "action-event",
|
|
1156
|
-
ERROR_EVENT: "error-event"
|
|
1157
|
-
}), EventType = Object.freeze({
|
|
1158
|
-
FILE_ADDED: "file-added",
|
|
1159
|
-
FILE_REMOVED: "file-removed",
|
|
1160
|
-
FILE_UPLOAD_START: "file-upload-start",
|
|
1161
|
-
FILE_UPLOAD_PROGRESS: "file-upload-progress",
|
|
1162
|
-
FILE_UPLOAD_SUCCESS: "file-upload-success",
|
|
1163
|
-
FILE_UPLOAD_FAILED: "file-upload-failed",
|
|
1164
|
-
FILE_URL_CHANGED: "file-url-changed",
|
|
1165
|
-
MODAL_OPEN: "modal-open",
|
|
1166
|
-
MODAL_CLOSE: "modal-close",
|
|
1167
|
-
DONE_CLICK: "done-click",
|
|
1168
|
-
UPLOAD_CLICK: "upload-click",
|
|
1169
|
-
ACTIVITY_CHANGE: "activity-change",
|
|
1170
|
-
COMMON_UPLOAD_START: "common-upload-start",
|
|
1171
|
-
COMMON_UPLOAD_PROGRESS: "common-upload-progress",
|
|
1172
|
-
COMMON_UPLOAD_SUCCESS: "common-upload-success",
|
|
1173
|
-
COMMON_UPLOAD_FAILED: "common-upload-failed",
|
|
1174
|
-
CHANGE: "change",
|
|
1175
|
-
GROUP_CREATED: "group-created"
|
|
1176
|
-
});
|
|
1177
|
-
var EventEmitter = class extends SharedInstance {
|
|
1178
|
-
constructor(...d) {
|
|
1179
|
-
super(...d), this._timeoutStore = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Set();
|
|
1180
|
-
}
|
|
1181
|
-
bindTarget(d) {
|
|
1182
|
-
return this._targets.add(d), () => {
|
|
1183
|
-
this._targets.delete(d);
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
_dispatch(d, B) {
|
|
1187
|
-
for (let V of this._targets) V.dispatchEvent(new CustomEvent(d, { detail: B }));
|
|
1188
|
-
this._debugPrint?.(() => {
|
|
1189
|
-
let V = B && typeof B == "object" ? { ...B } : B;
|
|
1190
|
-
return [`event "${d}"`, V];
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
emit(d, B, V = {}) {
|
|
1194
|
-
let { debounce: H } = V;
|
|
1195
|
-
if (typeof H != "number" && !H) {
|
|
1196
|
-
this._dispatch(d, typeof B == "function" ? B() : B);
|
|
1197
|
-
return;
|
|
1198
|
-
}
|
|
1199
|
-
this._timeoutStore.has(d) && window.clearTimeout(this._timeoutStore.get(d));
|
|
1200
|
-
let U = typeof H == "number" ? H : DEFAULT_DEBOUNCE_TIMEOUT, W = window.setTimeout(() => {
|
|
1201
|
-
try {
|
|
1202
|
-
let V = typeof B == "function" ? B() : B;
|
|
1203
|
-
this._dispatch(d, V), this._timeoutStore.delete(d);
|
|
1204
|
-
} catch (B) {
|
|
1205
|
-
this._debugPrint?.(() => `Error while getting payload for event "${d}"`, B);
|
|
1206
|
-
}
|
|
1207
|
-
}, U);
|
|
1208
|
-
this._timeoutStore.set(d, W);
|
|
1209
|
-
}
|
|
1210
|
-
destroy() {
|
|
1211
|
-
for (let d of this._timeoutStore.values()) window.clearTimeout(d);
|
|
1212
|
-
this._targets.clear();
|
|
1213
|
-
}
|
|
1214
|
-
}, TelemetryManager = class extends SharedInstance {
|
|
1215
|
-
constructor(d) {
|
|
1216
|
-
super(d), this._sessionId = UID.generateRandomUUID(), this._config = structuredClone(initialConfig), this._initialized = !1, this._lastPayload = null, this._isEnabled = !1, this._telemetryInstance = new TelemetryAPIService(), this._queue = new Queue(10), this.addSub(this._ctx.sub(sharedConfigKey("qualityInsights"), (d) => {
|
|
1217
|
-
this._isEnabled = !!d;
|
|
1218
|
-
}));
|
|
1219
|
-
for (let d of Object.keys(this._config)) this.addSub(this._ctx.sub(sharedConfigKey(d), (B) => {
|
|
1220
|
-
this._isEnabled && (this._initialized && this._config[d] !== B && this.sendEvent({ eventType: InternalEventType.CHANGE_CONFIG }), this._setConfig(d, B));
|
|
1221
|
-
}));
|
|
1222
|
-
}
|
|
1223
|
-
_init(d) {
|
|
1224
|
-
d === InternalEventType.INIT_SOLUTION && !this._initialized && (this._initialized = !0);
|
|
1225
|
-
}
|
|
1226
|
-
_setConfig(d, B) {
|
|
1227
|
-
this._config[d] !== B && (this._config[d] = B);
|
|
1228
|
-
}
|
|
1229
|
-
_formattingPayload(d) {
|
|
1230
|
-
let B = d.payload ? { ...d.payload } : {};
|
|
1231
|
-
B.activity &&= void 0;
|
|
1232
|
-
let V = { ...d };
|
|
1233
|
-
return (d.eventType === InternalEventType.INIT_SOLUTION || d.eventType === InternalEventType.CHANGE_CONFIG) && (V.config = this._config), {
|
|
1234
|
-
...V,
|
|
1235
|
-
appVersion: PACKAGE_VERSION,
|
|
1236
|
-
appName: PACKAGE_NAME,
|
|
1237
|
-
sessionId: this._sessionId,
|
|
1238
|
-
component: this._solution,
|
|
1239
|
-
activity: this._activity,
|
|
1240
|
-
projectPubkey: this._config.pubkey,
|
|
1241
|
-
userAgent: navigator.userAgent,
|
|
1242
|
-
eventType: V.eventType ?? "",
|
|
1243
|
-
eventTimestamp: this._timestamp,
|
|
1244
|
-
payload: {
|
|
1245
|
-
location: this._location,
|
|
1246
|
-
...B
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
_excludedEvents(d) {
|
|
1251
|
-
return !!(d && [
|
|
1252
|
-
EventType.CHANGE,
|
|
1253
|
-
EventType.COMMON_UPLOAD_PROGRESS,
|
|
1254
|
-
EventType.FILE_ADDED,
|
|
1255
|
-
EventType.FILE_REMOVED,
|
|
1256
|
-
EventType.FILE_UPLOAD_START,
|
|
1257
|
-
EventType.FILE_UPLOAD_PROGRESS,
|
|
1258
|
-
EventType.FILE_UPLOAD_SUCCESS,
|
|
1259
|
-
EventType.FILE_UPLOAD_FAILED
|
|
1260
|
-
].includes(d));
|
|
1261
|
-
}
|
|
1262
|
-
sendEvent(d) {
|
|
1263
|
-
if (!this._isEnabled) return;
|
|
1264
|
-
let B = this._formattingPayload({
|
|
1265
|
-
eventType: d.eventType,
|
|
1266
|
-
payload: d.payload,
|
|
1267
|
-
config: d.config
|
|
1268
|
-
});
|
|
1269
|
-
this._init(d.eventType), !this._excludedEvents(d.eventType) && (this._lastPayload && this._checkObj(this._lastPayload, B) || this._queue.add(async () => {
|
|
1270
|
-
this._lastPayload = B, await this._telemetryInstance.sendEvent(B);
|
|
1271
|
-
}));
|
|
1272
|
-
}
|
|
1273
|
-
sendEventError(d, B = "unknown") {
|
|
1274
|
-
this.sendEvent({
|
|
1275
|
-
eventType: InternalEventType.ERROR_EVENT,
|
|
1276
|
-
payload: { metadata: {
|
|
1277
|
-
event: "error",
|
|
1278
|
-
text: `Error in ${B}`,
|
|
1279
|
-
error: d.message
|
|
1280
|
-
} }
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
sendEventCloudImageEditor(d, B, V = {}) {
|
|
1284
|
-
this.sendEvent({
|
|
1285
|
-
eventType: InternalEventType.ACTION_EVENT,
|
|
1286
|
-
payload: { metadata: {
|
|
1287
|
-
tabId: B,
|
|
1288
|
-
node: d.currentTarget?.tagName,
|
|
1289
|
-
event: d.type,
|
|
1290
|
-
...V
|
|
1291
|
-
} }
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
_checkObj(d, B) {
|
|
1295
|
-
if (JSON.stringify(d) === JSON.stringify(B)) return !0;
|
|
1296
|
-
if (typeof d != "object" || typeof B != "object" || d == null || B == null) return !1;
|
|
1297
|
-
let V = Object.keys(d), H = Object.keys(B);
|
|
1298
|
-
if (V.length !== H.length) return !1;
|
|
1299
|
-
for (let H of V) if (!Object.hasOwn(B, H) || !this._checkObj(d[H], B[H])) return !1;
|
|
1300
|
-
return !0;
|
|
1301
|
-
}
|
|
1302
|
-
get _timestamp() {
|
|
1303
|
-
return Date.now();
|
|
1304
|
-
}
|
|
1305
|
-
get _solution() {
|
|
1306
|
-
if (!this._ctx.has("*solution")) return null;
|
|
1307
|
-
let d = this._ctx.read("*solution");
|
|
1308
|
-
return d ? d.toLowerCase() : null;
|
|
1309
|
-
}
|
|
1310
|
-
get _activity() {
|
|
1311
|
-
return this._ctx.has("*currentActivity") ? this._ctx.read("*currentActivity") : null;
|
|
1312
|
-
}
|
|
1313
|
-
get _location() {
|
|
1314
|
-
return location.origin;
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
const getLocaleDirection = (d) => {
|
|
1318
|
-
let B = new Intl.Locale(d), V = "ltr", H = B.getTextInfo?.().direction;
|
|
1319
|
-
return H ? V = H : B.textInfo?.direction && (V = B.textInfo.direction), V;
|
|
1320
|
-
};
|
|
1321
|
-
var DEFAULT_TRANSFORMER = (d) => d, OPEN_TOKEN = "{{", CLOSE_TOKEN = "}}", PLURAL_PREFIX = "plural:";
|
|
1322
|
-
function applyTemplateData(d, B = {}, V = {}) {
|
|
1323
|
-
let { openToken: H = OPEN_TOKEN, closeToken: U = CLOSE_TOKEN, transform: W = DEFAULT_TRANSFORMER } = V;
|
|
1324
|
-
for (let V in B) {
|
|
1325
|
-
let G = B[V]?.toString(), K = typeof G == "string" ? W(G) : String(G);
|
|
1326
|
-
d = d.replaceAll(H + V + U, K);
|
|
1327
|
-
}
|
|
1328
|
-
return d;
|
|
1329
|
-
}
|
|
1330
|
-
function getPluralObjects(d) {
|
|
1331
|
-
let B = [], V = d.indexOf(OPEN_TOKEN);
|
|
1332
|
-
for (; V !== -1;) {
|
|
1333
|
-
let H = d.indexOf(CLOSE_TOKEN, V);
|
|
1334
|
-
if (H === -1) break;
|
|
1335
|
-
let U = d.substring(V + 2, H);
|
|
1336
|
-
if (U.startsWith(PLURAL_PREFIX)) {
|
|
1337
|
-
let W = d.substring(V + 2, H).replace(PLURAL_PREFIX, ""), G = W.substring(0, W.indexOf("(")), K = W.substring(W.indexOf("(") + 1, W.indexOf(")"));
|
|
1338
|
-
B.push({
|
|
1339
|
-
variable: U,
|
|
1340
|
-
pluralKey: G,
|
|
1341
|
-
countVariable: K
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
V = d.indexOf(OPEN_TOKEN, H);
|
|
1345
|
-
}
|
|
1346
|
-
return B;
|
|
1347
|
-
}
|
|
1348
|
-
var WINDOW_HEIGHT_TRACKER_PROPERTY = "--uploadcare-blocks-window-height", WindowHeightTracker = class d {
|
|
1349
|
-
static {
|
|
1350
|
-
this.clientsRegistry = /* @__PURE__ */ new Set();
|
|
1351
|
-
}
|
|
1352
|
-
static {
|
|
1353
|
-
this.flush = debounce(() => {
|
|
1354
|
-
document.documentElement.style.setProperty(WINDOW_HEIGHT_TRACKER_PROPERTY, `${window.innerHeight}px`);
|
|
1355
|
-
}, 100);
|
|
1356
|
-
}
|
|
1357
|
-
static registerClient(B) {
|
|
1358
|
-
d.clientsRegistry.size === 0 && d.attachTracker(), d.clientsRegistry.add(B);
|
|
1359
|
-
}
|
|
1360
|
-
static unregisterClient(B) {
|
|
1361
|
-
d.clientsRegistry.delete(B), d.clientsRegistry.size === 0 && d.detachTracker();
|
|
1362
|
-
}
|
|
1363
|
-
static attachTracker() {
|
|
1364
|
-
window.addEventListener("resize", d.flush, {
|
|
1365
|
-
passive: !0,
|
|
1366
|
-
capture: !0
|
|
1367
|
-
}), d.flush();
|
|
1368
|
-
}
|
|
1369
|
-
static detachTracker() {
|
|
1370
|
-
window.removeEventListener("resize", d.flush, { capture: !0 }), document.documentElement.style.removeProperty(WINDOW_HEIGHT_TRACKER_PROPERTY);
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
const getPluralForm = (d, B) => new Intl.PluralRules(d).select(B), createPluralizer = (d) => (B, V) => {
|
|
1374
|
-
let H = d();
|
|
1375
|
-
return H(`${B}__${getPluralForm(H("locale-id") || "en", V)}`);
|
|
1376
|
-
}, createL10n = (d) => {
|
|
1377
|
-
let B = createPluralizer(() => V), V = (V, H = {}) => {
|
|
1378
|
-
if (!V) return "";
|
|
1379
|
-
let U = d().read(localeStateKey(V)) || V, W = getPluralObjects(U);
|
|
1380
|
-
for (let d of W) H[d.variable] = B(d.pluralKey, Number(H[d.countVariable]));
|
|
1381
|
-
return applyTemplateData(U, H);
|
|
1382
|
-
};
|
|
1383
|
-
return V;
|
|
1384
|
-
};
|
|
1385
|
-
var isCustomElement = (d) => d.tagName?.includes("-") ?? !1, TestModeController = class {
|
|
1386
|
-
constructor(d) {
|
|
1387
|
-
this._trackedElements = /* @__PURE__ */ new Set(), this._originalValues = /* @__PURE__ */ new Map(), this._enabled = !1, this._host = d, this._host.addController(this);
|
|
1388
|
-
}
|
|
1389
|
-
hostDisconnected() {
|
|
1390
|
-
this._unsubscribe?.(), this._unsubscribe = void 0, this._trackedElements.clear(), this._originalValues.clear();
|
|
1391
|
-
}
|
|
1392
|
-
hostUpdated() {
|
|
1393
|
-
!this._unsubscribe && this._host.has(sharedConfigKey("testMode")) && (this._unsubscribe = this._host.subConfigValue("testMode", (d) => {
|
|
1394
|
-
this._enabled = !!d, this._applyTestMode();
|
|
1395
|
-
})), this._collectElements(), this._applyTestMode();
|
|
1396
|
-
}
|
|
1397
|
-
_collectElements() {
|
|
1398
|
-
let d = this._host, B = d.renderRoot ?? d;
|
|
1399
|
-
if (!B) return;
|
|
1400
|
-
let V = this._host, H = V.tagName?.toLowerCase(), U = Array.from(B.querySelectorAll("[data-testid]")).filter((d) => !isCustomElement(d));
|
|
1401
|
-
for (let d of U) if (!(H && d.closest(H) !== V) && !this._trackedElements.has(d)) {
|
|
1402
|
-
let B = d.getAttribute("data-testid");
|
|
1403
|
-
if (!B) continue;
|
|
1404
|
-
this._trackedElements.add(d), this._originalValues.set(d, B);
|
|
1405
|
-
}
|
|
1406
|
-
for (let d of Array.from(this._trackedElements)) (!d.isConnected || H && d.closest(H) !== V) && (this._trackedElements.delete(d), this._originalValues.delete(d));
|
|
1407
|
-
}
|
|
1408
|
-
_applyTestMode() {
|
|
1409
|
-
if (!this._trackedElements.size) return;
|
|
1410
|
-
let d = this._host.testId || "";
|
|
1411
|
-
for (let B of this._trackedElements) {
|
|
1412
|
-
let V = this._originalValues.get(B);
|
|
1413
|
-
V && (this._enabled ? B.setAttribute("data-testid", `${d}--${V}`) : B.removeAttribute("data-testid"));
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
}, LitBlockBase = RegisterableElementMixin(SymbioteMixin()(CssDataMixin(LightDomMixin(LitElement)))), LitBlock = class extends LitBlockBase {
|
|
1417
|
-
static {
|
|
1418
|
-
this.styleAttrs = [];
|
|
1419
|
-
}
|
|
1420
|
-
constructor() {
|
|
1421
|
-
super(), this.activityType = null, this.init$ = blockCtx(), this.l10n = createL10n(() => this.sharedCtx), this.debugPrint = createDebugPrinter(() => this.sharedCtx, this.constructor.name), this._sharedInstancesBag = createSharedInstancesBag(() => this.sharedCtx), new TestModeController(this);
|
|
1422
|
-
}
|
|
1423
|
-
emit(d, B, V) {
|
|
1424
|
-
let H = this.has("*eventEmitter") ? this.$["*eventEmitter"] : void 0;
|
|
1425
|
-
if (!H) return;
|
|
1426
|
-
H.emit(d, B, V);
|
|
1427
|
-
let U = typeof B == "function" ? B() : B;
|
|
1428
|
-
this.telemetryManager.sendEvent({
|
|
1429
|
-
eventType: d,
|
|
1430
|
-
payload: U ?? void 0
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
1433
|
-
hasBlockInCtx(d) {
|
|
1434
|
-
for (let B of this.blocksRegistry) if (d(B)) return !0;
|
|
1435
|
-
return !1;
|
|
1436
|
-
}
|
|
1437
|
-
connectedCallback() {
|
|
1438
|
-
this.constructor.styleAttrs.forEach((d) => {
|
|
1439
|
-
this.setAttribute(d, "");
|
|
1440
|
-
}), super.connectedCallback(), WindowHeightTracker.registerClient(this);
|
|
1441
|
-
}
|
|
1442
|
-
initCallback() {
|
|
1443
|
-
this._addSharedContextInstance("*blocksRegistry", () => /* @__PURE__ */ new Set()), this._addSharedContextInstance("*pluginManager", (d) => new PluginManager(d)), this._addSharedContextInstance("*eventEmitter", (d) => new EventEmitter(d)), this._addSharedContextInstance("*localeManager", (d) => new LocaleManager(d)), this._addSharedContextInstance("*modalManager", (d) => new ModalManager(d)), this._addSharedContextInstance("*a11y", () => new A11y()), this._addSharedContextInstance("*clipboard", (d) => new ClipboardLayer(d)), this._addSharedContextInstance("*telemetryManager", (d) => new TelemetryManager(d)), this.sub(localeStateKey("locale-id"), (d) => {
|
|
1444
|
-
let B = getLocaleDirection(d);
|
|
1445
|
-
this.style.direction = B === "ltr" ? "" : B, this.requestUpdate();
|
|
1446
|
-
}), this.subConfigValue("testMode", (d) => {
|
|
1447
|
-
if (!d || !this.testId) {
|
|
1448
|
-
this.removeAttribute("data-testid");
|
|
1449
|
-
return;
|
|
1450
|
-
}
|
|
1451
|
-
this.setAttribute("data-testid", this.testId);
|
|
1452
|
-
}), this.blocksRegistry.add(this);
|
|
1453
|
-
}
|
|
1454
|
-
get testId() {
|
|
1455
|
-
return window.customElements.getName(this.constructor);
|
|
1456
|
-
}
|
|
1457
|
-
get modalManager() {
|
|
1458
|
-
return this._getSharedContextInstance("*modalManager", !1);
|
|
1459
|
-
}
|
|
1460
|
-
get telemetryManager() {
|
|
1461
|
-
return this._getSharedContextInstance("*telemetryManager");
|
|
1462
|
-
}
|
|
1463
|
-
get localeManager() {
|
|
1464
|
-
return this._getSharedContextInstance("*localeManager");
|
|
1465
|
-
}
|
|
1466
|
-
get a11y() {
|
|
1467
|
-
return this._getSharedContextInstance("*a11y");
|
|
1468
|
-
}
|
|
1469
|
-
get clipboardLayer() {
|
|
1470
|
-
return this._getSharedContextInstance("*clipboard");
|
|
1471
|
-
}
|
|
1472
|
-
get blocksRegistry() {
|
|
1473
|
-
return this._getSharedContextInstance("*blocksRegistry");
|
|
1474
|
-
}
|
|
1475
|
-
get eventEmitter() {
|
|
1476
|
-
return this._getSharedContextInstance("*eventEmitter");
|
|
1477
|
-
}
|
|
1478
|
-
disconnectedCallback() {
|
|
1479
|
-
super.disconnectedCallback(), WindowHeightTracker.unregisterClient(this);
|
|
1480
|
-
let d = this.blocksRegistry;
|
|
1481
|
-
d?.delete(this), d?.size === 0 && setTimeout(() => {
|
|
1482
|
-
this.isConnected || d?.size > 0 || this.destroyCtxCallback();
|
|
1483
|
-
}, 0);
|
|
1484
|
-
}
|
|
1485
|
-
destroyCtxCallback() {
|
|
1486
|
-
this._destroySharedContextInstances(), PubSub.deleteCtx(this.ctxName);
|
|
1487
|
-
}
|
|
1488
|
-
_getSharedContextInstances() {
|
|
1489
|
-
let d = "*sharedContextInstances";
|
|
1490
|
-
if (!this.has(d) || !this.$[d]) {
|
|
1491
|
-
let B = /* @__PURE__ */ new Map();
|
|
1492
|
-
this.add(d, B, !0);
|
|
1493
|
-
}
|
|
1494
|
-
return this.$[d];
|
|
1495
|
-
}
|
|
1496
|
-
_addSharedContextInstance(d, B) {
|
|
1497
|
-
let V = this._getSharedContextInstances();
|
|
1498
|
-
if (!V.has(d) && (!this.has(d) || !this.$[d])) {
|
|
1499
|
-
let H = B(this._sharedInstancesBag);
|
|
1500
|
-
this.add(d, H, !0), V.set(d, H);
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
_destroySharedContextInstances() {
|
|
1505
|
-
let d = this._getSharedContextInstances();
|
|
1506
|
-
for (let [B, V] of d.entries()) V?.destroy?.(), this.pub(B, null);
|
|
1507
|
-
d.clear();
|
|
1508
|
-
}
|
|
1509
|
-
_getSharedContextInstance(d, B = !0) {
|
|
1510
|
-
if (this.has(d) && this.$[d] || !B) return this.$[d];
|
|
1511
|
-
throw Error(`Unexpected error: context manager for key "${String(d)}" is not available`);
|
|
1512
|
-
}
|
|
1513
|
-
async proxyUrl(d) {
|
|
1514
|
-
if (this.cfg.secureDeliveryProxy && this.cfg.secureDeliveryProxyUrlResolver && console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."), this.cfg.secureDeliveryProxyUrlResolver) try {
|
|
1515
|
-
return await this.cfg.secureDeliveryProxyUrlResolver(d, {
|
|
1516
|
-
uuid: extractUuid(d),
|
|
1517
|
-
cdnUrlModifiers: extractCdnUrlModifiers(d),
|
|
1518
|
-
fileName: extractFilename(d)
|
|
1519
|
-
});
|
|
1520
|
-
} catch (B) {
|
|
1521
|
-
return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.", B), this.telemetryManager.sendEventError(B, "secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."), d;
|
|
1522
|
-
}
|
|
1523
|
-
return this.cfg.secureDeliveryProxy ? applyTemplateData(this.cfg.secureDeliveryProxy, { previewUrl: d }, { transform: (d) => window.encodeURIComponent(d) }) : d;
|
|
1524
|
-
}
|
|
1525
|
-
get cfg() {
|
|
1526
|
-
return this._cfgProxy ||= new Proxy({}, {
|
|
1527
|
-
set: (d, B, V) => {
|
|
1528
|
-
if (typeof B != "string" || !(B in initialConfig)) return !1;
|
|
1529
|
-
let H = B, U = sharedConfigKey(H);
|
|
1530
|
-
return this.has(U) || this.add(U, initialConfig[H]), this.$[U] = V, !0;
|
|
1531
|
-
},
|
|
1532
|
-
get: (d, B) => {
|
|
1533
|
-
let V = sharedConfigKey(B);
|
|
1534
|
-
return this.has(V) || this.add(V, initialConfig[B]), this.$[V];
|
|
1535
|
-
}
|
|
1536
|
-
}), this._cfgProxy;
|
|
1537
|
-
}
|
|
1538
|
-
subConfigValue(d, B) {
|
|
1539
|
-
let V = sharedConfigKey(d);
|
|
1540
|
-
return this.has(V) || this.add(V, initialConfig[d]), this.sub(V, B);
|
|
1541
|
-
}
|
|
1542
|
-
};
|
|
1543
|
-
const CameraSourceTypes = Object.freeze({
|
|
1544
|
-
PHOTO: "photo",
|
|
1545
|
-
VIDEO: "video"
|
|
1546
|
-
}), CameraSourceEvents = Object.freeze({
|
|
1547
|
-
IDLE: "idle",
|
|
1548
|
-
SHOT: "shot",
|
|
1549
|
-
PLAY: "play",
|
|
1550
|
-
PAUSE: "pause",
|
|
1551
|
-
RESUME: "resume",
|
|
1552
|
-
STOP: "stop",
|
|
1553
|
-
RETAKE: "retake",
|
|
1554
|
-
ACCEPT: "accept"
|
|
1555
|
-
});
|
|
1556
|
-
var warnings = /* @__PURE__ */ new Set();
|
|
1557
|
-
function warnOnce(d) {
|
|
1558
|
-
warnings.has(d) || (warnings.add(d), console.warn(d));
|
|
1559
|
-
}
|
|
1560
|
-
const CROP_PADDING = 20, THUMB_CORNER_SIZE = 24, THUMB_SIDE_SIZE = 34, THUMB_STROKE_WIDTH = 3, THUMB_OFFSET = 3 / 2, GUIDE_STROKE_WIDTH = 1, GUIDE_THIRD = 100 / 3, MIN_CROP_SIZE = 1, MAX_INTERACTION_SIZE = 24, MIN_INTERACTION_SIZE = 6;
|
|
1561
|
-
function setSvgNodeAttrs(d, B) {
|
|
1562
|
-
for (let [V, H] of Object.entries(B)) d.setAttributeNS(null, V, H.toString());
|
|
1563
|
-
}
|
|
1564
|
-
function createSvgNode(d, B = {}) {
|
|
1565
|
-
let V = document.createElementNS("http://www.w3.org/2000/svg", d);
|
|
1566
|
-
return setSvgNodeAttrs(V, B), V;
|
|
1567
|
-
}
|
|
1568
|
-
function cornerPath(d, B, V) {
|
|
1569
|
-
let { x: H, y: U, width: W, height: G } = d, K = B.includes("w") ? 0 : 1, q = B.includes("n") ? 0 : 1, J = K === 0 ? -1 : 1, Y = q === 0 ? -1 : 1, X = [H + K * W + THUMB_OFFSET * J, U + q * G + THUMB_OFFSET * Y - 24 * V * Y], Z = [H + K * W + THUMB_OFFSET * J, U + q * G + THUMB_OFFSET * Y], Q = [H + K * W - 24 * V * J + THUMB_OFFSET * J, U + q * G + THUMB_OFFSET * Y];
|
|
1570
|
-
return {
|
|
1571
|
-
d: `M ${X[0]} ${X[1]} L ${Z[0]} ${Z[1]} L ${Q[0]} ${Q[1]}`,
|
|
1572
|
-
center: [Z[0], Z[1]]
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
function sidePath(d, B, V) {
|
|
1576
|
-
let { x: H, y: U, width: W, height: G } = d, K = B === "n" || B === "s", q = B === "w" || B === "e", J = K ? .5 : B === "w" ? 0 : 1, Y = q ? .5 : B === "n" ? 0 : 1, X = B === "w" ? -1 : B === "e" ? 1 : 0, Z = B === "n" ? -1 : B === "s" ? 1 : 0, Q, $;
|
|
1577
|
-
return K ? (Q = [H + J * W - 34 * V / 2, U + Y * G + THUMB_OFFSET * Z], $ = [H + J * W + 34 * V / 2, U + Y * G + THUMB_OFFSET * Z]) : (Q = [H + J * W + THUMB_OFFSET * X, U + Y * G - 34 * V / 2], $ = [H + J * W + THUMB_OFFSET * X, U + Y * G + 34 * V / 2]), {
|
|
1578
|
-
d: `M ${Q[0]} ${Q[1]} L ${$[0]} ${$[1]}`,
|
|
1579
|
-
center: [(Q[0] + $[0]) / 2, (Q[1] + $[1]) / 2]
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
function thumbCursor(d) {
|
|
1583
|
-
return d === "" ? "move" : ["e", "w"].includes(d) ? "ew-resize" : ["n", "s"].includes(d) ? "ns-resize" : ["nw", "se"].includes(d) ? "nwse-resize" : "nesw-resize";
|
|
1584
|
-
}
|
|
1585
|
-
function moveRect({ rect: d, delta: [B, V], imageBox: H }) {
|
|
1586
|
-
return constraintRect({
|
|
1587
|
-
...d,
|
|
1588
|
-
x: d.x + B,
|
|
1589
|
-
y: d.y + V
|
|
1590
|
-
}, H);
|
|
1591
|
-
}
|
|
1592
|
-
function constraintRect(d, B) {
|
|
1593
|
-
let { x: V } = d, { y: H } = d;
|
|
1594
|
-
return d.x < B.x ? V = B.x : d.x + d.width > B.x + B.width && (V = B.x + B.width - d.width), d.y < B.y ? H = B.y : d.y + d.height > B.y + B.height && (H = B.y + B.height - d.height), {
|
|
1595
|
-
...d,
|
|
1596
|
-
x: V,
|
|
1597
|
-
y: H
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
function resizeNorth({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1601
|
-
let [, U] = B, { y: W, width: G, height: K } = d;
|
|
1602
|
-
W += U, K -= U, V && (G = K * V);
|
|
1603
|
-
let q = d.x + d.width / 2 - G / 2;
|
|
1604
|
-
return W <= H.y && (W = H.y, K = d.y + d.height - W, V && (G = K * V, q = d.x + d.width / 2 - G / 2)), q <= H.x && (q = H.x, W = d.y + d.height - K), q + G >= H.x + H.width && (q = Math.max(H.x, H.x + H.width - G), G = H.x + H.width - q, V && (K = G / V), W = d.y + d.height - K), K < 1 && (K = 1, V && (G = K * V, q = d.x + d.width / 2 - G / 2), W = d.y + d.height - K), G < 1 && (G = 1, V && (K = G / V, q = d.x + d.width / 2 - G / 2), W = d.y + d.height - K), {
|
|
1605
|
-
x: q,
|
|
1606
|
-
y: W,
|
|
1607
|
-
width: G,
|
|
1608
|
-
height: K
|
|
1609
|
-
};
|
|
1610
|
-
}
|
|
1611
|
-
function resizeWest({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1612
|
-
let [U] = B, { x: W, width: G, height: K } = d;
|
|
1613
|
-
W += U, G -= U, V && (K = G / V);
|
|
1614
|
-
let q = d.y + d.height / 2 - K / 2;
|
|
1615
|
-
return W <= H.x && (W = H.x, G = d.x + d.width - W, V && (K = G / V, q = d.y + d.height / 2 - K / 2)), q <= H.y && (q = H.y, W = d.x + d.width - G), q + K >= H.y + H.height && (q = Math.max(H.y, H.y + H.height - K), K = H.y + H.height - q, V && (G = K * V), W = d.x + d.width - G), K < 1 && (K = 1, V && (G = K * V), q = d.y + d.height / 2 - K / 2, W = d.x + d.width - G), G < 1 && (G = 1, V && (K = G / V), q = d.y + d.height / 2 - K / 2, W = d.x + d.width - G), {
|
|
1616
|
-
x: W,
|
|
1617
|
-
y: q,
|
|
1618
|
-
width: G,
|
|
1619
|
-
height: K
|
|
1620
|
-
};
|
|
1621
|
-
}
|
|
1622
|
-
function resizeSouth({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1623
|
-
let [, U] = B, { y: W, width: G, height: K } = d;
|
|
1624
|
-
K += U, V && (G = K * V);
|
|
1625
|
-
let q = d.x + d.width / 2 - G / 2;
|
|
1626
|
-
return W + K >= H.y + H.height && (K = H.y + H.height - W, V && (G = K * V), q = d.x + d.width / 2 - G / 2), q <= H.x && (q = H.x, W = d.y), q + G >= H.x + H.width && (q = Math.max(H.x, H.x + H.width - G), G = H.x + H.width - q, V && (K = G / V), W = d.y), K < 1 && (K = 1, V && (G = K * V), q = d.x + d.width / 2 - G / 2), G < 1 && (G = 1, V && (K = G / V), q = d.x + d.width / 2 - G / 2), {
|
|
1627
|
-
x: q,
|
|
1628
|
-
y: W,
|
|
1629
|
-
width: G,
|
|
1630
|
-
height: K
|
|
1631
|
-
};
|
|
1632
|
-
}
|
|
1633
|
-
function resizeEast({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1634
|
-
let [U] = B, { x: W, width: G, height: K } = d;
|
|
1635
|
-
G += U, V && (K = G / V);
|
|
1636
|
-
let q = d.y + d.height / 2 - K / 2;
|
|
1637
|
-
return W + G >= H.x + H.width && (G = H.x + H.width - W, V && (K = G / V), q = d.y + d.height / 2 - K / 2), q <= H.y && (q = H.y, W = d.x), q + K >= H.y + H.height && (q = Math.max(H.y, H.y + H.height - K), K = H.y + H.height - q, V && (G = K * V), W = d.x), K < 1 && (K = 1, V && (G = K * V), q = d.y + d.height / 2 - K / 2), G < 1 && (G = 1, V && (K = G / V), q = d.y + d.height / 2 - K / 2), {
|
|
1638
|
-
x: W,
|
|
1639
|
-
y: q,
|
|
1640
|
-
width: G,
|
|
1641
|
-
height: K
|
|
1642
|
-
};
|
|
1643
|
-
}
|
|
1644
|
-
function resizeNorthWest({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1645
|
-
let [U, W] = B, { x: G, y: K, width: q, height: J } = d;
|
|
1646
|
-
return G + U < H.x && (U = H.x - G), K + W < H.y && (W = H.y - K), G += U, q -= U, K += W, J -= W, V && Math.abs(q / J) > V ? (W = q / V - J, J += W, K -= W, K <= H.y && (J -= H.y - K, q = J * V, G = d.x + d.width - q, K = H.y)) : V && (U = J * V - q, q += U, G -= U, G <= H.x && (q -= H.x - G, J = q / V, G = H.x, K = d.y + d.height - J)), J < 1 && (J = 1, V && (q = J * V), G = d.x + d.width - q, K = d.y + d.height - J), q < 1 && (q = 1, V && (J = q / V), G = d.x + d.width - q, K = d.y + d.height - J), {
|
|
1647
|
-
x: G,
|
|
1648
|
-
y: K,
|
|
1649
|
-
width: q,
|
|
1650
|
-
height: J
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
function resizeNorthEast({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1654
|
-
let [U, W] = B, { x: G, y: K, width: q, height: J } = d;
|
|
1655
|
-
return G + q + U > H.x + H.width && (U = H.x + H.width - G - q), K + W < H.y && (W = H.y - K), q += U, K += W, J -= W, V && Math.abs(q / J) > V ? (W = q / V - J, J += W, K -= W, K <= H.y && (J -= H.y - K, q = J * V, G = d.x, K = H.y)) : V && (U = J * V - q, q += U, G + q >= H.x + H.width && (q = H.x + H.width - G, J = q / V, G = H.x + H.width - q, K = d.y + d.height - J)), J < 1 && (J = 1, V && (q = J * V), K = d.y + d.height - J), q < 1 && (q = 1, V && (J = q / V), K = d.y + d.height - J), {
|
|
1656
|
-
x: G,
|
|
1657
|
-
y: K,
|
|
1658
|
-
width: q,
|
|
1659
|
-
height: J
|
|
1660
|
-
};
|
|
1661
|
-
}
|
|
1662
|
-
function resizeSouthWest({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1663
|
-
let [U, W] = B, { x: G, y: K, width: q, height: J } = d;
|
|
1664
|
-
return G + U < H.x && (U = H.x - G), K + J + W > H.y + H.height && (W = H.y + H.height - K - J), G += U, q -= U, J += W, V && Math.abs(q / J) > V ? (W = q / V - J, J += W, K + J >= H.y + H.height && (J = H.y + H.height - K, q = J * V, G = d.x + d.width - q, K = H.y + H.height - J)) : V && (U = J * V - q, q += U, G -= U, G <= H.x && (q -= H.x - G, J = q / V, G = H.x, K = d.y)), J < 1 && (J = 1, V && (q = J * V), G = d.x + d.width - q), q < 1 && (q = 1, V && (J = q / V), G = d.x + d.width - q), {
|
|
1665
|
-
x: G,
|
|
1666
|
-
y: K,
|
|
1667
|
-
width: q,
|
|
1668
|
-
height: J
|
|
1669
|
-
};
|
|
1670
|
-
}
|
|
1671
|
-
function resizeSouthEast({ rect: d, delta: B, aspectRatio: V, imageBox: H }) {
|
|
1672
|
-
let [U, W] = B, { x: G, y: K, width: q, height: J } = d;
|
|
1673
|
-
return G + q + U > H.x + H.width && (U = H.x + H.width - G - q), K + J + W > H.y + H.height && (W = H.y + H.height - K - J), q += U, J += W, V && Math.abs(q / J) > V ? (W = q / V - J, J += W, K + J >= H.y + H.height && (J = H.y + H.height - K, q = J * V, G = d.x, K = H.y + H.height - J)) : V && (U = J * V - q, q += U, G + q >= H.x + H.width && (q = H.x + H.width - G, J = q / V, G = H.x + H.width - q, K = d.y)), J < 1 && (J = 1, V && (q = J * V)), q < 1 && (q = 1, V && (J = q / V)), {
|
|
1674
|
-
x: G,
|
|
1675
|
-
y: K,
|
|
1676
|
-
width: q,
|
|
1677
|
-
height: J
|
|
1678
|
-
};
|
|
1679
|
-
}
|
|
1680
|
-
function resizeRect({ direction: d, ...B }) {
|
|
1681
|
-
switch (d) {
|
|
1682
|
-
case "n": return resizeNorth(B);
|
|
1683
|
-
case "w": return resizeWest(B);
|
|
1684
|
-
case "s": return resizeSouth(B);
|
|
1685
|
-
case "e": return resizeEast(B);
|
|
1686
|
-
case "nw": return resizeNorthWest(B);
|
|
1687
|
-
case "ne": return resizeNorthEast(B);
|
|
1688
|
-
case "sw": return resizeSouthWest(B);
|
|
1689
|
-
case "se": return resizeSouthEast(B);
|
|
1690
|
-
default: return B.rect;
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
function rectContainsPoint(d, [B, V]) {
|
|
1694
|
-
return d.x <= B && B <= d.x + d.width && d.y <= V && V <= d.y + d.height;
|
|
1695
|
-
}
|
|
1696
|
-
function isRectInsideRect(d, B) {
|
|
1697
|
-
return d.x >= B.x && d.y >= B.y && d.x + d.width <= B.x + B.width && d.y + d.height <= B.y + B.height;
|
|
1698
|
-
}
|
|
1699
|
-
function isRectMatchesAspectRatio(d, B) {
|
|
1700
|
-
return Math.abs(d.width / d.height - B) < .1;
|
|
1701
|
-
}
|
|
1702
|
-
function rotateSize({ width: d, height: B }, V) {
|
|
1703
|
-
let H = V / 90 % 2 != 0;
|
|
1704
|
-
return {
|
|
1705
|
-
width: H ? B : d,
|
|
1706
|
-
height: H ? d : B
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1709
|
-
function calculateMaxCenteredCropFrame(d, B, V) {
|
|
1710
|
-
let H = d / B, U, W;
|
|
1711
|
-
H > V ? (U = Math.round(B * V), W = B) : (U = d, W = Math.round(d / V));
|
|
1712
|
-
let G = Math.round((d - U) / 2), K = Math.round((B - W) / 2);
|
|
1713
|
-
return G + U > d && (U = d - G), K + W > B && (W = B - K), {
|
|
1714
|
-
x: G,
|
|
1715
|
-
y: K,
|
|
1716
|
-
width: U,
|
|
1717
|
-
height: W
|
|
1718
|
-
};
|
|
1719
|
-
}
|
|
1720
|
-
function roundRect(d) {
|
|
1721
|
-
return {
|
|
1722
|
-
x: Math.round(d.x),
|
|
1723
|
-
y: Math.round(d.y),
|
|
1724
|
-
width: Math.round(d.width),
|
|
1725
|
-
height: Math.round(d.height)
|
|
1726
|
-
};
|
|
1727
|
-
}
|
|
1728
|
-
function clamp(d, B, V) {
|
|
1729
|
-
return Math.min(Math.max(d, B), V);
|
|
1730
|
-
}
|
|
1731
|
-
var EXCLUDED_TYPES = ["free"];
|
|
1732
|
-
const parseCropPreset = (d) => {
|
|
1733
|
-
let B = stringToArray(d);
|
|
1734
|
-
if (!B || B.length === 0) return [];
|
|
1735
|
-
let V = [];
|
|
1736
|
-
for (let d of B) {
|
|
1737
|
-
let B = d.trim();
|
|
1738
|
-
if (!B) continue;
|
|
1739
|
-
let H = B.indexOf(":");
|
|
1740
|
-
if (H === -1 && !EXCLUDED_TYPES.includes(B)) {
|
|
1741
|
-
console.warn(`Invalid crop preset: ${B}`);
|
|
1742
|
-
continue;
|
|
1743
|
-
}
|
|
1744
|
-
let U = Number(B.slice(0, H)), W = Number(B.slice(H + 1));
|
|
1745
|
-
if ((!Number.isFinite(U) || !Number.isFinite(W) || U <= 0 || W <= 0) && !EXCLUDED_TYPES.includes(B)) {
|
|
1746
|
-
console.warn(`Invalid crop preset: ${B}`);
|
|
1747
|
-
continue;
|
|
1748
|
-
}
|
|
1749
|
-
V.push({
|
|
1750
|
-
id: UID.generateFastUid(),
|
|
1751
|
-
type: "aspect-ratio",
|
|
1752
|
-
width: EXCLUDED_TYPES.includes(B) ? 0 : U,
|
|
1753
|
-
height: EXCLUDED_TYPES.includes(B) ? 0 : W,
|
|
1754
|
-
hasFreeform: EXCLUDED_TYPES.includes(B)
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
return V;
|
|
1758
|
-
}, getClosestAspectRatio = (d, B, V, H = .1) => {
|
|
1759
|
-
let U = d / B, W = null, G = Infinity;
|
|
1760
|
-
for (let d of V) {
|
|
1761
|
-
let [B, V] = [d.width, d.height], H = B / V, K = Math.abs(U - H);
|
|
1762
|
-
K < G && (G = K, W = d);
|
|
1763
|
-
}
|
|
1764
|
-
if (W) {
|
|
1765
|
-
let [d, B] = [W.width, W.height], V = d / B;
|
|
1766
|
-
if (Math.abs(U - V) / V > H) return null;
|
|
1767
|
-
}
|
|
1768
|
-
return W;
|
|
1769
|
-
};
|
|
1770
|
-
var Icon = class extends LitBlock {
|
|
1771
|
-
constructor(...d) {
|
|
1772
|
-
super(...d), this.name = "", this._resolvedHref = "", this._pluginSvg = null, this._iconHrefResolver = null;
|
|
1773
|
-
}
|
|
1774
|
-
initCallback() {
|
|
1775
|
-
super.initCallback(), this.setAttribute("aria-hidden", "true"), this.subConfigValue("iconHrefResolver", (d) => {
|
|
1776
|
-
this._iconHrefResolver = d, this._updateResolvedHref();
|
|
1777
|
-
});
|
|
1778
|
-
let d = this._sharedInstancesBag.pluginManager;
|
|
1779
|
-
d?.onPluginsChange && (this._unsubscribePlugins = d.onPluginsChange(() => this._updateResolvedHref()));
|
|
1780
|
-
}
|
|
1781
|
-
willUpdate(d) {
|
|
1782
|
-
super.willUpdate(d), d.has("name") && this._updateResolvedHref();
|
|
1783
|
-
}
|
|
1784
|
-
_updateResolvedHref() {
|
|
1785
|
-
if (!this.name) {
|
|
1786
|
-
this._resolvedHref = "", this._pluginSvg = null;
|
|
1787
|
-
return;
|
|
1788
|
-
}
|
|
1789
|
-
let d = this._sharedInstancesBag.pluginManager?.snapshot().icons.find((d) => d.name === this.name);
|
|
1790
|
-
if (d) {
|
|
1791
|
-
this._pluginSvg = d.svg, this._resolvedHref = "";
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
this._pluginSvg = null;
|
|
1795
|
-
let B = `#uc-icon-${this.name}`;
|
|
1796
|
-
this._resolvedHref = this._iconHrefResolver?.(this.name) ?? B;
|
|
1797
|
-
}
|
|
1798
|
-
render() {
|
|
1799
|
-
return this._pluginSvg ? html`${this.yield("", html`${unsafeSVG(this._pluginSvg)}`)}` : html`
|
|
1800
|
-
${this.yield("", html`
|
|
1801
|
-
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1802
|
-
<use href=${this._resolvedHref}></use>
|
|
1803
|
-
</svg>`)}
|
|
1804
|
-
`;
|
|
1805
|
-
}
|
|
1806
|
-
disconnectedCallback() {
|
|
1807
|
-
this._unsubscribePlugins?.(), this._unsubscribePlugins = void 0, super.disconnectedCallback();
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
__decorate([property({ type: String })], Icon.prototype, "name", void 0), __decorate([state()], Icon.prototype, "_resolvedHref", void 0), __decorate([state()], Icon.prototype, "_pluginSvg", void 0);
|
|
1811
|
-
export { createCdnUrl as $, CameraSourceTypes as A, SharedInstance as B, MIN_CROP_SIZE as C, THUMB_STROKE_WIDTH as D, THUMB_SIDE_SIZE as E, InternalEventType as F, ALL_FILTERS as G, initialConfig as H, activityBlockCtx as I, TabId as J, ALL_TABS as K, solutionBlockCtx as L, createL10n as M, getPluralForm as N, warnOnce as O, EventType as P, stringToArray as Q, uploaderBlockCtx as R, MAX_INTERACTION_SIZE as S, THUMB_CORNER_SIZE as T, ALL_COLOR_OPERATIONS as U, DEFAULT_CDN_CNAME as V, ALL_CROP_OPERATIONS as W, operationsToTransformations as X, COMMON_OPERATIONS as Y, transformationsToOperations as Z, sidePath as _, clamp as a, defineLocale as at, GUIDE_STROKE_WIDTH as b, createSvgNode as c, __decorate as ct, moveRect as d, LightDomMixin as dt, createCdnUrlModifiers as et, rectContainsPoint as f, CssDataMixin as ft, setSvgNodeAttrs as g, roundRect as h, calculateMaxCenteredCropFrame as i, sharedConfigKey as it, LitBlock as j, CameraSourceEvents as k, isRectInsideRect as l, debounce as lt, rotateSize as m, getClosestAspectRatio as n, extractOperations as nt, constraintRect as o, UID as ot, resizeRect as p, PubSub as pt, COLOR_OPERATIONS_CONFIG as q, parseCropPreset as r, extractUuid as rt, cornerPath as s, SymbioteMixin as st, Icon as t, createOriginalUrl as tt, isRectMatchesAspectRatio as u, RegisterableElementMixin as ut, thumbCursor as v, MIN_INTERACTION_SIZE as w, GUIDE_THIRD as x, CROP_PADDING as y, ModalEvents as z };
|