@uploadcare/file-uploader 1.28.0-alpha.0 → 1.28.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityHeader-R6Mlx-dA.js +9 -0
- package/dist/ActivityHeader.css +23 -0
- package/dist/ActivityHeader.layered.css +24 -0
- package/dist/{CameraSource-DbyO6GoK.js → CameraSource-DDwj1jCV.js} +106 -76
- package/dist/CameraSource-n1tun2Df.js +10 -0
- package/dist/CameraSource.css +180 -0
- package/dist/CameraSource.layered.css +209 -0
- package/dist/{CloudImageEditor-BIxf1V4M.js → CloudImageEditor-DcVoIRb3.js} +66 -65
- package/dist/{CloudImageEditorActivity-d4DpK6fQ.js → CloudImageEditorActivity-Csij4nlC.js} +4 -4
- package/dist/{CloudImageEditorActivity-CJxP5N0S.js → CloudImageEditorActivity-DD4NdU0P.js} +4 -4
- package/dist/CloudImageEditorActivity.css +14 -0
- package/dist/CloudImageEditorActivity.layered.css +15 -0
- package/dist/{Config-DuWre5p3.js → Config-DKOromHY.js} +27 -27
- package/dist/Config.css +4 -0
- package/dist/Config.layered.css +5 -0
- package/dist/ExternalSource-6MSUgxqy.js +10 -0
- package/dist/{ExternalSource-BKTFp95O.js → ExternalSource-DVEjSkPB.js} +56 -51
- package/dist/ExternalSource.css +98 -0
- package/dist/ExternalSource.layered.css +116 -0
- package/dist/{Icon-CqTVC82Q.js → Icon-tXRTvEF2.js} +7 -8
- package/dist/Icon.css +14 -0
- package/dist/Icon.layered.css +15 -0
- package/dist/{LitUploaderBlock-BA34rzeU.js → LitUploaderBlock-LxeOZ0ya.js} +65 -65
- package/dist/{UrlSource-DZK5EBwT.js → UrlSource-BkyX00I2.js} +5 -5
- package/dist/UrlSource-RI8TSD48.js +10 -0
- package/dist/UrlSource.css +17 -0
- package/dist/UrlSource.layered.css +18 -0
- package/dist/abstract/loadFileUploaderFrom.js +3 -3
- package/dist/cameraPlugin-weRKO7eG.js +8 -0
- package/dist/{cloud-image-editor-fNswWrI4.js → cloud-image-editor-hhbyNWLG.js} +6 -6
- package/dist/cloud-image-editor.css +1380 -0
- package/dist/cloud-image-editor.layered.css +1549 -0
- package/dist/cloudImageEditorPlugin-FjUgbMK3.js +8 -0
- package/dist/{en-DNCwRJsB.js → en-8OWEmZim.js} +2 -2
- package/dist/env-mM-ksNPq.js +8 -0
- package/dist/env.js +3 -3
- package/dist/externalSourcesPlugin-CMBmLT8S.js +8 -0
- package/dist/imageShrinkPlugin-BN6loiP2.js +8 -0
- package/dist/index-base.css +2497 -0
- package/dist/index-base.layered.css +2837 -0
- package/dist/index.css +9 -3964
- package/dist/index.d.ts +13 -0
- package/dist/index.js +827 -42
- package/dist/index.layered.css +9 -4478
- package/dist/instagramPlugin-CXRm8MGL.js +8 -0
- package/dist/{loadFileUploaderFrom-BWJM43Yq.js → loadFileUploaderFrom-Bfz8L3VB.js} +3 -3
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/dist/{plugins-DxjsQUa8.js → plugins-CGUls7EV.js} +6 -6
- package/dist/urlSourcePlugin-_WdbEhq2.js +8 -0
- package/package.json +1 -1
- package/web/ActivityHeader-BFdTdVfD.js +9 -0
- package/web/ActivityHeader-DQy6rII1.js +9 -0
- package/web/ActivityHeader-DvzMl0uj.js +9 -0
- package/web/ActivityHeader-i4x6_Fne.js +9 -0
- package/web/CameraSource-BAWIA4Wm.js +508 -0
- package/web/CameraSource-BqZCQcij.js +11 -0
- package/web/CameraSource-Brxr4tz4.js +508 -0
- package/web/CameraSource-BvBJ5Uzy.js +508 -0
- package/web/CameraSource-CkHzIE-h.js +11 -0
- package/web/CameraSource-D964yPLu.js +508 -0
- package/web/CameraSource-DE48Az-f.js +11 -0
- package/web/CameraSource-DyPebtRF.js +478 -0
- package/web/CameraSource-pj7Xo81m.js +11 -0
- package/web/CloudImageEditor-CTgUWB07.js +2192 -0
- package/web/CloudImageEditor-CxqV9Lwm.js +2192 -0
- package/web/CloudImageEditor-DoLWHpqV.js +2192 -0
- package/web/CloudImageEditor-Drywn265.js +2192 -0
- package/web/CloudImageEditor-MXcaDtMx.js +2187 -0
- package/web/CloudImageEditorActivity-BPzmfaJV.js +85 -0
- package/web/CloudImageEditorActivity-Br8pU5gd.js +11 -0
- package/web/CloudImageEditorActivity-Cw8b2CEz.js +11 -0
- package/web/CloudImageEditorActivity-Df1ySGq0.js +86 -0
- package/web/CloudImageEditorActivity-DinG5r0y.js +11 -0
- package/web/CloudImageEditorActivity-DmnLLINR.js +85 -0
- package/web/CloudImageEditorActivity-U90BGCek.js +85 -0
- package/web/CloudImageEditorActivity-dNLQZRZI.js +11 -0
- package/web/CloudImageEditorActivity-ur-hQ-6p.js +85 -0
- package/web/Config-8hlBNhvs.js +455 -0
- package/web/Config-BDZhPIyz.js +455 -0
- package/web/Config-CJVNrrjj.js +455 -0
- package/web/Config-DvkVtlQ7.js +455 -0
- package/web/ExternalSource-B9ycBFiD.js +10 -0
- package/web/ExternalSource-BE7HX47E.js +250 -0
- package/web/ExternalSource-BL5GSlol.js +250 -0
- package/web/ExternalSource-BXQY6Dlc.js +10 -0
- package/web/ExternalSource-BXxH3JCD.js +250 -0
- package/web/ExternalSource-BYSS-PPV.js +245 -0
- package/web/ExternalSource-C57a61QN.js +10 -0
- package/web/ExternalSource-CKfMtOgU.js +250 -0
- package/web/ExternalSource-DP6q8ylB.js +10 -0
- package/web/LitUploaderBlock-AX6jOdAS.js +996 -0
- package/web/LitUploaderBlock-BjAaoLl2.js +996 -0
- package/web/LitUploaderBlock-D8E5HuwH.js +996 -0
- package/web/LitUploaderBlock-Dl3ce0Tc.js +996 -0
- package/web/LitUploaderBlock-Oi33U0uf.js +996 -0
- package/web/UrlSource-B9SX3K0L.js +10 -0
- package/web/UrlSource-C3zB1rCb.js +70 -0
- package/web/UrlSource-C7bEU6Xv.js +10 -0
- package/web/UrlSource-CE389CBz.js +70 -0
- package/web/UrlSource-CnvAJ58Y.js +10 -0
- package/web/UrlSource-CqF0h6B-.js +10 -0
- package/web/UrlSource-D-971Nut.js +70 -0
- package/web/UrlSource-DhI3YCt5.js +70 -0
- package/web/UrlSource-hWV7jtB2.js +70 -0
- package/web/abstract/CTX.d.ts +40 -0
- package/web/abstract/TypedCollection.d.ts +47 -0
- package/web/abstract/TypedCollection.test.d.ts +1 -0
- package/web/abstract/TypedData.d.ts +12 -0
- package/web/abstract/TypedData.test.d.ts +1 -0
- package/web/abstract/UploaderPublicApi.d.ts +41 -0
- package/web/abstract/buildOutputCollectionState.d.ts +3 -0
- package/web/abstract/customConfigOptions.d.ts +65 -0
- package/web/abstract/defineComponents.d.ts +1 -0
- package/web/abstract/features/ClipboardLayer.d.ts +12 -0
- package/web/abstract/loadFileUploaderFrom.d.ts +13 -0
- package/web/abstract/localeRegistry.d.ts +5 -0
- package/web/abstract/managers/LocaleManager.d.ts +10 -0
- package/web/abstract/managers/ModalManager.d.ts +53 -0
- package/web/abstract/managers/SecureUploadsManager.d.ts +7 -0
- package/web/abstract/managers/TelemetryManager.d.ts +41 -0
- package/web/abstract/managers/ValidationManager.d.ts +34 -0
- package/web/abstract/managers/__tests__/ModalManager.test.d.ts +13 -0
- package/web/abstract/managers/__tests__/SecureUploadsManager.test.d.ts +1 -0
- package/web/abstract/managers/a11y.d.ts +9 -0
- package/web/abstract/managers/plugin/PluginManager.d.ts +25 -0
- package/web/abstract/managers/plugin/PluginTypes.d.ts +146 -0
- package/web/abstract/managers/plugin/index.d.ts +2 -0
- package/web/abstract/sharedConfigKey.d.ts +2 -0
- package/web/abstract/uploadEntrySchema.d.ts +34 -0
- package/web/blocks/ActivityHeader/ActivityHeader.d.ts +8 -0
- package/web/blocks/CameraSource/CameraSource.d.ts +121 -0
- package/web/blocks/CameraSource/__tests__/calcCameraModes.test.d.ts +1 -0
- package/web/blocks/CameraSource/calcCameraModes.d.ts +5 -0
- package/web/blocks/CameraSource/constants.d.ts +15 -0
- package/web/blocks/CloudImageEditor/index.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +60 -0
- package/web/blocks/CloudImageEditor/src/CropFrame.d.ts +56 -0
- package/web/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +24 -0
- package/web/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +14 -0
- package/web/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +13 -0
- package/web/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +35 -0
- package/web/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +56 -0
- package/web/blocks/CloudImageEditor/src/EditorImageFader.d.ts +63 -0
- package/web/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +15 -0
- package/web/blocks/CloudImageEditor/src/EditorScroller.d.ts +15 -0
- package/web/blocks/CloudImageEditor/src/EditorSlider.d.ts +33 -0
- package/web/blocks/CloudImageEditor/src/EditorToolbar.d.ts +68 -0
- package/web/blocks/CloudImageEditor/src/crop-utils.d.ts +36 -0
- package/web/blocks/CloudImageEditor/src/crop-utils.test.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/cropper-constants.d.ts +10 -0
- package/web/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +31 -0
- package/web/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +19 -0
- package/web/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +27 -0
- package/web/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +38 -0
- package/web/blocks/CloudImageEditor/src/index.d.ts +15 -0
- package/web/blocks/CloudImageEditor/src/lib/classNames.d.ts +5 -0
- package/web/blocks/CloudImageEditor/src/lib/classNames.test.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/linspace.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/linspace.test.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +4 -0
- package/web/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +2 -0
- package/web/blocks/CloudImageEditor/src/lib/pick.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/pick.test.d.ts +1 -0
- package/web/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +7 -0
- package/web/blocks/CloudImageEditor/src/state.d.ts +20 -0
- package/web/blocks/CloudImageEditor/src/svg-sprite.d.ts +2 -0
- package/web/blocks/CloudImageEditor/src/toolbar-constants.d.ts +61 -0
- package/web/blocks/CloudImageEditor/src/types.d.ts +60 -0
- package/web/blocks/CloudImageEditor/src/util.d.ts +2 -0
- package/web/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +7 -0
- package/web/blocks/CloudImageEditor/src/utils/parseFilterValue.test.d.ts +1 -0
- package/web/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +25 -0
- package/web/blocks/Config/Config.d.ts +60 -0
- package/web/blocks/Config/assertions.d.ts +5 -0
- package/web/blocks/Config/computed-properties.d.ts +24 -0
- package/web/blocks/Config/computed-properties.test.d.ts +1 -0
- package/web/blocks/Config/initialConfig.d.ts +6 -0
- package/web/blocks/Config/normalizeConfigValue.d.ts +2 -0
- package/web/blocks/Config/validatorsType.d.ts +18 -0
- package/web/blocks/Copyright/Copyright.d.ts +10 -0
- package/web/blocks/DropArea/DropArea.d.ts +47 -0
- package/web/blocks/DropArea/addDropzone.d.ts +17 -0
- package/web/blocks/DropArea/getDropItems.d.ts +12 -0
- package/web/blocks/ExternalSource/ExternalSource.d.ts +45 -0
- package/web/blocks/ExternalSource/MessageBridge.d.ts +11 -0
- package/web/blocks/ExternalSource/buildThemeDefinition.d.ts +4 -0
- package/web/blocks/ExternalSource/query-string.d.ts +1 -0
- package/web/blocks/ExternalSource/types.d.ts +105 -0
- package/web/blocks/FileItem/FileItem.d.ts +50 -0
- package/web/blocks/FileItem/FileItemConfig.d.ts +10 -0
- package/web/blocks/FormInput/FormInput.d.ts +18 -0
- package/web/blocks/Icon/Icon.d.ts +19 -0
- package/web/blocks/Img/Img.d.ts +14 -0
- package/web/blocks/Img/ImgBase.d.ts +29 -0
- package/web/blocks/Img/ImgConfig.d.ts +28 -0
- package/web/blocks/Img/configurations.d.ts +11 -0
- package/web/blocks/Img/props-map.d.ts +28 -0
- package/web/blocks/Img/utils/parseObjectToString.d.ts +2 -0
- package/web/blocks/Modal/Modal.d.ts +34 -0
- package/web/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +32 -0
- package/web/blocks/PluginActivityRenderer/index.d.ts +1 -0
- package/web/blocks/ProgressBar/ProgressBar.d.ts +21 -0
- package/web/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +17 -0
- package/web/blocks/Select/Select.d.ts +18 -0
- package/web/blocks/SimpleBtn/SimpleBtn.d.ts +15 -0
- package/web/blocks/SourceBtn/SourceBtn.d.ts +23 -0
- package/web/blocks/SourceList/SourceList.d.ts +24 -0
- package/web/blocks/Spinner/Spinner.d.ts +9 -0
- package/web/blocks/StartFrom/StartFrom.d.ts +12 -0
- package/web/blocks/Thumb/Thumb.d.ts +35 -0
- package/web/blocks/UploadCtxProvider/EventEmitter.d.ts +70 -0
- package/web/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +44 -0
- package/web/blocks/UploadList/UploadList.d.ts +39 -0
- package/web/blocks/UrlSource/UrlSource.d.ts +14 -0
- package/web/blocks/svg-backgrounds/svg-backgrounds.d.ts +3 -0
- package/web/blocks/themes/uc-basic/svg-sprite.d.ts +2 -0
- package/web/cameraPlugin-DeedXMWV.js +8 -0
- package/web/cameraPlugin-Duy1QwjB.js +8 -0
- package/web/cameraPlugin-QS9SUOtO.js +8 -0
- package/web/cameraPlugin-bq8ggY04.js +8 -0
- package/web/cameraPlugin-cel9YgP_.js +8 -0
- package/web/cloud-image-editor-8DrVRZ7E.js +12 -0
- package/web/cloud-image-editor-BX50EK1U.js +12 -0
- package/web/cloud-image-editor-DSW3oWq-.js +12 -0
- package/web/cloud-image-editor-DuI2Lx4M.js +12 -0
- package/web/cloudImageEditorPlugin-5my6aD36.js +8 -0
- package/web/cloudImageEditorPlugin-Bk19DmJv.js +8 -0
- package/web/cloudImageEditorPlugin-CcdnmtBW.js +8 -0
- package/web/cloudImageEditorPlugin-DQJmDl03.js +8 -0
- package/web/cloudImageEditorPlugin-kojghfqw.js +8 -0
- package/web/constants-BCfCF0cJ.js +4025 -0
- package/web/core.d.ts +42 -0
- package/web/env.d.ts +2 -0
- package/web/externalSourcesPlugin-BTeRm5C0.js +8 -0
- package/web/externalSourcesPlugin-BXgVeojg.js +8 -0
- package/web/externalSourcesPlugin-BgLpuIK9.js +8 -0
- package/web/externalSourcesPlugin-DMc9zs4T.js +8 -0
- package/web/externalSourcesPlugin-Dm9vnTBv.js +8 -0
- package/web/file-uploader.iife.min.js +697 -0
- package/web/file-uploader.min.js +1859 -0
- package/web/imageShrinkPlugin-BdHgEGZH.js +8 -0
- package/web/imageShrinkPlugin-BjkMGfvT.js +8 -0
- package/web/imageShrinkPlugin-CCkGHL2w.js +8 -0
- package/web/imageShrinkPlugin-D4WjaRGo.js +8 -0
- package/web/imageShrinkPlugin-DqYGutVx.js +8 -0
- package/web/index.d.ts +42 -0
- package/web/instagramPlugin-BTMz0K2a.js +8 -0
- package/web/instagramPlugin-BbIKgTH7.js +8 -0
- package/web/instagramPlugin-CQQhsEJa.js +8 -0
- package/web/instagramPlugin-Cm7lWKae.js +8 -0
- package/web/instagramPlugin-DcclxM_d.js +8 -0
- package/web/lit/BaseComponent.d.ts +12 -0
- package/web/lit/Constructor.d.ts +1 -0
- package/web/lit/CssDataMixin.d.ts +7 -0
- package/web/lit/LightDomMixin.d.ts +8 -0
- package/web/lit/LitActivityBlock.d.ts +53 -0
- package/web/lit/LitBlock.d.ts +83 -0
- package/web/lit/LitSolutionBlock.d.ts +21 -0
- package/web/lit/LitUploaderBlock.d.ts +53 -0
- package/web/lit/PubSubCompat.d.ts +18 -0
- package/web/lit/RegisterableElementMixin.d.ts +7 -0
- package/web/lit/SharedState.d.ts +119 -0
- package/web/lit/SymbioteCompatMixin.d.ts +40 -0
- package/web/lit/TestModeController.d.ts +16 -0
- package/web/lit/Uid.d.ts +3 -0
- package/web/lit/activity-constants.d.ts +11 -0
- package/web/lit/createDebugPrinter.d.ts +3 -0
- package/web/lit/findBlockInCtx.d.ts +3 -0
- package/web/lit/getOutputData.d.ts +2 -0
- package/web/lit/hasBlockInCtx.d.ts +3 -0
- package/web/lit/l10n.d.ts +5 -0
- package/web/lit/parseCssPropertyValue.d.ts +1 -0
- package/web/lit/shared-instances.d.ts +65 -0
- package/web/locales/file-uploader/ar.d.ts +137 -0
- package/web/locales/file-uploader/az.d.ts +129 -0
- package/web/locales/file-uploader/ca.d.ts +131 -0
- package/web/locales/file-uploader/cs.d.ts +133 -0
- package/web/locales/file-uploader/da.d.ts +129 -0
- package/web/locales/file-uploader/de.d.ts +129 -0
- package/web/locales/file-uploader/el.d.ts +129 -0
- package/web/locales/file-uploader/en.d.ts +129 -0
- package/web/locales/file-uploader/es.d.ts +131 -0
- package/web/locales/file-uploader/et.d.ts +129 -0
- package/web/locales/file-uploader/fi.d.ts +129 -0
- package/web/locales/file-uploader/fr.d.ts +131 -0
- package/web/locales/file-uploader/he.d.ts +131 -0
- package/web/locales/file-uploader/hy.d.ts +129 -0
- package/web/locales/file-uploader/is.d.ts +129 -0
- package/web/locales/file-uploader/it.d.ts +131 -0
- package/web/locales/file-uploader/ja.d.ts +129 -0
- package/web/locales/file-uploader/ka.d.ts +129 -0
- package/web/locales/file-uploader/kk.d.ts +129 -0
- package/web/locales/file-uploader/ko.d.ts +129 -0
- package/web/locales/file-uploader/lv.d.ts +131 -0
- package/web/locales/file-uploader/nb.d.ts +129 -0
- package/web/locales/file-uploader/nl.d.ts +129 -0
- package/web/locales/file-uploader/pl.d.ts +133 -0
- package/web/locales/file-uploader/pt.d.ts +131 -0
- package/web/locales/file-uploader/ro.d.ts +131 -0
- package/web/locales/file-uploader/ru.d.ts +133 -0
- package/web/locales/file-uploader/sk.d.ts +133 -0
- package/web/locales/file-uploader/sr.d.ts +131 -0
- package/web/locales/file-uploader/sv.d.ts +129 -0
- package/web/locales/file-uploader/tr.d.ts +129 -0
- package/web/locales/file-uploader/uk.d.ts +133 -0
- package/web/locales/file-uploader/vi.d.ts +129 -0
- package/web/locales/file-uploader/zh-TW.d.ts +129 -0
- package/web/locales/file-uploader/zh.d.ts +129 -0
- package/web/plugins/cameraPlugin.d.ts +2 -0
- package/web/plugins/cloudImageEditorPlugin.d.ts +2 -0
- package/web/plugins/externalSourcesPlugin.d.ts +2 -0
- package/web/plugins/imageShrinkPlugin.d.ts +2 -0
- package/web/plugins/instagramPlugin.d.ts +2 -0
- package/web/plugins/unsplashPlugin.d.ts +16 -0
- package/web/plugins/urlSourcePlugin.d.ts +2 -0
- package/web/plugins-Bt7FXHKx.js +562 -0
- package/web/plugins-CaaolyMk.js +562 -0
- package/web/plugins-Cjgw5oWg.js +562 -0
- package/web/plugins-CzNtrVQB.js +562 -0
- package/web/plugins-DS0hIs2V.js +563 -0
- package/web/ref-BOnG19ns.js +4040 -0
- package/web/ref-BejJFG7m.js +4040 -0
- package/web/ref-DcRg7zo9.js +4040 -0
- package/web/ref-ZWPcLQB9.js +4040 -0
- package/web/solutions/adaptive-image/index.d.ts +2 -0
- package/web/solutions/cloud-image-editor/CloudImageEditor.d.ts +11 -0
- package/web/solutions/cloud-image-editor/index.d.ts +5 -0
- package/web/solutions/file-uploader/inline/FileUploaderInline.d.ts +20 -0
- package/web/solutions/file-uploader/inline/index.d.ts +1 -0
- package/web/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +23 -0
- package/web/solutions/file-uploader/minimal/index.d.ts +1 -0
- package/web/solutions/file-uploader/regular/FileUploaderRegular.d.ts +17 -0
- package/web/solutions/file-uploader/regular/index.d.ts +1 -0
- package/web/style-map-BmZdux7T.js +37 -0
- package/web/style-map-CZ6fSV6e.js +37 -0
- package/web/style-map-Dk7mLCrB.js +37 -0
- package/web/style-map-HkHnu9oA.js +37 -0
- package/web/style-map-tw1yUEaj.js +37 -0
- package/web/types/dom.d.ts +1 -0
- package/web/types/events.d.ts +4 -0
- package/web/types/exported.d.ts +492 -0
- package/web/types/index.d.ts +5 -0
- package/web/uc-basic.layered.min.css +6046 -0
- package/web/uc-basic.min.css +5487 -0
- package/web/uc-cloud-image-editor.layered.min.css +1884 -0
- package/web/uc-cloud-image-editor.min.css +1675 -0
- package/web/uc-cloud-image-editor.min.js +457 -0
- package/web/uc-file-uploader-inline.layered.min.css +4352 -0
- package/web/uc-file-uploader-inline.min.css +3836 -0
- package/web/uc-file-uploader-inline.min.js +1859 -0
- package/web/uc-file-uploader-minimal.layered.min.css +4352 -0
- package/web/uc-file-uploader-minimal.min.css +3836 -0
- package/web/uc-file-uploader-minimal.min.js +1859 -0
- package/web/uc-file-uploader-regular.layered.min.css +4352 -0
- package/web/uc-file-uploader-regular.min.css +3836 -0
- package/web/uc-file-uploader-regular.min.js +1859 -0
- package/web/uc-img.min.js +895 -0
- package/web/urlSourcePlugin-9lhcr02f.js +8 -0
- package/web/urlSourcePlugin-C-sLGhGb.js +8 -0
- package/web/urlSourcePlugin-DNXDpnRD.js +8 -0
- package/web/urlSourcePlugin-JnD0cnxb.js +8 -0
- package/web/urlSourcePlugin-hcMU2K6T.js +8 -0
- package/web/utils/UID.d.ts +5 -0
- package/web/utils/UID.test.d.ts +1 -0
- package/web/utils/UploadSource.d.ts +37 -0
- package/web/utils/WindowHeightTracker.d.ts +9 -0
- package/web/utils/abilities.d.ts +1 -0
- package/web/utils/applyStyles.d.ts +1 -0
- package/web/utils/browser-info.d.ts +12 -0
- package/web/utils/browser-info.test.d.ts +1 -0
- package/web/utils/cdn-utils.d.ts +53 -0
- package/web/utils/cdn-utils.test.d.ts +1 -0
- package/web/utils/comma-separated.d.ts +2 -0
- package/web/utils/debounce.d.ts +3 -0
- package/web/utils/delay.d.ts +1 -0
- package/web/utils/fileTypes.d.ts +11 -0
- package/web/utils/fileTypes.test.d.ts +1 -0
- package/web/utils/get-top-level-origin.d.ts +1 -0
- package/web/utils/get-top-level-origin.test.d.ts +1 -0
- package/web/utils/getLocaleDirection.d.ts +1 -0
- package/web/utils/getPluralForm.d.ts +1 -0
- package/web/utils/getPluralForm.test.d.ts +1 -0
- package/web/utils/isPromiseLike.d.ts +1 -0
- package/web/utils/isPromiseLike.test.d.ts +1 -0
- package/web/utils/isSecureTokenExpired.d.ts +8 -0
- package/web/utils/isSecureTokenExpired.test.d.ts +1 -0
- package/web/utils/memoize.d.ts +1 -0
- package/web/utils/memoize.test.d.ts +1 -0
- package/web/utils/mixinClass.d.ts +8 -0
- package/web/utils/parseCdnUrl.d.ts +11 -0
- package/web/utils/parseCdnUrl.test.d.ts +1 -0
- package/web/utils/parseShrink.d.ts +7 -0
- package/web/utils/parseShrink.test.d.ts +1 -0
- package/web/utils/preloadImage.d.ts +10 -0
- package/web/utils/prettyBytes.d.ts +11 -0
- package/web/utils/prettyBytes.test.d.ts +1 -0
- package/web/utils/resizeImage.d.ts +1 -0
- package/web/utils/stringToArray.d.ts +1 -0
- package/web/utils/stringToArray.test.d.ts +1 -0
- package/web/utils/template-utils.d.ts +16 -0
- package/web/utils/template-utils.test.d.ts +1 -0
- package/web/utils/throttle.d.ts +3 -0
- package/web/utils/toKebabCase.d.ts +2 -0
- package/web/utils/toKebabCase.test.d.ts +1 -0
- package/web/utils/transparentPixelSrc.d.ts +1 -0
- package/web/utils/uniqueArray.d.ts +1 -0
- package/web/utils/uniqueArray.test.d.ts +1 -0
- package/web/utils/userAgent.d.ts +2 -0
- package/web/utils/validators/collection/index.d.ts +2 -0
- package/web/utils/validators/collection/validateCollectionUploadError.d.ts +2 -0
- package/web/utils/validators/collection/validateMultiple.d.ts +2 -0
- package/web/utils/validators/file/index.d.ts +4 -0
- package/web/utils/validators/file/validateFileType.d.ts +2 -0
- package/web/utils/validators/file/validateIsImage.d.ts +2 -0
- package/web/utils/validators/file/validateMaxSizeLimit.d.ts +2 -0
- package/web/utils/validators/file/validateUploadError.d.ts +2 -0
- package/web/utils/warnOnce.d.ts +1 -0
- package/web/utils/wildcardRegexp.d.ts +1 -0
- package/web/utils/wildcardRegexp.test.d.ts +1 -0
- package/web/utils/withResolvers.d.ts +5 -0
- package/web/utils/withResolvers.test.d.ts +1 -0
- package/dist/CameraSource-px4BzEMI.js +0 -9
- package/dist/ExternalSource-CR5DG0Jv.js +0 -9
- package/dist/UrlSource-BxVL9Pve.js +0 -9
- package/dist/cameraPlugin-dGash48Q.js +0 -8
- package/dist/cloudImageEditorPlugin-2EU0Pm_j.js +0 -8
- 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/urlSourcePlugin-9xdB7Pvw.js +0 -8
|
@@ -0,0 +1,4040 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.1 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-02T20:26:09.550Z
|
|
6
|
+
*/
|
|
7
|
+
import { d as ACTIVITY_TYPES, p as serializeCsv } from "./plugins-CzNtrVQB.js";
|
|
8
|
+
let clean = Symbol("clean");
|
|
9
|
+
var listenerQueue = [], lqIndex = 0, QUEUE_ITEMS_PER_LISTENER = 4;
|
|
10
|
+
let epoch = 0;
|
|
11
|
+
const atom = /* @__NO_SIDE_EFFECTS__ */ (l) => {
|
|
12
|
+
let d = [], U = {
|
|
13
|
+
get() {
|
|
14
|
+
return U.lc || U.listen(() => {})(), U.value;
|
|
15
|
+
},
|
|
16
|
+
lc: 0,
|
|
17
|
+
listen(l) {
|
|
18
|
+
return U.lc = d.push(l), () => {
|
|
19
|
+
for (let d = lqIndex + QUEUE_ITEMS_PER_LISTENER; d < listenerQueue.length;) listenerQueue[d] === l ? listenerQueue.splice(d, QUEUE_ITEMS_PER_LISTENER) : d += QUEUE_ITEMS_PER_LISTENER;
|
|
20
|
+
let x = d.indexOf(l);
|
|
21
|
+
~x && (d.splice(x, 1), --U.lc || U.off());
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
notify(l, x) {
|
|
25
|
+
epoch++;
|
|
26
|
+
let W = !listenerQueue.length;
|
|
27
|
+
for (let T of d) listenerQueue.push(T, U.value, l, x);
|
|
28
|
+
if (W) {
|
|
29
|
+
for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) listenerQueue[lqIndex](listenerQueue[lqIndex + 1], listenerQueue[lqIndex + 2], listenerQueue[lqIndex + 3]);
|
|
30
|
+
listenerQueue.length = 0;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
off() {},
|
|
34
|
+
set(l) {
|
|
35
|
+
let d = U.value;
|
|
36
|
+
d !== l && (U.value = l, U.notify(d));
|
|
37
|
+
},
|
|
38
|
+
subscribe(l) {
|
|
39
|
+
let d = U.listen(l);
|
|
40
|
+
return l(U.value), d;
|
|
41
|
+
},
|
|
42
|
+
value: l
|
|
43
|
+
};
|
|
44
|
+
return process.env.NODE_ENV !== "production" && (U[clean] = () => {
|
|
45
|
+
d = [], U.lc = 0, U.off();
|
|
46
|
+
}), U;
|
|
47
|
+
};
|
|
48
|
+
function listenKeys(l, d, x) {
|
|
49
|
+
let w = new Set(d).add(void 0);
|
|
50
|
+
return l.listen((l, d, T) => {
|
|
51
|
+
w.has(T) && x(l, d, T);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function subscribeKeys(l, d, x) {
|
|
55
|
+
let w = listenKeys(l, d, x);
|
|
56
|
+
return x(l.value), w;
|
|
57
|
+
}
|
|
58
|
+
const map = /* @__NO_SIDE_EFFECTS__ */ (l = {}) => {
|
|
59
|
+
let d = /* @__PURE__ */ atom(l);
|
|
60
|
+
return d.setKey = function(l, x) {
|
|
61
|
+
let w = d.value;
|
|
62
|
+
x === void 0 && l in d.value ? (d.value = { ...d.value }, delete d.value[l], d.notify(w, l)) : d.value[l] !== x && (d.value = {
|
|
63
|
+
...d.value,
|
|
64
|
+
[l]: x
|
|
65
|
+
}, d.notify(w, l));
|
|
66
|
+
}, d;
|
|
67
|
+
};
|
|
68
|
+
var PubSub = class l {
|
|
69
|
+
static {
|
|
70
|
+
this._contexts = /* @__PURE__ */ new Map();
|
|
71
|
+
}
|
|
72
|
+
constructor(l, d) {
|
|
73
|
+
this._ctxId = l, this._store = d;
|
|
74
|
+
}
|
|
75
|
+
get id() {
|
|
76
|
+
return this._ctxId;
|
|
77
|
+
}
|
|
78
|
+
pub(l, d) {
|
|
79
|
+
l in this._store.get() || console.warn(`PubSub#pub: Key "${String(l)}" not found`), this._store.setKey(l, d);
|
|
80
|
+
}
|
|
81
|
+
sub(l, d, x = !0) {
|
|
82
|
+
return (x ? subscribeKeys : listenKeys)(this._store, [l], (x) => {
|
|
83
|
+
d(x[l]);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
read(l) {
|
|
87
|
+
return l in this._store.get() || console.warn(`PubSub#read: Key "${String(l)}" not found`), this._store.get()[l];
|
|
88
|
+
}
|
|
89
|
+
add(l, d, x = !1) {
|
|
90
|
+
(!(l in this._store.get()) || x) && this._store.setKey(l, d);
|
|
91
|
+
}
|
|
92
|
+
has(l) {
|
|
93
|
+
return l in this._store.get();
|
|
94
|
+
}
|
|
95
|
+
get store() {
|
|
96
|
+
return this._store.get();
|
|
97
|
+
}
|
|
98
|
+
static registerCtx(d, x) {
|
|
99
|
+
if (l._contexts.has(x)) throw Error(`PubSub: Context with id "${x}" already exists`);
|
|
100
|
+
let w = /* @__PURE__ */ map(d);
|
|
101
|
+
return l._contexts.set(x, w), new l(x, w);
|
|
102
|
+
}
|
|
103
|
+
static deleteCtx(d) {
|
|
104
|
+
l._contexts.delete(d);
|
|
105
|
+
}
|
|
106
|
+
static getCtx(d) {
|
|
107
|
+
let x = l._contexts.get(d);
|
|
108
|
+
return x ? new l(d, x) : null;
|
|
109
|
+
}
|
|
110
|
+
static hasCtx(d) {
|
|
111
|
+
return l._contexts.has(d);
|
|
112
|
+
}
|
|
113
|
+
}, t$4 = globalThis, e$7 = t$4.ShadowRoot && (t$4.ShadyCSS === void 0 || t$4.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$7 = Symbol(), o$8 = /* @__PURE__ */ new WeakMap(), n$7 = class {
|
|
114
|
+
constructor(l, d, x) {
|
|
115
|
+
if (this._$cssResult$ = !0, x !== s$7) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
116
|
+
this.cssText = l, this.t = d;
|
|
117
|
+
}
|
|
118
|
+
get styleSheet() {
|
|
119
|
+
let l = this.o, d = this.t;
|
|
120
|
+
if (e$7 && l === void 0) {
|
|
121
|
+
let x = d !== void 0 && d.length === 1;
|
|
122
|
+
x && (l = o$8.get(d)), l === void 0 && ((this.o = l = new CSSStyleSheet()).replaceSync(this.cssText), x && o$8.set(d, l));
|
|
123
|
+
}
|
|
124
|
+
return l;
|
|
125
|
+
}
|
|
126
|
+
toString() {
|
|
127
|
+
return this.cssText;
|
|
128
|
+
}
|
|
129
|
+
}, r$6 = (l) => new n$7(typeof l == "string" ? l : l + "", void 0, s$7), S$1 = (l, d) => {
|
|
130
|
+
if (e$7) l.adoptedStyleSheets = d.map((l) => l instanceof CSSStyleSheet ? l : l.styleSheet);
|
|
131
|
+
else for (let x of d) {
|
|
132
|
+
let d = document.createElement("style"), w = t$4.litNonce;
|
|
133
|
+
w !== void 0 && d.setAttribute("nonce", w), d.textContent = x.cssText, l.appendChild(d);
|
|
134
|
+
}
|
|
135
|
+
}, c$4 = e$7 ? (l) => l : (l) => l instanceof CSSStyleSheet ? ((l) => {
|
|
136
|
+
let d = "";
|
|
137
|
+
for (let x of l.cssRules) d += x.cssText;
|
|
138
|
+
return r$6(d);
|
|
139
|
+
})(l) : l, { is: i$6, defineProperty: e$6, getOwnPropertyDescriptor: h$5, getOwnPropertyNames: r$5, getOwnPropertySymbols: o$7, getPrototypeOf: n$6 } = Object, a$2 = globalThis, c$5 = a$2.trustedTypes, l$3 = c$5 ? c$5.emptyScript : "", p$3 = a$2.reactiveElementPolyfillSupport, d$2 = (l, d) => l, u$2 = {
|
|
140
|
+
toAttribute(l, d) {
|
|
141
|
+
switch (d) {
|
|
142
|
+
case Boolean:
|
|
143
|
+
l = l ? l$3 : null;
|
|
144
|
+
break;
|
|
145
|
+
case Object:
|
|
146
|
+
case Array: l = l == null ? l : JSON.stringify(l);
|
|
147
|
+
}
|
|
148
|
+
return l;
|
|
149
|
+
},
|
|
150
|
+
fromAttribute(l, d) {
|
|
151
|
+
let x = l;
|
|
152
|
+
switch (d) {
|
|
153
|
+
case Boolean:
|
|
154
|
+
x = l !== null;
|
|
155
|
+
break;
|
|
156
|
+
case Number:
|
|
157
|
+
x = l === null ? null : Number(l);
|
|
158
|
+
break;
|
|
159
|
+
case Object:
|
|
160
|
+
case Array: try {
|
|
161
|
+
x = JSON.parse(l);
|
|
162
|
+
} catch {
|
|
163
|
+
x = null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return x;
|
|
167
|
+
}
|
|
168
|
+
}, f$3 = (l, d) => !i$6(l, d), b$1 = {
|
|
169
|
+
attribute: !0,
|
|
170
|
+
type: String,
|
|
171
|
+
converter: u$2,
|
|
172
|
+
reflect: !1,
|
|
173
|
+
useDefault: !1,
|
|
174
|
+
hasChanged: f$3
|
|
175
|
+
};
|
|
176
|
+
Symbol.metadata ??= Symbol("metadata"), a$2.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
177
|
+
var y$1 = class extends HTMLElement {
|
|
178
|
+
static addInitializer(l) {
|
|
179
|
+
this._$Ei(), (this.l ??= []).push(l);
|
|
180
|
+
}
|
|
181
|
+
static get observedAttributes() {
|
|
182
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
183
|
+
}
|
|
184
|
+
static createProperty(l, d = b$1) {
|
|
185
|
+
if (d.state && (d.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(l) && ((d = Object.create(d)).wrapped = !0), this.elementProperties.set(l, d), !d.noAccessor) {
|
|
186
|
+
let x = Symbol(), w = this.getPropertyDescriptor(l, x, d);
|
|
187
|
+
w !== void 0 && e$6(this.prototype, l, w);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
static getPropertyDescriptor(l, d, x) {
|
|
191
|
+
let { get: w, set: T } = h$5(this.prototype, l) ?? {
|
|
192
|
+
get() {
|
|
193
|
+
return this[d];
|
|
194
|
+
},
|
|
195
|
+
set(l) {
|
|
196
|
+
this[d] = l;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
get: w,
|
|
201
|
+
set(d) {
|
|
202
|
+
let O = w?.call(this);
|
|
203
|
+
T?.call(this, d), this.requestUpdate(l, O, x);
|
|
204
|
+
},
|
|
205
|
+
configurable: !0,
|
|
206
|
+
enumerable: !0
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
static getPropertyOptions(l) {
|
|
210
|
+
return this.elementProperties.get(l) ?? b$1;
|
|
211
|
+
}
|
|
212
|
+
static _$Ei() {
|
|
213
|
+
if (this.hasOwnProperty(d$2("elementProperties"))) return;
|
|
214
|
+
let l = n$6(this);
|
|
215
|
+
l.finalize(), l.l !== void 0 && (this.l = [...l.l]), this.elementProperties = new Map(l.elementProperties);
|
|
216
|
+
}
|
|
217
|
+
static finalize() {
|
|
218
|
+
if (this.hasOwnProperty(d$2("finalized"))) return;
|
|
219
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$2("properties"))) {
|
|
220
|
+
let l = this.properties, d = [...r$5(l), ...o$7(l)];
|
|
221
|
+
for (let x of d) this.createProperty(x, l[x]);
|
|
222
|
+
}
|
|
223
|
+
let l = this[Symbol.metadata];
|
|
224
|
+
if (l !== null) {
|
|
225
|
+
let d = litPropertyMetadata.get(l);
|
|
226
|
+
if (d !== void 0) for (let [l, x] of d) this.elementProperties.set(l, x);
|
|
227
|
+
}
|
|
228
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
229
|
+
for (let [l, d] of this.elementProperties) {
|
|
230
|
+
let x = this._$Eu(l, d);
|
|
231
|
+
x !== void 0 && this._$Eh.set(x, l);
|
|
232
|
+
}
|
|
233
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
234
|
+
}
|
|
235
|
+
static finalizeStyles(l) {
|
|
236
|
+
let d = [];
|
|
237
|
+
if (Array.isArray(l)) {
|
|
238
|
+
let x = new Set(l.flat(Infinity).reverse());
|
|
239
|
+
for (let l of x) d.unshift(c$4(l));
|
|
240
|
+
} else l !== void 0 && d.push(c$4(l));
|
|
241
|
+
return d;
|
|
242
|
+
}
|
|
243
|
+
static _$Eu(l, d) {
|
|
244
|
+
let x = d.attribute;
|
|
245
|
+
return !1 === x ? void 0 : typeof x == "string" ? x : typeof l == "string" ? l.toLowerCase() : void 0;
|
|
246
|
+
}
|
|
247
|
+
constructor() {
|
|
248
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
249
|
+
}
|
|
250
|
+
_$Ev() {
|
|
251
|
+
this._$ES = new Promise((l) => this.enableUpdating = l), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((l) => l(this));
|
|
252
|
+
}
|
|
253
|
+
addController(l) {
|
|
254
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(l), this.renderRoot !== void 0 && this.isConnected && l.hostConnected?.();
|
|
255
|
+
}
|
|
256
|
+
removeController(l) {
|
|
257
|
+
this._$EO?.delete(l);
|
|
258
|
+
}
|
|
259
|
+
_$E_() {
|
|
260
|
+
let l = /* @__PURE__ */ new Map(), d = this.constructor.elementProperties;
|
|
261
|
+
for (let x of d.keys()) this.hasOwnProperty(x) && (l.set(x, this[x]), delete this[x]);
|
|
262
|
+
l.size > 0 && (this._$Ep = l);
|
|
263
|
+
}
|
|
264
|
+
createRenderRoot() {
|
|
265
|
+
let l = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
266
|
+
return S$1(l, this.constructor.elementStyles), l;
|
|
267
|
+
}
|
|
268
|
+
connectedCallback() {
|
|
269
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((l) => l.hostConnected?.());
|
|
270
|
+
}
|
|
271
|
+
enableUpdating(l) {}
|
|
272
|
+
disconnectedCallback() {
|
|
273
|
+
this._$EO?.forEach((l) => l.hostDisconnected?.());
|
|
274
|
+
}
|
|
275
|
+
attributeChangedCallback(l, d, x) {
|
|
276
|
+
this._$AK(l, x);
|
|
277
|
+
}
|
|
278
|
+
_$ET(l, d) {
|
|
279
|
+
let x = this.constructor.elementProperties.get(l), w = this.constructor._$Eu(l, x);
|
|
280
|
+
if (w !== void 0 && !0 === x.reflect) {
|
|
281
|
+
let T = (x.converter?.toAttribute === void 0 ? u$2 : x.converter).toAttribute(d, x.type);
|
|
282
|
+
this._$Em = l, T == null ? this.removeAttribute(w) : this.setAttribute(w, T), this._$Em = null;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
_$AK(l, d) {
|
|
286
|
+
let x = this.constructor, w = x._$Eh.get(l);
|
|
287
|
+
if (w !== void 0 && this._$Em !== w) {
|
|
288
|
+
let l = x.getPropertyOptions(w), T = typeof l.converter == "function" ? { fromAttribute: l.converter } : l.converter?.fromAttribute === void 0 ? u$2 : l.converter;
|
|
289
|
+
this._$Em = w;
|
|
290
|
+
let O = T.fromAttribute(d, l.type);
|
|
291
|
+
this[w] = O ?? this._$Ej?.get(w) ?? O, this._$Em = null;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
requestUpdate(l, d, x, w = !1, T) {
|
|
295
|
+
if (l !== void 0) {
|
|
296
|
+
let O = this.constructor;
|
|
297
|
+
if (!1 === w && (T = this[l]), x ??= O.getPropertyOptions(l), !((x.hasChanged ?? f$3)(T, d) || x.useDefault && x.reflect && T === this._$Ej?.get(l) && !this.hasAttribute(O._$Eu(l, x)))) return;
|
|
298
|
+
this.C(l, d, x);
|
|
299
|
+
}
|
|
300
|
+
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
301
|
+
}
|
|
302
|
+
C(l, d, { useDefault: x, reflect: w, wrapped: T }, O) {
|
|
303
|
+
x && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(l) && (this._$Ej.set(l, O ?? d ?? this[l]), !0 !== T || O !== void 0) || (this._$AL.has(l) || (this.hasUpdated || x || (d = void 0), this._$AL.set(l, d)), !0 === w && this._$Em !== l && (this._$Eq ??= /* @__PURE__ */ new Set()).add(l));
|
|
304
|
+
}
|
|
305
|
+
async _$EP() {
|
|
306
|
+
this.isUpdatePending = !0;
|
|
307
|
+
try {
|
|
308
|
+
await this._$ES;
|
|
309
|
+
} catch (l) {
|
|
310
|
+
Promise.reject(l);
|
|
311
|
+
}
|
|
312
|
+
let l = this.scheduleUpdate();
|
|
313
|
+
return l != null && await l, !this.isUpdatePending;
|
|
314
|
+
}
|
|
315
|
+
scheduleUpdate() {
|
|
316
|
+
return this.performUpdate();
|
|
317
|
+
}
|
|
318
|
+
performUpdate() {
|
|
319
|
+
if (!this.isUpdatePending) return;
|
|
320
|
+
if (!this.hasUpdated) {
|
|
321
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
322
|
+
for (let [l, d] of this._$Ep) this[l] = d;
|
|
323
|
+
this._$Ep = void 0;
|
|
324
|
+
}
|
|
325
|
+
let l = this.constructor.elementProperties;
|
|
326
|
+
if (l.size > 0) for (let [d, x] of l) {
|
|
327
|
+
let { wrapped: l } = x, w = this[d];
|
|
328
|
+
!0 !== l || this._$AL.has(d) || w === void 0 || this.C(d, void 0, x, w);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
let l = !1, d = this._$AL;
|
|
332
|
+
try {
|
|
333
|
+
l = this.shouldUpdate(d), l ? (this.willUpdate(d), this._$EO?.forEach((l) => l.hostUpdate?.()), this.update(d)) : this._$EM();
|
|
334
|
+
} catch (d) {
|
|
335
|
+
throw l = !1, this._$EM(), d;
|
|
336
|
+
}
|
|
337
|
+
l && this._$AE(d);
|
|
338
|
+
}
|
|
339
|
+
willUpdate(l) {}
|
|
340
|
+
_$AE(l) {
|
|
341
|
+
this._$EO?.forEach((l) => l.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(l)), this.updated(l);
|
|
342
|
+
}
|
|
343
|
+
_$EM() {
|
|
344
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
345
|
+
}
|
|
346
|
+
get updateComplete() {
|
|
347
|
+
return this.getUpdateComplete();
|
|
348
|
+
}
|
|
349
|
+
getUpdateComplete() {
|
|
350
|
+
return this._$ES;
|
|
351
|
+
}
|
|
352
|
+
shouldUpdate(l) {
|
|
353
|
+
return !0;
|
|
354
|
+
}
|
|
355
|
+
update(l) {
|
|
356
|
+
this._$Eq &&= this._$Eq.forEach((l) => this._$ET(l, this[l])), this._$EM();
|
|
357
|
+
}
|
|
358
|
+
updated(l) {}
|
|
359
|
+
firstUpdated(l) {}
|
|
360
|
+
};
|
|
361
|
+
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$2("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$2("finalized")] = /* @__PURE__ */ new Map(), p$3?.({ ReactiveElement: y$1 }), (a$2.reactiveElementVersions ??= []).push("2.1.2");
|
|
362
|
+
/**
|
|
363
|
+
* @license
|
|
364
|
+
* Copyright 2017 Google LLC
|
|
365
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
366
|
+
*/
|
|
367
|
+
var t$3 = globalThis, i$5 = (l) => l, s$6 = t$3.trustedTypes, e$5 = s$6 ? s$6.createPolicy("lit-html", { createHTML: (l) => l }) : void 0, h$4 = "$lit$", o$6 = `lit$${Math.random().toFixed(9).slice(2)}$`, n$5 = "?" + o$6, r$4 = `<${n$5}>`, l$2 = document, c$3 = () => l$2.createComment(""), a$1 = (l) => l === null || typeof l != "object" && typeof l != "function", u$3 = Array.isArray, d$1 = (l) => u$3(l) || typeof l?.[Symbol.iterator] == "function", f$4 = "[ \n\f\r]", v$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m$1 = />/g, p$2 = RegExp(`>|${f$4}(?:([^\\s"'>=/]+)(${f$4}*=${f$4}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y$2 = /^(?:script|style|textarea|title)$/i, b = ((l) => (d, ...x) => ({
|
|
368
|
+
_$litType$: l,
|
|
369
|
+
strings: d,
|
|
370
|
+
values: x
|
|
371
|
+
}))(1), E = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), C = /* @__PURE__ */ new WeakMap(), P = l$2.createTreeWalker(l$2, 129);
|
|
372
|
+
function V(l, d) {
|
|
373
|
+
if (!u$3(l) || !l.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
374
|
+
return e$5 === void 0 ? d : e$5.createHTML(d);
|
|
375
|
+
}
|
|
376
|
+
var N = (l, d) => {
|
|
377
|
+
let x = l.length - 1, w = [], T, O = d === 2 ? "<svg>" : d === 3 ? "<math>" : "", F = v$1;
|
|
378
|
+
for (let d = 0; d < x; d++) {
|
|
379
|
+
let x = l[d], U, W, G = -1, K = 0;
|
|
380
|
+
for (; K < x.length && (F.lastIndex = K, W = F.exec(x), W !== null);) K = F.lastIndex, F === v$1 ? W[1] === "!--" ? F = _ : W[1] === void 0 ? W[2] === void 0 ? W[3] !== void 0 && (F = p$2) : (y$2.test(W[2]) && (T = RegExp("</" + W[2], "g")), F = p$2) : F = m$1 : F === p$2 ? W[0] === ">" ? (F = T ?? v$1, G = -1) : W[1] === void 0 ? G = -2 : (G = F.lastIndex - W[2].length, U = W[1], F = W[3] === void 0 ? p$2 : W[3] === "\"" ? $ : g) : F === $ || F === g ? F = p$2 : F === _ || F === m$1 ? F = v$1 : (F = p$2, T = void 0);
|
|
381
|
+
let q = F === p$2 && l[d + 1].startsWith("/>") ? " " : "";
|
|
382
|
+
O += F === v$1 ? x + r$4 : G >= 0 ? (w.push(U), x.slice(0, G) + h$4 + x.slice(G) + o$6 + q) : x + o$6 + (G === -2 ? d : q);
|
|
383
|
+
}
|
|
384
|
+
return [V(l, O + (l[x] || "<?>") + (d === 2 ? "</svg>" : d === 3 ? "</math>" : "")), w];
|
|
385
|
+
}, S = class l {
|
|
386
|
+
constructor({ strings: d, _$litType$: x }, w) {
|
|
387
|
+
let T;
|
|
388
|
+
this.parts = [];
|
|
389
|
+
let O = 0, F = 0, U = d.length - 1, W = this.parts, [G, K] = N(d, x);
|
|
390
|
+
if (this.el = l.createElement(G, w), P.currentNode = this.el.content, x === 2 || x === 3) {
|
|
391
|
+
let l = this.el.content.firstChild;
|
|
392
|
+
l.replaceWith(...l.childNodes);
|
|
393
|
+
}
|
|
394
|
+
for (; (T = P.nextNode()) !== null && W.length < U;) {
|
|
395
|
+
if (T.nodeType === 1) {
|
|
396
|
+
if (T.hasAttributes()) for (let l of T.getAttributeNames()) if (l.endsWith(h$4)) {
|
|
397
|
+
let d = K[F++], x = T.getAttribute(l).split(o$6), w = /([.?@])?(.*)/.exec(d);
|
|
398
|
+
W.push({
|
|
399
|
+
type: 1,
|
|
400
|
+
index: O,
|
|
401
|
+
name: w[2],
|
|
402
|
+
strings: x,
|
|
403
|
+
ctor: w[1] === "." ? I : w[1] === "?" ? L : w[1] === "@" ? z : H
|
|
404
|
+
}), T.removeAttribute(l);
|
|
405
|
+
} else l.startsWith(o$6) && (W.push({
|
|
406
|
+
type: 6,
|
|
407
|
+
index: O
|
|
408
|
+
}), T.removeAttribute(l));
|
|
409
|
+
if (y$2.test(T.tagName)) {
|
|
410
|
+
let l = T.textContent.split(o$6), d = l.length - 1;
|
|
411
|
+
if (d > 0) {
|
|
412
|
+
T.textContent = s$6 ? s$6.emptyScript : "";
|
|
413
|
+
for (let x = 0; x < d; x++) T.append(l[x], c$3()), P.nextNode(), W.push({
|
|
414
|
+
type: 2,
|
|
415
|
+
index: ++O
|
|
416
|
+
});
|
|
417
|
+
T.append(l[d], c$3());
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
} else if (T.nodeType === 8) if (T.data === n$5) W.push({
|
|
421
|
+
type: 2,
|
|
422
|
+
index: O
|
|
423
|
+
});
|
|
424
|
+
else {
|
|
425
|
+
let l = -1;
|
|
426
|
+
for (; (l = T.data.indexOf(o$6, l + 1)) !== -1;) W.push({
|
|
427
|
+
type: 7,
|
|
428
|
+
index: O
|
|
429
|
+
}), l += o$6.length - 1;
|
|
430
|
+
}
|
|
431
|
+
O++;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
static createElement(l, d) {
|
|
435
|
+
let x = l$2.createElement("template");
|
|
436
|
+
return x.innerHTML = l, x;
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
function M$1(l, d, x = l, w) {
|
|
440
|
+
if (d === E) return d;
|
|
441
|
+
let T = w === void 0 ? x._$Cl : x._$Co?.[w], O = a$1(d) ? void 0 : d._$litDirective$;
|
|
442
|
+
return T?.constructor !== O && (T?._$AO?.(!1), O === void 0 ? T = void 0 : (T = new O(l), T._$AT(l, x, w)), w === void 0 ? x._$Cl = T : (x._$Co ??= [])[w] = T), T !== void 0 && (d = M$1(l, T._$AS(l, d.values), T, w)), d;
|
|
443
|
+
}
|
|
444
|
+
var R = class {
|
|
445
|
+
constructor(l, d) {
|
|
446
|
+
this._$AV = [], this._$AN = void 0, this._$AD = l, this._$AM = d;
|
|
447
|
+
}
|
|
448
|
+
get parentNode() {
|
|
449
|
+
return this._$AM.parentNode;
|
|
450
|
+
}
|
|
451
|
+
get _$AU() {
|
|
452
|
+
return this._$AM._$AU;
|
|
453
|
+
}
|
|
454
|
+
u(l) {
|
|
455
|
+
let { el: { content: d }, parts: x } = this._$AD, w = (l?.creationScope ?? l$2).importNode(d, !0);
|
|
456
|
+
P.currentNode = w;
|
|
457
|
+
let T = P.nextNode(), O = 0, F = 0, U = x[0];
|
|
458
|
+
for (; U !== void 0;) {
|
|
459
|
+
if (O === U.index) {
|
|
460
|
+
let d;
|
|
461
|
+
U.type === 2 ? d = new k(T, T.nextSibling, this, l) : U.type === 1 ? d = new U.ctor(T, U.name, U.strings, this, l) : U.type === 6 && (d = new Z(T, this, l)), this._$AV.push(d), U = x[++F];
|
|
462
|
+
}
|
|
463
|
+
O !== U?.index && (T = P.nextNode(), O++);
|
|
464
|
+
}
|
|
465
|
+
return P.currentNode = l$2, w;
|
|
466
|
+
}
|
|
467
|
+
p(l) {
|
|
468
|
+
let d = 0;
|
|
469
|
+
for (let x of this._$AV) x !== void 0 && (x.strings === void 0 ? x._$AI(l[d]) : (x._$AI(l, x, d), d += x.strings.length - 2)), d++;
|
|
470
|
+
}
|
|
471
|
+
}, k = class l {
|
|
472
|
+
get _$AU() {
|
|
473
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
474
|
+
}
|
|
475
|
+
constructor(l, d, x, w) {
|
|
476
|
+
this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = l, this._$AB = d, this._$AM = x, this.options = w, this._$Cv = w?.isConnected ?? !0;
|
|
477
|
+
}
|
|
478
|
+
get parentNode() {
|
|
479
|
+
let l = this._$AA.parentNode, d = this._$AM;
|
|
480
|
+
return d !== void 0 && l?.nodeType === 11 && (l = d.parentNode), l;
|
|
481
|
+
}
|
|
482
|
+
get startNode() {
|
|
483
|
+
return this._$AA;
|
|
484
|
+
}
|
|
485
|
+
get endNode() {
|
|
486
|
+
return this._$AB;
|
|
487
|
+
}
|
|
488
|
+
_$AI(l, d = this) {
|
|
489
|
+
l = M$1(this, l, d), a$1(l) ? l === A || l == null || l === "" ? (this._$AH !== A && this._$AR(), this._$AH = A) : l !== this._$AH && l !== E && this._(l) : l._$litType$ === void 0 ? l.nodeType === void 0 ? d$1(l) ? this.k(l) : this._(l) : this.T(l) : this.$(l);
|
|
490
|
+
}
|
|
491
|
+
O(l) {
|
|
492
|
+
return this._$AA.parentNode.insertBefore(l, this._$AB);
|
|
493
|
+
}
|
|
494
|
+
T(l) {
|
|
495
|
+
this._$AH !== l && (this._$AR(), this._$AH = this.O(l));
|
|
496
|
+
}
|
|
497
|
+
_(l) {
|
|
498
|
+
this._$AH !== A && a$1(this._$AH) ? this._$AA.nextSibling.data = l : this.T(l$2.createTextNode(l)), this._$AH = l;
|
|
499
|
+
}
|
|
500
|
+
$(l) {
|
|
501
|
+
let { values: d, _$litType$: x } = l, w = typeof x == "number" ? this._$AC(l) : (x.el === void 0 && (x.el = S.createElement(V(x.h, x.h[0]), this.options)), x);
|
|
502
|
+
if (this._$AH?._$AD === w) this._$AH.p(d);
|
|
503
|
+
else {
|
|
504
|
+
let l = new R(w, this), x = l.u(this.options);
|
|
505
|
+
l.p(d), this.T(x), this._$AH = l;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
_$AC(l) {
|
|
509
|
+
let d = C.get(l.strings);
|
|
510
|
+
return d === void 0 && C.set(l.strings, d = new S(l)), d;
|
|
511
|
+
}
|
|
512
|
+
k(d) {
|
|
513
|
+
u$3(this._$AH) || (this._$AH = [], this._$AR());
|
|
514
|
+
let x = this._$AH, w, T = 0;
|
|
515
|
+
for (let O of d) T === x.length ? x.push(w = new l(this.O(c$3()), this.O(c$3()), this, this.options)) : w = x[T], w._$AI(O), T++;
|
|
516
|
+
T < x.length && (this._$AR(w && w._$AB.nextSibling, T), x.length = T);
|
|
517
|
+
}
|
|
518
|
+
_$AR(l = this._$AA.nextSibling, d) {
|
|
519
|
+
for (this._$AP?.(!1, !0, d); l !== this._$AB;) {
|
|
520
|
+
let d = i$5(l).nextSibling;
|
|
521
|
+
i$5(l).remove(), l = d;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
setConnected(l) {
|
|
525
|
+
this._$AM === void 0 && (this._$Cv = l, this._$AP?.(l));
|
|
526
|
+
}
|
|
527
|
+
}, H = class {
|
|
528
|
+
get tagName() {
|
|
529
|
+
return this.element.tagName;
|
|
530
|
+
}
|
|
531
|
+
get _$AU() {
|
|
532
|
+
return this._$AM._$AU;
|
|
533
|
+
}
|
|
534
|
+
constructor(l, d, x, w, T) {
|
|
535
|
+
this.type = 1, this._$AH = A, this._$AN = void 0, this.element = l, this.name = d, this._$AM = w, this.options = T, x.length > 2 || x[0] !== "" || x[1] !== "" ? (this._$AH = Array(x.length - 1).fill(/* @__PURE__ */ new String()), this.strings = x) : this._$AH = A;
|
|
536
|
+
}
|
|
537
|
+
_$AI(l, d = this, x, w) {
|
|
538
|
+
let T = this.strings, O = !1;
|
|
539
|
+
if (T === void 0) l = M$1(this, l, d, 0), O = !a$1(l) || l !== this._$AH && l !== E, O && (this._$AH = l);
|
|
540
|
+
else {
|
|
541
|
+
let w = l, F, U;
|
|
542
|
+
for (l = T[0], F = 0; F < T.length - 1; F++) U = M$1(this, w[x + F], d, F), U === E && (U = this._$AH[F]), O ||= !a$1(U) || U !== this._$AH[F], U === A ? l = A : l !== A && (l += (U ?? "") + T[F + 1]), this._$AH[F] = U;
|
|
543
|
+
}
|
|
544
|
+
O && !w && this.j(l);
|
|
545
|
+
}
|
|
546
|
+
j(l) {
|
|
547
|
+
l === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, l ?? "");
|
|
548
|
+
}
|
|
549
|
+
}, I = class extends H {
|
|
550
|
+
constructor() {
|
|
551
|
+
super(...arguments), this.type = 3;
|
|
552
|
+
}
|
|
553
|
+
j(l) {
|
|
554
|
+
this.element[this.name] = l === A ? void 0 : l;
|
|
555
|
+
}
|
|
556
|
+
}, L = class extends H {
|
|
557
|
+
constructor() {
|
|
558
|
+
super(...arguments), this.type = 4;
|
|
559
|
+
}
|
|
560
|
+
j(l) {
|
|
561
|
+
this.element.toggleAttribute(this.name, !!l && l !== A);
|
|
562
|
+
}
|
|
563
|
+
}, z = class extends H {
|
|
564
|
+
constructor(l, d, x, w, T) {
|
|
565
|
+
super(l, d, x, w, T), this.type = 5;
|
|
566
|
+
}
|
|
567
|
+
_$AI(l, d = this) {
|
|
568
|
+
if ((l = M$1(this, l, d, 0) ?? A) === E) return;
|
|
569
|
+
let x = this._$AH, w = l === A && x !== A || l.capture !== x.capture || l.once !== x.once || l.passive !== x.passive, T = l !== A && (x === A || w);
|
|
570
|
+
w && this.element.removeEventListener(this.name, this, x), T && this.element.addEventListener(this.name, this, l), this._$AH = l;
|
|
571
|
+
}
|
|
572
|
+
handleEvent(l) {
|
|
573
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, l) : this._$AH.handleEvent(l);
|
|
574
|
+
}
|
|
575
|
+
}, Z = class {
|
|
576
|
+
constructor(l, d, x) {
|
|
577
|
+
this.element = l, this.type = 6, this._$AN = void 0, this._$AM = d, this.options = x;
|
|
578
|
+
}
|
|
579
|
+
get _$AU() {
|
|
580
|
+
return this._$AM._$AU;
|
|
581
|
+
}
|
|
582
|
+
_$AI(l) {
|
|
583
|
+
M$1(this, l);
|
|
584
|
+
}
|
|
585
|
+
}, j = {
|
|
586
|
+
M: h$4,
|
|
587
|
+
P: o$6,
|
|
588
|
+
A: n$5,
|
|
589
|
+
C: 1,
|
|
590
|
+
L: N,
|
|
591
|
+
R,
|
|
592
|
+
D: d$1,
|
|
593
|
+
V: M$1,
|
|
594
|
+
I: k,
|
|
595
|
+
H,
|
|
596
|
+
N: L,
|
|
597
|
+
U: z,
|
|
598
|
+
B: I,
|
|
599
|
+
F: Z
|
|
600
|
+
}, B = t$3.litHtmlPolyfillSupport;
|
|
601
|
+
B?.(S, k), (t$3.litHtmlVersions ??= []).push("3.3.2");
|
|
602
|
+
var D = (l, d, x) => {
|
|
603
|
+
let w = x?.renderBefore ?? d, T = w._$litPart$;
|
|
604
|
+
if (T === void 0) {
|
|
605
|
+
let l = x?.renderBefore ?? null;
|
|
606
|
+
w._$litPart$ = T = new k(d.insertBefore(c$3(), l), l, void 0, x ?? {});
|
|
607
|
+
}
|
|
608
|
+
return T._$AI(l), T;
|
|
609
|
+
}, s$5 = globalThis, i$2 = class extends y$1 {
|
|
610
|
+
constructor() {
|
|
611
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
612
|
+
}
|
|
613
|
+
createRenderRoot() {
|
|
614
|
+
let l = super.createRenderRoot();
|
|
615
|
+
return this.renderOptions.renderBefore ??= l.firstChild, l;
|
|
616
|
+
}
|
|
617
|
+
update(l) {
|
|
618
|
+
let d = this.render();
|
|
619
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(l), this._$Do = D(d, this.renderRoot, this.renderOptions);
|
|
620
|
+
}
|
|
621
|
+
connectedCallback() {
|
|
622
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
623
|
+
}
|
|
624
|
+
disconnectedCallback() {
|
|
625
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
626
|
+
}
|
|
627
|
+
render() {
|
|
628
|
+
return E;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
i$2._$litElement$ = !0, i$2.finalized = !0, s$5.litElementHydrateSupport?.({ LitElement: i$2 });
|
|
632
|
+
var o$5 = s$5.litElementPolyfillSupport;
|
|
633
|
+
o$5?.({ LitElement: i$2 }), (s$5.litElementVersions ??= []).push("4.2.2");
|
|
634
|
+
var SINGLE_QUOTE = "'", DOUBLE_QUOTE = "\"", ESCAPED_PATTERN = /\\([0-9a-fA-F]{1,6} ?)/g;
|
|
635
|
+
function hasLeadingTrailingQuotes(l) {
|
|
636
|
+
return l.length < 2 ? !1 : (l[0] === DOUBLE_QUOTE || l[0] === SINGLE_QUOTE) && (l[l.length - 1] === DOUBLE_QUOTE || l[l.length - 1] === SINGLE_QUOTE);
|
|
637
|
+
}
|
|
638
|
+
function trimQuotes(l) {
|
|
639
|
+
let d = l;
|
|
640
|
+
return (d[0] === DOUBLE_QUOTE || d[0] === SINGLE_QUOTE) && (d = d.slice(1)), (d[d.length - 1] === DOUBLE_QUOTE || d[d.length - 1] === SINGLE_QUOTE) && (d = d.slice(0, -1)), d;
|
|
641
|
+
}
|
|
642
|
+
function escapeQuotes(l) {
|
|
643
|
+
let d = "", x = "";
|
|
644
|
+
for (let w = 0; w < l.length; w++) {
|
|
645
|
+
let T = l[w + 1];
|
|
646
|
+
l[w] === "\\" && T === "\"" ? (d += "\\\"", w++) : l[w] === "\"" && x !== "\\" ? d += "\\\"" : d += l[w], x = l[w] ?? "";
|
|
647
|
+
}
|
|
648
|
+
return d;
|
|
649
|
+
}
|
|
650
|
+
function parseCssPropertyValue(l) {
|
|
651
|
+
let d = l;
|
|
652
|
+
hasLeadingTrailingQuotes(l) && (d = trimQuotes(d), d = d.replace(ESCAPED_PATTERN, (l, d) => String.fromCodePoint(parseInt(d.trim(), 16))), d = d.replaceAll("\\\n", "\\n"), d = escapeQuotes(d), d = DOUBLE_QUOTE + d + DOUBLE_QUOTE);
|
|
653
|
+
try {
|
|
654
|
+
return JSON.parse(d);
|
|
655
|
+
} catch {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
function CssDataMixin(l) {
|
|
660
|
+
class d extends l {
|
|
661
|
+
constructor(...l) {
|
|
662
|
+
super(...l), this._cssDataCache = null, this._computedStyle = null;
|
|
663
|
+
}
|
|
664
|
+
getCssData(l, d = !1) {
|
|
665
|
+
let x = this._cssDataCache ?? Object.create(null);
|
|
666
|
+
if (!Object.keys(x).includes(l) || !x[l]) {
|
|
667
|
+
this._computedStyle ||= window.getComputedStyle(this);
|
|
668
|
+
let w = this._computedStyle.getPropertyValue(l).trim();
|
|
669
|
+
try {
|
|
670
|
+
x[l] = parseCssPropertyValue(w);
|
|
671
|
+
} catch (w) {
|
|
672
|
+
d || console.warn(`CSS Data error: ${l}`, w), x[l] = null;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return this._cssDataCache = x, x[l];
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return d;
|
|
679
|
+
}
|
|
680
|
+
function LightDomMixin(l) {
|
|
681
|
+
class d extends l {
|
|
682
|
+
constructor(...l) {
|
|
683
|
+
super(...l), this.willYield = !0, this._slotsMap = {}, this._initialLightDomChildren = null, this._hasAdoptedChildren = !1;
|
|
684
|
+
}
|
|
685
|
+
createRenderRoot() {
|
|
686
|
+
return this;
|
|
687
|
+
}
|
|
688
|
+
connectedCallback() {
|
|
689
|
+
this._initialLightDomChildren ||= Array.from(this.childNodes), super.connectedCallback();
|
|
690
|
+
}
|
|
691
|
+
_adoptChildren() {
|
|
692
|
+
if (this._hasAdoptedChildren) return;
|
|
693
|
+
this._hasAdoptedChildren = !0, this._slotsMap = {};
|
|
694
|
+
let l = Array.from(this.childNodes), d = l.length ? l : this._initialLightDomChildren ?? [];
|
|
695
|
+
for (let l of d) {
|
|
696
|
+
let d = this._getSlotNameForChild(l), x = this._slotsMap[d] ?? [];
|
|
697
|
+
l instanceof Element && (l.removeAttribute("slot"), l.removeAttribute("content-for")), x.push(l), this._slotsMap[d] = x;
|
|
698
|
+
}
|
|
699
|
+
this._initialLightDomChildren = null;
|
|
700
|
+
}
|
|
701
|
+
_getSlotNameForChild(l) {
|
|
702
|
+
return l instanceof Comment && l.nextSibling instanceof Element ? this._getSlotNameForChild(l.nextSibling) : "contentFor" in l ? l.contentFor || "" : l instanceof Element && l.hasAttribute("content-for") && l.getAttribute("content-for") || "";
|
|
703
|
+
}
|
|
704
|
+
_isTextNodeEmpty(l) {
|
|
705
|
+
return !l.textContent || !l.textContent.trim();
|
|
706
|
+
}
|
|
707
|
+
_isSlotEmpty(l) {
|
|
708
|
+
let d = this._slotsMap[l];
|
|
709
|
+
return !d || d.every((l) => l instanceof Comment || l instanceof Text && this._isTextNodeEmpty(l));
|
|
710
|
+
}
|
|
711
|
+
update(l) {
|
|
712
|
+
!this.hasUpdated && this.willYield && this._adoptChildren(), super.update(l);
|
|
713
|
+
}
|
|
714
|
+
yield(l, d) {
|
|
715
|
+
if (l === "" && !this._slotsMap[l] && !this._hasAdoptedChildren && this._initialLightDomChildren?.length) {
|
|
716
|
+
let d = [];
|
|
717
|
+
for (let l of this._initialLightDomChildren) l instanceof Element && (l.removeAttribute("slot"), l.removeAttribute("content-for")), d.push(l);
|
|
718
|
+
this._slotsMap[l] = d, this._hasAdoptedChildren = !0, this._initialLightDomChildren = null;
|
|
719
|
+
}
|
|
720
|
+
return b`
|
|
721
|
+
${this._slotsMap[l]}
|
|
722
|
+
${this._isSlotEmpty(l) ? d : void 0}
|
|
723
|
+
`;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return d;
|
|
727
|
+
}
|
|
728
|
+
function RegisterableElementMixin(l) {
|
|
729
|
+
class d extends l {
|
|
730
|
+
static reg(l) {
|
|
731
|
+
let d = this, x = window.customElements.get(l);
|
|
732
|
+
if (x) {
|
|
733
|
+
x !== d && console.warn([
|
|
734
|
+
`Element with tag name "${l}" already registered.`,
|
|
735
|
+
`You're trying to override it with another class "${this.name}".`,
|
|
736
|
+
"This is most likely a mistake.",
|
|
737
|
+
"New element will not be registered."
|
|
738
|
+
].join("\n"));
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
window.customElements.define(l, d);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return d;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* @license
|
|
748
|
+
* Copyright 2021 Google LLC
|
|
749
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
750
|
+
*/
|
|
751
|
+
var s$3 = class extends Event {
|
|
752
|
+
constructor(l, d, x, w) {
|
|
753
|
+
super("context-request", {
|
|
754
|
+
bubbles: !0,
|
|
755
|
+
composed: !0
|
|
756
|
+
}), this.context = l, this.contextTarget = d, this.callback = x, this.subscribe = w ?? !1;
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* @license
|
|
761
|
+
* Copyright 2021 Google LLC
|
|
762
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
763
|
+
*/
|
|
764
|
+
function n$4(l) {
|
|
765
|
+
return l;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* @license
|
|
769
|
+
* Copyright 2021 Google LLC
|
|
770
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
771
|
+
*/ var s$2 = class {
|
|
772
|
+
constructor(l, d, x, w) {
|
|
773
|
+
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (l, d) => {
|
|
774
|
+
this.unsubscribe && (this.unsubscribe !== d && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = l, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(l, d)), this.unsubscribe = d;
|
|
775
|
+
}, this.host = l, d.context !== void 0) {
|
|
776
|
+
let l = d;
|
|
777
|
+
this.context = l.context, this.callback = l.callback, this.subscribe = l.subscribe ?? !1;
|
|
778
|
+
} else this.context = d, this.callback = x, this.subscribe = w ?? !1;
|
|
779
|
+
this.host.addController(this);
|
|
780
|
+
}
|
|
781
|
+
hostConnected() {
|
|
782
|
+
this.dispatchRequest();
|
|
783
|
+
}
|
|
784
|
+
hostDisconnected() {
|
|
785
|
+
this.unsubscribe &&= (this.unsubscribe(), void 0);
|
|
786
|
+
}
|
|
787
|
+
dispatchRequest() {
|
|
788
|
+
this.host.dispatchEvent(new s$3(this.context, this.host, this.t, this.subscribe));
|
|
789
|
+
}
|
|
790
|
+
}, s$4 = class {
|
|
791
|
+
get value() {
|
|
792
|
+
return this.o;
|
|
793
|
+
}
|
|
794
|
+
set value(l) {
|
|
795
|
+
this.setValue(l);
|
|
796
|
+
}
|
|
797
|
+
setValue(l, d = !1) {
|
|
798
|
+
let x = d || !Object.is(l, this.o);
|
|
799
|
+
this.o = l, x && this.updateObservers();
|
|
800
|
+
}
|
|
801
|
+
constructor(l) {
|
|
802
|
+
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
803
|
+
for (let [l, { disposer: d }] of this.subscriptions) l(this.o, d);
|
|
804
|
+
}, l !== void 0 && (this.value = l);
|
|
805
|
+
}
|
|
806
|
+
addCallback(l, d, x) {
|
|
807
|
+
if (!x) return void l(this.value);
|
|
808
|
+
this.subscriptions.has(l) || this.subscriptions.set(l, {
|
|
809
|
+
disposer: () => {
|
|
810
|
+
this.subscriptions.delete(l);
|
|
811
|
+
},
|
|
812
|
+
consumerHost: d
|
|
813
|
+
});
|
|
814
|
+
let { disposer: w } = this.subscriptions.get(l);
|
|
815
|
+
l(this.value, w);
|
|
816
|
+
}
|
|
817
|
+
clearCallbacks() {
|
|
818
|
+
this.subscriptions.clear();
|
|
819
|
+
}
|
|
820
|
+
}, e$4 = class extends Event {
|
|
821
|
+
constructor(l, d) {
|
|
822
|
+
super("context-provider", {
|
|
823
|
+
bubbles: !0,
|
|
824
|
+
composed: !0
|
|
825
|
+
}), this.context = l, this.contextTarget = d;
|
|
826
|
+
}
|
|
827
|
+
}, i$4 = class extends s$4 {
|
|
828
|
+
constructor(l, d, x) {
|
|
829
|
+
super(d.context === void 0 ? x : d.initialValue), this.onContextRequest = (l) => {
|
|
830
|
+
if (l.context !== this.context) return;
|
|
831
|
+
let d = l.contextTarget ?? l.composedPath()[0];
|
|
832
|
+
d !== this.host && (l.stopPropagation(), this.addCallback(l.callback, d, l.subscribe));
|
|
833
|
+
}, this.onProviderRequest = (l) => {
|
|
834
|
+
if (l.context !== this.context || (l.contextTarget ?? l.composedPath()[0]) === this.host) return;
|
|
835
|
+
let d = /* @__PURE__ */ new Set();
|
|
836
|
+
for (let [l, { consumerHost: x }] of this.subscriptions) d.has(l) || (d.add(l), x.dispatchEvent(new s$3(this.context, x, l, !0)));
|
|
837
|
+
l.stopPropagation();
|
|
838
|
+
}, this.host = l, d.context === void 0 ? this.context = d : this.context = d.context, this.attachListeners(), this.host.addController?.(this);
|
|
839
|
+
}
|
|
840
|
+
attachListeners() {
|
|
841
|
+
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
842
|
+
}
|
|
843
|
+
hostConnected() {
|
|
844
|
+
this.host.dispatchEvent(new e$4(this.context, this.host));
|
|
845
|
+
}
|
|
846
|
+
}, o$4 = {
|
|
847
|
+
attribute: !0,
|
|
848
|
+
type: String,
|
|
849
|
+
converter: u$2,
|
|
850
|
+
reflect: !1,
|
|
851
|
+
hasChanged: f$3
|
|
852
|
+
}, r$3 = (l = o$4, d, x) => {
|
|
853
|
+
let { kind: w, metadata: T } = x, O = globalThis.litPropertyMetadata.get(T);
|
|
854
|
+
if (O === void 0 && globalThis.litPropertyMetadata.set(T, O = /* @__PURE__ */ new Map()), w === "setter" && ((l = Object.create(l)).wrapped = !0), O.set(x.name, l), w === "accessor") {
|
|
855
|
+
let { name: w } = x;
|
|
856
|
+
return {
|
|
857
|
+
set(x) {
|
|
858
|
+
let T = d.get.call(this);
|
|
859
|
+
d.set.call(this, x), this.requestUpdate(w, T, l, !0, x);
|
|
860
|
+
},
|
|
861
|
+
init(d) {
|
|
862
|
+
return d !== void 0 && this.C(w, void 0, l, d), d;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
if (w === "setter") {
|
|
867
|
+
let { name: w } = x;
|
|
868
|
+
return function(x) {
|
|
869
|
+
let T = this[w];
|
|
870
|
+
d.call(this, x), this.requestUpdate(w, T, l, !0, x);
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
throw Error("Unsupported decorator location: " + w);
|
|
874
|
+
};
|
|
875
|
+
function n$3(l) {
|
|
876
|
+
return (d, x) => typeof x == "object" ? r$3(l, d, x) : ((l, d, x) => {
|
|
877
|
+
let w = d.hasOwnProperty(x);
|
|
878
|
+
return d.constructor.createProperty(x, l), w ? Object.getOwnPropertyDescriptor(d, x) : void 0;
|
|
879
|
+
})(l, d, x);
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* @license
|
|
883
|
+
* Copyright 2017 Google LLC
|
|
884
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
885
|
+
*/ function r$2(l) {
|
|
886
|
+
return n$3({
|
|
887
|
+
...l,
|
|
888
|
+
state: !0,
|
|
889
|
+
attribute: !1
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function debounce(l, d) {
|
|
893
|
+
let x, w = ((...w) => {
|
|
894
|
+
x && clearTimeout(x), x = setTimeout(() => l(...w), d);
|
|
895
|
+
});
|
|
896
|
+
return w.cancel = () => {
|
|
897
|
+
x && clearTimeout(x);
|
|
898
|
+
}, w;
|
|
899
|
+
}
|
|
900
|
+
function __decorate(l, d, x, w) {
|
|
901
|
+
var T = arguments.length, O = T < 3 ? d : w === null ? w = Object.getOwnPropertyDescriptor(d, x) : w, F;
|
|
902
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") O = Reflect.decorate(l, d, x, w);
|
|
903
|
+
else for (var U = l.length - 1; U >= 0; U--) (F = l[U]) && (O = (T < 3 ? F(O) : T > 3 ? F(d, x, O) : F(d, x)) || O);
|
|
904
|
+
return T > 3 && O && Object.defineProperty(d, x, O), O;
|
|
905
|
+
}
|
|
906
|
+
const ctxNameContext = n$4("ctx-name-context");
|
|
907
|
+
function SymbioteMixin() {
|
|
908
|
+
return function(l) {
|
|
909
|
+
class d extends l {
|
|
910
|
+
static set template(l) {
|
|
911
|
+
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.");
|
|
912
|
+
}
|
|
913
|
+
get _ctxNameAttr() {
|
|
914
|
+
return this._ctxNameAttrValue;
|
|
915
|
+
}
|
|
916
|
+
set _ctxNameAttr(l) {
|
|
917
|
+
let d = l ?? void 0;
|
|
918
|
+
this._ctxNameAttrValue !== d && (this._ctxNameAttrValue = d, this._handleCtxNameSourceChange());
|
|
919
|
+
}
|
|
920
|
+
shouldUpdate(l) {
|
|
921
|
+
return this._isInitialized ? super.shouldUpdate(l) : !1;
|
|
922
|
+
}
|
|
923
|
+
constructor(...l) {
|
|
924
|
+
super(...l), 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 s$2(this, {
|
|
925
|
+
context: ctxNameContext,
|
|
926
|
+
callback: (l) => {
|
|
927
|
+
if (!l) {
|
|
928
|
+
console.error("SymbioteMixin: Received invalid ctx-name from context");
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
this._ctxNameFromContext = l, this._handleCtxNameSourceChange();
|
|
932
|
+
},
|
|
933
|
+
subscribe: !0
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
get _effectiveCtxName() {
|
|
937
|
+
return this._ctxNameAttr || this._ctxNameFromContext || void 0;
|
|
938
|
+
}
|
|
939
|
+
_handleCtxNameSourceChange() {
|
|
940
|
+
if (this.ctxName = this._effectiveCtxName, !(!this.ctxName || this._symbioteFirstUpdated)) {
|
|
941
|
+
if (this.isConnected) {
|
|
942
|
+
this._performInitialization();
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
this._pendingCtxInitOnConnect = !0;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
willUpdate(l) {
|
|
949
|
+
super.willUpdate(l), this.ctxName = this._effectiveCtxName, this.ctxName && (this._ctxNameProvider ? this._ctxNameProvider.setValue(this.ctxName) : this._ctxNameProvider = new i$4(this, {
|
|
950
|
+
context: ctxNameContext,
|
|
951
|
+
initialValue: this.ctxName
|
|
952
|
+
}));
|
|
953
|
+
}
|
|
954
|
+
_applyPendingSharedAdds() {
|
|
955
|
+
if (!(!this._symbioteSharedPubSub || this._pendingSharedAdds.size === 0)) {
|
|
956
|
+
for (let [l, { value: d, rewrite: x }] of this._pendingSharedAdds) this._symbioteSharedPubSub.add(l, d, x);
|
|
957
|
+
this._pendingSharedAdds.clear();
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
_getSharedPubSub() {
|
|
961
|
+
return !this._symbioteSharedPubSub && this._effectiveCtxName && this._initSharedContext(), this._symbioteSharedPubSub && this._applyPendingSharedAdds(), this._symbioteSharedPubSub;
|
|
962
|
+
}
|
|
963
|
+
_requireSharedPubSub() {
|
|
964
|
+
let l = this._getSharedPubSub();
|
|
965
|
+
if (!l) throw Error("SymbioteMixin: Shared context is not initialized.");
|
|
966
|
+
return l;
|
|
967
|
+
}
|
|
968
|
+
_initSharedContext() {
|
|
969
|
+
let l = this.init$, d = this._effectiveCtxName;
|
|
970
|
+
if (!d) {
|
|
971
|
+
console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
if (!this._symbioteSharedPubSub) {
|
|
975
|
+
this._symbioteSharedPubSub = PubSub.getCtx(d) ?? PubSub.registerCtx(l, d);
|
|
976
|
+
for (let [l, d] of Object.entries(this.init$)) this._symbioteSharedPubSub.add(l, d, this.ctxOwner);
|
|
977
|
+
this._applyPendingSharedAdds();
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
get $() {
|
|
981
|
+
return this._effectiveCtxName && this._initSharedContext(), new Proxy({}, {
|
|
982
|
+
get: (l, d) => {
|
|
983
|
+
if (typeof d == "string") return this._symbioteSharedPubSub?.read(d);
|
|
984
|
+
},
|
|
985
|
+
set: (l, d, x) => (typeof d == "string" && this._symbioteSharedPubSub?.pub(d, x), !0)
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
sub(l, d, x = !0) {
|
|
989
|
+
let w = this._requireSharedPubSub().sub(l, d, x);
|
|
990
|
+
if (!w || typeof w != "function") return () => {};
|
|
991
|
+
let T = w.bind(w), O = !1, F = () => {
|
|
992
|
+
O || (O = !0, T(), this._symbioteSubscriptions.delete(F));
|
|
993
|
+
};
|
|
994
|
+
return this._symbioteSubscriptions.add(F), F;
|
|
995
|
+
}
|
|
996
|
+
pub(l, d) {
|
|
997
|
+
this._requireSharedPubSub().pub(l, d);
|
|
998
|
+
}
|
|
999
|
+
set$(l) {
|
|
1000
|
+
for (let [d, x] of Object.entries(l)) this.pub(d, x);
|
|
1001
|
+
}
|
|
1002
|
+
get sharedCtx() {
|
|
1003
|
+
return this._requireSharedPubSub();
|
|
1004
|
+
}
|
|
1005
|
+
has(l) {
|
|
1006
|
+
return this._symbioteSharedPubSub?.has(l) ?? !1;
|
|
1007
|
+
}
|
|
1008
|
+
add(l, d, x = !1) {
|
|
1009
|
+
let w = this._getSharedPubSub();
|
|
1010
|
+
if (!w) {
|
|
1011
|
+
if (!x && this._pendingSharedAdds.has(l)) return;
|
|
1012
|
+
this._pendingSharedAdds.set(l, {
|
|
1013
|
+
value: d,
|
|
1014
|
+
rewrite: x
|
|
1015
|
+
});
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
this._pendingSharedAdds.delete(l), w.add(l, d, x);
|
|
1019
|
+
}
|
|
1020
|
+
add$(l, d = !1) {
|
|
1021
|
+
for (let [x, w] of Object.entries(l)) this.add(x, w, d);
|
|
1022
|
+
}
|
|
1023
|
+
connectedCallback() {
|
|
1024
|
+
super.connectedCallback(), this._symbioteFirstUpdated ? this._isInitialized && this._needsReconnectInit && (this._needsReconnectInit = !1, this.initCallback()) : (this.ctxName || this._pendingCtxInitOnConnect && this._effectiveCtxName) && (this._pendingCtxInitOnConnect = !1, this._performInitialization());
|
|
1025
|
+
}
|
|
1026
|
+
_performInitialization() {
|
|
1027
|
+
if (this._symbioteFirstUpdated) return;
|
|
1028
|
+
this._symbioteFirstUpdated = !0, this._initSharedContext();
|
|
1029
|
+
let l = this.init$;
|
|
1030
|
+
if (Object.keys(l).length > 0) {
|
|
1031
|
+
let d = this._requireSharedPubSub();
|
|
1032
|
+
for (let [x, w] of Object.entries(l)) d.read(x) === void 0 && d.pub(x, w), this.sub(x, debounce(async () => {
|
|
1033
|
+
this.isConnected && (await this.updateComplete, this.requestUpdate());
|
|
1034
|
+
}, 0), !1);
|
|
1035
|
+
}
|
|
1036
|
+
this.initCallback(), this._isInitialized = !0, this.requestUpdate();
|
|
1037
|
+
}
|
|
1038
|
+
firstUpdated(l) {
|
|
1039
|
+
super.firstUpdated(l);
|
|
1040
|
+
}
|
|
1041
|
+
disconnectedCallback() {
|
|
1042
|
+
this._cleanupSymbioteSubscriptions(), super.disconnectedCallback(), this._symbioteFirstUpdated && (this._needsReconnectInit = !0);
|
|
1043
|
+
}
|
|
1044
|
+
_cleanupSymbioteSubscriptions() {
|
|
1045
|
+
if (this._symbioteSubscriptions.size !== 0) {
|
|
1046
|
+
for (let l of [...this._symbioteSubscriptions]) l();
|
|
1047
|
+
this._symbioteSubscriptions.clear();
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
initCallback() {}
|
|
1051
|
+
}
|
|
1052
|
+
return __decorate([n$3({
|
|
1053
|
+
type: String,
|
|
1054
|
+
attribute: "ctx-name",
|
|
1055
|
+
noAccessor: !0
|
|
1056
|
+
})], d.prototype, "_ctxNameAttr", null), __decorate([r$2()], d.prototype, "_ctxNameFromContext", void 0), __decorate([r$2()], d.prototype, "ctxName", void 0), __decorate([r$2()], d.prototype, "_isInitialized", void 0), d;
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
var UID = class l {
|
|
1060
|
+
static generateFastUid() {
|
|
1061
|
+
return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
|
|
1062
|
+
}
|
|
1063
|
+
static generateRandomUUID() {
|
|
1064
|
+
let d = globalThis.crypto;
|
|
1065
|
+
return d && typeof d.randomUUID == "function" ? d.randomUUID() : l.generateFastUid();
|
|
1066
|
+
}
|
|
1067
|
+
}, en_default = {
|
|
1068
|
+
"locale-id": "en",
|
|
1069
|
+
"social-source-lang": "en",
|
|
1070
|
+
"upload-file": "Upload file",
|
|
1071
|
+
"upload-files": "Upload files",
|
|
1072
|
+
"choose-file": "Choose file",
|
|
1073
|
+
"choose-files": "Choose files",
|
|
1074
|
+
"drop-files-here": "Drop files here",
|
|
1075
|
+
"select-file-source": "Select file source",
|
|
1076
|
+
selected: "Selected",
|
|
1077
|
+
upload: "Upload",
|
|
1078
|
+
"add-more": "Add more",
|
|
1079
|
+
cancel: "Cancel",
|
|
1080
|
+
"start-from-cancel": "Cancel",
|
|
1081
|
+
clear: "Clear",
|
|
1082
|
+
"camera-shot": "Shot",
|
|
1083
|
+
"upload-url": "Import",
|
|
1084
|
+
"upload-url-placeholder": "Paste link here",
|
|
1085
|
+
"edit-image": "Edit image",
|
|
1086
|
+
"edit-detail": "Details",
|
|
1087
|
+
back: "Back",
|
|
1088
|
+
done: "Done",
|
|
1089
|
+
ok: "Ok",
|
|
1090
|
+
"remove-from-list": "Remove",
|
|
1091
|
+
no: "No",
|
|
1092
|
+
yes: "Yes",
|
|
1093
|
+
"confirm-your-action": "Confirm your action",
|
|
1094
|
+
"are-you-sure": "Are you sure?",
|
|
1095
|
+
"selected-count": "{{count}} of {{total}} selected",
|
|
1096
|
+
"select-all": "Select all",
|
|
1097
|
+
"deselect-all": "Deselect all",
|
|
1098
|
+
"upload-error": "Upload error",
|
|
1099
|
+
"validation-error": "Validation error",
|
|
1100
|
+
"no-files": "No files selected",
|
|
1101
|
+
browse: "Browse",
|
|
1102
|
+
"not-uploaded-yet": "Not uploaded yet...",
|
|
1103
|
+
file__one: "file",
|
|
1104
|
+
file__other: "files",
|
|
1105
|
+
error__one: "error",
|
|
1106
|
+
error__other: "errors",
|
|
1107
|
+
"header-uploading": "Uploading {{count}} {{plural:file(count)}}",
|
|
1108
|
+
"header-failed": "{{count}} {{plural:error(count)}}",
|
|
1109
|
+
"header-succeed": "{{count}} {{plural:file(count)}} uploaded",
|
|
1110
|
+
"header-total": "{{count}} {{plural:file(count)}} selected",
|
|
1111
|
+
"src-type-local": "From device",
|
|
1112
|
+
"src-type-from-url": "From link",
|
|
1113
|
+
"src-type-camera": "Camera",
|
|
1114
|
+
"src-type-mobile-video-camera": "Video",
|
|
1115
|
+
"src-type-mobile-photo-camera": "Photo",
|
|
1116
|
+
"src-type-facebook": "Facebook",
|
|
1117
|
+
"src-type-dropbox": "Dropbox",
|
|
1118
|
+
"src-type-gdrive": "Google Drive",
|
|
1119
|
+
"src-type-ngdrive": "Google Drive",
|
|
1120
|
+
"src-type-gphotos": "Google Photos",
|
|
1121
|
+
"src-type-flickr": "Flickr",
|
|
1122
|
+
"src-type-vk": "VK",
|
|
1123
|
+
"src-type-evernote": "Evernote",
|
|
1124
|
+
"src-type-box": "Box",
|
|
1125
|
+
"src-type-onedrive": "OneDrive",
|
|
1126
|
+
"src-type-huddle": "Huddle",
|
|
1127
|
+
"src-type-other": "Other",
|
|
1128
|
+
"caption-from-url": "Import from link",
|
|
1129
|
+
"caption-camera": "Camera",
|
|
1130
|
+
"caption-edit-file": "Edit file",
|
|
1131
|
+
"file-no-name": "No name...",
|
|
1132
|
+
"toggle-fullscreen": "Toggle fullscreen",
|
|
1133
|
+
"toggle-guides": "Toggle guides",
|
|
1134
|
+
rotate: "Rotate",
|
|
1135
|
+
"flip-vertical": "Flip vertical",
|
|
1136
|
+
"flip-horizontal": "Flip horizontal",
|
|
1137
|
+
apply: "Apply",
|
|
1138
|
+
brightness: "Brightness",
|
|
1139
|
+
contrast: "Contrast",
|
|
1140
|
+
saturation: "Saturation",
|
|
1141
|
+
exposure: "Exposure",
|
|
1142
|
+
gamma: "Gamma",
|
|
1143
|
+
vibrance: "Vibrance",
|
|
1144
|
+
warmth: "Warmth",
|
|
1145
|
+
enhance: "Enhance",
|
|
1146
|
+
original: "Original",
|
|
1147
|
+
resize: "Resize image",
|
|
1148
|
+
crop: "Crop",
|
|
1149
|
+
"select-color": "Select color",
|
|
1150
|
+
text: "Text",
|
|
1151
|
+
draw: "Draw",
|
|
1152
|
+
"cancel-edit": "Cancel edit",
|
|
1153
|
+
"tab-view": "Preview",
|
|
1154
|
+
"tab-details": "Details",
|
|
1155
|
+
"file-name": "Name",
|
|
1156
|
+
"file-size": "Size",
|
|
1157
|
+
"cdn-url": "CDN URL",
|
|
1158
|
+
"file-size-unknown": "Unknown",
|
|
1159
|
+
"camera-permissions-denied": "Camera access denied",
|
|
1160
|
+
"camera-permissions-prompt": "Please allow access to the camera",
|
|
1161
|
+
"camera-permissions-request": "Request access",
|
|
1162
|
+
"files-count-limit-error-title": "Files count limit overflow",
|
|
1163
|
+
"files-count-limit-error-too-few": "You’ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.",
|
|
1164
|
+
"files-count-limit-error-too-many": "You’ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.",
|
|
1165
|
+
"files-max-size-limit-error": "File is too big. Max file size is {{maxFileSize}}.",
|
|
1166
|
+
"has-validation-errors": "File validation error occurred. Please, check your files before upload.",
|
|
1167
|
+
"images-only-accepted": "Only image files are accepted.",
|
|
1168
|
+
"file-type-not-allowed": "Uploading of these file types is not allowed.",
|
|
1169
|
+
"some-files-were-not-uploaded": "Some files were not uploaded.",
|
|
1170
|
+
"file-item-edit-button": "Edit",
|
|
1171
|
+
"file-item-remove-button": "Remove",
|
|
1172
|
+
"a11y-editor-tab-filters": "Filters",
|
|
1173
|
+
"a11y-editor-tab-tuning": "Tuning",
|
|
1174
|
+
"a11y-editor-tab-crop": "Crop",
|
|
1175
|
+
"a11y-activity-header-button-close": "Close",
|
|
1176
|
+
flip: "Flip",
|
|
1177
|
+
mirror: "Mirror",
|
|
1178
|
+
"a11y-cloud-editor-apply-filter": "Apply {{name}} filter",
|
|
1179
|
+
"a11y-cloud-editor-apply-crop": "Apply {{name}} operation",
|
|
1180
|
+
"a11y-cloud-editor-apply-tuning": "Apply {{name}} tuning",
|
|
1181
|
+
"a11y-cloud-editor-apply-aspect-ratio": "Apply operation {{name}} {{value}}",
|
|
1182
|
+
finished: "Finished",
|
|
1183
|
+
failed: "Failed",
|
|
1184
|
+
uploading: "Uploading",
|
|
1185
|
+
idle: "Idle",
|
|
1186
|
+
"a11y-file-item-status": "File {{fileName}} in status {{status}}",
|
|
1187
|
+
"waiting-for": "Waiting for {{source}}",
|
|
1188
|
+
"queued-uploading": "Queued for upload",
|
|
1189
|
+
"queued-validation": "Queued for validation",
|
|
1190
|
+
validation: "Validating",
|
|
1191
|
+
"crop-to-shape": "Crop to {{value}}",
|
|
1192
|
+
custom: "Freeform",
|
|
1193
|
+
"freeform-crop": "Freeform crop"
|
|
1194
|
+
}, localeRegistry = /* @__PURE__ */ new Map(), localeResolvers = /* @__PURE__ */ new Map(), defineLocaleSync = (l, d) => {
|
|
1195
|
+
localeRegistry.has(l) && console.log(`Locale ${l} is already defined. Overwriting...`);
|
|
1196
|
+
let x = {
|
|
1197
|
+
...en_default,
|
|
1198
|
+
...d
|
|
1199
|
+
};
|
|
1200
|
+
return localeRegistry.set(l, x), x;
|
|
1201
|
+
}, defineLocaleAsync = (l, d) => {
|
|
1202
|
+
localeResolvers.set(l, d);
|
|
1203
|
+
};
|
|
1204
|
+
const defineLocale = (l, d) => {
|
|
1205
|
+
typeof d == "function" ? defineLocaleAsync(l, d) : defineLocaleSync(l, d);
|
|
1206
|
+
}, resolveLocaleDefinition = async (l) => {
|
|
1207
|
+
let d = localeRegistry.get(l);
|
|
1208
|
+
if (!d) {
|
|
1209
|
+
let x = localeResolvers.get(l);
|
|
1210
|
+
if (!x) throw Error(`Locale ${l} is not defined`);
|
|
1211
|
+
d = defineLocaleSync(l, await x());
|
|
1212
|
+
}
|
|
1213
|
+
return d;
|
|
1214
|
+
};
|
|
1215
|
+
defineLocale("en", en_default);
|
|
1216
|
+
const sharedConfigKey = (l) => `*cfg/${l}`, normalizeCdnOperation = (l) => {
|
|
1217
|
+
if (typeof l != "string" || !l) return "";
|
|
1218
|
+
let d = l.trim();
|
|
1219
|
+
return d.startsWith("-/") ? d = d.slice(2) : d.startsWith("/") && (d = d.slice(1)), d.endsWith("/") && (d = d.slice(0, d.length - 1)), d;
|
|
1220
|
+
}, joinCdnOperations = (...l) => l.filter((l) => typeof l == "string" && !!l).map((l) => normalizeCdnOperation(l)).join("/-/"), createCdnUrlModifiers = (...l) => {
|
|
1221
|
+
let d = joinCdnOperations(...l);
|
|
1222
|
+
return d ? `-/${d}/` : "";
|
|
1223
|
+
};
|
|
1224
|
+
function extractFilename(l) {
|
|
1225
|
+
let d = new URL(l), x = d.pathname + d.search + d.hash, w = x.lastIndexOf("http"), T = x.lastIndexOf("/"), O = "";
|
|
1226
|
+
return w >= 0 ? O = x.slice(w) : T >= 0 && (O = x.slice(T + 1)), O;
|
|
1227
|
+
}
|
|
1228
|
+
function extractUuid(l) {
|
|
1229
|
+
let { pathname: d } = new URL(l), x = d.indexOf("/"), w = d.indexOf("/", x + 1);
|
|
1230
|
+
return d.substring(x + 1, w);
|
|
1231
|
+
}
|
|
1232
|
+
function extractCdnUrlModifiers(l) {
|
|
1233
|
+
let d = trimFilename(l), x = new URL(d), w = x.pathname.indexOf("/-/");
|
|
1234
|
+
return w === -1 ? "" : x.pathname.substring(w).slice(1);
|
|
1235
|
+
}
|
|
1236
|
+
function extractOperations(l) {
|
|
1237
|
+
return extractCdnUrlModifiers(l).split("/-/").filter(Boolean).map((l) => normalizeCdnOperation(l));
|
|
1238
|
+
}
|
|
1239
|
+
function trimFilename(l) {
|
|
1240
|
+
let d = new URL(l), x = extractFilename(l), w = isFileUrl(x) ? splitFileUrl(x).pathname : x;
|
|
1241
|
+
return d.pathname = d.pathname.replace(w, ""), d.search = "", d.hash = "", d.toString();
|
|
1242
|
+
}
|
|
1243
|
+
function isFileUrl(l) {
|
|
1244
|
+
return l.startsWith("http");
|
|
1245
|
+
}
|
|
1246
|
+
function splitFileUrl(l) {
|
|
1247
|
+
let d = new URL(l);
|
|
1248
|
+
return {
|
|
1249
|
+
pathname: `${d.origin}${d.pathname ?? ""}`,
|
|
1250
|
+
search: d.search ?? "",
|
|
1251
|
+
hash: d.hash ?? ""
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
const createCdnUrl = (l, d, x) => {
|
|
1255
|
+
let w = new URL(trimFilename(l)), T = x ?? extractFilename(l), O = d ?? "";
|
|
1256
|
+
if (w.pathname.startsWith("//") && (w.pathname = w.pathname.replace("//", "/")), T && isFileUrl(T)) {
|
|
1257
|
+
let l = splitFileUrl(T);
|
|
1258
|
+
w.pathname = `${w.pathname}${O}${l.pathname || ""}`, w.search = l.search, w.hash = l.hash;
|
|
1259
|
+
} else w.pathname = `${w.pathname}${O}${T || ""}`;
|
|
1260
|
+
return w.toString();
|
|
1261
|
+
}, createOriginalUrl = (l, d) => {
|
|
1262
|
+
let x = new URL(l);
|
|
1263
|
+
return x.pathname = `${d}/`, x.toString();
|
|
1264
|
+
}, stringToArray = (l, d = ",") => l.trim().split(d).map((l) => l.trim()).filter((l) => l.length > 0), OPERATIONS_DEFAULTS = Object.freeze({
|
|
1265
|
+
brightness: 0,
|
|
1266
|
+
exposure: 0,
|
|
1267
|
+
gamma: 100,
|
|
1268
|
+
contrast: 0,
|
|
1269
|
+
saturation: 0,
|
|
1270
|
+
vibrance: 0,
|
|
1271
|
+
warmth: 0,
|
|
1272
|
+
enhance: 0,
|
|
1273
|
+
filter: 0,
|
|
1274
|
+
rotate: 0,
|
|
1275
|
+
mirror: !1,
|
|
1276
|
+
flip: !1,
|
|
1277
|
+
crop: void 0
|
|
1278
|
+
});
|
|
1279
|
+
var SUPPORTED_OPERATIONS_ORDERED = [
|
|
1280
|
+
"enhance",
|
|
1281
|
+
"brightness",
|
|
1282
|
+
"exposure",
|
|
1283
|
+
"gamma",
|
|
1284
|
+
"contrast",
|
|
1285
|
+
"saturation",
|
|
1286
|
+
"vibrance",
|
|
1287
|
+
"warmth",
|
|
1288
|
+
"filter",
|
|
1289
|
+
"mirror",
|
|
1290
|
+
"flip",
|
|
1291
|
+
"rotate",
|
|
1292
|
+
"crop"
|
|
1293
|
+
];
|
|
1294
|
+
function transformationToStr(l, d) {
|
|
1295
|
+
if (typeof d == "number") {
|
|
1296
|
+
let x = d;
|
|
1297
|
+
return OPERATIONS_DEFAULTS[l] === x ? "" : `${l}/${x}`;
|
|
1298
|
+
}
|
|
1299
|
+
if (typeof d == "boolean") {
|
|
1300
|
+
let x = d;
|
|
1301
|
+
return OPERATIONS_DEFAULTS[l] === x ? "" : `${l}`;
|
|
1302
|
+
}
|
|
1303
|
+
if (l === "filter" && d) {
|
|
1304
|
+
let { name: x, amount: w } = d;
|
|
1305
|
+
return OPERATIONS_DEFAULTS.filter === w ? "" : `${l}/${x}/${w}`;
|
|
1306
|
+
}
|
|
1307
|
+
if (l === "crop" && d) {
|
|
1308
|
+
let { dimensions: x, coords: w } = d;
|
|
1309
|
+
return `${l}/${x.join("x")}/${w.join(",")}`;
|
|
1310
|
+
}
|
|
1311
|
+
return "";
|
|
1312
|
+
}
|
|
1313
|
+
function transformationsToOperations(l) {
|
|
1314
|
+
return joinCdnOperations(...SUPPORTED_OPERATIONS_ORDERED.filter((d) => l[d] !== void 0 && l[d] !== null).map((d) => {
|
|
1315
|
+
let x = l[d];
|
|
1316
|
+
return transformationToStr(d, x);
|
|
1317
|
+
}).filter((l) => !!l));
|
|
1318
|
+
}
|
|
1319
|
+
const COMMON_OPERATIONS = joinCdnOperations("format/auto", "progressive/yes");
|
|
1320
|
+
var asNumber = ([l]) => l === void 0 ? void 0 : Number(l), asBoolean = () => !0, asFilter = ([l, d]) => ({
|
|
1321
|
+
name: l,
|
|
1322
|
+
amount: d === void 0 ? 100 : Number(d)
|
|
1323
|
+
}), asCrop = ([l, d]) => {
|
|
1324
|
+
if (!/\d+x\d+/.test(l) || !/\d+,\d+/.test(d)) throw Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");
|
|
1325
|
+
return {
|
|
1326
|
+
dimensions: stringToArray(l, "x").map(Number),
|
|
1327
|
+
coords: stringToArray(d).map(Number)
|
|
1328
|
+
};
|
|
1329
|
+
}, OPERATION_PROCESSORS = Object.freeze({
|
|
1330
|
+
enhance: asNumber,
|
|
1331
|
+
brightness: asNumber,
|
|
1332
|
+
exposure: asNumber,
|
|
1333
|
+
gamma: asNumber,
|
|
1334
|
+
contrast: asNumber,
|
|
1335
|
+
saturation: asNumber,
|
|
1336
|
+
vibrance: asNumber,
|
|
1337
|
+
warmth: asNumber,
|
|
1338
|
+
filter: asFilter,
|
|
1339
|
+
mirror: asBoolean,
|
|
1340
|
+
flip: asBoolean,
|
|
1341
|
+
rotate: asNumber,
|
|
1342
|
+
crop: (l) => {
|
|
1343
|
+
let [d, x] = l, { dimensions: w, coords: T } = asCrop([d, x]);
|
|
1344
|
+
return {
|
|
1345
|
+
dimensions: w,
|
|
1346
|
+
coords: T
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
function operationsToTransformations(l) {
|
|
1351
|
+
let d = {};
|
|
1352
|
+
for (let x of l) {
|
|
1353
|
+
let [l, ...w] = x.split("/");
|
|
1354
|
+
if (!l || !SUPPORTED_OPERATIONS_ORDERED.includes(l)) continue;
|
|
1355
|
+
let T = l, O = OPERATION_PROCESSORS[T];
|
|
1356
|
+
try {
|
|
1357
|
+
d[T] = O(w);
|
|
1358
|
+
} catch (l) {
|
|
1359
|
+
console.warn([
|
|
1360
|
+
`Failed to parse URL operation "${x}". It will be ignored.`,
|
|
1361
|
+
l instanceof Error ? `Error message: "${l.message}"` : l,
|
|
1362
|
+
"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"
|
|
1363
|
+
].join("\n"));
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return d;
|
|
1367
|
+
}
|
|
1368
|
+
const TabId = Object.freeze({
|
|
1369
|
+
CROP: "crop",
|
|
1370
|
+
TUNING: "tuning",
|
|
1371
|
+
FILTERS: "filters"
|
|
1372
|
+
}), ALL_TABS = Object.freeze([
|
|
1373
|
+
TabId.CROP,
|
|
1374
|
+
TabId.TUNING,
|
|
1375
|
+
TabId.FILTERS
|
|
1376
|
+
]), ALL_COLOR_OPERATIONS = Object.freeze([
|
|
1377
|
+
"brightness",
|
|
1378
|
+
"exposure",
|
|
1379
|
+
"gamma",
|
|
1380
|
+
"contrast",
|
|
1381
|
+
"saturation",
|
|
1382
|
+
"vibrance",
|
|
1383
|
+
"warmth",
|
|
1384
|
+
"enhance"
|
|
1385
|
+
]), 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([
|
|
1386
|
+
"rotate",
|
|
1387
|
+
"mirror",
|
|
1388
|
+
"flip"
|
|
1389
|
+
]);
|
|
1390
|
+
var NUMERIC_OPERATION_DEFAULTS = OPERATIONS_DEFAULTS;
|
|
1391
|
+
const COLOR_OPERATIONS_CONFIG = Object.freeze({
|
|
1392
|
+
brightness: {
|
|
1393
|
+
zero: NUMERIC_OPERATION_DEFAULTS.brightness,
|
|
1394
|
+
range: [-100, 100],
|
|
1395
|
+
keypointsNumber: 2
|
|
1396
|
+
},
|
|
1397
|
+
exposure: {
|
|
1398
|
+
zero: NUMERIC_OPERATION_DEFAULTS.exposure,
|
|
1399
|
+
range: [-500, 500],
|
|
1400
|
+
keypointsNumber: 2
|
|
1401
|
+
},
|
|
1402
|
+
gamma: {
|
|
1403
|
+
zero: NUMERIC_OPERATION_DEFAULTS.gamma,
|
|
1404
|
+
range: [0, 1e3],
|
|
1405
|
+
keypointsNumber: 2
|
|
1406
|
+
},
|
|
1407
|
+
contrast: {
|
|
1408
|
+
zero: NUMERIC_OPERATION_DEFAULTS.contrast,
|
|
1409
|
+
range: [-100, 500],
|
|
1410
|
+
keypointsNumber: 2
|
|
1411
|
+
},
|
|
1412
|
+
saturation: {
|
|
1413
|
+
zero: NUMERIC_OPERATION_DEFAULTS.saturation,
|
|
1414
|
+
range: [-100, 500],
|
|
1415
|
+
keypointsNumber: 1
|
|
1416
|
+
},
|
|
1417
|
+
vibrance: {
|
|
1418
|
+
zero: NUMERIC_OPERATION_DEFAULTS.vibrance,
|
|
1419
|
+
range: [-100, 500],
|
|
1420
|
+
keypointsNumber: 1
|
|
1421
|
+
},
|
|
1422
|
+
warmth: {
|
|
1423
|
+
zero: NUMERIC_OPERATION_DEFAULTS.warmth,
|
|
1424
|
+
range: [-100, 100],
|
|
1425
|
+
keypointsNumber: 1
|
|
1426
|
+
},
|
|
1427
|
+
enhance: {
|
|
1428
|
+
zero: NUMERIC_OPERATION_DEFAULTS.enhance,
|
|
1429
|
+
range: [0, 100],
|
|
1430
|
+
keypointsNumber: 1
|
|
1431
|
+
},
|
|
1432
|
+
filter: {
|
|
1433
|
+
zero: NUMERIC_OPERATION_DEFAULTS.filter,
|
|
1434
|
+
range: [0, 100],
|
|
1435
|
+
keypointsNumber: 1
|
|
1436
|
+
}
|
|
1437
|
+
}), DEFAULT_CDN_CNAME = "https://ucarecdn.com";
|
|
1438
|
+
var config = {
|
|
1439
|
+
pubkey: "",
|
|
1440
|
+
multiple: !0,
|
|
1441
|
+
multipleMin: 0,
|
|
1442
|
+
multipleMax: 2 ** 53 - 1,
|
|
1443
|
+
confirmUpload: !1,
|
|
1444
|
+
imgOnly: !1,
|
|
1445
|
+
accept: "",
|
|
1446
|
+
externalSourcesPreferredTypes: "",
|
|
1447
|
+
externalSourcesEmbedCss: "",
|
|
1448
|
+
store: "auto",
|
|
1449
|
+
cameraMirror: !1,
|
|
1450
|
+
cameraCapture: "",
|
|
1451
|
+
sourceList: "local, url, camera, dropbox, gdrive",
|
|
1452
|
+
topLevelOrigin: "",
|
|
1453
|
+
maxLocalFileSizeBytes: 0,
|
|
1454
|
+
thumbSize: 76,
|
|
1455
|
+
showEmptyList: !1,
|
|
1456
|
+
useLocalImageEditor: !1,
|
|
1457
|
+
removeCopyright: !1,
|
|
1458
|
+
cropPreset: "",
|
|
1459
|
+
imageShrink: "",
|
|
1460
|
+
modalScrollLock: !0,
|
|
1461
|
+
modalBackdropStrokes: !1,
|
|
1462
|
+
sourceListWrap: !0,
|
|
1463
|
+
remoteTabSessionKey: "",
|
|
1464
|
+
cdnCname: DEFAULT_CDN_CNAME,
|
|
1465
|
+
cdnCnamePrefixed: "https://ucarecd.net",
|
|
1466
|
+
baseUrl: "https://upload.uploadcare.com",
|
|
1467
|
+
socialBaseUrl: "https://social.uploadcare.com",
|
|
1468
|
+
secureSignature: "",
|
|
1469
|
+
secureExpire: "",
|
|
1470
|
+
secureDeliveryProxy: "",
|
|
1471
|
+
retryThrottledRequestMaxTimes: 3,
|
|
1472
|
+
retryNetworkErrorMaxTimes: 3,
|
|
1473
|
+
multipartMinFileSize: 26214400,
|
|
1474
|
+
multipartChunkSize: 5242880,
|
|
1475
|
+
maxConcurrentRequests: 10,
|
|
1476
|
+
multipartMaxConcurrentRequests: 4,
|
|
1477
|
+
multipartMaxAttempts: 3,
|
|
1478
|
+
checkForUrlDuplicates: !1,
|
|
1479
|
+
saveUrlForRecurrentUploads: !1,
|
|
1480
|
+
groupOutput: !1,
|
|
1481
|
+
userAgentIntegration: "",
|
|
1482
|
+
debug: !1,
|
|
1483
|
+
metadata: null,
|
|
1484
|
+
localeName: "en",
|
|
1485
|
+
localeDefinitionOverride: null,
|
|
1486
|
+
secureUploadsExpireThreshold: 600 * 1e3,
|
|
1487
|
+
secureUploadsSignatureResolver: null,
|
|
1488
|
+
secureDeliveryProxyUrlResolver: null,
|
|
1489
|
+
iconHrefResolver: null,
|
|
1490
|
+
fileValidators: [],
|
|
1491
|
+
collectionValidators: [],
|
|
1492
|
+
validationTimeout: 15 * 1e3,
|
|
1493
|
+
validationConcurrency: 100,
|
|
1494
|
+
cameraModes: "photo, video",
|
|
1495
|
+
defaultCameraMode: null,
|
|
1496
|
+
enableAudioRecording: !0,
|
|
1497
|
+
enableVideoRecording: null,
|
|
1498
|
+
maxVideoRecordingDuration: null,
|
|
1499
|
+
mediaRecorderOptions: null,
|
|
1500
|
+
filesViewMode: "list",
|
|
1501
|
+
gridShowFileNames: !1,
|
|
1502
|
+
useCloudImageEditor: !0,
|
|
1503
|
+
cloudImageEditorAutoOpen: !1,
|
|
1504
|
+
cloudImageEditorTabs: serializeCsv(ALL_TABS),
|
|
1505
|
+
cloudImageEditorMaskHref: null,
|
|
1506
|
+
testMode: !1,
|
|
1507
|
+
qualityInsights: !0,
|
|
1508
|
+
pasteScope: "local",
|
|
1509
|
+
plugins: []
|
|
1510
|
+
};
|
|
1511
|
+
const initialConfig = Object.freeze(config), createDebugPrinter = (l, d) => (...x) => {
|
|
1512
|
+
let w = l();
|
|
1513
|
+
if (!w.read(sharedConfigKey("debug"))) return;
|
|
1514
|
+
let T = x;
|
|
1515
|
+
if (typeof x?.[0] == "function") {
|
|
1516
|
+
let l = x[0];
|
|
1517
|
+
T = l();
|
|
1518
|
+
}
|
|
1519
|
+
let O = [w.id, d].filter(Boolean);
|
|
1520
|
+
console.log(`[${O.join("][")}]`, ...T);
|
|
1521
|
+
};
|
|
1522
|
+
var SharedInstance = class {
|
|
1523
|
+
constructor(l) {
|
|
1524
|
+
this._subscriptions = /* @__PURE__ */ new Set(), this._cfgProxy = null, this._debugPrint = createDebugPrinter(() => this._sharedInstancesBag.ctx, this.constructor.name), this._sharedInstancesBag = l, this._ctx = l.ctx;
|
|
1525
|
+
}
|
|
1526
|
+
addSub(l) {
|
|
1527
|
+
this._subscriptions.add(l);
|
|
1528
|
+
}
|
|
1529
|
+
get _cfg() {
|
|
1530
|
+
return this._cfgProxy ||= new Proxy({}, {
|
|
1531
|
+
set: () => {
|
|
1532
|
+
throw Error("SharedInstance cfg proxy is read-only");
|
|
1533
|
+
},
|
|
1534
|
+
get: (l, d) => {
|
|
1535
|
+
if (typeof d != "string") return;
|
|
1536
|
+
let x = sharedConfigKey(d);
|
|
1537
|
+
return this._sharedInstancesBag.ctx.has(x) ? this._sharedInstancesBag.ctx.read(x) : initialConfig[d];
|
|
1538
|
+
}
|
|
1539
|
+
}), this._cfgProxy;
|
|
1540
|
+
}
|
|
1541
|
+
destroy() {
|
|
1542
|
+
for (let l of this._subscriptions) try {
|
|
1543
|
+
l();
|
|
1544
|
+
} catch {}
|
|
1545
|
+
this._subscriptions.clear();
|
|
1546
|
+
}
|
|
1547
|
+
}, instanceKeyMap = {
|
|
1548
|
+
modalManager: "*modalManager",
|
|
1549
|
+
pluginManager: "*pluginManager",
|
|
1550
|
+
telemetryManager: "*telemetryManager",
|
|
1551
|
+
localeManager: "*localeManager",
|
|
1552
|
+
a11y: "*a11y",
|
|
1553
|
+
clipboard: "*clipboard",
|
|
1554
|
+
blocksRegistry: "*blocksRegistry",
|
|
1555
|
+
eventEmitter: "*eventEmitter",
|
|
1556
|
+
uploadCollection: "*uploadCollection",
|
|
1557
|
+
secureUploadsManager: "*secureUploadsManager",
|
|
1558
|
+
api: "*publicApi",
|
|
1559
|
+
validationManager: "*validationManager"
|
|
1560
|
+
};
|
|
1561
|
+
const getSharedInstance = (l, d, x = !0) => {
|
|
1562
|
+
let w = l.has(d), T = w ? l.read(d) : null;
|
|
1563
|
+
if (w && T || !x) return T;
|
|
1564
|
+
throw Error(`Unexpected error: shared instance for key "${String(d)}" is not available`);
|
|
1565
|
+
}, createSharedInstancesBag = (l) => ({
|
|
1566
|
+
get ctx() {
|
|
1567
|
+
return l();
|
|
1568
|
+
},
|
|
1569
|
+
get modalManager() {
|
|
1570
|
+
return getSharedInstance(l(), "*modalManager", !1);
|
|
1571
|
+
},
|
|
1572
|
+
get pluginManager() {
|
|
1573
|
+
return getSharedInstance(l(), "*pluginManager");
|
|
1574
|
+
},
|
|
1575
|
+
get telemetryManager() {
|
|
1576
|
+
return getSharedInstance(l(), "*telemetryManager");
|
|
1577
|
+
},
|
|
1578
|
+
get localeManager() {
|
|
1579
|
+
return getSharedInstance(l(), "*localeManager");
|
|
1580
|
+
},
|
|
1581
|
+
get a11y() {
|
|
1582
|
+
return getSharedInstance(l(), "*a11y");
|
|
1583
|
+
},
|
|
1584
|
+
get blocksRegistry() {
|
|
1585
|
+
return getSharedInstance(l(), "*blocksRegistry");
|
|
1586
|
+
},
|
|
1587
|
+
get eventEmitter() {
|
|
1588
|
+
return getSharedInstance(l(), "*eventEmitter");
|
|
1589
|
+
},
|
|
1590
|
+
get uploadCollection() {
|
|
1591
|
+
return getSharedInstance(l(), "*uploadCollection");
|
|
1592
|
+
},
|
|
1593
|
+
get secureUploadsManager() {
|
|
1594
|
+
return getSharedInstance(l(), "*secureUploadsManager", !1);
|
|
1595
|
+
},
|
|
1596
|
+
get api() {
|
|
1597
|
+
return getSharedInstance(l(), "*publicApi");
|
|
1598
|
+
},
|
|
1599
|
+
get validationManager() {
|
|
1600
|
+
return getSharedInstance(l(), "*validationManager");
|
|
1601
|
+
},
|
|
1602
|
+
when(d, x) {
|
|
1603
|
+
let w = instanceKeyMap[d], T = l(), O = T.has(w) ? T.read(w) : void 0;
|
|
1604
|
+
if (O) return x(O), () => {};
|
|
1605
|
+
let F = T.sub(w, (l) => {
|
|
1606
|
+
l && (x(l), F());
|
|
1607
|
+
});
|
|
1608
|
+
return F;
|
|
1609
|
+
}
|
|
1610
|
+
}), ModalEvents = Object.freeze({
|
|
1611
|
+
ADD: "modal:add",
|
|
1612
|
+
DELETE: "modal:delete",
|
|
1613
|
+
OPEN: "modal:open",
|
|
1614
|
+
CLOSE: "modal:close",
|
|
1615
|
+
CLOSE_ALL: "modal:closeAll",
|
|
1616
|
+
DESTROY: "modal:destroy"
|
|
1617
|
+
});
|
|
1618
|
+
var ModalManager = class extends SharedInstance {
|
|
1619
|
+
constructor(...l) {
|
|
1620
|
+
super(...l), this._modals = /* @__PURE__ */ new Map(), this._activeModals = /* @__PURE__ */ new Set(), this._subscribers = /* @__PURE__ */ new Map();
|
|
1621
|
+
}
|
|
1622
|
+
registerModal(l, d) {
|
|
1623
|
+
this._modals.set(l, d), this._notify(ModalEvents.ADD, {
|
|
1624
|
+
id: l,
|
|
1625
|
+
modal: d
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
deleteModal(l) {
|
|
1629
|
+
let d = this._modals.get(l);
|
|
1630
|
+
return d ? (this._modals.delete(l), this._activeModals.delete(l), this._notify(ModalEvents.DELETE, {
|
|
1631
|
+
id: l,
|
|
1632
|
+
modal: d
|
|
1633
|
+
}), !0) : !1;
|
|
1634
|
+
}
|
|
1635
|
+
open(l) {
|
|
1636
|
+
let d = this._modals.get(l);
|
|
1637
|
+
return d ? (this._activeModals.add(l), this._notify(ModalEvents.OPEN, {
|
|
1638
|
+
modal: d,
|
|
1639
|
+
id: l
|
|
1640
|
+
}), !0) : (this._debugPrint(`Modal with ID "${l}" not found`), !1);
|
|
1641
|
+
}
|
|
1642
|
+
close(l) {
|
|
1643
|
+
let d = this._modals.get(l);
|
|
1644
|
+
return !d || !this._activeModals.has(l) ? (this._debugPrint(`Modal with ID "${l}" not found or not active`), !1) : (this._activeModals.delete(l), this._notify(ModalEvents.CLOSE, {
|
|
1645
|
+
id: l,
|
|
1646
|
+
modal: d
|
|
1647
|
+
}), !0);
|
|
1648
|
+
}
|
|
1649
|
+
toggle(l) {
|
|
1650
|
+
return this._modals.has(l) ? this._activeModals.has(l) ? this.close(l) : this.open(l) : (this._debugPrint(`Modal with ID "${l}" not found`), !1);
|
|
1651
|
+
}
|
|
1652
|
+
get hasActiveModals() {
|
|
1653
|
+
return this._activeModals.size > 0;
|
|
1654
|
+
}
|
|
1655
|
+
back() {
|
|
1656
|
+
if (this._activeModals.size === 0) return this._debugPrint("No active modals to go back from"), !1;
|
|
1657
|
+
let l = Array.from(this._activeModals).pop();
|
|
1658
|
+
return l ? this.close(l) : !1;
|
|
1659
|
+
}
|
|
1660
|
+
closeAll() {
|
|
1661
|
+
let l = this._activeModals.size;
|
|
1662
|
+
return this._activeModals.clear(), this._notify(ModalEvents.CLOSE_ALL, {}), l;
|
|
1663
|
+
}
|
|
1664
|
+
subscribe(l, d) {
|
|
1665
|
+
return this._subscribers.has(l) || this._subscribers.set(l, /* @__PURE__ */ new Set()), this._subscribers.get(l)?.add(d), () => this.unsubscribe(l, d);
|
|
1666
|
+
}
|
|
1667
|
+
unsubscribe(l, d) {
|
|
1668
|
+
this._subscribers.has(l) && this._subscribers.get(l)?.delete(d);
|
|
1669
|
+
}
|
|
1670
|
+
_notify(l, d) {
|
|
1671
|
+
if (this._subscribers.has(l)) for (let x of this._subscribers.get(l) ?? /* @__PURE__ */ new Set()) try {
|
|
1672
|
+
x(d);
|
|
1673
|
+
} catch (l) {
|
|
1674
|
+
this._sharedInstancesBag.telemetryManager.sendEventError(l, "modal subscriber"), this._debugPrint("Error in modal subscriber:", l);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
destroy() {
|
|
1678
|
+
super.destroy(), this.closeAll(), this._modals.clear(), this._subscribers.clear(), this._notify(ModalEvents.DESTROY, {});
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
function isObject(l) {
|
|
1682
|
+
return Object.prototype.toString.call(l) === "[object Object]";
|
|
1683
|
+
}
|
|
1684
|
+
var SEPARATOR = /\W|_/g;
|
|
1685
|
+
function camelizeString(l) {
|
|
1686
|
+
return l.split(SEPARATOR).map((l, d) => l.charAt(0)[d > 0 ? "toUpperCase" : "toLowerCase"]() + l.slice(1)).join("");
|
|
1687
|
+
}
|
|
1688
|
+
function camelizeArrayItems(l, { ignoreKeys: d } = { ignoreKeys: [] }) {
|
|
1689
|
+
return Array.isArray(l) ? l.map((l) => camelizeKeys(l, { ignoreKeys: d })) : l;
|
|
1690
|
+
}
|
|
1691
|
+
function camelizeKeys(l, { ignoreKeys: d } = { ignoreKeys: [] }) {
|
|
1692
|
+
if (Array.isArray(l)) return camelizeArrayItems(l, { ignoreKeys: d });
|
|
1693
|
+
if (!isObject(l)) return l;
|
|
1694
|
+
let x = {};
|
|
1695
|
+
for (let w of Object.keys(l)) {
|
|
1696
|
+
let T = l[w];
|
|
1697
|
+
if (d.includes(w)) {
|
|
1698
|
+
x[w] = T;
|
|
1699
|
+
continue;
|
|
1700
|
+
}
|
|
1701
|
+
isObject(T) ? T = camelizeKeys(T, { ignoreKeys: d }) : Array.isArray(T) && (T = camelizeArrayItems(T, { ignoreKeys: d })), x[camelizeString(w)] = T;
|
|
1702
|
+
}
|
|
1703
|
+
return x;
|
|
1704
|
+
}
|
|
1705
|
+
var delay = (l) => new Promise((d) => setTimeout(d, l));
|
|
1706
|
+
function getUserAgent$1({ libraryName: l, libraryVersion: d, userAgent: x, publicKey: w = "", integration: T = "" }) {
|
|
1707
|
+
let O = "JavaScript";
|
|
1708
|
+
return typeof x == "string" ? x : typeof x == "function" ? x({
|
|
1709
|
+
publicKey: w,
|
|
1710
|
+
libraryName: l,
|
|
1711
|
+
libraryVersion: d,
|
|
1712
|
+
languageName: O,
|
|
1713
|
+
integration: T
|
|
1714
|
+
}) : `${[
|
|
1715
|
+
l,
|
|
1716
|
+
d,
|
|
1717
|
+
w
|
|
1718
|
+
].filter(Boolean).join("/")} (${[O, T].filter(Boolean).join("; ")})`;
|
|
1719
|
+
}
|
|
1720
|
+
var defaultOptions = {
|
|
1721
|
+
factor: 2,
|
|
1722
|
+
time: 100
|
|
1723
|
+
};
|
|
1724
|
+
function retrier(l, d = defaultOptions) {
|
|
1725
|
+
let x = 0;
|
|
1726
|
+
function w(l) {
|
|
1727
|
+
let T = Math.round(d.time * d.factor ** x);
|
|
1728
|
+
return l({
|
|
1729
|
+
attempt: x,
|
|
1730
|
+
retry: (d) => delay(d ?? T).then(() => (x += 1, w(l)))
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
return w(l);
|
|
1734
|
+
}
|
|
1735
|
+
var UploadcareError = class extends Error {}, NetworkError = class l extends UploadcareError {
|
|
1736
|
+
originalProgressEvent;
|
|
1737
|
+
constructor(d) {
|
|
1738
|
+
super(), this.name = "NetworkError", this.message = "Network error", Object.setPrototypeOf(this, l.prototype), this.originalProgressEvent = d;
|
|
1739
|
+
}
|
|
1740
|
+
}, onCancel = (l, d) => {
|
|
1741
|
+
l && (l.aborted ? Promise.resolve().then(d) : l.addEventListener("abort", () => d(), { once: !0 }));
|
|
1742
|
+
}, CancelError = class l extends UploadcareError {
|
|
1743
|
+
isCancel = !0;
|
|
1744
|
+
constructor(d = "Request canceled") {
|
|
1745
|
+
super(d), this.name = "CancelError", Object.setPrototypeOf(this, l.prototype);
|
|
1746
|
+
}
|
|
1747
|
+
}, DEFAULT_INTERVAL = 500, poll = ({ check: l, interval: d = DEFAULT_INTERVAL, timeout: x, signal: w }) => new Promise((T, O) => {
|
|
1748
|
+
let F, U;
|
|
1749
|
+
onCancel(w, () => {
|
|
1750
|
+
F && clearTimeout(F), O(new CancelError("Poll cancelled"));
|
|
1751
|
+
}), x && (U = setTimeout(() => {
|
|
1752
|
+
F && clearTimeout(F), O(new CancelError("Timed out"));
|
|
1753
|
+
}, x));
|
|
1754
|
+
let W = () => {
|
|
1755
|
+
try {
|
|
1756
|
+
Promise.resolve(l(w)).then((l) => {
|
|
1757
|
+
l ? (U && clearTimeout(U), T(l)) : F = setTimeout(W, d);
|
|
1758
|
+
}).catch((l) => {
|
|
1759
|
+
U && clearTimeout(U), O(l);
|
|
1760
|
+
});
|
|
1761
|
+
} catch (l) {
|
|
1762
|
+
U && clearTimeout(U), O(l);
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
F = setTimeout(W, 0);
|
|
1766
|
+
}), defaultSettings = {
|
|
1767
|
+
baseCDN: "https://ucarecdn.com",
|
|
1768
|
+
baseURL: "https://upload.uploadcare.com",
|
|
1769
|
+
maxContentLength: 50 * 1024 * 1024,
|
|
1770
|
+
retryThrottledRequestMaxTimes: 1,
|
|
1771
|
+
retryNetworkErrorMaxTimes: 3,
|
|
1772
|
+
multipartMinFileSize: 25 * 1024 * 1024,
|
|
1773
|
+
multipartChunkSize: 5 * 1024 * 1024,
|
|
1774
|
+
multipartMinLastPartSize: 1024 * 1024,
|
|
1775
|
+
maxConcurrentRequests: 4,
|
|
1776
|
+
pollingTimeoutMilliseconds: 1e4,
|
|
1777
|
+
pusherKey: "79ae88bd931ea68464d9"
|
|
1778
|
+
}, defaultContentType = "application/octet-stream", defaultFilename = "original", request = ({ method: l, url: d, data: x, headers: w = {}, signal: T, onProgress: O }) => new Promise((F, U) => {
|
|
1779
|
+
let W = new XMLHttpRequest(), G = l?.toUpperCase() || "GET", K = !1;
|
|
1780
|
+
W.open(G, d, !0), w && Object.entries(w).forEach((l) => {
|
|
1781
|
+
let [d, x] = l;
|
|
1782
|
+
x !== void 0 && !Array.isArray(x) && W.setRequestHeader(d, x);
|
|
1783
|
+
}), W.responseType = "text", onCancel(T, () => {
|
|
1784
|
+
K = !0, W.abort(), U(new CancelError());
|
|
1785
|
+
}), W.onload = () => {
|
|
1786
|
+
if (W.status != 200) U(/* @__PURE__ */ Error(`Error ${W.status}: ${W.statusText}`));
|
|
1787
|
+
else {
|
|
1788
|
+
let l = {
|
|
1789
|
+
method: G,
|
|
1790
|
+
url: d,
|
|
1791
|
+
data: x,
|
|
1792
|
+
headers: w || void 0,
|
|
1793
|
+
signal: T,
|
|
1794
|
+
onProgress: O
|
|
1795
|
+
}, U = W.getAllResponseHeaders().trim().split(/[\r\n]+/), K = {};
|
|
1796
|
+
U.forEach(function(l) {
|
|
1797
|
+
let d = l.split(": "), x = d.shift(), w = d.join(": ");
|
|
1798
|
+
x && x !== void 0 && (K[x] = w);
|
|
1799
|
+
});
|
|
1800
|
+
let q = W.response, J = W.status;
|
|
1801
|
+
F({
|
|
1802
|
+
request: l,
|
|
1803
|
+
data: q,
|
|
1804
|
+
headers: K,
|
|
1805
|
+
status: J
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
}, W.onerror = (l) => {
|
|
1809
|
+
K || U(new NetworkError(l));
|
|
1810
|
+
}, O && typeof O == "function" && (W.upload.onprogress = (l) => {
|
|
1811
|
+
l.lengthComputable ? O({
|
|
1812
|
+
isComputable: !0,
|
|
1813
|
+
value: l.loaded / l.total
|
|
1814
|
+
}) : O({ isComputable: !1 });
|
|
1815
|
+
}), x ? W.send(x) : W.send();
|
|
1816
|
+
});
|
|
1817
|
+
function identity(l, ...d) {
|
|
1818
|
+
return l;
|
|
1819
|
+
}
|
|
1820
|
+
var getFileOptions = ({ name: l }) => l ? [l] : [], transformFile = identity, getFormData = () => new FormData(), isBuffer = (l) => !1, isBlob = (l) => typeof Blob < "u" && l instanceof Blob, isFile = (l) => typeof File < "u" && l instanceof File, isReactNativeAsset = (l) => !!l && typeof l == "object" && !Array.isArray(l) && "uri" in l && typeof l.uri == "string", isFileData = (l) => isBlob(l) || isFile(l) || isBuffer() || isReactNativeAsset(l), isSimpleValue = (l) => typeof l == "string" || typeof l == "number" || l === void 0, isObjectValue = (l) => !!l && typeof l == "object" && !Array.isArray(l), isFileValue = (l) => !!l && typeof l == "object" && "data" in l && isFileData(l.data);
|
|
1821
|
+
function collectParams(l, d, x) {
|
|
1822
|
+
if (Array.isArray(x)) for (let w of x) collectParams(l, `${d}[]`, w);
|
|
1823
|
+
else if (isFileValue(x)) {
|
|
1824
|
+
let { name: w, contentType: T } = x, O = transformFile(x.data, w, T ?? defaultContentType), F = getFileOptions({
|
|
1825
|
+
name: w,
|
|
1826
|
+
contentType: T
|
|
1827
|
+
});
|
|
1828
|
+
l.push([
|
|
1829
|
+
d,
|
|
1830
|
+
O,
|
|
1831
|
+
...F
|
|
1832
|
+
]);
|
|
1833
|
+
} else if (isObjectValue(x)) for (let [w, T] of Object.entries(x)) T !== void 0 && l.push([`${d}[${w}]`, String(T)]);
|
|
1834
|
+
else isSimpleValue(x) && x && l.push([d, x.toString()]);
|
|
1835
|
+
}
|
|
1836
|
+
function getFormDataParams(l) {
|
|
1837
|
+
let d = [];
|
|
1838
|
+
for (let [x, w] of Object.entries(l)) collectParams(d, x, w);
|
|
1839
|
+
return d;
|
|
1840
|
+
}
|
|
1841
|
+
function buildFormData(l) {
|
|
1842
|
+
let d = getFormData(), x = getFormDataParams(l);
|
|
1843
|
+
for (let l of x) {
|
|
1844
|
+
let [x, w, ...T] = l;
|
|
1845
|
+
d.append(x, w, ...T);
|
|
1846
|
+
}
|
|
1847
|
+
return d;
|
|
1848
|
+
}
|
|
1849
|
+
var UploadError = class l extends UploadcareError {
|
|
1850
|
+
code;
|
|
1851
|
+
request;
|
|
1852
|
+
response;
|
|
1853
|
+
headers;
|
|
1854
|
+
constructor(d, x, w, T, O) {
|
|
1855
|
+
super(), this.name = "UploadError", this.message = d, this.code = x, this.request = w, this.response = T, this.headers = O, Object.setPrototypeOf(this, l.prototype);
|
|
1856
|
+
}
|
|
1857
|
+
}, buildSearchParams = (l) => {
|
|
1858
|
+
let d = new URLSearchParams();
|
|
1859
|
+
for (let [x, w] of Object.entries(l)) w && typeof w == "object" && !Array.isArray(w) ? Object.entries(w).filter((l) => l[1] ?? !1).forEach((l) => d.set(`${x}[${l[0]}]`, String(l[1]))) : Array.isArray(w) ? w.forEach((l) => {
|
|
1860
|
+
d.append(`${x}[]`, l);
|
|
1861
|
+
}) : typeof w == "string" && w ? d.set(x, w) : typeof w == "number" && d.set(x, w.toString());
|
|
1862
|
+
return d.toString();
|
|
1863
|
+
}, getUrl = (l, d, x) => {
|
|
1864
|
+
let w = new URL(l);
|
|
1865
|
+
return w.pathname = (w.pathname + d).replace("//", "/"), x && (w.search = buildSearchParams(x)), w.toString();
|
|
1866
|
+
}, version$1 = "6.18.4", LIBRARY_NAME = "UploadcareUploadClient", LIBRARY_VERSION = version$1;
|
|
1867
|
+
function getUserAgent(l) {
|
|
1868
|
+
return getUserAgent$1({
|
|
1869
|
+
libraryName: LIBRARY_NAME,
|
|
1870
|
+
libraryVersion: LIBRARY_VERSION,
|
|
1871
|
+
...l
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
var REQUEST_WAS_THROTTLED_CODE = "RequestThrottledError", DEFAULT_RETRY_AFTER_TIMEOUT = 15e3, DEFAULT_NETWORK_ERROR_TIMEOUT = 1e3;
|
|
1875
|
+
function getTimeoutFromThrottledRequest(l) {
|
|
1876
|
+
let { headers: d } = l || {};
|
|
1877
|
+
if (!d || typeof d["retry-after"] != "string") return DEFAULT_RETRY_AFTER_TIMEOUT;
|
|
1878
|
+
let x = parseInt(d["retry-after"], 10);
|
|
1879
|
+
return Number.isFinite(x) ? x * 1e3 : DEFAULT_RETRY_AFTER_TIMEOUT;
|
|
1880
|
+
}
|
|
1881
|
+
function retryIfFailed(l, d) {
|
|
1882
|
+
let { retryThrottledRequestMaxTimes: x, retryNetworkErrorMaxTimes: w } = d;
|
|
1883
|
+
return retrier(({ attempt: d, retry: T }) => l().catch((l) => {
|
|
1884
|
+
if ("response" in l && l?.code === REQUEST_WAS_THROTTLED_CODE && d < x) return T(getTimeoutFromThrottledRequest(l));
|
|
1885
|
+
if (l instanceof NetworkError && d < w) return T((d + 1) * DEFAULT_NETWORK_ERROR_TIMEOUT);
|
|
1886
|
+
throw l;
|
|
1887
|
+
}));
|
|
1888
|
+
}
|
|
1889
|
+
var getContentType = (l) => {
|
|
1890
|
+
let d = "";
|
|
1891
|
+
return (isBlob(l) || isFile(l) || isReactNativeAsset(l)) && (d = l.type), d || defaultContentType;
|
|
1892
|
+
}, getFileName = (l) => {
|
|
1893
|
+
let d = "";
|
|
1894
|
+
return isFile(l) && l.name ? d = l.name : isBlob(l) || isBuffer() ? d = "" : isReactNativeAsset(l) && l.name && (d = l.name), d || defaultFilename;
|
|
1895
|
+
};
|
|
1896
|
+
function getStoreValue(l) {
|
|
1897
|
+
return l === void 0 || l === "auto" ? "auto" : l ? "1" : "0";
|
|
1898
|
+
}
|
|
1899
|
+
function base(l, { publicKey: d, fileName: x, contentType: w, baseURL: T = defaultSettings.baseURL, secureSignature: O, secureExpire: F, store: U, signal: W, onProgress: G, source: K = "local", integration: q, userAgent: J, retryThrottledRequestMaxTimes: Y = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: X = defaultSettings.retryNetworkErrorMaxTimes, metadata: Q }) {
|
|
1900
|
+
return retryIfFailed(() => request({
|
|
1901
|
+
method: "POST",
|
|
1902
|
+
url: getUrl(T, "/base/", { jsonerrors: 1 }),
|
|
1903
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
1904
|
+
publicKey: d,
|
|
1905
|
+
integration: q,
|
|
1906
|
+
userAgent: J
|
|
1907
|
+
}) },
|
|
1908
|
+
data: buildFormData({
|
|
1909
|
+
file: {
|
|
1910
|
+
data: l,
|
|
1911
|
+
name: x || getFileName(l),
|
|
1912
|
+
contentType: w || getContentType(l)
|
|
1913
|
+
},
|
|
1914
|
+
UPLOADCARE_PUB_KEY: d,
|
|
1915
|
+
UPLOADCARE_STORE: getStoreValue(U),
|
|
1916
|
+
signature: O,
|
|
1917
|
+
expire: F,
|
|
1918
|
+
source: K,
|
|
1919
|
+
metadata: Q
|
|
1920
|
+
}),
|
|
1921
|
+
signal: W,
|
|
1922
|
+
onProgress: G
|
|
1923
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
1924
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
1925
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
1926
|
+
return w;
|
|
1927
|
+
}), {
|
|
1928
|
+
retryNetworkErrorMaxTimes: X,
|
|
1929
|
+
retryThrottledRequestMaxTimes: Y
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
var TypeEnum;
|
|
1933
|
+
(function(l) {
|
|
1934
|
+
l.Token = "token", l.FileInfo = "file_info";
|
|
1935
|
+
})(TypeEnum ||= {});
|
|
1936
|
+
function fromUrl(l, { publicKey: d, baseURL: x = defaultSettings.baseURL, store: w, fileName: T, checkForUrlDuplicates: O, saveUrlForRecurrentUploads: F, secureSignature: U, secureExpire: W, source: G = "url", signal: K, integration: q, userAgent: J, retryThrottledRequestMaxTimes: Y = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: X = defaultSettings.retryNetworkErrorMaxTimes, metadata: Q }) {
|
|
1937
|
+
return retryIfFailed(() => request({
|
|
1938
|
+
method: "POST",
|
|
1939
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
1940
|
+
publicKey: d,
|
|
1941
|
+
integration: q,
|
|
1942
|
+
userAgent: J
|
|
1943
|
+
}) },
|
|
1944
|
+
url: getUrl(x, "/from_url/", {
|
|
1945
|
+
jsonerrors: 1,
|
|
1946
|
+
pub_key: d,
|
|
1947
|
+
source_url: l,
|
|
1948
|
+
store: getStoreValue(w),
|
|
1949
|
+
filename: T,
|
|
1950
|
+
check_URL_duplicates: O ? 1 : void 0,
|
|
1951
|
+
save_URL_duplicates: F ? 1 : void 0,
|
|
1952
|
+
signature: U,
|
|
1953
|
+
expire: W,
|
|
1954
|
+
source: G,
|
|
1955
|
+
metadata: Q
|
|
1956
|
+
}),
|
|
1957
|
+
signal: K
|
|
1958
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
1959
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
1960
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
1961
|
+
return w;
|
|
1962
|
+
}), {
|
|
1963
|
+
retryNetworkErrorMaxTimes: X,
|
|
1964
|
+
retryThrottledRequestMaxTimes: Y
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
var Status;
|
|
1968
|
+
(function(l) {
|
|
1969
|
+
l.Unknown = "unknown", l.Waiting = "waiting", l.Progress = "progress", l.Error = "error", l.Success = "success";
|
|
1970
|
+
})(Status ||= {});
|
|
1971
|
+
var isErrorResponse = (l) => "status" in l && l.status === Status.Error;
|
|
1972
|
+
function fromUrlStatus(l, { publicKey: d, baseURL: x = defaultSettings.baseURL, signal: w, integration: T, userAgent: O, retryThrottledRequestMaxTimes: F = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: U = defaultSettings.retryNetworkErrorMaxTimes } = {}) {
|
|
1973
|
+
return retryIfFailed(() => request({
|
|
1974
|
+
method: "GET",
|
|
1975
|
+
headers: d ? { "X-UC-User-Agent": getUserAgent({
|
|
1976
|
+
publicKey: d,
|
|
1977
|
+
integration: T,
|
|
1978
|
+
userAgent: O
|
|
1979
|
+
}) } : void 0,
|
|
1980
|
+
url: getUrl(x, "/from_url/status/", {
|
|
1981
|
+
jsonerrors: 1,
|
|
1982
|
+
token: l
|
|
1983
|
+
}),
|
|
1984
|
+
signal: w
|
|
1985
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
1986
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
1987
|
+
if ("error" in w && !isErrorResponse(w)) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
1988
|
+
return w;
|
|
1989
|
+
}), {
|
|
1990
|
+
retryNetworkErrorMaxTimes: U,
|
|
1991
|
+
retryThrottledRequestMaxTimes: F
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
function group(l, { publicKey: d, baseURL: x = defaultSettings.baseURL, jsonpCallback: w, secureSignature: T, secureExpire: O, signal: F, source: U, integration: W, userAgent: G, retryThrottledRequestMaxTimes: K = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: q = defaultSettings.retryNetworkErrorMaxTimes }) {
|
|
1995
|
+
return retryIfFailed(() => request({
|
|
1996
|
+
method: "POST",
|
|
1997
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
1998
|
+
publicKey: d,
|
|
1999
|
+
integration: W,
|
|
2000
|
+
userAgent: G
|
|
2001
|
+
}) },
|
|
2002
|
+
url: getUrl(x, "/group/", { jsonerrors: 1 }),
|
|
2003
|
+
data: buildFormData({
|
|
2004
|
+
files: l,
|
|
2005
|
+
callback: w,
|
|
2006
|
+
pub_key: d,
|
|
2007
|
+
signature: T,
|
|
2008
|
+
expire: O,
|
|
2009
|
+
source: U
|
|
2010
|
+
}),
|
|
2011
|
+
signal: F
|
|
2012
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
2013
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
2014
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
2015
|
+
return w;
|
|
2016
|
+
}), {
|
|
2017
|
+
retryNetworkErrorMaxTimes: q,
|
|
2018
|
+
retryThrottledRequestMaxTimes: K
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
function info(l, { publicKey: d, baseURL: x = defaultSettings.baseURL, signal: w, source: T, integration: O, userAgent: F, retryThrottledRequestMaxTimes: U = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: W = defaultSettings.retryNetworkErrorMaxTimes }) {
|
|
2022
|
+
return retryIfFailed(() => request({
|
|
2023
|
+
method: "GET",
|
|
2024
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
2025
|
+
publicKey: d,
|
|
2026
|
+
integration: O,
|
|
2027
|
+
userAgent: F
|
|
2028
|
+
}) },
|
|
2029
|
+
url: getUrl(x, "/info/", {
|
|
2030
|
+
jsonerrors: 1,
|
|
2031
|
+
pub_key: d,
|
|
2032
|
+
file_id: l,
|
|
2033
|
+
source: T
|
|
2034
|
+
}),
|
|
2035
|
+
signal: w
|
|
2036
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
2037
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
2038
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
2039
|
+
return w;
|
|
2040
|
+
}), {
|
|
2041
|
+
retryThrottledRequestMaxTimes: U,
|
|
2042
|
+
retryNetworkErrorMaxTimes: W
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
function multipartStart(l, { publicKey: d, contentType: x, fileName: w, multipartChunkSize: T = defaultSettings.multipartChunkSize, baseURL: O = "", secureSignature: F, secureExpire: U, store: W, signal: G, source: K = "local", integration: q, userAgent: J, retryThrottledRequestMaxTimes: Y = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: X = defaultSettings.retryNetworkErrorMaxTimes, metadata: Q }) {
|
|
2046
|
+
return retryIfFailed(() => request({
|
|
2047
|
+
method: "POST",
|
|
2048
|
+
url: getUrl(O, "/multipart/start/", { jsonerrors: 1 }),
|
|
2049
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
2050
|
+
publicKey: d,
|
|
2051
|
+
integration: q,
|
|
2052
|
+
userAgent: J
|
|
2053
|
+
}) },
|
|
2054
|
+
data: buildFormData({
|
|
2055
|
+
filename: w || defaultFilename,
|
|
2056
|
+
size: l,
|
|
2057
|
+
content_type: x || defaultContentType,
|
|
2058
|
+
part_size: T,
|
|
2059
|
+
UPLOADCARE_STORE: getStoreValue(W),
|
|
2060
|
+
UPLOADCARE_PUB_KEY: d,
|
|
2061
|
+
signature: F,
|
|
2062
|
+
expire: U,
|
|
2063
|
+
source: K,
|
|
2064
|
+
metadata: Q
|
|
2065
|
+
}),
|
|
2066
|
+
signal: G
|
|
2067
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
2068
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
2069
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
2070
|
+
return w.parts = Object.keys(w.parts).map((l) => w.parts[Number(l)]), w;
|
|
2071
|
+
}), {
|
|
2072
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2073
|
+
retryNetworkErrorMaxTimes: X
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
function multipartUpload(l, d, { contentType: x, signal: w, onProgress: T, retryThrottledRequestMaxTimes: O = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: F = defaultSettings.retryNetworkErrorMaxTimes }) {
|
|
2077
|
+
return retryIfFailed(() => request({
|
|
2078
|
+
method: "PUT",
|
|
2079
|
+
url: d,
|
|
2080
|
+
data: l,
|
|
2081
|
+
onProgress: T,
|
|
2082
|
+
signal: w,
|
|
2083
|
+
headers: { "Content-Type": x || defaultContentType }
|
|
2084
|
+
}).then((l) => (T && T({
|
|
2085
|
+
isComputable: !0,
|
|
2086
|
+
value: 1
|
|
2087
|
+
}), l)).then(({ status: l }) => ({ code: l })), {
|
|
2088
|
+
retryThrottledRequestMaxTimes: O,
|
|
2089
|
+
retryNetworkErrorMaxTimes: F
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
function multipartComplete(l, { publicKey: d, baseURL: x = defaultSettings.baseURL, source: w = "local", signal: T, integration: O, userAgent: F, retryThrottledRequestMaxTimes: U = defaultSettings.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: W = defaultSettings.retryNetworkErrorMaxTimes }) {
|
|
2093
|
+
return retryIfFailed(() => request({
|
|
2094
|
+
method: "POST",
|
|
2095
|
+
url: getUrl(x, "/multipart/complete/", { jsonerrors: 1 }),
|
|
2096
|
+
headers: { "X-UC-User-Agent": getUserAgent({
|
|
2097
|
+
publicKey: d,
|
|
2098
|
+
integration: O,
|
|
2099
|
+
userAgent: F
|
|
2100
|
+
}) },
|
|
2101
|
+
data: buildFormData({
|
|
2102
|
+
uuid: l,
|
|
2103
|
+
UPLOADCARE_PUB_KEY: d,
|
|
2104
|
+
source: w
|
|
2105
|
+
}),
|
|
2106
|
+
signal: T
|
|
2107
|
+
}).then(({ data: l, headers: d, request: x }) => {
|
|
2108
|
+
let w = camelizeKeys(JSON.parse(l));
|
|
2109
|
+
if ("error" in w) throw new UploadError(w.error.content, w.error.errorCode, x, w, d);
|
|
2110
|
+
return w;
|
|
2111
|
+
}), {
|
|
2112
|
+
retryThrottledRequestMaxTimes: U,
|
|
2113
|
+
retryNetworkErrorMaxTimes: W
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
function isReadyPoll(l, { publicKey: d, baseURL: x, source: w, integration: T, userAgent: O, retryThrottledRequestMaxTimes: F, retryNetworkErrorMaxTimes: U, signal: W, onProgress: G }) {
|
|
2117
|
+
return poll({
|
|
2118
|
+
check: (W) => info(l, {
|
|
2119
|
+
publicKey: d,
|
|
2120
|
+
baseURL: x,
|
|
2121
|
+
signal: W,
|
|
2122
|
+
source: w,
|
|
2123
|
+
integration: T,
|
|
2124
|
+
userAgent: O,
|
|
2125
|
+
retryThrottledRequestMaxTimes: F,
|
|
2126
|
+
retryNetworkErrorMaxTimes: U
|
|
2127
|
+
}).then((l) => l.isReady ? l : (G && G({
|
|
2128
|
+
isComputable: !0,
|
|
2129
|
+
value: 1
|
|
2130
|
+
}), !1)),
|
|
2131
|
+
signal: W
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
function isGroupFileInfo(l) {
|
|
2135
|
+
return "defaultEffects" in l;
|
|
2136
|
+
}
|
|
2137
|
+
var UploadcareFile = class {
|
|
2138
|
+
uuid;
|
|
2139
|
+
name;
|
|
2140
|
+
size;
|
|
2141
|
+
isStored;
|
|
2142
|
+
isImage;
|
|
2143
|
+
mimeType;
|
|
2144
|
+
cdnUrl;
|
|
2145
|
+
s3Url;
|
|
2146
|
+
originalFilename;
|
|
2147
|
+
imageInfo;
|
|
2148
|
+
videoInfo;
|
|
2149
|
+
contentInfo;
|
|
2150
|
+
metadata;
|
|
2151
|
+
s3Bucket;
|
|
2152
|
+
defaultEffects = null;
|
|
2153
|
+
constructor(l, { baseCDN: d = defaultSettings.baseCDN, fileName: x } = {}) {
|
|
2154
|
+
let { uuid: w, s3Bucket: T } = l, O = getUrl(d, `${w}/`), F = T ? getUrl(`https://${T}.s3.amazonaws.com/`, `${w}/${l.filename}`) : null;
|
|
2155
|
+
this.uuid = w, this.name = x || l.filename, this.size = l.size, this.isStored = l.isStored, this.isImage = l.isImage, this.mimeType = l.mimeType, this.cdnUrl = O, this.originalFilename = l.originalFilename, this.imageInfo = l.imageInfo, this.videoInfo = l.videoInfo, this.contentInfo = l.contentInfo, this.metadata = l.metadata || null, this.s3Bucket = T || null, this.s3Url = F, isGroupFileInfo(l) && (this.defaultEffects = l.defaultEffects);
|
|
2156
|
+
}
|
|
2157
|
+
}, uploadDirect = (l, { publicKey: d, fileName: x, baseURL: w, secureSignature: T, secureExpire: O, store: F, contentType: U, signal: W, onProgress: G, source: K, integration: q, userAgent: J, retryThrottledRequestMaxTimes: Y, retryNetworkErrorMaxTimes: X, baseCDN: Q, metadata: Co }) => base(l, {
|
|
2158
|
+
publicKey: d,
|
|
2159
|
+
fileName: x,
|
|
2160
|
+
contentType: U,
|
|
2161
|
+
baseURL: w,
|
|
2162
|
+
secureSignature: T,
|
|
2163
|
+
secureExpire: O,
|
|
2164
|
+
store: F,
|
|
2165
|
+
signal: W,
|
|
2166
|
+
onProgress: G,
|
|
2167
|
+
source: K,
|
|
2168
|
+
integration: q,
|
|
2169
|
+
userAgent: J,
|
|
2170
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2171
|
+
retryNetworkErrorMaxTimes: X,
|
|
2172
|
+
metadata: Co
|
|
2173
|
+
}).then(({ file: l }) => isReadyPoll(l, {
|
|
2174
|
+
publicKey: d,
|
|
2175
|
+
baseURL: w,
|
|
2176
|
+
source: K,
|
|
2177
|
+
integration: q,
|
|
2178
|
+
userAgent: J,
|
|
2179
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2180
|
+
retryNetworkErrorMaxTimes: X,
|
|
2181
|
+
onProgress: G,
|
|
2182
|
+
signal: W
|
|
2183
|
+
})).then((l) => new UploadcareFile(l, { baseCDN: Q })), uploadFromUploaded = (l, { publicKey: d, fileName: x, baseURL: w, signal: T, onProgress: O, source: F, integration: U, userAgent: W, retryThrottledRequestMaxTimes: G, retryNetworkErrorMaxTimes: K, baseCDN: q }) => info(l, {
|
|
2184
|
+
publicKey: d,
|
|
2185
|
+
baseURL: w,
|
|
2186
|
+
signal: T,
|
|
2187
|
+
source: F,
|
|
2188
|
+
integration: U,
|
|
2189
|
+
userAgent: W,
|
|
2190
|
+
retryThrottledRequestMaxTimes: G,
|
|
2191
|
+
retryNetworkErrorMaxTimes: K
|
|
2192
|
+
}).then((l) => new UploadcareFile(l, {
|
|
2193
|
+
baseCDN: q,
|
|
2194
|
+
fileName: x
|
|
2195
|
+
})).then((l) => (O && O({
|
|
2196
|
+
isComputable: !0,
|
|
2197
|
+
value: 1
|
|
2198
|
+
}), l)), race = (l, { signal: d } = {}) => {
|
|
2199
|
+
let x = null, w = null, T = l.map(() => new AbortController()), O = (l) => () => {
|
|
2200
|
+
w = l, T.forEach((d, x) => x !== l && d.abort());
|
|
2201
|
+
};
|
|
2202
|
+
return onCancel(d, () => {
|
|
2203
|
+
T.forEach((l) => l.abort());
|
|
2204
|
+
}), Promise.all(l.map((l, d) => {
|
|
2205
|
+
let w = O(d);
|
|
2206
|
+
return Promise.resolve().then(() => l({
|
|
2207
|
+
stopRace: w,
|
|
2208
|
+
signal: T[d].signal
|
|
2209
|
+
})).then((l) => (w(), l)).catch((l) => (x = l, null));
|
|
2210
|
+
})).then((l) => {
|
|
2211
|
+
if (w === null) throw x;
|
|
2212
|
+
return l[w];
|
|
2213
|
+
});
|
|
2214
|
+
}, WebSocket = window.WebSocket, Events = class {
|
|
2215
|
+
events = Object.create({});
|
|
2216
|
+
emit(l, d) {
|
|
2217
|
+
this.events[l]?.forEach((l) => l(d));
|
|
2218
|
+
}
|
|
2219
|
+
on(l, d) {
|
|
2220
|
+
this.events[l] = this.events[l] || [], this.events[l].push(d);
|
|
2221
|
+
}
|
|
2222
|
+
off(l, d) {
|
|
2223
|
+
d ? this.events[l] = this.events[l].filter((l) => l !== d) : this.events[l] = [];
|
|
2224
|
+
}
|
|
2225
|
+
}, response = (l, d) => l === "success" ? {
|
|
2226
|
+
status: Status.Success,
|
|
2227
|
+
...d
|
|
2228
|
+
} : l === "progress" ? {
|
|
2229
|
+
status: Status.Progress,
|
|
2230
|
+
...d
|
|
2231
|
+
} : {
|
|
2232
|
+
status: Status.Error,
|
|
2233
|
+
...d
|
|
2234
|
+
}, Pusher = class {
|
|
2235
|
+
key;
|
|
2236
|
+
disconnectTime;
|
|
2237
|
+
ws = void 0;
|
|
2238
|
+
queue = [];
|
|
2239
|
+
isConnected = !1;
|
|
2240
|
+
subscribers = 0;
|
|
2241
|
+
emmitter = new Events();
|
|
2242
|
+
disconnectTimeoutId = null;
|
|
2243
|
+
constructor(l, d = 3e4) {
|
|
2244
|
+
this.key = l, this.disconnectTime = d;
|
|
2245
|
+
}
|
|
2246
|
+
connect() {
|
|
2247
|
+
this.disconnectTimeoutId && clearTimeout(this.disconnectTimeoutId), !this.isConnected && !this.ws && (this.ws = new WebSocket(`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`), this.ws.addEventListener("error", (l) => {
|
|
2248
|
+
this.emmitter.emit("error", Error(l.message));
|
|
2249
|
+
}), this.emmitter.on("connected", () => {
|
|
2250
|
+
this.isConnected = !0, this.queue.forEach((l) => this.send(l.event, l.data)), this.queue = [];
|
|
2251
|
+
}), this.ws.addEventListener("message", (l) => {
|
|
2252
|
+
let d = JSON.parse(l.data.toString());
|
|
2253
|
+
switch (d.event) {
|
|
2254
|
+
case "pusher:connection_established":
|
|
2255
|
+
this.emmitter.emit("connected", void 0);
|
|
2256
|
+
break;
|
|
2257
|
+
case "pusher:ping":
|
|
2258
|
+
this.send("pusher:pong", {});
|
|
2259
|
+
break;
|
|
2260
|
+
case "progress":
|
|
2261
|
+
case "success":
|
|
2262
|
+
case "fail": this.emmitter.emit(d.channel, response(d.event, JSON.parse(d.data)));
|
|
2263
|
+
}
|
|
2264
|
+
}));
|
|
2265
|
+
}
|
|
2266
|
+
disconnect() {
|
|
2267
|
+
let l = () => {
|
|
2268
|
+
this.ws?.close(), this.ws = void 0, this.isConnected = !1;
|
|
2269
|
+
};
|
|
2270
|
+
this.disconnectTime ? this.disconnectTimeoutId = setTimeout(() => {
|
|
2271
|
+
l();
|
|
2272
|
+
}, this.disconnectTime) : l();
|
|
2273
|
+
}
|
|
2274
|
+
send(l, d) {
|
|
2275
|
+
let x = JSON.stringify({
|
|
2276
|
+
event: l,
|
|
2277
|
+
data: d
|
|
2278
|
+
});
|
|
2279
|
+
this.ws?.send(x);
|
|
2280
|
+
}
|
|
2281
|
+
subscribe(l, d) {
|
|
2282
|
+
this.subscribers += 1, this.connect();
|
|
2283
|
+
let x = `task-status-${l}`, w = {
|
|
2284
|
+
event: "pusher:subscribe",
|
|
2285
|
+
data: { channel: x }
|
|
2286
|
+
};
|
|
2287
|
+
this.emmitter.on(x, d), this.isConnected ? this.send(w.event, w.data) : this.queue.push(w);
|
|
2288
|
+
}
|
|
2289
|
+
unsubscribe(l) {
|
|
2290
|
+
--this.subscribers;
|
|
2291
|
+
let d = `task-status-${l}`, x = {
|
|
2292
|
+
event: "pusher:unsubscribe",
|
|
2293
|
+
data: { channel: d }
|
|
2294
|
+
};
|
|
2295
|
+
this.emmitter.off(d), this.isConnected ? this.send(x.event, x.data) : this.queue = this.queue.filter((l) => l.data.channel !== d), this.subscribers === 0 && this.disconnect();
|
|
2296
|
+
}
|
|
2297
|
+
onError(l) {
|
|
2298
|
+
return this.emmitter.on("error", l), () => this.emmitter.off("error", l);
|
|
2299
|
+
}
|
|
2300
|
+
}, pusher = null, getPusher = (l) => (pusher ||= new Pusher(l, typeof window > "u" ? 0 : 3e4), pusher), preconnect = (l) => {
|
|
2301
|
+
getPusher(l).connect();
|
|
2302
|
+
};
|
|
2303
|
+
function pollStrategy({ token: l, publicKey: d, baseURL: x, integration: w, userAgent: T, retryThrottledRequestMaxTimes: O, retryNetworkErrorMaxTimes: F, onProgress: U, signal: W }) {
|
|
2304
|
+
return poll({
|
|
2305
|
+
check: (W) => fromUrlStatus(l, {
|
|
2306
|
+
publicKey: d,
|
|
2307
|
+
baseURL: x,
|
|
2308
|
+
integration: w,
|
|
2309
|
+
userAgent: T,
|
|
2310
|
+
retryThrottledRequestMaxTimes: O,
|
|
2311
|
+
retryNetworkErrorMaxTimes: F,
|
|
2312
|
+
signal: W
|
|
2313
|
+
}).then((d) => {
|
|
2314
|
+
switch (d.status) {
|
|
2315
|
+
case Status.Error: return new UploadError(d.error, d.errorCode);
|
|
2316
|
+
case Status.Waiting: return !1;
|
|
2317
|
+
case Status.Unknown: return new UploadError(`Token "${l}" was not found.`);
|
|
2318
|
+
case Status.Progress: return U && (d.total === "unknown" ? U({ isComputable: !1 }) : U({
|
|
2319
|
+
isComputable: !0,
|
|
2320
|
+
value: d.done / d.total
|
|
2321
|
+
})), !1;
|
|
2322
|
+
case Status.Success: return U && U({
|
|
2323
|
+
isComputable: !0,
|
|
2324
|
+
value: d.done / d.total
|
|
2325
|
+
}), d;
|
|
2326
|
+
default: throw Error("Unknown status");
|
|
2327
|
+
}
|
|
2328
|
+
}),
|
|
2329
|
+
signal: W
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
var pushStrategy = ({ token: l, pusherKey: d, signal: x, onProgress: w }) => new Promise((T, O) => {
|
|
2333
|
+
let F = getPusher(d), U = F.onError(O), W = () => {
|
|
2334
|
+
U(), F.unsubscribe(l);
|
|
2335
|
+
};
|
|
2336
|
+
onCancel(x, () => {
|
|
2337
|
+
W(), O(new CancelError("pusher cancelled"));
|
|
2338
|
+
}), F.subscribe(l, (l) => {
|
|
2339
|
+
switch (l.status) {
|
|
2340
|
+
case Status.Progress:
|
|
2341
|
+
w && (l.total === "unknown" ? w({ isComputable: !1 }) : w({
|
|
2342
|
+
isComputable: !0,
|
|
2343
|
+
value: l.done / l.total
|
|
2344
|
+
}));
|
|
2345
|
+
break;
|
|
2346
|
+
case Status.Success:
|
|
2347
|
+
W(), w && w({
|
|
2348
|
+
isComputable: !0,
|
|
2349
|
+
value: l.done / l.total
|
|
2350
|
+
}), T(l);
|
|
2351
|
+
break;
|
|
2352
|
+
case Status.Error: W(), O(new UploadError(l.msg, l.error_code));
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
}), uploadFromUrl = (l, { publicKey: d, fileName: x, baseURL: w, baseCDN: T, checkForUrlDuplicates: O, saveUrlForRecurrentUploads: F, secureSignature: U, secureExpire: W, store: G, signal: K, onProgress: q, source: J, integration: Y, userAgent: X, retryThrottledRequestMaxTimes: Q, pusherKey: Co = defaultSettings.pusherKey, metadata: wo }) => Promise.resolve(preconnect(Co)).then(() => fromUrl(l, {
|
|
2356
|
+
publicKey: d,
|
|
2357
|
+
fileName: x,
|
|
2358
|
+
baseURL: w,
|
|
2359
|
+
checkForUrlDuplicates: O,
|
|
2360
|
+
saveUrlForRecurrentUploads: F,
|
|
2361
|
+
secureSignature: U,
|
|
2362
|
+
secureExpire: W,
|
|
2363
|
+
store: G,
|
|
2364
|
+
signal: K,
|
|
2365
|
+
source: J,
|
|
2366
|
+
integration: Y,
|
|
2367
|
+
userAgent: X,
|
|
2368
|
+
retryThrottledRequestMaxTimes: Q,
|
|
2369
|
+
metadata: wo
|
|
2370
|
+
})).catch((l) => (getPusher(Co)?.disconnect(), Promise.reject(l))).then((l) => l.type === TypeEnum.FileInfo ? l : race([({ signal: x }) => pollStrategy({
|
|
2371
|
+
token: l.token,
|
|
2372
|
+
publicKey: d,
|
|
2373
|
+
baseURL: w,
|
|
2374
|
+
integration: Y,
|
|
2375
|
+
userAgent: X,
|
|
2376
|
+
retryThrottledRequestMaxTimes: Q,
|
|
2377
|
+
onProgress: q,
|
|
2378
|
+
signal: x
|
|
2379
|
+
}), ({ signal: d }) => pushStrategy({
|
|
2380
|
+
token: l.token,
|
|
2381
|
+
pusherKey: Co,
|
|
2382
|
+
signal: d,
|
|
2383
|
+
onProgress: q
|
|
2384
|
+
})], { signal: K })).then((l) => {
|
|
2385
|
+
if (l instanceof UploadError) throw l;
|
|
2386
|
+
return l;
|
|
2387
|
+
}).then((l) => isReadyPoll(l.uuid, {
|
|
2388
|
+
publicKey: d,
|
|
2389
|
+
baseURL: w,
|
|
2390
|
+
integration: Y,
|
|
2391
|
+
userAgent: X,
|
|
2392
|
+
retryThrottledRequestMaxTimes: Q,
|
|
2393
|
+
onProgress: q,
|
|
2394
|
+
signal: K
|
|
2395
|
+
})).then((l) => new UploadcareFile(l, { baseCDN: T })), memo = /* @__PURE__ */ new WeakMap(), getBlobFromReactNativeAsset = async (l) => {
|
|
2396
|
+
if (memo.has(l)) return memo.get(l);
|
|
2397
|
+
let d = await fetch(l.uri).then((l) => l.blob());
|
|
2398
|
+
return memo.set(l, d), d;
|
|
2399
|
+
}, getFileSize = async (l) => {
|
|
2400
|
+
if (isFile(l) || isBlob(l)) return l.size;
|
|
2401
|
+
if (isReactNativeAsset(l)) return (await getBlobFromReactNativeAsset(l)).size;
|
|
2402
|
+
throw Error("Unknown file type. Cannot determine file size.");
|
|
2403
|
+
}, isMultipart = (l, d = defaultSettings.multipartMinFileSize) => l >= d, isUuid = (l) => {
|
|
2404
|
+
let d = /* @__PURE__ */ RegExp("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
|
|
2405
|
+
return !isFileData(l) && d.test(l);
|
|
2406
|
+
}, isUrl = (l) => {
|
|
2407
|
+
let d = /* @__PURE__ */ RegExp("^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$");
|
|
2408
|
+
return !isFileData(l) && d.test(l);
|
|
2409
|
+
}, runWithConcurrency = (l, d) => new Promise((x, w) => {
|
|
2410
|
+
let T = [], O = !1, F = d.length, U = [...d], W = () => {
|
|
2411
|
+
let l = d.length - U.length, G = U.shift();
|
|
2412
|
+
G && G().then((d) => {
|
|
2413
|
+
O || (T[l] = d, --F, F ? W() : x(T));
|
|
2414
|
+
}).catch((l) => {
|
|
2415
|
+
O = !0, w(l);
|
|
2416
|
+
});
|
|
2417
|
+
};
|
|
2418
|
+
for (let d = 0; d < l; d++) W();
|
|
2419
|
+
}), sliceChunk = (l, d, x, w) => {
|
|
2420
|
+
let T = w * d, O = Math.min(T + w, x);
|
|
2421
|
+
return l.slice(T, O);
|
|
2422
|
+
}, prepareChunks = async (l, d, x) => (w) => sliceChunk(l, w, d, x), uploadPart = (l, d, { publicKey: x, contentType: w, onProgress: T, signal: O, integration: F, retryThrottledRequestMaxTimes: U, retryNetworkErrorMaxTimes: W }) => multipartUpload(l, d, {
|
|
2423
|
+
publicKey: x,
|
|
2424
|
+
contentType: w,
|
|
2425
|
+
onProgress: T,
|
|
2426
|
+
signal: O,
|
|
2427
|
+
integration: F,
|
|
2428
|
+
retryThrottledRequestMaxTimes: U,
|
|
2429
|
+
retryNetworkErrorMaxTimes: W
|
|
2430
|
+
}), uploadMultipart = async (l, { publicKey: d, fileName: x, fileSize: w, baseURL: T, secureSignature: O, secureExpire: F, store: U, signal: W, onProgress: G, source: K, integration: q, userAgent: J, retryThrottledRequestMaxTimes: Y, retryNetworkErrorMaxTimes: X, contentType: Q, multipartChunkSize: Co = defaultSettings.multipartChunkSize, maxConcurrentRequests: wo = defaultSettings.maxConcurrentRequests, baseCDN: To, metadata: Eo }) => {
|
|
2431
|
+
let Do = w ?? await getFileSize(l), Oo, ko = (l, d) => {
|
|
2432
|
+
if (!G) return;
|
|
2433
|
+
Oo ||= Array(l).fill(0);
|
|
2434
|
+
let x = (l) => l.reduce((l, d) => l + d, 0);
|
|
2435
|
+
return (w) => {
|
|
2436
|
+
w.isComputable && (Oo[d] = w.value, G({
|
|
2437
|
+
isComputable: !0,
|
|
2438
|
+
value: x(Oo) / l
|
|
2439
|
+
}));
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
return Q ||= getContentType(l), multipartStart(Do, {
|
|
2443
|
+
publicKey: d,
|
|
2444
|
+
contentType: Q,
|
|
2445
|
+
fileName: x || getFileName(l),
|
|
2446
|
+
baseURL: T,
|
|
2447
|
+
secureSignature: O,
|
|
2448
|
+
secureExpire: F,
|
|
2449
|
+
store: U,
|
|
2450
|
+
signal: W,
|
|
2451
|
+
source: K,
|
|
2452
|
+
integration: q,
|
|
2453
|
+
userAgent: J,
|
|
2454
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2455
|
+
retryNetworkErrorMaxTimes: X,
|
|
2456
|
+
metadata: Eo,
|
|
2457
|
+
multipartChunkSize: Co
|
|
2458
|
+
}).then(async ({ uuid: x, parts: w }) => {
|
|
2459
|
+
let T = await prepareChunks(l, Do, Co);
|
|
2460
|
+
return Promise.all([x, runWithConcurrency(wo, w.map((l, x) => () => uploadPart(T(x), l, {
|
|
2461
|
+
publicKey: d,
|
|
2462
|
+
contentType: Q,
|
|
2463
|
+
onProgress: ko(w.length, x),
|
|
2464
|
+
signal: W,
|
|
2465
|
+
integration: q,
|
|
2466
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2467
|
+
retryNetworkErrorMaxTimes: X
|
|
2468
|
+
})))]);
|
|
2469
|
+
}).then(([l]) => multipartComplete(l, {
|
|
2470
|
+
publicKey: d,
|
|
2471
|
+
baseURL: T,
|
|
2472
|
+
source: K,
|
|
2473
|
+
integration: q,
|
|
2474
|
+
userAgent: J,
|
|
2475
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2476
|
+
retryNetworkErrorMaxTimes: X
|
|
2477
|
+
})).then((l) => l.isReady ? l : isReadyPoll(l.uuid, {
|
|
2478
|
+
publicKey: d,
|
|
2479
|
+
baseURL: T,
|
|
2480
|
+
source: K,
|
|
2481
|
+
integration: q,
|
|
2482
|
+
userAgent: J,
|
|
2483
|
+
retryThrottledRequestMaxTimes: Y,
|
|
2484
|
+
retryNetworkErrorMaxTimes: X,
|
|
2485
|
+
onProgress: G,
|
|
2486
|
+
signal: W
|
|
2487
|
+
})).then((l) => new UploadcareFile(l, { baseCDN: To }));
|
|
2488
|
+
};
|
|
2489
|
+
async function uploadFile(l, { publicKey: d, fileName: x, baseURL: w = defaultSettings.baseURL, secureSignature: T, secureExpire: O, store: F, signal: U, onProgress: W, source: G, integration: K, userAgent: q, retryThrottledRequestMaxTimes: J, retryNetworkErrorMaxTimes: Y, contentType: X, multipartMinFileSize: Q, multipartChunkSize: Co, maxConcurrentRequests: wo, baseCDN: To = defaultSettings.baseCDN, checkForUrlDuplicates: Eo, saveUrlForRecurrentUploads: Do, pusherKey: Oo, metadata: ko }) {
|
|
2490
|
+
if (isFileData(l)) {
|
|
2491
|
+
let Eo = await getFileSize(l);
|
|
2492
|
+
return isMultipart(Eo, Q) ? uploadMultipart(l, {
|
|
2493
|
+
publicKey: d,
|
|
2494
|
+
contentType: X,
|
|
2495
|
+
multipartChunkSize: Co,
|
|
2496
|
+
fileSize: Eo,
|
|
2497
|
+
fileName: x,
|
|
2498
|
+
baseURL: w,
|
|
2499
|
+
secureSignature: T,
|
|
2500
|
+
secureExpire: O,
|
|
2501
|
+
store: F,
|
|
2502
|
+
signal: U,
|
|
2503
|
+
onProgress: W,
|
|
2504
|
+
source: G,
|
|
2505
|
+
integration: K,
|
|
2506
|
+
userAgent: q,
|
|
2507
|
+
maxConcurrentRequests: wo,
|
|
2508
|
+
retryThrottledRequestMaxTimes: J,
|
|
2509
|
+
retryNetworkErrorMaxTimes: Y,
|
|
2510
|
+
baseCDN: To,
|
|
2511
|
+
metadata: ko
|
|
2512
|
+
}) : uploadDirect(l, {
|
|
2513
|
+
publicKey: d,
|
|
2514
|
+
fileName: x,
|
|
2515
|
+
contentType: X,
|
|
2516
|
+
baseURL: w,
|
|
2517
|
+
secureSignature: T,
|
|
2518
|
+
secureExpire: O,
|
|
2519
|
+
store: F,
|
|
2520
|
+
signal: U,
|
|
2521
|
+
onProgress: W,
|
|
2522
|
+
source: G,
|
|
2523
|
+
integration: K,
|
|
2524
|
+
userAgent: q,
|
|
2525
|
+
retryThrottledRequestMaxTimes: J,
|
|
2526
|
+
retryNetworkErrorMaxTimes: Y,
|
|
2527
|
+
baseCDN: To,
|
|
2528
|
+
metadata: ko
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
if (isUrl(l)) return uploadFromUrl(l, {
|
|
2532
|
+
publicKey: d,
|
|
2533
|
+
fileName: x,
|
|
2534
|
+
baseURL: w,
|
|
2535
|
+
baseCDN: To,
|
|
2536
|
+
checkForUrlDuplicates: Eo,
|
|
2537
|
+
saveUrlForRecurrentUploads: Do,
|
|
2538
|
+
secureSignature: T,
|
|
2539
|
+
secureExpire: O,
|
|
2540
|
+
store: F,
|
|
2541
|
+
signal: U,
|
|
2542
|
+
onProgress: W,
|
|
2543
|
+
source: G,
|
|
2544
|
+
integration: K,
|
|
2545
|
+
userAgent: q,
|
|
2546
|
+
retryThrottledRequestMaxTimes: J,
|
|
2547
|
+
retryNetworkErrorMaxTimes: Y,
|
|
2548
|
+
pusherKey: Oo,
|
|
2549
|
+
metadata: ko
|
|
2550
|
+
});
|
|
2551
|
+
if (isUuid(l)) return uploadFromUploaded(l, {
|
|
2552
|
+
publicKey: d,
|
|
2553
|
+
fileName: x,
|
|
2554
|
+
baseURL: w,
|
|
2555
|
+
signal: U,
|
|
2556
|
+
onProgress: W,
|
|
2557
|
+
source: G,
|
|
2558
|
+
integration: K,
|
|
2559
|
+
userAgent: q,
|
|
2560
|
+
retryThrottledRequestMaxTimes: J,
|
|
2561
|
+
retryNetworkErrorMaxTimes: Y,
|
|
2562
|
+
baseCDN: To
|
|
2563
|
+
});
|
|
2564
|
+
throw TypeError(`File uploading from "${l}" is not supported`);
|
|
2565
|
+
}
|
|
2566
|
+
var replaceUrlBase = (l, d) => {
|
|
2567
|
+
try {
|
|
2568
|
+
let x = new URL(l), w = new URL(d);
|
|
2569
|
+
return x.protocol = w.protocol, x.hostname = w.hostname, x.port = w.port, x.toString();
|
|
2570
|
+
} catch {
|
|
2571
|
+
return l;
|
|
2572
|
+
}
|
|
2573
|
+
}, UploadcareGroup = class {
|
|
2574
|
+
uuid;
|
|
2575
|
+
filesCount;
|
|
2576
|
+
totalSize;
|
|
2577
|
+
isStored;
|
|
2578
|
+
isImage;
|
|
2579
|
+
cdnUrl;
|
|
2580
|
+
files;
|
|
2581
|
+
createdAt;
|
|
2582
|
+
storedAt = null;
|
|
2583
|
+
constructor(l, { baseCDN: d = defaultSettings.baseCDN } = {}) {
|
|
2584
|
+
this.uuid = l.id, this.filesCount = l.filesCount;
|
|
2585
|
+
let x = l.files.filter(Boolean);
|
|
2586
|
+
this.totalSize = Object.values(x).reduce((l, d) => l + d.size, 0), this.isStored = !!l.datetimeStored, this.isImage = !!Object.values(x).filter((l) => l.isImage).length, this.cdnUrl = replaceUrlBase(l.cdnUrl, d), this.files = x.map((l) => new UploadcareFile(l, { baseCDN: d })), this.createdAt = l.datetimeCreated, this.storedAt = l.datetimeStored;
|
|
2587
|
+
}
|
|
2588
|
+
}, isFileDataArray = (l) => {
|
|
2589
|
+
for (let d of l) if (!isFileData(d)) return !1;
|
|
2590
|
+
return !0;
|
|
2591
|
+
}, isUuidArray = (l) => {
|
|
2592
|
+
for (let d of l) if (!isUuid(d)) return !1;
|
|
2593
|
+
return !0;
|
|
2594
|
+
}, isUrlArray = (l) => {
|
|
2595
|
+
for (let d of l) if (!isUrl(d)) return !1;
|
|
2596
|
+
return !0;
|
|
2597
|
+
};
|
|
2598
|
+
function uploadFileGroup(l, { publicKey: d, fileName: x, baseURL: w = defaultSettings.baseURL, secureSignature: T, secureExpire: O, store: F, signal: U, onProgress: W, source: G, integration: K, userAgent: q, retryThrottledRequestMaxTimes: J, retryNetworkErrorMaxTimes: Y, contentType: X, multipartChunkSize: Q = defaultSettings.multipartChunkSize, baseCDN: Co = defaultSettings.baseCDN, checkForUrlDuplicates: wo, saveUrlForRecurrentUploads: To, jsonpCallback: Eo }) {
|
|
2599
|
+
if (!isFileDataArray(l) && !isUrlArray(l) && !isUuidArray(l)) throw TypeError(`Group uploading from "${l}" is not supported`);
|
|
2600
|
+
let Do, Oo = !0, ko = l.length, Ao = (l, d) => {
|
|
2601
|
+
if (!W) return;
|
|
2602
|
+
Do ||= Array(l).fill(0);
|
|
2603
|
+
let x = (d) => d.reduce((l, d) => l + d) / l;
|
|
2604
|
+
return (l) => {
|
|
2605
|
+
if (!l.isComputable || !Oo) {
|
|
2606
|
+
Oo = !1, W({ isComputable: !1 });
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
Do[d] = l.value, W({
|
|
2610
|
+
isComputable: !0,
|
|
2611
|
+
value: x(Do)
|
|
2612
|
+
});
|
|
2613
|
+
};
|
|
2614
|
+
};
|
|
2615
|
+
return Promise.all(l.map((l, W) => isFileData(l) || isUrl(l) ? uploadFile(l, {
|
|
2616
|
+
publicKey: d,
|
|
2617
|
+
fileName: x,
|
|
2618
|
+
baseURL: w,
|
|
2619
|
+
secureSignature: T,
|
|
2620
|
+
secureExpire: O,
|
|
2621
|
+
store: F,
|
|
2622
|
+
signal: U,
|
|
2623
|
+
onProgress: Ao(ko, W),
|
|
2624
|
+
source: G,
|
|
2625
|
+
integration: K,
|
|
2626
|
+
userAgent: q,
|
|
2627
|
+
retryThrottledRequestMaxTimes: J,
|
|
2628
|
+
retryNetworkErrorMaxTimes: Y,
|
|
2629
|
+
contentType: X,
|
|
2630
|
+
multipartChunkSize: Q,
|
|
2631
|
+
baseCDN: Co,
|
|
2632
|
+
checkForUrlDuplicates: wo,
|
|
2633
|
+
saveUrlForRecurrentUploads: To
|
|
2634
|
+
}).then((l) => l.uuid) : l)).then((l) => group(l, {
|
|
2635
|
+
publicKey: d,
|
|
2636
|
+
baseURL: w,
|
|
2637
|
+
jsonpCallback: Eo,
|
|
2638
|
+
secureSignature: T,
|
|
2639
|
+
secureExpire: O,
|
|
2640
|
+
signal: U,
|
|
2641
|
+
source: G,
|
|
2642
|
+
integration: K,
|
|
2643
|
+
userAgent: q,
|
|
2644
|
+
retryThrottledRequestMaxTimes: J,
|
|
2645
|
+
retryNetworkErrorMaxTimes: Y
|
|
2646
|
+
}).then((l) => new UploadcareGroup(l, { baseCDN: Co })).then((l) => (W && W({
|
|
2647
|
+
isComputable: !0,
|
|
2648
|
+
value: 1
|
|
2649
|
+
}), l)));
|
|
2650
|
+
}
|
|
2651
|
+
var Queue = class {
|
|
2652
|
+
_concurrency = 1;
|
|
2653
|
+
_pending = [];
|
|
2654
|
+
_running = 0;
|
|
2655
|
+
_resolvers = /* @__PURE__ */ new Map();
|
|
2656
|
+
_rejectors = /* @__PURE__ */ new Map();
|
|
2657
|
+
constructor(l) {
|
|
2658
|
+
this._concurrency = l;
|
|
2659
|
+
}
|
|
2660
|
+
run() {
|
|
2661
|
+
let l = this._concurrency - this._running;
|
|
2662
|
+
for (let d = 0; d < l; d++) {
|
|
2663
|
+
let l = this._pending.shift();
|
|
2664
|
+
if (!l) return;
|
|
2665
|
+
let d = this._resolvers.get(l), x = this._rejectors.get(l);
|
|
2666
|
+
if (!d || !x) throw Error("Unexpected behavior: resolver or rejector is undefined");
|
|
2667
|
+
this._running += 1, l().finally(() => {
|
|
2668
|
+
this._resolvers.delete(l), this._rejectors.delete(l), --this._running, this.run();
|
|
2669
|
+
}).then((l) => d(l)).catch((l) => x(l));
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
add(l, { autoRun: d } = { autoRun: !0 }) {
|
|
2673
|
+
return new Promise((x, w) => {
|
|
2674
|
+
this._resolvers.set(l, x), this._rejectors.set(l, w), this._pending.push(l), d && this.run();
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
get pending() {
|
|
2678
|
+
return this._pending.length;
|
|
2679
|
+
}
|
|
2680
|
+
get running() {
|
|
2681
|
+
return this._running;
|
|
2682
|
+
}
|
|
2683
|
+
set concurrency(l) {
|
|
2684
|
+
this._concurrency = l, this.run();
|
|
2685
|
+
}
|
|
2686
|
+
get concurrency() {
|
|
2687
|
+
return this._concurrency;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
const blockCtx = () => ({}), activityBlockCtx = (l) => ({
|
|
2691
|
+
...blockCtx(),
|
|
2692
|
+
"*currentActivity": null,
|
|
2693
|
+
"*currentActivityParams": {},
|
|
2694
|
+
"*history": [],
|
|
2695
|
+
"*historyBack": null,
|
|
2696
|
+
"*closeModal": () => {
|
|
2697
|
+
l.modalManager?.close(l.$["*currentActivity"]), l.pub("*currentActivity", null);
|
|
2698
|
+
}
|
|
2699
|
+
}), uploaderBlockCtx = (l) => ({
|
|
2700
|
+
...activityBlockCtx(l),
|
|
2701
|
+
"*commonProgress": 0,
|
|
2702
|
+
"*uploadList": [],
|
|
2703
|
+
"*uploadQueue": new Queue(1),
|
|
2704
|
+
"*collectionErrors": [],
|
|
2705
|
+
"*collectionState": null,
|
|
2706
|
+
"*groupInfo": null,
|
|
2707
|
+
"*uploadTrigger": /* @__PURE__ */ new Set()
|
|
2708
|
+
}), solutionBlockCtx = (l) => ({
|
|
2709
|
+
...uploaderBlockCtx(l),
|
|
2710
|
+
"*solution": null
|
|
2711
|
+
});
|
|
2712
|
+
var ClipboardLayer = class extends SharedInstance {
|
|
2713
|
+
constructor(l) {
|
|
2714
|
+
super(l), this.scopes = /* @__PURE__ */ new Set(), this.listener = this._listener.bind(this), window.addEventListener("paste", this.listener);
|
|
2715
|
+
}
|
|
2716
|
+
openUploadList() {
|
|
2717
|
+
this._sharedInstancesBag.api.setCurrentActivity(ACTIVITY_TYPES.UPLOAD_LIST), this._sharedInstancesBag.api.setModalState(!0);
|
|
2718
|
+
}
|
|
2719
|
+
async _listener(l) {
|
|
2720
|
+
if (l.clipboardData) {
|
|
2721
|
+
for (let d of this.scopes) if (d.isConnected) switch (this._cfg.pasteScope) {
|
|
2722
|
+
case "global":
|
|
2723
|
+
await this.handlePaste(l);
|
|
2724
|
+
break;
|
|
2725
|
+
case "local":
|
|
2726
|
+
if (!d.contains(l.target)) continue;
|
|
2727
|
+
await this.handlePaste(l);
|
|
2728
|
+
break;
|
|
2729
|
+
default: continue;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
async handlePaste(l) {
|
|
2734
|
+
let d = Array.from(l.clipboardData.items), x = d.map((l) => l.getAsFile()).filter((l) => l !== null), w = d.filter((l) => l.kind === "string" && l.type === "text/plain").map((l) => new Promise((d) => {
|
|
2735
|
+
l.getAsString((l) => {
|
|
2736
|
+
d(l);
|
|
2737
|
+
});
|
|
2738
|
+
}));
|
|
2739
|
+
x.length > 0 && (x.forEach((l) => {
|
|
2740
|
+
this._sharedInstancesBag.api.addFileFromObject(l, { source: "clipboard" });
|
|
2741
|
+
}), this.openUploadList()), w.length > 0 && ((await Promise.all(w)).forEach((l) => {
|
|
2742
|
+
this._sharedInstancesBag.api.addFileFromUrl(l, { source: "clipboard" });
|
|
2743
|
+
}), this.openUploadList());
|
|
2744
|
+
}
|
|
2745
|
+
registerBlock(l) {
|
|
2746
|
+
return this.scopes.add(l), () => {
|
|
2747
|
+
this.scopes.delete(l);
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
destroy() {
|
|
2751
|
+
super.destroy(), window.removeEventListener("paste", this.listener), this.scopes.clear();
|
|
2752
|
+
}
|
|
2753
|
+
}, ROLES = {
|
|
2754
|
+
button: ["toolbar"],
|
|
2755
|
+
checkbox: ["toolbar"],
|
|
2756
|
+
menuitem: ["menu", "menubar"],
|
|
2757
|
+
option: ["listbox"],
|
|
2758
|
+
tab: ["tablist"]
|
|
2759
|
+
};
|
|
2760
|
+
function focus(l, d) {
|
|
2761
|
+
d.tabIndex = 0, d.focus(), l.tabIndex = -1;
|
|
2762
|
+
}
|
|
2763
|
+
function findGroupNodeByEventTarget(l) {
|
|
2764
|
+
let d = l.role || l.type || l.tagName;
|
|
2765
|
+
if (!d) return null;
|
|
2766
|
+
let x = ROLES[d.toLowerCase()];
|
|
2767
|
+
if (!x) return null;
|
|
2768
|
+
for (let d of x) {
|
|
2769
|
+
let x = l.closest(`[role=${d}]`);
|
|
2770
|
+
if (x) return x;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
function getItems(l, d) {
|
|
2774
|
+
return d.role === "toolbar" ? getToolbarItems(d) : d.querySelectorAll(`[role=${l.role}]`);
|
|
2775
|
+
}
|
|
2776
|
+
function getToolbarItems(l) {
|
|
2777
|
+
return [...l.querySelectorAll("*")].filter((l) => l.role === "button" || l.type === "button" || l.role === "checkbox" || l.type === "checkbox");
|
|
2778
|
+
}
|
|
2779
|
+
function isHorizontalOrientation(l) {
|
|
2780
|
+
let d = l.getAttribute("aria-orientation");
|
|
2781
|
+
if (d === "vertical") return !1;
|
|
2782
|
+
if (d === "horizontal") return !0;
|
|
2783
|
+
let x = l.role;
|
|
2784
|
+
return x === "menubar" || x === "tablist" || x === "toolbar";
|
|
2785
|
+
}
|
|
2786
|
+
function focusGroupKeyUX(l) {
|
|
2787
|
+
return (d) => {
|
|
2788
|
+
let x = !1, w = l?.searchDelayMs || 300, T = 0, O = "";
|
|
2789
|
+
function F(l) {
|
|
2790
|
+
let x = findGroupNodeByEventTarget(l.target);
|
|
2791
|
+
if (!x) {
|
|
2792
|
+
U();
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
let F = getItems(l.target, x), W = Array.from(F).indexOf(l.target), G = "ArrowDown", K = "ArrowUp";
|
|
2796
|
+
if (isHorizontalOrientation(x) && (d.document.dir === "rtl" ? (G = "ArrowLeft", K = "ArrowRight") : (G = "ArrowRight", K = "ArrowLeft")), l.key === G) l.preventDefault(), focus(l.target, F[W + 1] || F[0]);
|
|
2797
|
+
else if (l.key === K) l.preventDefault(), focus(l.target, F[W - 1] || F[F.length - 1]);
|
|
2798
|
+
else if (l.key === "Home") l.preventDefault(), focus(l.target, F[0]);
|
|
2799
|
+
else if (l.key === "End") l.preventDefault(), focus(l.target, F[F.length - 1]);
|
|
2800
|
+
else if (l.key.length === 1 && x.role !== "tablist") {
|
|
2801
|
+
let d = Date.now();
|
|
2802
|
+
d - T <= w ? O += l.key.toLowerCase() : O = l.key.toLowerCase(), T = d;
|
|
2803
|
+
let x = Array.from(F).find((l) => l.textContent?.trim()?.toLowerCase()?.startsWith(O));
|
|
2804
|
+
x && (l.preventDefault(), focus(l.target, x));
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
function U() {
|
|
2808
|
+
x = !1, d.removeEventListener("keydown", F);
|
|
2809
|
+
}
|
|
2810
|
+
function W(l) {
|
|
2811
|
+
let w = findGroupNodeByEventTarget(l.target);
|
|
2812
|
+
if (w) {
|
|
2813
|
+
x || (x = !0, d.addEventListener("keydown", F));
|
|
2814
|
+
let T = getItems(l.target, w);
|
|
2815
|
+
for (let d of T) d !== l.target && d.setAttribute("tabindex", -1);
|
|
2816
|
+
} else x && U();
|
|
2817
|
+
}
|
|
2818
|
+
function G(l) {
|
|
2819
|
+
(!l.relatedTarget || l.relatedTarget === d.document) && U();
|
|
2820
|
+
}
|
|
2821
|
+
function K(l) {
|
|
2822
|
+
let d = findGroupNodeByEventTarget(l.target);
|
|
2823
|
+
if (d) {
|
|
2824
|
+
let x = getItems(l.target, d);
|
|
2825
|
+
for (let d of x) d !== l.target && d.setAttribute("tabindex", -1);
|
|
2826
|
+
l.target.setAttribute("tabindex", 0);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
return d.addEventListener("click", K), d.addEventListener("focusin", W), d.addEventListener("focusout", G), () => {
|
|
2830
|
+
U(), d.removeEventListener("click", K), d.removeEventListener("focusin", W), d.removeEventListener("focusout", G);
|
|
2831
|
+
};
|
|
2832
|
+
};
|
|
2833
|
+
}
|
|
2834
|
+
function hiddenKeyUX() {
|
|
2835
|
+
return (l) => {
|
|
2836
|
+
let d, x;
|
|
2837
|
+
function w(l) {
|
|
2838
|
+
if (l.target.getAttribute("aria-hidden") === "true") {
|
|
2839
|
+
d = l.target, d.setAttribute("aria-hidden", "false"), x = d.hidden, x && (d.hidden = !1);
|
|
2840
|
+
let w = l.target.querySelector("a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex=\"-1\"])");
|
|
2841
|
+
w && (w.tabIndex = 0);
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
function T(l) {
|
|
2845
|
+
d && d.contains(l.target) && (!l.relatedTarget || !d.contains(l.relatedTarget)) && (l.target.tabIndex = -1, d.setAttribute("aria-hidden", "true"), x && (d.hidden = !0), d = null);
|
|
2846
|
+
}
|
|
2847
|
+
return l.addEventListener("keyuxJump", w), l.addEventListener("focusout", T), () => {
|
|
2848
|
+
l.removeEventListener("keyuxJump", w), l.removeEventListener("focusout", T);
|
|
2849
|
+
};
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
function jumpKeyUX() {
|
|
2853
|
+
return (l) => {
|
|
2854
|
+
let d = [];
|
|
2855
|
+
function x(x) {
|
|
2856
|
+
let w = l.document.activeElement;
|
|
2857
|
+
w && w !== l.document.body && d.push(new WeakRef(w)), x.focus({ focusVisible: !0 });
|
|
2858
|
+
}
|
|
2859
|
+
function w() {
|
|
2860
|
+
let x = d.pop();
|
|
2861
|
+
if (!x) {
|
|
2862
|
+
l.document.activeElement.blur();
|
|
2863
|
+
return;
|
|
2864
|
+
}
|
|
2865
|
+
let T = x.deref();
|
|
2866
|
+
T && T.isConnected ? T.focus() : w();
|
|
2867
|
+
}
|
|
2868
|
+
let T = 0, O;
|
|
2869
|
+
function F(d) {
|
|
2870
|
+
clearInterval(O);
|
|
2871
|
+
let w = d.getAttribute("aria-controls");
|
|
2872
|
+
O = setInterval(() => {
|
|
2873
|
+
if (T++ > 50) {
|
|
2874
|
+
clearInterval(O);
|
|
2875
|
+
return;
|
|
2876
|
+
}
|
|
2877
|
+
let d = l.document.getElementById(w);
|
|
2878
|
+
if (d) {
|
|
2879
|
+
let w = d.querySelector("a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex=\"-1\"])");
|
|
2880
|
+
w && (clearInterval(O), d.dispatchEvent(new l.CustomEvent("keyuxJump", { bubbles: !0 })), x(w));
|
|
2881
|
+
}
|
|
2882
|
+
}, 50);
|
|
2883
|
+
}
|
|
2884
|
+
function U(l) {
|
|
2885
|
+
l.target.getAttribute("aria-controls") && l.key === "Enter" && F(l.target), l.key === "Escape" && w();
|
|
2886
|
+
}
|
|
2887
|
+
return l.addEventListener("keydown", U), () => {
|
|
2888
|
+
l.removeEventListener("keydown", U);
|
|
2889
|
+
};
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
function pressKeyUX(l) {
|
|
2893
|
+
let d, x = l.split(" "), w;
|
|
2894
|
+
function T(l) {
|
|
2895
|
+
l.key === "Enter" && (l.target.tagName === "BUTTON" || l.target.tagName === "A") && (O(), l.target.classList.add(...x), d = l.target, w = l.target);
|
|
2896
|
+
}
|
|
2897
|
+
function O() {
|
|
2898
|
+
d && d.classList.remove(...x), w = null;
|
|
2899
|
+
}
|
|
2900
|
+
function F(l) {
|
|
2901
|
+
l.clientX === 0 && l.clientY === 0 && w !== l.target && (O(), l.target.classList.add(...x), d = l.target);
|
|
2902
|
+
}
|
|
2903
|
+
return (l) => (l.addEventListener("click", F), l.addEventListener("keydown", T), l.addEventListener("keyup", O), () => {
|
|
2904
|
+
l.removeEventListener("click", F), l.removeEventListener("keydown", T), l.removeEventListener("keyup", O);
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
function startKeyUX(l, d) {
|
|
2908
|
+
let x = d.map((d) => d(l));
|
|
2909
|
+
return () => {
|
|
2910
|
+
x.forEach((l) => l());
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
var ScopedMinimalWindow = class {
|
|
2914
|
+
constructor() {
|
|
2915
|
+
this._listeners = /* @__PURE__ */ new Map(), this._scope = [];
|
|
2916
|
+
}
|
|
2917
|
+
addEventListener(l, d) {
|
|
2918
|
+
let x = (l) => {
|
|
2919
|
+
let x = l.target;
|
|
2920
|
+
x instanceof Node && this._scope.some((l) => l === x || l.contains(x)) && d(l);
|
|
2921
|
+
};
|
|
2922
|
+
this._listeners.set(d, x), window.addEventListener(l, x);
|
|
2923
|
+
}
|
|
2924
|
+
removeEventListener(l, d) {
|
|
2925
|
+
let x = this._listeners.get(d);
|
|
2926
|
+
x && window.removeEventListener(l, x), this._listeners.delete(d);
|
|
2927
|
+
}
|
|
2928
|
+
get CustomEvent() {
|
|
2929
|
+
return window.CustomEvent;
|
|
2930
|
+
}
|
|
2931
|
+
get document() {
|
|
2932
|
+
return window.document;
|
|
2933
|
+
}
|
|
2934
|
+
get navigator() {
|
|
2935
|
+
return window.navigator;
|
|
2936
|
+
}
|
|
2937
|
+
registerScope(l) {
|
|
2938
|
+
this._scope.push(l);
|
|
2939
|
+
}
|
|
2940
|
+
destroy() {
|
|
2941
|
+
this._scope = [];
|
|
2942
|
+
for (let l of this._listeners.values()) window.removeEventListener("keydown", l), window.removeEventListener("keyup", l);
|
|
2943
|
+
this._listeners.clear();
|
|
2944
|
+
}
|
|
2945
|
+
}, A11y = class {
|
|
2946
|
+
constructor() {
|
|
2947
|
+
this._scopedWindow = new ScopedMinimalWindow(), this._destroyKeyUX = startKeyUX(this._scopedWindow, [
|
|
2948
|
+
focusGroupKeyUX(),
|
|
2949
|
+
pressKeyUX("is-pressed"),
|
|
2950
|
+
jumpKeyUX(),
|
|
2951
|
+
hiddenKeyUX()
|
|
2952
|
+
]);
|
|
2953
|
+
}
|
|
2954
|
+
registerBlock(l) {
|
|
2955
|
+
this._scopedWindow.registerScope(l);
|
|
2956
|
+
}
|
|
2957
|
+
destroy() {
|
|
2958
|
+
this._destroyKeyUX?.(), this._scopedWindow.destroy();
|
|
2959
|
+
}
|
|
2960
|
+
};
|
|
2961
|
+
const localeStateKey = (l) => `*l10n/${l}`;
|
|
2962
|
+
var LocaleManager = class extends SharedInstance {
|
|
2963
|
+
constructor(l) {
|
|
2964
|
+
super(l), this._localeName = "";
|
|
2965
|
+
for (let [l, d] of Object.entries(en_default)) {
|
|
2966
|
+
let x = this._ctx.has(localeStateKey(l)) ? !this._ctx.read(localeStateKey(l)) : !0;
|
|
2967
|
+
this._ctx.add(localeStateKey(l), d, x);
|
|
2968
|
+
}
|
|
2969
|
+
let d = l.pluginManager;
|
|
2970
|
+
d?.onPluginsChange && this.addSub(d.onPluginsChange(() => {
|
|
2971
|
+
this._localeName && this._applyPluginLocales(this._localeName);
|
|
2972
|
+
})), this.addSub(this._ctx.sub(sharedConfigKey("localeName"), async (l) => {
|
|
2973
|
+
if (!l) return;
|
|
2974
|
+
this._localeName = l;
|
|
2975
|
+
let d = await resolveLocaleDefinition(l);
|
|
2976
|
+
l !== "en" && this._localeName !== l || (this._applyPluginLocales(l), this._applyOverrides(l, d));
|
|
2977
|
+
})), this.addSub(this._ctx.sub(sharedConfigKey("localeDefinitionOverride"), (l) => {
|
|
2978
|
+
if (!l) return;
|
|
2979
|
+
let d = l[this._localeName];
|
|
2980
|
+
d && this._applyOverrides(this._localeName, d);
|
|
2981
|
+
}));
|
|
2982
|
+
}
|
|
2983
|
+
_applyOverrides(l, d) {
|
|
2984
|
+
let x = this._cfg.localeDefinitionOverride?.[l];
|
|
2985
|
+
for (let [l, w] of Object.entries(d)) {
|
|
2986
|
+
let d = x?.[l];
|
|
2987
|
+
this._ctx.add(localeStateKey(l), d ?? w, !0);
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
_applyPluginLocales(l) {
|
|
2991
|
+
let d = this._sharedInstancesBag.pluginManager;
|
|
2992
|
+
if (!d) return;
|
|
2993
|
+
let x = d.snapshot();
|
|
2994
|
+
for (let d of x.i18n) {
|
|
2995
|
+
let { pluginId: x, ...w } = d, T = w[l];
|
|
2996
|
+
if (T) for (let [l, d] of Object.entries(T)) d !== void 0 && this._ctx.add(localeStateKey(l), d, !0);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
}, CustomConfigRegistry = class {
|
|
3000
|
+
constructor() {
|
|
3001
|
+
this._definitions = /* @__PURE__ */ new Map();
|
|
3002
|
+
}
|
|
3003
|
+
register(l, d) {
|
|
3004
|
+
if (this._definitions.has(d.name)) {
|
|
3005
|
+
console.warn(`[CustomConfig] Config option "${d.name}" is already registered`);
|
|
3006
|
+
return;
|
|
3007
|
+
}
|
|
3008
|
+
let x = {
|
|
3009
|
+
attribute: !0,
|
|
3010
|
+
...d,
|
|
3011
|
+
pluginId: l
|
|
3012
|
+
};
|
|
3013
|
+
this._definitions.set(d.name, x);
|
|
3014
|
+
}
|
|
3015
|
+
unregister(l) {
|
|
3016
|
+
this._definitions.delete(l);
|
|
3017
|
+
}
|
|
3018
|
+
unregisterByPlugin(l) {
|
|
3019
|
+
for (let [d, x] of this._definitions) x.pluginId === l && this._definitions.delete(d);
|
|
3020
|
+
}
|
|
3021
|
+
get(l) {
|
|
3022
|
+
return this._definitions.get(l);
|
|
3023
|
+
}
|
|
3024
|
+
getAll() {
|
|
3025
|
+
return new Map(this._definitions);
|
|
3026
|
+
}
|
|
3027
|
+
}, PluginManager = class extends SharedInstance {
|
|
3028
|
+
constructor(l) {
|
|
3029
|
+
super(l), 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"), (l) => {
|
|
3030
|
+
this._pluginsUpdate = this._pluginsUpdate.then(() => this._syncPlugins(l));
|
|
3031
|
+
}));
|
|
3032
|
+
}
|
|
3033
|
+
onPluginsChange(l) {
|
|
3034
|
+
return this._subscribers.add(l), () => {
|
|
3035
|
+
this._subscribers.delete(l);
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
async _syncPlugins(l) {
|
|
3039
|
+
let d = new Set(this._plugins.keys()), x = /* @__PURE__ */ new Set();
|
|
3040
|
+
for (let w of l) {
|
|
3041
|
+
if (x.has(w.id)) {
|
|
3042
|
+
this._debugPrint(`Plugin "${w.id}" is already in the list, skipping duplicate`);
|
|
3043
|
+
continue;
|
|
3044
|
+
}
|
|
3045
|
+
x.add(w.id);
|
|
3046
|
+
let l = this._plugins.get(w.id);
|
|
3047
|
+
if (!l || l.plugin !== w) try {
|
|
3048
|
+
await this._registerPlugin(w);
|
|
3049
|
+
} catch (l) {
|
|
3050
|
+
this._purgeRegistrations(w.id), this._notifySubscribers(), this._debugPrint(`Plugin "${w.id}" setup failed`, l);
|
|
3051
|
+
}
|
|
3052
|
+
d.delete(w.id);
|
|
3053
|
+
}
|
|
3054
|
+
for (let l of d) this._unregisterPlugin(l);
|
|
3055
|
+
}
|
|
3056
|
+
async _registerPlugin(l) {
|
|
3057
|
+
this._plugins.has(l.id) && this._unregisterPlugin(l.id);
|
|
3058
|
+
let d = {
|
|
3059
|
+
sources: [],
|
|
3060
|
+
activities: [],
|
|
3061
|
+
fileActions: [],
|
|
3062
|
+
fileHooks: [],
|
|
3063
|
+
icons: [],
|
|
3064
|
+
i18n: []
|
|
3065
|
+
}, x = [], w = {
|
|
3066
|
+
registry: {
|
|
3067
|
+
registerSource: (x) => this._register(this._sources, d.sources, l.id, x),
|
|
3068
|
+
registerActivity: (x) => this._register(this._activities, d.activities, l.id, x),
|
|
3069
|
+
registerFileAction: (x) => this._register(this._fileActions, d.fileActions, l.id, x),
|
|
3070
|
+
registerFileHook: (x) => this._register(this._fileHooks, d.fileHooks, l.id, x),
|
|
3071
|
+
registerIcon: (x) => this._register(this._icons, d.icons, l.id, x),
|
|
3072
|
+
registerI18n: (x) => this._register(this._i18n, d.i18n, l.id, x),
|
|
3073
|
+
registerConfig: (d) => {
|
|
3074
|
+
this.configRegistry.register(l.id, d);
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
config: {
|
|
3078
|
+
get: (l) => {
|
|
3079
|
+
let d = sharedConfigKey(l);
|
|
3080
|
+
return this._ctx.read(d);
|
|
3081
|
+
},
|
|
3082
|
+
subscribe: (l, d) => {
|
|
3083
|
+
let w = sharedConfigKey(l), T = this._ctx.sub(w, (l) => {
|
|
3084
|
+
d(l);
|
|
3085
|
+
});
|
|
3086
|
+
return x.push(T), T;
|
|
3087
|
+
}
|
|
3088
|
+
},
|
|
3089
|
+
activity: {
|
|
3090
|
+
getParams: () => this._ctx.read("*currentActivityParams"),
|
|
3091
|
+
subscribeToParams: (l) => {
|
|
3092
|
+
let d = this._ctx.sub("*currentActivityParams", (d) => {
|
|
3093
|
+
l(d);
|
|
3094
|
+
});
|
|
3095
|
+
return x.push(d), d;
|
|
3096
|
+
}
|
|
3097
|
+
},
|
|
3098
|
+
files: { update: (l, d) => {
|
|
3099
|
+
let x = this._sharedInstancesBag.uploadCollection?.read(l);
|
|
3100
|
+
x && (d.file !== void 0 && (x.setValue("file", d.file), x.setValue("fileSize", d.file.size)), d.cdnUrl !== void 0 && x.setValue("cdnUrl", d.cdnUrl), d.cdnUrlModifiers !== void 0 && x.setValue("cdnUrlModifiers", d.cdnUrlModifiers), d.mimeType !== void 0 && x.setValue("mimeType", d.mimeType));
|
|
3101
|
+
} }
|
|
3102
|
+
}, T = this._sharedInstancesBag.api, O;
|
|
3103
|
+
try {
|
|
3104
|
+
O = await l.setup({
|
|
3105
|
+
pluginApi: w,
|
|
3106
|
+
uploaderApi: T
|
|
3107
|
+
}) ?? void 0;
|
|
3108
|
+
} catch (l) {
|
|
3109
|
+
for (let l of x) try {
|
|
3110
|
+
l();
|
|
3111
|
+
} catch (l) {
|
|
3112
|
+
this._debugPrint("Failed to unsubscribe config listener", l);
|
|
3113
|
+
}
|
|
3114
|
+
throw l;
|
|
3115
|
+
}
|
|
3116
|
+
this._plugins.set(l.id, {
|
|
3117
|
+
plugin: l,
|
|
3118
|
+
exports: O,
|
|
3119
|
+
registrations: d,
|
|
3120
|
+
configSubscriptions: x
|
|
3121
|
+
}), this._notifySubscribers();
|
|
3122
|
+
}
|
|
3123
|
+
_unregisterPlugin(l) {
|
|
3124
|
+
let d = this._plugins.get(l);
|
|
3125
|
+
if (d) {
|
|
3126
|
+
this._purgeRegistrations(l);
|
|
3127
|
+
for (let l of d.configSubscriptions) try {
|
|
3128
|
+
l();
|
|
3129
|
+
} catch (l) {
|
|
3130
|
+
this._debugPrint("Failed to unsubscribe config listener", l);
|
|
3131
|
+
}
|
|
3132
|
+
d.exports?.dispose?.(), this._plugins.delete(l), this._notifySubscribers();
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
snapshot() {
|
|
3136
|
+
return {
|
|
3137
|
+
sources: [...this._sources],
|
|
3138
|
+
activities: [...this._activities],
|
|
3139
|
+
fileActions: [...this._fileActions],
|
|
3140
|
+
fileHooks: [...this._fileHooks],
|
|
3141
|
+
icons: [...this._icons],
|
|
3142
|
+
i18n: [...this._i18n]
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
destroy() {
|
|
3146
|
+
for (let l of Array.from(this._plugins.keys())) this._unregisterPlugin(l);
|
|
3147
|
+
super.destroy();
|
|
3148
|
+
}
|
|
3149
|
+
_register(l, d, x, w) {
|
|
3150
|
+
let T = {
|
|
3151
|
+
...w,
|
|
3152
|
+
pluginId: x
|
|
3153
|
+
};
|
|
3154
|
+
return l.push(T), d.push(T), w;
|
|
3155
|
+
}
|
|
3156
|
+
_purgeRegistrations(l) {
|
|
3157
|
+
this._sources = this._sources.filter((d) => d.pluginId !== l), this._activities = this._activities.filter((d) => d.pluginId !== l), this._fileActions = this._fileActions.filter((d) => d.pluginId !== l), this._fileHooks = this._fileHooks.filter((d) => d.pluginId !== l), this._icons = this._icons.filter((d) => d.pluginId !== l), this._i18n = this._i18n.filter((d) => d.pluginId !== l), this.configRegistry.unregisterByPlugin(l);
|
|
3158
|
+
}
|
|
3159
|
+
_notifySubscribers() {
|
|
3160
|
+
for (let l of this._subscribers) try {
|
|
3161
|
+
l();
|
|
3162
|
+
} catch {}
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
function i$3(l) {
|
|
3166
|
+
return l.replace(/[A-Z]/g, (l) => `_${l.toLowerCase()}`).replace(/__/g, "_");
|
|
3167
|
+
}
|
|
3168
|
+
function c$2(l) {
|
|
3169
|
+
return Array.isArray(l) ? l.map((l) => typeof l == "object" && l ? c$2(l) : l) : typeof l != "object" || !l ? l : Object.fromEntries(Object.entries(l).map(([l, d]) => {
|
|
3170
|
+
let x = i$3(l);
|
|
3171
|
+
return typeof d == "object" && d ? [x, c$2(d)] : [x, d];
|
|
3172
|
+
}));
|
|
3173
|
+
}
|
|
3174
|
+
function u$1(l) {
|
|
3175
|
+
return {
|
|
3176
|
+
ok: !0,
|
|
3177
|
+
value: l
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
function a(l) {
|
|
3181
|
+
return {
|
|
3182
|
+
ok: !1,
|
|
3183
|
+
error: l
|
|
3184
|
+
};
|
|
3185
|
+
}
|
|
3186
|
+
var l$1 = "https://tlm.uploadcare.com/api/", y = class {
|
|
3187
|
+
constructor(l = l$1) {
|
|
3188
|
+
this.baseUrl = l;
|
|
3189
|
+
}
|
|
3190
|
+
async base(l, d = {}) {
|
|
3191
|
+
let x = `${this.baseUrl}${l}`;
|
|
3192
|
+
try {
|
|
3193
|
+
let l = await fetch(x, d);
|
|
3194
|
+
if (!l.ok) return a(/* @__PURE__ */ Error(`Got non-200 response from "${x}". Status: ${l.status.toString()}`));
|
|
3195
|
+
try {
|
|
3196
|
+
return u$1(await l.json());
|
|
3197
|
+
} catch (l) {
|
|
3198
|
+
return a(/* @__PURE__ */ Error(`Error parsing JSON from "${x}". Error: ${l}`));
|
|
3199
|
+
}
|
|
3200
|
+
} catch (l) {
|
|
3201
|
+
return a(/* @__PURE__ */ Error(`Error fetching data from "${x}". Error: ${l}`));
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
async post(l, d, x = {}) {
|
|
3205
|
+
return await this.base(l, {
|
|
3206
|
+
...x,
|
|
3207
|
+
method: "POST",
|
|
3208
|
+
body: JSON.stringify(c$2(d)),
|
|
3209
|
+
headers: {
|
|
3210
|
+
"Content-Type": "application/json",
|
|
3211
|
+
...x.headers || {}
|
|
3212
|
+
}
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
async get(l, d = {}) {
|
|
3216
|
+
return await this.base(l, {
|
|
3217
|
+
method: "GET",
|
|
3218
|
+
...d
|
|
3219
|
+
});
|
|
3220
|
+
}
|
|
3221
|
+
}, p$1 = async (l, d) => ({
|
|
3222
|
+
success: !0,
|
|
3223
|
+
data: d
|
|
3224
|
+
}), f$2 = async (l) => p$1(void 0, l), h$3 = class extends y {
|
|
3225
|
+
constructor() {
|
|
3226
|
+
super();
|
|
3227
|
+
}
|
|
3228
|
+
async sendEvent(l, d) {
|
|
3229
|
+
let x = await f$2(l);
|
|
3230
|
+
if (!x.success) throw console.error("TelemetryAPIService: events: body is invalid", x.error), /* @__PURE__ */ Error("TelemetryAPIService: events: body is invalid");
|
|
3231
|
+
return this.post("v1/events", l, d);
|
|
3232
|
+
}
|
|
3233
|
+
}, DEFAULT_DEBOUNCE_TIMEOUT = 20;
|
|
3234
|
+
const InternalEventType = Object.freeze({
|
|
3235
|
+
INIT_SOLUTION: "init-solution",
|
|
3236
|
+
CHANGE_CONFIG: "change-config",
|
|
3237
|
+
ACTION_EVENT: "action-event",
|
|
3238
|
+
ERROR_EVENT: "error-event"
|
|
3239
|
+
}), EventType = Object.freeze({
|
|
3240
|
+
FILE_ADDED: "file-added",
|
|
3241
|
+
FILE_REMOVED: "file-removed",
|
|
3242
|
+
FILE_UPLOAD_START: "file-upload-start",
|
|
3243
|
+
FILE_UPLOAD_PROGRESS: "file-upload-progress",
|
|
3244
|
+
FILE_UPLOAD_SUCCESS: "file-upload-success",
|
|
3245
|
+
FILE_UPLOAD_FAILED: "file-upload-failed",
|
|
3246
|
+
FILE_URL_CHANGED: "file-url-changed",
|
|
3247
|
+
MODAL_OPEN: "modal-open",
|
|
3248
|
+
MODAL_CLOSE: "modal-close",
|
|
3249
|
+
DONE_CLICK: "done-click",
|
|
3250
|
+
UPLOAD_CLICK: "upload-click",
|
|
3251
|
+
ACTIVITY_CHANGE: "activity-change",
|
|
3252
|
+
COMMON_UPLOAD_START: "common-upload-start",
|
|
3253
|
+
COMMON_UPLOAD_PROGRESS: "common-upload-progress",
|
|
3254
|
+
COMMON_UPLOAD_SUCCESS: "common-upload-success",
|
|
3255
|
+
COMMON_UPLOAD_FAILED: "common-upload-failed",
|
|
3256
|
+
CHANGE: "change",
|
|
3257
|
+
GROUP_CREATED: "group-created"
|
|
3258
|
+
});
|
|
3259
|
+
var EventEmitter = class extends SharedInstance {
|
|
3260
|
+
constructor(...l) {
|
|
3261
|
+
super(...l), this._timeoutStore = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Set();
|
|
3262
|
+
}
|
|
3263
|
+
bindTarget(l) {
|
|
3264
|
+
return this._targets.add(l), () => {
|
|
3265
|
+
this._targets.delete(l);
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
_dispatch(l, d) {
|
|
3269
|
+
for (let x of this._targets) x.dispatchEvent(new CustomEvent(l, { detail: d }));
|
|
3270
|
+
this._debugPrint?.(() => {
|
|
3271
|
+
let x = d && typeof d == "object" ? { ...d } : d;
|
|
3272
|
+
return [`event "${l}"`, x];
|
|
3273
|
+
});
|
|
3274
|
+
}
|
|
3275
|
+
emit(l, d, x = {}) {
|
|
3276
|
+
let { debounce: w } = x;
|
|
3277
|
+
if (typeof w != "number" && !w) {
|
|
3278
|
+
this._dispatch(l, typeof d == "function" ? d() : d);
|
|
3279
|
+
return;
|
|
3280
|
+
}
|
|
3281
|
+
this._timeoutStore.has(l) && window.clearTimeout(this._timeoutStore.get(l));
|
|
3282
|
+
let T = typeof w == "number" ? w : DEFAULT_DEBOUNCE_TIMEOUT, O = window.setTimeout(() => {
|
|
3283
|
+
try {
|
|
3284
|
+
let x = typeof d == "function" ? d() : d;
|
|
3285
|
+
this._dispatch(l, x), this._timeoutStore.delete(l);
|
|
3286
|
+
} catch (d) {
|
|
3287
|
+
this._debugPrint?.(() => `Error while getting payload for event "${l}"`, d);
|
|
3288
|
+
}
|
|
3289
|
+
}, T);
|
|
3290
|
+
this._timeoutStore.set(l, O);
|
|
3291
|
+
}
|
|
3292
|
+
destroy() {
|
|
3293
|
+
for (let l of this._timeoutStore.values()) window.clearTimeout(l);
|
|
3294
|
+
this._targets.clear();
|
|
3295
|
+
}
|
|
3296
|
+
};
|
|
3297
|
+
const PACKAGE_NAME = "blocks", PACKAGE_VERSION = "1.28.0-alpha.1";
|
|
3298
|
+
var TelemetryManager = class extends SharedInstance {
|
|
3299
|
+
constructor(l) {
|
|
3300
|
+
super(l), this._sessionId = UID.generateRandomUUID(), this._config = structuredClone(initialConfig), this._initialized = !1, this._lastPayload = null, this._isEnabled = !1, this._telemetryInstance = new h$3(), this._queue = new Queue(10), this.addSub(this._ctx.sub(sharedConfigKey("qualityInsights"), (l) => {
|
|
3301
|
+
this._isEnabled = !!l;
|
|
3302
|
+
}));
|
|
3303
|
+
for (let l of Object.keys(this._config)) this.addSub(this._ctx.sub(sharedConfigKey(l), (d) => {
|
|
3304
|
+
this._isEnabled && (this._initialized && this._config[l] !== d && this.sendEvent({ eventType: InternalEventType.CHANGE_CONFIG }), this._setConfig(l, d));
|
|
3305
|
+
}));
|
|
3306
|
+
}
|
|
3307
|
+
_init(l) {
|
|
3308
|
+
l === InternalEventType.INIT_SOLUTION && !this._initialized && (this._initialized = !0);
|
|
3309
|
+
}
|
|
3310
|
+
_setConfig(l, d) {
|
|
3311
|
+
this._config[l] !== d && (this._config[l] = d);
|
|
3312
|
+
}
|
|
3313
|
+
_formattingPayload(l) {
|
|
3314
|
+
let d = l.payload ? { ...l.payload } : {};
|
|
3315
|
+
d.activity &&= void 0;
|
|
3316
|
+
let x = { ...l };
|
|
3317
|
+
return (l.eventType === InternalEventType.INIT_SOLUTION || l.eventType === InternalEventType.CHANGE_CONFIG) && (x.config = this._config), {
|
|
3318
|
+
...x,
|
|
3319
|
+
appVersion: PACKAGE_VERSION,
|
|
3320
|
+
appName: PACKAGE_NAME,
|
|
3321
|
+
sessionId: this._sessionId,
|
|
3322
|
+
component: this._solution,
|
|
3323
|
+
activity: this._activity,
|
|
3324
|
+
projectPubkey: this._config.pubkey,
|
|
3325
|
+
userAgent: navigator.userAgent,
|
|
3326
|
+
eventType: x.eventType ?? "",
|
|
3327
|
+
eventTimestamp: this._timestamp,
|
|
3328
|
+
payload: {
|
|
3329
|
+
location: this._location,
|
|
3330
|
+
...d
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
}
|
|
3334
|
+
_excludedEvents(l) {
|
|
3335
|
+
return !!(l && [
|
|
3336
|
+
EventType.CHANGE,
|
|
3337
|
+
EventType.COMMON_UPLOAD_PROGRESS,
|
|
3338
|
+
EventType.FILE_ADDED,
|
|
3339
|
+
EventType.FILE_REMOVED,
|
|
3340
|
+
EventType.FILE_UPLOAD_START,
|
|
3341
|
+
EventType.FILE_UPLOAD_PROGRESS,
|
|
3342
|
+
EventType.FILE_UPLOAD_SUCCESS,
|
|
3343
|
+
EventType.FILE_UPLOAD_FAILED
|
|
3344
|
+
].includes(l));
|
|
3345
|
+
}
|
|
3346
|
+
sendEvent(l) {
|
|
3347
|
+
if (!this._isEnabled) return;
|
|
3348
|
+
let d = this._formattingPayload({
|
|
3349
|
+
eventType: l.eventType,
|
|
3350
|
+
payload: l.payload,
|
|
3351
|
+
config: l.config
|
|
3352
|
+
});
|
|
3353
|
+
this._init(l.eventType), !this._excludedEvents(l.eventType) && (this._lastPayload && this._checkObj(this._lastPayload, d) || this._queue.add(async () => {
|
|
3354
|
+
this._lastPayload = d, await this._telemetryInstance.sendEvent(d);
|
|
3355
|
+
}));
|
|
3356
|
+
}
|
|
3357
|
+
sendEventError(l, d = "unknown") {
|
|
3358
|
+
this.sendEvent({
|
|
3359
|
+
eventType: InternalEventType.ERROR_EVENT,
|
|
3360
|
+
payload: { metadata: {
|
|
3361
|
+
event: "error",
|
|
3362
|
+
text: `Error in ${d}`,
|
|
3363
|
+
error: l.message
|
|
3364
|
+
} }
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
sendEventCloudImageEditor(l, d, x = {}) {
|
|
3368
|
+
this.sendEvent({
|
|
3369
|
+
eventType: InternalEventType.ACTION_EVENT,
|
|
3370
|
+
payload: { metadata: {
|
|
3371
|
+
tabId: d,
|
|
3372
|
+
node: l.currentTarget?.tagName,
|
|
3373
|
+
event: l.type,
|
|
3374
|
+
...x
|
|
3375
|
+
} }
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
_checkObj(l, d) {
|
|
3379
|
+
if (JSON.stringify(l) === JSON.stringify(d)) return !0;
|
|
3380
|
+
if (typeof l != "object" || typeof d != "object" || l == null || d == null) return !1;
|
|
3381
|
+
let x = Object.keys(l), w = Object.keys(d);
|
|
3382
|
+
if (x.length !== w.length) return !1;
|
|
3383
|
+
for (let w of x) if (!Object.hasOwn(d, w) || !this._checkObj(l[w], d[w])) return !1;
|
|
3384
|
+
return !0;
|
|
3385
|
+
}
|
|
3386
|
+
get _timestamp() {
|
|
3387
|
+
return Date.now();
|
|
3388
|
+
}
|
|
3389
|
+
get _solution() {
|
|
3390
|
+
if (!this._ctx.has("*solution")) return null;
|
|
3391
|
+
let l = this._ctx.read("*solution");
|
|
3392
|
+
return l ? l.toLowerCase() : null;
|
|
3393
|
+
}
|
|
3394
|
+
get _activity() {
|
|
3395
|
+
return this._ctx.has("*currentActivity") ? this._ctx.read("*currentActivity") : null;
|
|
3396
|
+
}
|
|
3397
|
+
get _location() {
|
|
3398
|
+
return location.origin;
|
|
3399
|
+
}
|
|
3400
|
+
};
|
|
3401
|
+
const getLocaleDirection = (l) => {
|
|
3402
|
+
let d = new Intl.Locale(l), x = "ltr", w = d.getTextInfo?.().direction;
|
|
3403
|
+
return w ? x = w : d.textInfo?.direction && (x = d.textInfo.direction), x;
|
|
3404
|
+
};
|
|
3405
|
+
var DEFAULT_TRANSFORMER = (l) => l, OPEN_TOKEN = "{{", CLOSE_TOKEN = "}}", PLURAL_PREFIX = "plural:";
|
|
3406
|
+
function applyTemplateData(l, d = {}, x = {}) {
|
|
3407
|
+
let { openToken: w = OPEN_TOKEN, closeToken: T = CLOSE_TOKEN, transform: O = DEFAULT_TRANSFORMER } = x;
|
|
3408
|
+
for (let x in d) {
|
|
3409
|
+
let F = d[x]?.toString(), U = typeof F == "string" ? O(F) : String(F);
|
|
3410
|
+
l = l.replaceAll(w + x + T, U);
|
|
3411
|
+
}
|
|
3412
|
+
return l;
|
|
3413
|
+
}
|
|
3414
|
+
function getPluralObjects(l) {
|
|
3415
|
+
let d = [], x = l.indexOf(OPEN_TOKEN);
|
|
3416
|
+
for (; x !== -1;) {
|
|
3417
|
+
let w = l.indexOf(CLOSE_TOKEN, x);
|
|
3418
|
+
if (w === -1) break;
|
|
3419
|
+
let T = l.substring(x + 2, w);
|
|
3420
|
+
if (T.startsWith(PLURAL_PREFIX)) {
|
|
3421
|
+
let O = l.substring(x + 2, w).replace(PLURAL_PREFIX, ""), F = O.substring(0, O.indexOf("(")), U = O.substring(O.indexOf("(") + 1, O.indexOf(")"));
|
|
3422
|
+
d.push({
|
|
3423
|
+
variable: T,
|
|
3424
|
+
pluralKey: F,
|
|
3425
|
+
countVariable: U
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
x = l.indexOf(OPEN_TOKEN, w);
|
|
3429
|
+
}
|
|
3430
|
+
return d;
|
|
3431
|
+
}
|
|
3432
|
+
var WINDOW_HEIGHT_TRACKER_PROPERTY = "--uploadcare-blocks-window-height", WindowHeightTracker = class l {
|
|
3433
|
+
static {
|
|
3434
|
+
this.clientsRegistry = /* @__PURE__ */ new Set();
|
|
3435
|
+
}
|
|
3436
|
+
static {
|
|
3437
|
+
this.flush = debounce(() => {
|
|
3438
|
+
document.documentElement.style.setProperty(WINDOW_HEIGHT_TRACKER_PROPERTY, `${window.innerHeight}px`);
|
|
3439
|
+
}, 100);
|
|
3440
|
+
}
|
|
3441
|
+
static registerClient(d) {
|
|
3442
|
+
l.clientsRegistry.size === 0 && l.attachTracker(), l.clientsRegistry.add(d);
|
|
3443
|
+
}
|
|
3444
|
+
static unregisterClient(d) {
|
|
3445
|
+
l.clientsRegistry.delete(d), l.clientsRegistry.size === 0 && l.detachTracker();
|
|
3446
|
+
}
|
|
3447
|
+
static attachTracker() {
|
|
3448
|
+
window.addEventListener("resize", l.flush, {
|
|
3449
|
+
passive: !0,
|
|
3450
|
+
capture: !0
|
|
3451
|
+
}), l.flush();
|
|
3452
|
+
}
|
|
3453
|
+
static detachTracker() {
|
|
3454
|
+
window.removeEventListener("resize", l.flush, { capture: !0 }), document.documentElement.style.removeProperty(WINDOW_HEIGHT_TRACKER_PROPERTY);
|
|
3455
|
+
}
|
|
3456
|
+
};
|
|
3457
|
+
const getPluralForm = (l, d) => new Intl.PluralRules(l).select(d), createPluralizer = (l) => (d, x) => {
|
|
3458
|
+
let w = l();
|
|
3459
|
+
return w(`${d}__${getPluralForm(w("locale-id") || "en", x)}`);
|
|
3460
|
+
}, createL10n = (l) => {
|
|
3461
|
+
let d = createPluralizer(() => x), x = (x, w = {}) => {
|
|
3462
|
+
if (!x) return "";
|
|
3463
|
+
let T = l().read(localeStateKey(x)) || x, O = getPluralObjects(T);
|
|
3464
|
+
for (let l of O) w[l.variable] = d(l.pluralKey, Number(w[l.countVariable]));
|
|
3465
|
+
return applyTemplateData(T, w);
|
|
3466
|
+
};
|
|
3467
|
+
return x;
|
|
3468
|
+
};
|
|
3469
|
+
var isCustomElement = (l) => l.tagName?.includes("-") ?? !1, TestModeController = class {
|
|
3470
|
+
constructor(l) {
|
|
3471
|
+
this._trackedElements = /* @__PURE__ */ new Set(), this._originalValues = /* @__PURE__ */ new Map(), this._enabled = !1, this._host = l, this._host.addController(this);
|
|
3472
|
+
}
|
|
3473
|
+
hostDisconnected() {
|
|
3474
|
+
this._unsubscribe?.(), this._unsubscribe = void 0, this._trackedElements.clear(), this._originalValues.clear();
|
|
3475
|
+
}
|
|
3476
|
+
hostUpdated() {
|
|
3477
|
+
!this._unsubscribe && this._host.has(sharedConfigKey("testMode")) && (this._unsubscribe = this._host.subConfigValue("testMode", (l) => {
|
|
3478
|
+
this._enabled = !!l, this._applyTestMode();
|
|
3479
|
+
})), this._collectElements(), this._applyTestMode();
|
|
3480
|
+
}
|
|
3481
|
+
_collectElements() {
|
|
3482
|
+
let l = this._host, d = l.renderRoot ?? l;
|
|
3483
|
+
if (!d) return;
|
|
3484
|
+
let x = this._host, w = x.tagName?.toLowerCase(), T = Array.from(d.querySelectorAll("[data-testid]")).filter((l) => !isCustomElement(l));
|
|
3485
|
+
for (let l of T) if (!(w && l.closest(w) !== x) && !this._trackedElements.has(l)) {
|
|
3486
|
+
let d = l.getAttribute("data-testid");
|
|
3487
|
+
if (!d) continue;
|
|
3488
|
+
this._trackedElements.add(l), this._originalValues.set(l, d);
|
|
3489
|
+
}
|
|
3490
|
+
for (let l of Array.from(this._trackedElements)) (!l.isConnected || w && l.closest(w) !== x) && (this._trackedElements.delete(l), this._originalValues.delete(l));
|
|
3491
|
+
}
|
|
3492
|
+
_applyTestMode() {
|
|
3493
|
+
if (!this._trackedElements.size) return;
|
|
3494
|
+
let l = this._host.testId || "";
|
|
3495
|
+
for (let d of this._trackedElements) {
|
|
3496
|
+
let x = this._originalValues.get(d);
|
|
3497
|
+
x && (this._enabled ? d.setAttribute("data-testid", `${l}--${x}`) : d.removeAttribute("data-testid"));
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
}, LitBlockBase = RegisterableElementMixin(SymbioteMixin()(CssDataMixin(LightDomMixin(i$2)))), LitBlock = class extends LitBlockBase {
|
|
3501
|
+
static {
|
|
3502
|
+
this.styleAttrs = [];
|
|
3503
|
+
}
|
|
3504
|
+
constructor() {
|
|
3505
|
+
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);
|
|
3506
|
+
}
|
|
3507
|
+
emit(l, d, x) {
|
|
3508
|
+
let w = this.has("*eventEmitter") ? this.$["*eventEmitter"] : void 0;
|
|
3509
|
+
if (!w) return;
|
|
3510
|
+
w.emit(l, d, x);
|
|
3511
|
+
let T = typeof d == "function" ? d() : d;
|
|
3512
|
+
this.telemetryManager.sendEvent({
|
|
3513
|
+
eventType: l,
|
|
3514
|
+
payload: T ?? void 0
|
|
3515
|
+
});
|
|
3516
|
+
}
|
|
3517
|
+
hasBlockInCtx(l) {
|
|
3518
|
+
for (let d of this.blocksRegistry) if (l(d)) return !0;
|
|
3519
|
+
return !1;
|
|
3520
|
+
}
|
|
3521
|
+
connectedCallback() {
|
|
3522
|
+
this.constructor.styleAttrs.forEach((l) => {
|
|
3523
|
+
this.setAttribute(l, "");
|
|
3524
|
+
}), super.connectedCallback(), WindowHeightTracker.registerClient(this);
|
|
3525
|
+
}
|
|
3526
|
+
initCallback() {
|
|
3527
|
+
this._addSharedContextInstance("*blocksRegistry", () => /* @__PURE__ */ new Set()), this._addSharedContextInstance("*pluginManager", (l) => new PluginManager(l)), this._addSharedContextInstance("*eventEmitter", (l) => new EventEmitter(l)), this._addSharedContextInstance("*localeManager", (l) => new LocaleManager(l)), this._addSharedContextInstance("*modalManager", (l) => new ModalManager(l)), this._addSharedContextInstance("*a11y", () => new A11y()), this._addSharedContextInstance("*clipboard", (l) => new ClipboardLayer(l)), this._addSharedContextInstance("*telemetryManager", (l) => new TelemetryManager(l)), this.sub(localeStateKey("locale-id"), (l) => {
|
|
3528
|
+
let d = getLocaleDirection(l);
|
|
3529
|
+
this.style.direction = d === "ltr" ? "" : d, this.requestUpdate();
|
|
3530
|
+
}), this.subConfigValue("testMode", (l) => {
|
|
3531
|
+
if (!l || !this.testId) {
|
|
3532
|
+
this.removeAttribute("data-testid");
|
|
3533
|
+
return;
|
|
3534
|
+
}
|
|
3535
|
+
this.setAttribute("data-testid", this.testId);
|
|
3536
|
+
}), this.blocksRegistry.add(this);
|
|
3537
|
+
}
|
|
3538
|
+
get testId() {
|
|
3539
|
+
return window.customElements.getName(this.constructor);
|
|
3540
|
+
}
|
|
3541
|
+
get modalManager() {
|
|
3542
|
+
return this._getSharedContextInstance("*modalManager", !1);
|
|
3543
|
+
}
|
|
3544
|
+
get telemetryManager() {
|
|
3545
|
+
return this._getSharedContextInstance("*telemetryManager");
|
|
3546
|
+
}
|
|
3547
|
+
get localeManager() {
|
|
3548
|
+
return this._getSharedContextInstance("*localeManager");
|
|
3549
|
+
}
|
|
3550
|
+
get a11y() {
|
|
3551
|
+
return this._getSharedContextInstance("*a11y");
|
|
3552
|
+
}
|
|
3553
|
+
get clipboardLayer() {
|
|
3554
|
+
return this._getSharedContextInstance("*clipboard");
|
|
3555
|
+
}
|
|
3556
|
+
get blocksRegistry() {
|
|
3557
|
+
return this._getSharedContextInstance("*blocksRegistry");
|
|
3558
|
+
}
|
|
3559
|
+
get eventEmitter() {
|
|
3560
|
+
return this._getSharedContextInstance("*eventEmitter");
|
|
3561
|
+
}
|
|
3562
|
+
disconnectedCallback() {
|
|
3563
|
+
super.disconnectedCallback(), WindowHeightTracker.unregisterClient(this);
|
|
3564
|
+
let l = this.blocksRegistry;
|
|
3565
|
+
l?.delete(this), l?.size === 0 && setTimeout(() => {
|
|
3566
|
+
this.isConnected || l?.size > 0 || this.destroyCtxCallback();
|
|
3567
|
+
}, 0);
|
|
3568
|
+
}
|
|
3569
|
+
destroyCtxCallback() {
|
|
3570
|
+
this._destroySharedContextInstances(), PubSub.deleteCtx(this.ctxName);
|
|
3571
|
+
}
|
|
3572
|
+
_getSharedContextInstances() {
|
|
3573
|
+
let l = "*sharedContextInstances";
|
|
3574
|
+
if (!this.has(l) || !this.$[l]) {
|
|
3575
|
+
let d = /* @__PURE__ */ new Map();
|
|
3576
|
+
this.add(l, d, !0);
|
|
3577
|
+
}
|
|
3578
|
+
return this.$[l];
|
|
3579
|
+
}
|
|
3580
|
+
_addSharedContextInstance(l, d) {
|
|
3581
|
+
let x = this._getSharedContextInstances();
|
|
3582
|
+
if (!x.has(l) && (!this.has(l) || !this.$[l])) {
|
|
3583
|
+
let w = d(this._sharedInstancesBag);
|
|
3584
|
+
this.add(l, w, !0), x.set(l, w);
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
_destroySharedContextInstances() {
|
|
3589
|
+
let l = this._getSharedContextInstances();
|
|
3590
|
+
for (let [d, x] of l.entries()) x?.destroy?.(), this.pub(d, null);
|
|
3591
|
+
l.clear();
|
|
3592
|
+
}
|
|
3593
|
+
_getSharedContextInstance(l, d = !0) {
|
|
3594
|
+
if (this.has(l) && this.$[l] || !d) return this.$[l];
|
|
3595
|
+
throw Error(`Unexpected error: context manager for key "${String(l)}" is not available`);
|
|
3596
|
+
}
|
|
3597
|
+
async proxyUrl(l) {
|
|
3598
|
+
if (this.cfg.secureDeliveryProxy && this.cfg.secureDeliveryProxyUrlResolver && console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."), this.cfg.secureDeliveryProxyUrlResolver) try {
|
|
3599
|
+
return await this.cfg.secureDeliveryProxyUrlResolver(l, {
|
|
3600
|
+
uuid: extractUuid(l),
|
|
3601
|
+
cdnUrlModifiers: extractCdnUrlModifiers(l),
|
|
3602
|
+
fileName: extractFilename(l)
|
|
3603
|
+
});
|
|
3604
|
+
} catch (d) {
|
|
3605
|
+
return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.", d), this.telemetryManager.sendEventError(d, "secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."), l;
|
|
3606
|
+
}
|
|
3607
|
+
return this.cfg.secureDeliveryProxy ? applyTemplateData(this.cfg.secureDeliveryProxy, { previewUrl: l }, { transform: (l) => window.encodeURIComponent(l) }) : l;
|
|
3608
|
+
}
|
|
3609
|
+
get cfg() {
|
|
3610
|
+
return this._cfgProxy ||= new Proxy({}, {
|
|
3611
|
+
set: (l, d, x) => {
|
|
3612
|
+
if (typeof d != "string" || !(d in initialConfig)) return !1;
|
|
3613
|
+
let w = d, T = sharedConfigKey(w);
|
|
3614
|
+
return this.has(T) || this.add(T, initialConfig[w]), this.$[T] = x, !0;
|
|
3615
|
+
},
|
|
3616
|
+
get: (l, d) => {
|
|
3617
|
+
let x = sharedConfigKey(d);
|
|
3618
|
+
return this.has(x) || this.add(x, initialConfig[d]), this.$[x];
|
|
3619
|
+
}
|
|
3620
|
+
}), this._cfgProxy;
|
|
3621
|
+
}
|
|
3622
|
+
subConfigValue(l, d) {
|
|
3623
|
+
let x = sharedConfigKey(l);
|
|
3624
|
+
return this.has(x) || this.add(x, initialConfig[l]), this.sub(x, d);
|
|
3625
|
+
}
|
|
3626
|
+
}, t = {
|
|
3627
|
+
ATTRIBUTE: 1,
|
|
3628
|
+
CHILD: 2,
|
|
3629
|
+
PROPERTY: 3,
|
|
3630
|
+
BOOLEAN_ATTRIBUTE: 4,
|
|
3631
|
+
EVENT: 5,
|
|
3632
|
+
ELEMENT: 6
|
|
3633
|
+
}, e = (l) => (...d) => ({
|
|
3634
|
+
_$litDirective$: l,
|
|
3635
|
+
values: d
|
|
3636
|
+
}), i = class {
|
|
3637
|
+
constructor(l) {}
|
|
3638
|
+
get _$AU() {
|
|
3639
|
+
return this._$AM._$AU;
|
|
3640
|
+
}
|
|
3641
|
+
_$AT(l, d, x) {
|
|
3642
|
+
this._$Ct = l, this._$AM = d, this._$Ci = x;
|
|
3643
|
+
}
|
|
3644
|
+
_$AS(l, d) {
|
|
3645
|
+
return this.update(l, d);
|
|
3646
|
+
}
|
|
3647
|
+
update(l, d) {
|
|
3648
|
+
return this.render(...d);
|
|
3649
|
+
}
|
|
3650
|
+
}, e$3 = class extends i {
|
|
3651
|
+
constructor(l) {
|
|
3652
|
+
if (super(l), this.it = A, l.type !== t.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
3653
|
+
}
|
|
3654
|
+
render(l) {
|
|
3655
|
+
if (l === A || l == null) return this._t = void 0, this.it = l;
|
|
3656
|
+
if (l === E) return l;
|
|
3657
|
+
if (typeof l != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
3658
|
+
if (l === this.it) return this._t;
|
|
3659
|
+
this.it = l;
|
|
3660
|
+
let d = [l];
|
|
3661
|
+
return d.raw = d, this._t = {
|
|
3662
|
+
_$litType$: this.constructor.resultType,
|
|
3663
|
+
strings: d,
|
|
3664
|
+
values: []
|
|
3665
|
+
};
|
|
3666
|
+
}
|
|
3667
|
+
};
|
|
3668
|
+
e$3.directiveName = "unsafeHTML", e$3.resultType = 1;
|
|
3669
|
+
/**
|
|
3670
|
+
* @license
|
|
3671
|
+
* Copyright 2017 Google LLC
|
|
3672
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3673
|
+
*/ var t$2 = class extends e$3 {};
|
|
3674
|
+
t$2.directiveName = "unsafeSVG", t$2.resultType = 2;
|
|
3675
|
+
var o$2 = e(t$2);
|
|
3676
|
+
const CameraSourceTypes = Object.freeze({
|
|
3677
|
+
PHOTO: "photo",
|
|
3678
|
+
VIDEO: "video"
|
|
3679
|
+
}), CameraSourceEvents = Object.freeze({
|
|
3680
|
+
IDLE: "idle",
|
|
3681
|
+
SHOT: "shot",
|
|
3682
|
+
PLAY: "play",
|
|
3683
|
+
PAUSE: "pause",
|
|
3684
|
+
RESUME: "resume",
|
|
3685
|
+
STOP: "stop",
|
|
3686
|
+
RETAKE: "retake",
|
|
3687
|
+
ACCEPT: "accept"
|
|
3688
|
+
});
|
|
3689
|
+
var warnings = /* @__PURE__ */ new Set();
|
|
3690
|
+
function warnOnce(l) {
|
|
3691
|
+
warnings.has(l) || (warnings.add(l), console.warn(l));
|
|
3692
|
+
}
|
|
3693
|
+
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;
|
|
3694
|
+
function setSvgNodeAttrs(l, d) {
|
|
3695
|
+
for (let [x, w] of Object.entries(d)) l.setAttributeNS(null, x, w.toString());
|
|
3696
|
+
}
|
|
3697
|
+
function createSvgNode(l, d = {}) {
|
|
3698
|
+
let x = document.createElementNS("http://www.w3.org/2000/svg", l);
|
|
3699
|
+
return setSvgNodeAttrs(x, d), x;
|
|
3700
|
+
}
|
|
3701
|
+
function cornerPath(l, d, x) {
|
|
3702
|
+
let { x: w, y: T, width: O, height: F } = l, U = d.includes("w") ? 0 : 1, W = d.includes("n") ? 0 : 1, G = U === 0 ? -1 : 1, K = W === 0 ? -1 : 1, q = [w + U * O + THUMB_OFFSET * G, T + W * F + THUMB_OFFSET * K - 24 * x * K], J = [w + U * O + THUMB_OFFSET * G, T + W * F + THUMB_OFFSET * K], Y = [w + U * O - 24 * x * G + THUMB_OFFSET * G, T + W * F + THUMB_OFFSET * K];
|
|
3703
|
+
return {
|
|
3704
|
+
d: `M ${q[0]} ${q[1]} L ${J[0]} ${J[1]} L ${Y[0]} ${Y[1]}`,
|
|
3705
|
+
center: [J[0], J[1]]
|
|
3706
|
+
};
|
|
3707
|
+
}
|
|
3708
|
+
function sidePath(l, d, x) {
|
|
3709
|
+
let { x: w, y: T, width: O, height: F } = l, U = d === "n" || d === "s", W = d === "w" || d === "e", G = U ? .5 : d === "w" ? 0 : 1, K = W ? .5 : d === "n" ? 0 : 1, q = d === "w" ? -1 : d === "e" ? 1 : 0, J = d === "n" ? -1 : d === "s" ? 1 : 0, Y, X;
|
|
3710
|
+
return U ? (Y = [w + G * O - 34 * x / 2, T + K * F + THUMB_OFFSET * J], X = [w + G * O + 34 * x / 2, T + K * F + THUMB_OFFSET * J]) : (Y = [w + G * O + THUMB_OFFSET * q, T + K * F - 34 * x / 2], X = [w + G * O + THUMB_OFFSET * q, T + K * F + 34 * x / 2]), {
|
|
3711
|
+
d: `M ${Y[0]} ${Y[1]} L ${X[0]} ${X[1]}`,
|
|
3712
|
+
center: [(Y[0] + X[0]) / 2, (Y[1] + X[1]) / 2]
|
|
3713
|
+
};
|
|
3714
|
+
}
|
|
3715
|
+
function thumbCursor(l) {
|
|
3716
|
+
return l === "" ? "move" : ["e", "w"].includes(l) ? "ew-resize" : ["n", "s"].includes(l) ? "ns-resize" : ["nw", "se"].includes(l) ? "nwse-resize" : "nesw-resize";
|
|
3717
|
+
}
|
|
3718
|
+
function moveRect({ rect: l, delta: [d, x], imageBox: w }) {
|
|
3719
|
+
return constraintRect({
|
|
3720
|
+
...l,
|
|
3721
|
+
x: l.x + d,
|
|
3722
|
+
y: l.y + x
|
|
3723
|
+
}, w);
|
|
3724
|
+
}
|
|
3725
|
+
function constraintRect(l, d) {
|
|
3726
|
+
let { x } = l, { y: w } = l;
|
|
3727
|
+
return l.x < d.x ? x = d.x : l.x + l.width > d.x + d.width && (x = d.x + d.width - l.width), l.y < d.y ? w = d.y : l.y + l.height > d.y + d.height && (w = d.y + d.height - l.height), {
|
|
3728
|
+
...l,
|
|
3729
|
+
x,
|
|
3730
|
+
y: w
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
function resizeNorth({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3734
|
+
let [, T] = d, { y: O, width: F, height: U } = l;
|
|
3735
|
+
O += T, U -= T, x && (F = U * x);
|
|
3736
|
+
let W = l.x + l.width / 2 - F / 2;
|
|
3737
|
+
return O <= w.y && (O = w.y, U = l.y + l.height - O, x && (F = U * x, W = l.x + l.width / 2 - F / 2)), W <= w.x && (W = w.x, O = l.y + l.height - U), W + F >= w.x + w.width && (W = Math.max(w.x, w.x + w.width - F), F = w.x + w.width - W, x && (U = F / x), O = l.y + l.height - U), U < 1 && (U = 1, x && (F = U * x, W = l.x + l.width / 2 - F / 2), O = l.y + l.height - U), F < 1 && (F = 1, x && (U = F / x, W = l.x + l.width / 2 - F / 2), O = l.y + l.height - U), {
|
|
3738
|
+
x: W,
|
|
3739
|
+
y: O,
|
|
3740
|
+
width: F,
|
|
3741
|
+
height: U
|
|
3742
|
+
};
|
|
3743
|
+
}
|
|
3744
|
+
function resizeWest({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3745
|
+
let [T] = d, { x: O, width: F, height: U } = l;
|
|
3746
|
+
O += T, F -= T, x && (U = F / x);
|
|
3747
|
+
let W = l.y + l.height / 2 - U / 2;
|
|
3748
|
+
return O <= w.x && (O = w.x, F = l.x + l.width - O, x && (U = F / x, W = l.y + l.height / 2 - U / 2)), W <= w.y && (W = w.y, O = l.x + l.width - F), W + U >= w.y + w.height && (W = Math.max(w.y, w.y + w.height - U), U = w.y + w.height - W, x && (F = U * x), O = l.x + l.width - F), U < 1 && (U = 1, x && (F = U * x), W = l.y + l.height / 2 - U / 2, O = l.x + l.width - F), F < 1 && (F = 1, x && (U = F / x), W = l.y + l.height / 2 - U / 2, O = l.x + l.width - F), {
|
|
3749
|
+
x: O,
|
|
3750
|
+
y: W,
|
|
3751
|
+
width: F,
|
|
3752
|
+
height: U
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3755
|
+
function resizeSouth({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3756
|
+
let [, T] = d, { y: O, width: F, height: U } = l;
|
|
3757
|
+
U += T, x && (F = U * x);
|
|
3758
|
+
let W = l.x + l.width / 2 - F / 2;
|
|
3759
|
+
return O + U >= w.y + w.height && (U = w.y + w.height - O, x && (F = U * x), W = l.x + l.width / 2 - F / 2), W <= w.x && (W = w.x, O = l.y), W + F >= w.x + w.width && (W = Math.max(w.x, w.x + w.width - F), F = w.x + w.width - W, x && (U = F / x), O = l.y), U < 1 && (U = 1, x && (F = U * x), W = l.x + l.width / 2 - F / 2), F < 1 && (F = 1, x && (U = F / x), W = l.x + l.width / 2 - F / 2), {
|
|
3760
|
+
x: W,
|
|
3761
|
+
y: O,
|
|
3762
|
+
width: F,
|
|
3763
|
+
height: U
|
|
3764
|
+
};
|
|
3765
|
+
}
|
|
3766
|
+
function resizeEast({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3767
|
+
let [T] = d, { x: O, width: F, height: U } = l;
|
|
3768
|
+
F += T, x && (U = F / x);
|
|
3769
|
+
let W = l.y + l.height / 2 - U / 2;
|
|
3770
|
+
return O + F >= w.x + w.width && (F = w.x + w.width - O, x && (U = F / x), W = l.y + l.height / 2 - U / 2), W <= w.y && (W = w.y, O = l.x), W + U >= w.y + w.height && (W = Math.max(w.y, w.y + w.height - U), U = w.y + w.height - W, x && (F = U * x), O = l.x), U < 1 && (U = 1, x && (F = U * x), W = l.y + l.height / 2 - U / 2), F < 1 && (F = 1, x && (U = F / x), W = l.y + l.height / 2 - U / 2), {
|
|
3771
|
+
x: O,
|
|
3772
|
+
y: W,
|
|
3773
|
+
width: F,
|
|
3774
|
+
height: U
|
|
3775
|
+
};
|
|
3776
|
+
}
|
|
3777
|
+
function resizeNorthWest({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3778
|
+
let [T, O] = d, { x: F, y: U, width: W, height: G } = l;
|
|
3779
|
+
return F + T < w.x && (T = w.x - F), U + O < w.y && (O = w.y - U), F += T, W -= T, U += O, G -= O, x && Math.abs(W / G) > x ? (O = W / x - G, G += O, U -= O, U <= w.y && (G -= w.y - U, W = G * x, F = l.x + l.width - W, U = w.y)) : x && (T = G * x - W, W += T, F -= T, F <= w.x && (W -= w.x - F, G = W / x, F = w.x, U = l.y + l.height - G)), G < 1 && (G = 1, x && (W = G * x), F = l.x + l.width - W, U = l.y + l.height - G), W < 1 && (W = 1, x && (G = W / x), F = l.x + l.width - W, U = l.y + l.height - G), {
|
|
3780
|
+
x: F,
|
|
3781
|
+
y: U,
|
|
3782
|
+
width: W,
|
|
3783
|
+
height: G
|
|
3784
|
+
};
|
|
3785
|
+
}
|
|
3786
|
+
function resizeNorthEast({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3787
|
+
let [T, O] = d, { x: F, y: U, width: W, height: G } = l;
|
|
3788
|
+
return F + W + T > w.x + w.width && (T = w.x + w.width - F - W), U + O < w.y && (O = w.y - U), W += T, U += O, G -= O, x && Math.abs(W / G) > x ? (O = W / x - G, G += O, U -= O, U <= w.y && (G -= w.y - U, W = G * x, F = l.x, U = w.y)) : x && (T = G * x - W, W += T, F + W >= w.x + w.width && (W = w.x + w.width - F, G = W / x, F = w.x + w.width - W, U = l.y + l.height - G)), G < 1 && (G = 1, x && (W = G * x), U = l.y + l.height - G), W < 1 && (W = 1, x && (G = W / x), U = l.y + l.height - G), {
|
|
3789
|
+
x: F,
|
|
3790
|
+
y: U,
|
|
3791
|
+
width: W,
|
|
3792
|
+
height: G
|
|
3793
|
+
};
|
|
3794
|
+
}
|
|
3795
|
+
function resizeSouthWest({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3796
|
+
let [T, O] = d, { x: F, y: U, width: W, height: G } = l;
|
|
3797
|
+
return F + T < w.x && (T = w.x - F), U + G + O > w.y + w.height && (O = w.y + w.height - U - G), F += T, W -= T, G += O, x && Math.abs(W / G) > x ? (O = W / x - G, G += O, U + G >= w.y + w.height && (G = w.y + w.height - U, W = G * x, F = l.x + l.width - W, U = w.y + w.height - G)) : x && (T = G * x - W, W += T, F -= T, F <= w.x && (W -= w.x - F, G = W / x, F = w.x, U = l.y)), G < 1 && (G = 1, x && (W = G * x), F = l.x + l.width - W), W < 1 && (W = 1, x && (G = W / x), F = l.x + l.width - W), {
|
|
3798
|
+
x: F,
|
|
3799
|
+
y: U,
|
|
3800
|
+
width: W,
|
|
3801
|
+
height: G
|
|
3802
|
+
};
|
|
3803
|
+
}
|
|
3804
|
+
function resizeSouthEast({ rect: l, delta: d, aspectRatio: x, imageBox: w }) {
|
|
3805
|
+
let [T, O] = d, { x: F, y: U, width: W, height: G } = l;
|
|
3806
|
+
return F + W + T > w.x + w.width && (T = w.x + w.width - F - W), U + G + O > w.y + w.height && (O = w.y + w.height - U - G), W += T, G += O, x && Math.abs(W / G) > x ? (O = W / x - G, G += O, U + G >= w.y + w.height && (G = w.y + w.height - U, W = G * x, F = l.x, U = w.y + w.height - G)) : x && (T = G * x - W, W += T, F + W >= w.x + w.width && (W = w.x + w.width - F, G = W / x, F = w.x + w.width - W, U = l.y)), G < 1 && (G = 1, x && (W = G * x)), W < 1 && (W = 1, x && (G = W / x)), {
|
|
3807
|
+
x: F,
|
|
3808
|
+
y: U,
|
|
3809
|
+
width: W,
|
|
3810
|
+
height: G
|
|
3811
|
+
};
|
|
3812
|
+
}
|
|
3813
|
+
function resizeRect({ direction: l, ...d }) {
|
|
3814
|
+
switch (l) {
|
|
3815
|
+
case "n": return resizeNorth(d);
|
|
3816
|
+
case "w": return resizeWest(d);
|
|
3817
|
+
case "s": return resizeSouth(d);
|
|
3818
|
+
case "e": return resizeEast(d);
|
|
3819
|
+
case "nw": return resizeNorthWest(d);
|
|
3820
|
+
case "ne": return resizeNorthEast(d);
|
|
3821
|
+
case "sw": return resizeSouthWest(d);
|
|
3822
|
+
case "se": return resizeSouthEast(d);
|
|
3823
|
+
default: return d.rect;
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
function rectContainsPoint(l, [d, x]) {
|
|
3827
|
+
return l.x <= d && d <= l.x + l.width && l.y <= x && x <= l.y + l.height;
|
|
3828
|
+
}
|
|
3829
|
+
function isRectInsideRect(l, d) {
|
|
3830
|
+
return l.x >= d.x && l.y >= d.y && l.x + l.width <= d.x + d.width && l.y + l.height <= d.y + d.height;
|
|
3831
|
+
}
|
|
3832
|
+
function isRectMatchesAspectRatio(l, d) {
|
|
3833
|
+
return Math.abs(l.width / l.height - d) < .1;
|
|
3834
|
+
}
|
|
3835
|
+
function rotateSize({ width: l, height: d }, x) {
|
|
3836
|
+
let w = x / 90 % 2 != 0;
|
|
3837
|
+
return {
|
|
3838
|
+
width: w ? d : l,
|
|
3839
|
+
height: w ? l : d
|
|
3840
|
+
};
|
|
3841
|
+
}
|
|
3842
|
+
function calculateMaxCenteredCropFrame(l, d, x) {
|
|
3843
|
+
let w = l / d, T, O;
|
|
3844
|
+
w > x ? (T = Math.round(d * x), O = d) : (T = l, O = Math.round(l / x));
|
|
3845
|
+
let F = Math.round((l - T) / 2), U = Math.round((d - O) / 2);
|
|
3846
|
+
return F + T > l && (T = l - F), U + O > d && (O = d - U), {
|
|
3847
|
+
x: F,
|
|
3848
|
+
y: U,
|
|
3849
|
+
width: T,
|
|
3850
|
+
height: O
|
|
3851
|
+
};
|
|
3852
|
+
}
|
|
3853
|
+
function roundRect(l) {
|
|
3854
|
+
return {
|
|
3855
|
+
x: Math.round(l.x),
|
|
3856
|
+
y: Math.round(l.y),
|
|
3857
|
+
width: Math.round(l.width),
|
|
3858
|
+
height: Math.round(l.height)
|
|
3859
|
+
};
|
|
3860
|
+
}
|
|
3861
|
+
function clamp(l, d, x) {
|
|
3862
|
+
return Math.min(Math.max(l, d), x);
|
|
3863
|
+
}
|
|
3864
|
+
var EXCLUDED_TYPES = ["free"];
|
|
3865
|
+
const parseCropPreset = (l) => {
|
|
3866
|
+
let d = stringToArray(l);
|
|
3867
|
+
if (!d || d.length === 0) return [];
|
|
3868
|
+
let x = [];
|
|
3869
|
+
for (let l of d) {
|
|
3870
|
+
let d = l.trim();
|
|
3871
|
+
if (!d) continue;
|
|
3872
|
+
let w = d.indexOf(":");
|
|
3873
|
+
if (w === -1 && !EXCLUDED_TYPES.includes(d)) {
|
|
3874
|
+
console.warn(`Invalid crop preset: ${d}`);
|
|
3875
|
+
continue;
|
|
3876
|
+
}
|
|
3877
|
+
let T = Number(d.slice(0, w)), O = Number(d.slice(w + 1));
|
|
3878
|
+
if ((!Number.isFinite(T) || !Number.isFinite(O) || T <= 0 || O <= 0) && !EXCLUDED_TYPES.includes(d)) {
|
|
3879
|
+
console.warn(`Invalid crop preset: ${d}`);
|
|
3880
|
+
continue;
|
|
3881
|
+
}
|
|
3882
|
+
x.push({
|
|
3883
|
+
id: UID.generateFastUid(),
|
|
3884
|
+
type: "aspect-ratio",
|
|
3885
|
+
width: EXCLUDED_TYPES.includes(d) ? 0 : T,
|
|
3886
|
+
height: EXCLUDED_TYPES.includes(d) ? 0 : O,
|
|
3887
|
+
hasFreeform: EXCLUDED_TYPES.includes(d)
|
|
3888
|
+
});
|
|
3889
|
+
}
|
|
3890
|
+
return x;
|
|
3891
|
+
}, getClosestAspectRatio = (l, d, x, w = .1) => {
|
|
3892
|
+
let T = l / d, O = null, F = Infinity;
|
|
3893
|
+
for (let l of x) {
|
|
3894
|
+
let [d, x] = [l.width, l.height], w = d / x, U = Math.abs(T - w);
|
|
3895
|
+
U < F && (F = U, O = l);
|
|
3896
|
+
}
|
|
3897
|
+
if (O) {
|
|
3898
|
+
let [l, d] = [O.width, O.height], x = l / d;
|
|
3899
|
+
if (Math.abs(T - x) / x > w) return null;
|
|
3900
|
+
}
|
|
3901
|
+
return O;
|
|
3902
|
+
};
|
|
3903
|
+
var Icon = class extends LitBlock {
|
|
3904
|
+
constructor(...l) {
|
|
3905
|
+
super(...l), this.name = "", this._resolvedHref = "", this._pluginSvg = null, this._iconHrefResolver = null;
|
|
3906
|
+
}
|
|
3907
|
+
initCallback() {
|
|
3908
|
+
super.initCallback(), this.setAttribute("aria-hidden", "true"), this.subConfigValue("iconHrefResolver", (l) => {
|
|
3909
|
+
this._iconHrefResolver = l, this._updateResolvedHref();
|
|
3910
|
+
});
|
|
3911
|
+
let l = this._sharedInstancesBag.pluginManager;
|
|
3912
|
+
l?.onPluginsChange && (this._unsubscribePlugins = l.onPluginsChange(() => this._updateResolvedHref()));
|
|
3913
|
+
}
|
|
3914
|
+
willUpdate(l) {
|
|
3915
|
+
super.willUpdate(l), l.has("name") && this._updateResolvedHref();
|
|
3916
|
+
}
|
|
3917
|
+
_updateResolvedHref() {
|
|
3918
|
+
if (!this.name) {
|
|
3919
|
+
this._resolvedHref = "", this._pluginSvg = null;
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3922
|
+
let l = this._sharedInstancesBag.pluginManager?.snapshot().icons.find((l) => l.name === this.name);
|
|
3923
|
+
if (l) {
|
|
3924
|
+
this._pluginSvg = l.svg, this._resolvedHref = "";
|
|
3925
|
+
return;
|
|
3926
|
+
}
|
|
3927
|
+
this._pluginSvg = null;
|
|
3928
|
+
let d = `#uc-icon-${this.name}`;
|
|
3929
|
+
this._resolvedHref = this._iconHrefResolver?.(this.name) ?? d;
|
|
3930
|
+
}
|
|
3931
|
+
render() {
|
|
3932
|
+
return this._pluginSvg ? b`${this.yield("", b`${o$2(this._pluginSvg)}`)}` : b`
|
|
3933
|
+
${this.yield("", b`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
3934
|
+
<use href=${this._resolvedHref}></use>
|
|
3935
|
+
</svg>`)}
|
|
3936
|
+
`;
|
|
3937
|
+
}
|
|
3938
|
+
disconnectedCallback() {
|
|
3939
|
+
this._unsubscribePlugins?.(), this._unsubscribePlugins = void 0, super.disconnectedCallback();
|
|
3940
|
+
}
|
|
3941
|
+
};
|
|
3942
|
+
__decorate([n$3({ type: String })], Icon.prototype, "name", void 0), __decorate([r$2()], Icon.prototype, "_resolvedHref", void 0), __decorate([r$2()], Icon.prototype, "_pluginSvg", void 0);
|
|
3943
|
+
/**
|
|
3944
|
+
* @license
|
|
3945
|
+
* Copyright 2020 Google LLC
|
|
3946
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3947
|
+
*/ var { I: t$1 } = j, i$1 = (l) => l, r = (l) => l.strings === void 0, s$1 = () => document.createComment(""), v = (l, d, x) => {
|
|
3948
|
+
let w = l._$AA.parentNode, T = d === void 0 ? l._$AB : d._$AA;
|
|
3949
|
+
if (x === void 0) x = new t$1(w.insertBefore(s$1(), T), w.insertBefore(s$1(), T), l, l.options);
|
|
3950
|
+
else {
|
|
3951
|
+
let d = x._$AB.nextSibling, O = x._$AM, F = O !== l;
|
|
3952
|
+
if (F) {
|
|
3953
|
+
let d;
|
|
3954
|
+
x._$AQ?.(l), x._$AM = l, x._$AP !== void 0 && (d = l._$AU) !== O._$AU && x._$AP(d);
|
|
3955
|
+
}
|
|
3956
|
+
if (d !== T || F) {
|
|
3957
|
+
let l = x._$AA;
|
|
3958
|
+
for (; l !== d;) {
|
|
3959
|
+
let d = i$1(l).nextSibling;
|
|
3960
|
+
i$1(w).insertBefore(l, T), l = d;
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
return x;
|
|
3965
|
+
}, u = (l, d, x = l) => (l._$AI(d, x), l), m = {}, p = (l, d = m) => l._$AH = d, M = (l) => l._$AH, h$2 = (l) => {
|
|
3966
|
+
l._$AR(), l._$AA.remove();
|
|
3967
|
+
}, s = (l, d) => {
|
|
3968
|
+
let x = l._$AN;
|
|
3969
|
+
if (x === void 0) return !1;
|
|
3970
|
+
for (let l of x) l._$AO?.(d, !1), s(l, d);
|
|
3971
|
+
return !0;
|
|
3972
|
+
}, o$1 = (l) => {
|
|
3973
|
+
let d, x;
|
|
3974
|
+
do {
|
|
3975
|
+
if ((d = l._$AM) === void 0) break;
|
|
3976
|
+
x = d._$AN, x.delete(l), l = d;
|
|
3977
|
+
} while (x?.size === 0);
|
|
3978
|
+
}, r$1 = (l) => {
|
|
3979
|
+
for (let d; d = l._$AM; l = d) {
|
|
3980
|
+
let x = d._$AN;
|
|
3981
|
+
if (x === void 0) d._$AN = x = /* @__PURE__ */ new Set();
|
|
3982
|
+
else if (x.has(l)) break;
|
|
3983
|
+
x.add(l), c(d);
|
|
3984
|
+
}
|
|
3985
|
+
};
|
|
3986
|
+
function h$1(l) {
|
|
3987
|
+
this._$AN === void 0 ? this._$AM = l : (o$1(this), this._$AM = l, r$1(this));
|
|
3988
|
+
}
|
|
3989
|
+
function n$1(l, d = !1, x = 0) {
|
|
3990
|
+
let w = this._$AH, T = this._$AN;
|
|
3991
|
+
if (T !== void 0 && T.size !== 0) if (d) if (Array.isArray(w)) for (let l = x; l < w.length; l++) s(w[l], !1), o$1(w[l]);
|
|
3992
|
+
else w != null && (s(w, !1), o$1(w));
|
|
3993
|
+
else s(this, l);
|
|
3994
|
+
}
|
|
3995
|
+
var c = (l) => {
|
|
3996
|
+
l.type == t.CHILD && (l._$AP ??= n$1, l._$AQ ??= h$1);
|
|
3997
|
+
}, f = class extends i {
|
|
3998
|
+
constructor() {
|
|
3999
|
+
super(...arguments), this._$AN = void 0;
|
|
4000
|
+
}
|
|
4001
|
+
_$AT(l, d, x) {
|
|
4002
|
+
super._$AT(l, d, x), r$1(this), this.isConnected = l._$AU;
|
|
4003
|
+
}
|
|
4004
|
+
_$AO(l, d = !0) {
|
|
4005
|
+
l !== this.isConnected && (this.isConnected = l, l ? this.reconnected?.() : this.disconnected?.()), d && (s(this, l), o$1(this));
|
|
4006
|
+
}
|
|
4007
|
+
setValue(l) {
|
|
4008
|
+
if (r(this._$Ct)) this._$Ct._$AI(l, this);
|
|
4009
|
+
else {
|
|
4010
|
+
let d = [...this._$Ct._$AH];
|
|
4011
|
+
d[this._$Ci] = l, this._$Ct._$AI(d, this, 0);
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
disconnected() {}
|
|
4015
|
+
reconnected() {}
|
|
4016
|
+
}, e$1 = () => new h(), h = class {}, o = /* @__PURE__ */ new WeakMap(), n = e(class extends f {
|
|
4017
|
+
render(l) {
|
|
4018
|
+
return A;
|
|
4019
|
+
}
|
|
4020
|
+
update(l, [d]) {
|
|
4021
|
+
let x = d !== this.G;
|
|
4022
|
+
return x && this.G !== void 0 && this.rt(void 0), (x || this.lt !== this.ct) && (this.G = d, this.ht = l.options?.host, this.rt(this.ct = l.element)), A;
|
|
4023
|
+
}
|
|
4024
|
+
rt(l) {
|
|
4025
|
+
if (this.isConnected || (l = void 0), typeof this.G == "function") {
|
|
4026
|
+
let d = this.ht ?? globalThis, x = o.get(d);
|
|
4027
|
+
x === void 0 && (x = /* @__PURE__ */ new WeakMap(), o.set(d, x)), x.get(this.G) !== void 0 && this.G.call(this.ht, void 0), x.set(this.G, l), l !== void 0 && this.G.call(this.ht, l);
|
|
4028
|
+
} else this.G.value = l;
|
|
4029
|
+
}
|
|
4030
|
+
get lt() {
|
|
4031
|
+
return typeof this.G == "function" ? o.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
|
|
4032
|
+
}
|
|
4033
|
+
disconnected() {
|
|
4034
|
+
this.lt === this.ct && this.rt(void 0);
|
|
4035
|
+
}
|
|
4036
|
+
reconnected() {
|
|
4037
|
+
this.rt(this.ct);
|
|
4038
|
+
}
|
|
4039
|
+
});
|
|
4040
|
+
export { CancelError as $, MIN_CROP_SIZE as A, __decorate as At, i as B, b as Bt, setSvgNodeAttrs as C, createOriginalUrl as Ct, GUIDE_STROKE_WIDTH as D, defineLocale as Dt, CROP_PADDING as E, sharedConfigKey as Et, warnOnce as F, LightDomMixin as Ft, applyTemplateData as G, LitBlock as H, CameraSourceEvents as I, CssDataMixin as It, EventType as J, PACKAGE_NAME as K, CameraSourceTypes as L, i$2 as Lt, THUMB_CORNER_SIZE as M, r$2 as Mt, THUMB_SIDE_SIZE as N, n$3 as Nt, GUIDE_THIRD as O, UID as Ot, THUMB_STROKE_WIDTH as P, RegisterableElementMixin as Pt, uploaderBlockCtx as Q, o$2 as R, A as Rt, roundRect as S, createCdnUrlModifiers as St, thumbCursor as T, extractUuid as Tt, createL10n as U, t as V, PubSub as Vt, getPluralForm as W, activityBlockCtx as X, InternalEventType as Y, solutionBlockCtx as Z, isRectMatchesAspectRatio as _, COMMON_OPERATIONS as _t, p as a, uploadFile as at, resizeRect as b, stringToArray as bt, Icon as c, SharedInstance as ct, calculateMaxCenteredCropFrame as d, ALL_COLOR_OPERATIONS as dt, NetworkError as et, clamp as f, ALL_CROP_OPERATIONS as ft, isRectInsideRect as g, TabId as gt, createSvgNode as h, COLOR_OPERATIONS_CONFIG as ht, h$2 as i, getUserAgent$1 as it, MIN_INTERACTION_SIZE as j, debounce as jt, MAX_INTERACTION_SIZE as k, SymbioteMixin as kt, getClosestAspectRatio as l, DEFAULT_CDN_CNAME as lt, cornerPath as m, ALL_TABS as mt, n, UploadError as nt, u as o, uploadFileGroup as ot, constraintRect as p, ALL_FILTERS as pt, PACKAGE_VERSION as q, M as r, UploadcareError as rt, v as s, ModalEvents as st, e$1 as t, Queue as tt, parseCropPreset as u, initialConfig as ut, moveRect as v, operationsToTransformations as vt, sidePath as w, extractOperations as wt, rotateSize as x, createCdnUrl as xt, rectContainsPoint as y, transformationsToOperations as yt, e as z, E as zt };
|