@heartlandone/vega 2.89.0 → 2.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-4872f4e6.js → app-globals-08924736.js} +9 -7
- package/dist/cjs/{code-block-7c49d175.js → code-block-89850671.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-aae22ddf.js → component-value-history-controller-slimmer.abstract-a8da4087.js} +3 -3
- package/dist/cjs/{content-state-76b81780.js → content-state-e1c3efe6.js} +2 -2
- package/dist/cjs/{date-required-rule-71f71b32.js → date-required-rule-3437acbc.js} +1 -1
- package/dist/cjs/{design-token-c80d3f32.js → design-token-939bf72c.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-e95427b5.js → element-appender-slimmer-14e85a91.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-430b4f02.js → form-field-controller-slimmer-c4ebee27.js} +1 -1
- package/dist/cjs/{image-annotation-action-7959fd77.js → image-annotation-action-f86690fd.js} +26 -2
- package/dist/cjs/index.cjs.js +19 -19
- package/dist/cjs/{inject-keyboard-manager-3ccf1cb6.js → inject-keyboard-manager-743de047.js} +1 -1
- package/dist/cjs/{internal-translation-controller-5582d789.js → internal-translation-controller-9785d4e8.js} +4 -0
- package/dist/cjs/{keyboard-manager-5babfda8.js → keyboard-manager-5396083a.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-a73354ca.js → keyboard-manager-slimmer-eedcfbc8.js} +1 -1
- package/dist/cjs/link-extension-dafeeed0.js +583 -0
- package/dist/cjs/loader.cjs.js +11 -12
- package/dist/cjs/{month-view-generator-43e75062.js → month-view-generator-c7492e06.js} +1 -1
- package/dist/cjs/{public-rules-b23ab52d.js → public-rules-b032050f.js} +7 -7
- package/dist/cjs/{range-abe1b989.js → range-efdf6f78.js} +1 -1
- package/dist/cjs/{replace-selected-text-action-ef079fed.js → replace-selected-text-action-0f7b7c78.js} +1 -1
- package/dist/cjs/{responsive-format-facade-cc368403.js → responsive-format-facade-d112aa9f.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-bbd727a2.js → rich-text-editor-required-rule-86d9cd4d.js} +1 -1
- package/dist/cjs/{split-cell-operation-b1fe91b5.js → split-cell-operation-b41344bd.js} +3 -3
- package/dist/cjs/{state-border-formatter-398134c1.js → state-border-formatter-c3c9b90d.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-67421e2b.js → string-format-strategy.abstract-d51050cd.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-e84530b9.js → string-input-formatter-slimmer-23fdb50e.js} +1 -1
- package/dist/cjs/{string-mask-strategy-f9806f9b.js → string-mask-strategy-10fe0f6d.js} +2 -2
- package/dist/cjs/{style-formatter-da3a556b.js → style-formatter-11c95331.js} +2 -2
- package/dist/cjs/{time-required-rule-618109fa.js → time-required-rule-2fd7c828.js} +1 -1
- package/dist/cjs/{token-extension-dfee303a.js → token-extension-2e3e1631.js} +125 -498
- package/dist/cjs/{translation-slimmer-1a7a2b6d.js → translation-slimmer-e8549aff.js} +17 -1
- package/dist/cjs/{type-guard-474dec0d.js → type-guard-9917b11f.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-00c18527.js → valid-credit-card-number-rule-8c541bcd.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +3 -3
- package/dist/cjs/vega-calendar_4.cjs.entry.js +6 -6
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +14 -7
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-dialog_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +3 -3
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +17 -7
- package/dist/cjs/vega-input-numeric.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-passcode.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
- package/dist/cjs/vega-input.cjs.entry.js +6 -6
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +17 -10
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +63 -31
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +65 -22
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +18 -5
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +8 -5
- package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega.cjs.js +11 -12
- package/dist/collection/components/vega-checkbox/vega-checkbox-group/vega-checkbox-group.css +8 -11
- package/dist/collection/components/vega-checkbox/vega-checkbox-group/vega-checkbox-group.js +35 -7
- package/dist/collection/components/vega-field-label/vega-field-label.js +2 -2
- package/dist/collection/components/vega-input-credit-card/vega-input-credit-card.js +35 -1
- package/dist/collection/components/vega-radio/vega-radio-group/vega-radio-group.css +8 -11
- package/dist/collection/components/vega-radio/vega-radio-group/vega-radio-group.js +35 -7
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +36 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +15 -12
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.js +30 -16
- package/dist/collection/components/vega-rich-text-editor/extensions/line-height/line-height-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/link/link-extension.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/link/type.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/link/utils.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/rte-extension-state-store.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/public-api.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +39 -1
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.js +13 -4
- package/dist/collection/components/vega-selection-chip/vega-selection-chip-group/slimmers/renderers/vega-selection-chip-group-renderer.js +4 -1
- package/dist/collection/components/vega-selection-chip/vega-selection-chip-group/vega-selection-chip-group.js +34 -0
- package/dist/collection/components/vega-tab-group/slimmers/vega-tab-group/controllers/vega-tab-group-pages-controller.js +4 -2
- package/dist/collection/components/vega-tab-group/vega-tab-group.js +5 -4
- package/dist/collection/global/scripts/before-vega-load.js +2 -0
- package/dist/collection/helpers/slimmers/translation/translation-slimmer.js +16 -0
- package/dist/collection/helpers/translation/locales/en.js +4 -0
- package/dist/esm/{app-globals-081bbfd9.js → app-globals-a4134d21.js} +9 -7
- package/dist/esm/{code-block-17f596fc.js → code-block-9a17d89b.js} +2 -2
- package/dist/esm/{component-value-history-controller-slimmer.abstract-21e9126a.js → component-value-history-controller-slimmer.abstract-a64c3678.js} +3 -3
- package/dist/esm/{content-state-96741bb0.js → content-state-d59b4560.js} +3 -3
- package/dist/esm/{date-required-rule-d6ce832c.js → date-required-rule-cb960229.js} +1 -1
- package/dist/esm/{design-token-0a575bf2.js → design-token-f73ebce9.js} +3 -3
- package/dist/esm/{element-appender-slimmer-44bbb5c6.js → element-appender-slimmer-c62cf540.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-03894a51.js → form-field-controller-slimmer-514a3195.js} +1 -1
- package/dist/esm/{image-annotation-action-e8ab7b64.js → image-annotation-action-f4ea265c.js} +26 -3
- package/dist/esm/index.js +16 -17
- package/dist/esm/{inject-keyboard-manager-e5874185.js → inject-keyboard-manager-6522df5c.js} +1 -1
- package/dist/esm/{internal-translation-controller-84958bc9.js → internal-translation-controller-653bd7e3.js} +4 -0
- package/dist/esm/{keyboard-manager-404b9c17.js → keyboard-manager-9615fa9b.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-c8fcfe60.js → keyboard-manager-slimmer-21bdc3a4.js} +1 -1
- package/dist/esm/link-extension-be164793.js +576 -0
- package/dist/esm/loader.js +11 -12
- package/dist/esm/{month-view-generator-d341fa5a.js → month-view-generator-1b7c9bb8.js} +1 -1
- package/dist/esm/{public-rules-09387dcf.js → public-rules-58f31834.js} +7 -7
- package/dist/esm/{range-47d9f95e.js → range-1c1c20fa.js} +1 -1
- package/dist/esm/{replace-selected-text-action-a217dc89.js → replace-selected-text-action-1abc5200.js} +1 -1
- package/dist/esm/{responsive-format-facade-51c0c2e1.js → responsive-format-facade-12697af2.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-cca16fd0.js → rich-text-editor-required-rule-050d292b.js} +1 -1
- package/dist/esm/{split-cell-operation-ddde4106.js → split-cell-operation-8251d2a1.js} +3 -3
- package/dist/esm/{state-border-formatter-50394e9c.js → state-border-formatter-55cee24d.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-de17b899.js → string-format-strategy.abstract-14c1e874.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-c3d483ef.js → string-input-formatter-slimmer-ec297247.js} +1 -1
- package/dist/esm/{string-mask-strategy-87efdb9e.js → string-mask-strategy-18760123.js} +2 -2
- package/dist/esm/{style-formatter-c20c1988.js → style-formatter-6073ae27.js} +2 -2
- package/dist/esm/{time-required-rule-026c17a1.js → time-required-rule-9b775d24.js} +1 -1
- package/dist/esm/{token-extension-76323d76.js → token-extension-6cb7dcb2.js} +58 -429
- package/dist/esm/{translation-slimmer-7f195ba8.js → translation-slimmer-d32eb861.js} +17 -1
- package/dist/esm/{type-guard-30eec79c.js → type-guard-fd1f4760.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-1ac471e8.js → valid-credit-card-number-rule-dfd3e0a6.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +3 -3
- package/dist/esm/vega-calendar_4.entry.js +6 -6
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +14 -7
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-color-swatch-picker.entry.js +3 -3
- package/dist/esm/vega-color-swatch.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +8 -8
- package/dist/esm/vega-date-picker_2.entry.js +13 -13
- package/dist/esm/vega-dialog_2.entry.js +3 -3
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +7 -7
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +3 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +3 -3
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +5 -5
- package/dist/esm/vega-input-credit-card.entry.js +17 -7
- package/dist/esm/vega-input-numeric.entry.js +5 -5
- package/dist/esm/vega-input-passcode.entry.js +5 -5
- package/dist/esm/vega-input-phone-number.entry.js +4 -4
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +5 -5
- package/dist/esm/vega-input.entry.js +6 -6
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +8 -8
- package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
- package/dist/esm/vega-radio_2.entry.js +17 -10
- package/dist/esm/vega-rich-text-content.entry.js +40 -8
- package/dist/esm/vega-rich-text-editor_4.entry.js +64 -21
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-selection-chip_2.entry.js +18 -5
- package/dist/esm/vega-selection-tile_2.entry.js +2 -2
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-tab-group_2.entry.js +8 -5
- package/dist/esm/vega-table_11.entry.js +4 -4
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +6 -6
- package/dist/esm/vega.js +11 -12
- package/dist/sri/vega-sri-manifest.json +302 -306
- package/dist/types/components/vega-checkbox/vega-checkbox-group/vega-checkbox-group.d.ts +10 -1
- package/dist/types/components/vega-input-credit-card/vega-input-credit-card.d.ts +10 -0
- package/dist/types/components/vega-radio/vega-radio-group/vega-radio-group.d.ts +10 -1
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +8 -5
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.d.ts +16 -12
- package/dist/types/components/vega-rich-text-editor/extensions/link/link-extension.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/link/type.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/link/utils.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/rte-extension-state-store.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.d.ts +1 -0
- package/dist/types/components/vega-selection-chip/vega-selection-chip-group/slimmers/renderers/vega-selection-chip-group-renderer.d.ts +1 -0
- package/dist/types/components/vega-selection-chip/vega-selection-chip-group/vega-selection-chip-group.d.ts +10 -0
- package/dist/types/components/vega-tab-group/slimmers/vega-tab-group/controllers/vega-tab-group-pages-controller.d.ts +3 -2
- package/dist/types/components/vega-tab-group/vega-tab-group.d.ts +4 -3
- package/dist/types/components.d.ts +50 -2
- package/dist/types/helpers/slimmers/translation/translation-slimmer.d.ts +11 -0
- package/dist/types/helpers/translation/interface.d.ts +4 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-02492864.entry.js +1 -0
- package/dist/vega/{p-df3a649c.entry.js → p-0278cd2b.entry.js} +1 -1
- package/dist/vega/{p-630cd479.js → p-0542b8ac.js} +1 -1
- package/dist/vega/p-0a1c7f80.js +1 -0
- package/dist/vega/{p-b9bd85d6.entry.js → p-0cc4a052.entry.js} +1 -1
- package/dist/vega/{p-976536c7.entry.js → p-1b4abd76.entry.js} +1 -1
- package/dist/vega/{p-efe6e4e6.entry.js → p-1ee185d9.entry.js} +1 -1
- package/dist/vega/{p-c3be0c29.entry.js → p-203f4ce9.entry.js} +1 -1
- package/dist/vega/p-2620a164.js +1 -0
- package/dist/vega/{p-2abdca42.js → p-277c306b.js} +1 -1
- package/dist/vega/{p-2c5352fe.entry.js → p-285e5e52.entry.js} +1 -1
- package/dist/vega/p-2c7e1bcb.js +1 -0
- package/dist/vega/{p-1ab4c08d.js → p-30487f0e.js} +1 -1
- package/dist/vega/{p-c016b230.entry.js → p-30a6b7aa.entry.js} +1 -1
- package/dist/vega/p-350d1b75.entry.js +1 -0
- package/dist/vega/{p-4c6baf92.entry.js → p-355ea330.entry.js} +1 -1
- package/dist/vega/{p-50e7020c.js → p-35d617d5.js} +1 -1
- package/dist/vega/{p-6c484462.entry.js → p-3755d8d3.entry.js} +1 -1
- package/dist/vega/{p-61536fcf.entry.js → p-3e956269.entry.js} +1 -1
- package/dist/vega/{p-fae4d64e.js → p-3ed6a602.js} +1 -1
- package/dist/vega/{p-a0705cd0.entry.js → p-4386625c.entry.js} +1 -1
- package/dist/vega/{p-b66d46ce.js → p-44f39eee.js} +1 -1
- package/dist/vega/{p-df71c830.entry.js → p-44f81987.entry.js} +1 -1
- package/dist/vega/{p-d93574dd.entry.js → p-456890f5.entry.js} +1 -1
- package/dist/vega/p-465590d1.entry.js +1 -0
- package/dist/vega/{p-f764b62e.entry.js → p-47ffdc0f.entry.js} +1 -1
- package/dist/vega/p-4fdd0a71.js +1 -0
- package/dist/vega/{p-9a562813.entry.js → p-54141828.entry.js} +1 -1
- package/dist/vega/{p-35e800ac.js → p-566ba295.js} +1 -1
- package/dist/vega/{p-baef217a.entry.js → p-581d89bb.entry.js} +1 -1
- package/dist/vega/p-5f048811.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-8ce92f5f.entry.js → p-616d7096.entry.js} +1 -1
- package/dist/vega/{p-dbb02b32.entry.js → p-6528739f.entry.js} +1 -1
- package/dist/vega/{p-b3b22e36.entry.js → p-667c980d.entry.js} +1 -1
- package/dist/vega/{p-f597b65e.entry.js → p-6845ed5c.entry.js} +1 -1
- package/dist/vega/p-6cedb325.js +1 -0
- package/dist/vega/{p-78a6e741.entry.js → p-6d99a0b3.entry.js} +1 -1
- package/dist/vega/{p-43af604c.entry.js → p-6fec4d46.entry.js} +1 -1
- package/dist/vega/{p-337440ce.entry.js → p-716a393e.entry.js} +1 -1
- package/dist/vega/p-73ce8fef.js +1 -0
- package/dist/vega/p-788a7a5a.js +1 -0
- package/dist/vega/{p-ed0cc518.entry.js → p-7fe292af.entry.js} +1 -1
- package/dist/vega/{p-ad89f499.js → p-820ff54c.js} +1 -1
- package/dist/vega/p-82c133aa.js +1 -0
- package/dist/vega/{p-f7e8081e.js → p-844b7826.js} +1 -1
- package/dist/vega/{p-93cbc231.entry.js → p-850ea38b.entry.js} +1 -1
- package/dist/vega/p-85dcd07b.js +3 -0
- package/dist/vega/{p-3a49089e.js → p-881622fd.js} +1 -1
- package/dist/vega/{p-6a3ea3f0.entry.js → p-88c29aae.entry.js} +1 -1
- package/dist/vega/{p-a9b6ce74.js → p-8a054a13.js} +1 -1
- package/dist/vega/{p-bd5566e3.entry.js → p-8d9c4338.entry.js} +1 -1
- package/dist/vega/{p-26a54a73.entry.js → p-939c486f.entry.js} +1 -1
- package/dist/vega/{p-76454c9a.js → p-97e7da55.js} +1 -1
- package/dist/vega/{p-89d55444.entry.js → p-99545fd7.entry.js} +1 -1
- package/dist/vega/{p-157a2459.entry.js → p-99ea0fa0.entry.js} +1 -1
- package/dist/vega/{p-be6c1415.js → p-a809b33a.js} +1 -1
- package/dist/vega/{p-8865613a.entry.js → p-a9a70696.entry.js} +1 -1
- package/dist/vega/{p-9cb92fa3.entry.js → p-aae71499.entry.js} +1 -1
- package/dist/vega/{p-b2488adb.js → p-b0f55f5f.js} +1 -1
- package/dist/vega/{p-09deb867.entry.js → p-b5c08306.entry.js} +1 -1
- package/dist/vega/{p-c91e0a43.js → p-b7c90543.js} +1 -1
- package/dist/vega/{p-fc0ce3b5.entry.js → p-bcd3bd79.entry.js} +1 -1
- package/dist/vega/{p-8457b6b7.entry.js → p-bce9f489.entry.js} +1 -1
- package/dist/vega/{p-57b34bf9.entry.js → p-c0a6ed53.entry.js} +1 -1
- package/dist/vega/{p-48ea74b5.entry.js → p-c1c5bd2c.entry.js} +1 -1
- package/dist/vega/{p-f7cab150.entry.js → p-c5621f60.entry.js} +1 -1
- package/dist/vega/{p-94a064a3.js → p-c596bb49.js} +1 -1
- package/dist/vega/{p-dd529875.js → p-c9c42a07.js} +1 -1
- package/dist/vega/{p-d1cc3544.entry.js → p-d0e7c14b.entry.js} +1 -1
- package/dist/vega/{p-cdde6e64.entry.js → p-d6422004.entry.js} +1 -1
- package/dist/vega/{p-1e68e217.entry.js → p-d76cb9da.entry.js} +1 -1
- package/dist/vega/{p-c4bd6cf8.entry.js → p-d871e8eb.entry.js} +1 -1
- package/dist/vega/p-d905159c.entry.js +1 -0
- package/dist/vega/{p-285b161c.entry.js → p-dfda6e01.entry.js} +1 -1
- package/dist/vega/{p-3390bb20.js → p-e30a4f3e.js} +1 -1
- package/dist/vega/{p-059ba5f5.entry.js → p-e8c5a446.entry.js} +1 -1
- package/dist/vega/{p-091fbc35.js → p-eb927e2b.js} +1 -1
- package/dist/vega/{p-fbde6153.js → p-ecea4d24.js} +1 -1
- package/dist/vega/{p-44d2f9e7.entry.js → p-ed1dbc98.entry.js} +1 -1
- package/dist/vega/p-f0b99c3a.entry.js +1 -0
- package/dist/vega/{p-363e453b.js → p-f0d6e2f2.js} +1 -1
- package/dist/vega/{p-4b34df4c.entry.js → p-f251a907.entry.js} +1 -1
- package/dist/vega/{p-9a35a34f.entry.js → p-f5c8024e.entry.js} +1 -1
- package/dist/vega/{p-fa398acc.entry.js → p-f70cfac5.entry.js} +1 -1
- package/dist/vega/p-f830deb8.js +1 -0
- package/dist/vega/{p-2f2201d6.entry.js → p-f9ae396b.entry.js} +1 -1
- package/dist/vega/{p-e80e7cd9.entry.js → p-fd2a49be.entry.js} +1 -1
- package/dist/vega/{p-3ef9c69d.entry.js → p-fe573f85.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/base-renderer-0a3b62b7.js +0 -9
- package/dist/cjs/dto-renderer-manager-7eb5c5ce.js +0 -98
- package/dist/esm/base-renderer-101f6d04.js +0 -7
- package/dist/esm/dto-renderer-manager-abc7eb5f.js +0 -96
- package/dist/vega/p-2e86aee5.js +0 -1
- package/dist/vega/p-3a5737fa.js +0 -1
- package/dist/vega/p-5f09aba8.js +0 -1
- package/dist/vega/p-5fd29f29.entry.js +0 -1
- package/dist/vega/p-66b2a285.entry.js +0 -1
- package/dist/vega/p-73508c24.js +0 -1
- package/dist/vega/p-7fbd11b0.js +0 -1
- package/dist/vega/p-894fb9c9.entry.js +0 -1
- package/dist/vega/p-89947a43.js +0 -1
- package/dist/vega/p-8a3d12e6.js +0 -1
- package/dist/vega/p-a18d280f.js +0 -3
- package/dist/vega/p-a7b5f497.js +0 -1
- package/dist/vega/p-b6c3ce6d.js +0 -1
- package/dist/vega/p-ca4773c3.entry.js +0 -1
- package/dist/vega/p-efe48ed5.entry.js +0 -1
- package/dist/vega/p-f7c6af07.js +0 -1
- package/dist/vega/p-ff24b342.entry.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{d as t,b as e,R as n,e as s,A as r,T as i,t as a,H as o,u as l,i as c,v as h,w as u,x as d,y as w,z as p,I as m,k as f,D as g,g as x,B as T,E as b,a as O,q as y,F as E,l as A,p as k,s as H,G as N,N as j,o as C,J as B,K as v,j as S,L as I,M as R,S as L,O as $,P as D,U as M,Q as P,W as F,X as z,Y as U,Z as V,_ as W,$ as G,a0 as J,a1 as K,r as Y,a2 as X,n as Q,a3 as Z,a4 as _,a5 as q,m as tt,a6 as et,a7 as nt,a8 as st,a9 as rt}from"./p-35d617d5.js";import{g as it}from"./p-8b5d3a52.js";import{i as at}from"./p-b0f55f5f.js";import{C as ot}from"./p-2d0d575f.js";import{d as lt}from"./p-526e3634.js";import{c as ct,d as ht}from"./p-3a93730e.js";import{r as ut,i as dt}from"./p-528748fa.js";import{c as wt}from"./p-a841cf13.js";import{L as pt}from"./p-6e1ab235.js";class mt extends e{constructor(t,e,n){super(t,"list-item",n),this.dtoName=mt.dtoName,this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const s=new mt(t.id,void 0,e);s.children=t.nodes.map((t=>n.from(t,s,e))),t.children&&(s.nestList=t.children.map((t=>{const e=gt.from(t);return e.parent=s,e})));const{annotations:r}=t;return r&&Object.entries(r).forEach((([t,e])=>{const n=this.createAnnotationEntity(t,e);at(n)&&s.annotationMap.set(...n)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(t){return[`<li${super.generateAttributeString(t)}>`,this.getChildrenHtml(t),"</li>"].join("")}cloneWithNodes(t){const e=new mt(it());return e.children=[],e.apply(new s(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}createNewListItem(){return new mt(it())}clone(t){var e;const n=new mt(this.id);return n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n.nestList=null===(e=this.nestList)||void 0===e?void 0:e.map((t=>t.clone(n))),n.parent=t,n}}r.register(i.name,mt.name,new a),r.register(o.name,mt.name,new l),r.register(c.LINE_BREAK_SINGLE_BLOCK,mt.name,new h),r.register(c.LINE_BREAK_MULTIPLE_BLOCKS,mt.name,new u),r.register(c.DELETE_NEST_LIST,mt.name,new class extends t{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),r.register(c.SPLIT_BLOCK_WITH_NODE,mt.name,new d),r.register(c.REPLACE_CHILD_NODES,mt.name,new w),r.register(c.REPLACE_NEST_LIST,mt.name,new class extends t{handleAction(t,e){t.newList.forEach((t=>{t.parent=e})),e.nestList=t.newList}}),r.register(c.MERGE_TWO_BLOCKS_NODES,mt.name,new p),r.register(c.INSERT_IMAGE_TO_BLOCK,mt.name,new class extends t{handleAction(t,e){e.parent.apply(t)}}),mt.dtoName="RTEListItemBlock";class ft extends T{constructor(){super(...arguments),this.type=b.LIST}static getDefaultStyles(){return{paddingLeft:"8px",marginLeft:"16px"}}renderStyle(t){return(null==t?void 0:t.standalone)?ft.getDefaultStyles():null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new ft}toJSON(){}}class gt extends O{constructor(t,e,n){super(t),this.dtoName=gt.dtoName,this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(b.LIST,new ft)}static from(t,e={autoMatchFormat:!0}){const n=new gt(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);at(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=mt.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return A.from(e);case"customClass":return E.from(e);case"customStyle":return y.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag();return[`<${e}${super.generateAttributeString(t)}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(t){const e=new gt(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}r.register(c.TRANSFORM_LIST_BLOCK,gt.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,r=e.parent.createList(t.listType);if(n.every((t=>t.parent===e)))r.apply(new s(e.children)),e.parent.apply(new m(e,r)),e.parent.apply(new f(e)),n.forEach((t=>t.children.map((t=>t.apply(new g)))));else{const n=t.selectedBlocks.map((t=>e.parent.toListItem(t)));r.apply(new s(n)),e.parent.apply(new m(e,r)),t.selectedBlocks.forEach((t=>{t.parent.apply(new f(t))})),0===e.children.length&&e.parent.apply(new f(e))}}}),r.register(c.TRANSFORM_PARAGRAPH_BLOCK,gt.name,new class extends t{handleAction(t,e){let n=!1,r=!1;const i=t.selectedBlocks,a=i.map((t=>(t.children.map((t=>t.apply(new g))),t===e.children[0]&&(n=!0),t===e.children[e.children.length-1]&&(r=!0),this.toParagraph(t))));if(n)e.parent.apply(new x(e,...a));else if(r)e.parent.apply(new m(e,...a));else{const t=e.children.indexOf(i[0]),n=e.children.indexOf(i[i.length-1]),r=e.parent.createList(e.type);r.apply(new s(e.children.slice(0,t)));const o=e.parent.createList(e.type);o.apply(new s(e.children.slice(n+1))),e.parent.apply(new x(e,r,...a,o)),e.parent.apply(new f(e))}i.map((t=>{e.apply(new f(t))})),0===e.children.length&&e.parent.apply(new f(e))}toParagraph(t){const n=new e(it(),"paragraph");return n.apply(new s(t.children)),n.annotationMap=t.annotationMap,n}}),r.register(c.INSERT_IMAGE_TO_BLOCK,gt.name,new class extends t{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new m(e,t.imageBlockToBeInserted):t)}}),gt.dtoName="RTEListBlock";class xt{}class Tt{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(t={autoMatchFormat:!0,skipCustomAnnotations:!0}){const e=this.currentStrategy.handle(this.currentElements,t);return this.childrenOutput.length>0&&e&&this.currentStrategy.appendChildBlocks(e,this.childrenOutput.map((e=>e.toDto(t))).filter(at)),e}}const bt=new class{constructor(){this.elementToBlockStrategies=[],this.elementToNodeStrategies=[]}registerElementToBlockStrategy(t){this.hasDuplicateStrategy(t,this.elementToBlockStrategies)||this.elementToBlockStrategies.unshift(t)}registerElementToNodeStrategy(t){this.hasDuplicateStrategy(t,this.elementToNodeStrategies)||this.elementToNodeStrategies.unshift(t)}getElementToBlockStrategies(){return this.elementToBlockStrategies}getElementToNodeStrategies(){return this.elementToNodeStrategies}hasDuplicateStrategy(t,e){return e.includes(t)}},Ot=new class{process(t,e={autoMatchFormat:!0,skipCustomAnnotations:!0}){const n=this.getElementToBlockStrategies(),s=[];for(let r=0;r<t.length;r++){if(this.isInvalidElement(t[r],e))continue;let i=0;for(const a of n)if(i=a.canHandle(t,r,e),i>0){const n=t.slice(r,r+i),o=new Tt(a,n);1===i&&a.shouldProceedToElementChildren()&&o.setChildrenOutput(this.process(Array.from(n[0].childNodes),e)),s.push(o),r+=i-1;break}if(0===i&&r<t.length){const n=Array.from(t[r].childNodes),i=this.process(Array.from(n),e);i.length>0&&s.push(...i)}}return s}isInvalidElement(t,e){return t.nodeType===Node.COMMENT_NODE||!1!==e.autoMatchFormat&&["META","STYLE"].includes(t.nodeName)}getElementToBlockStrategies(){return bt.getElementToBlockStrategies()}};class yt extends t{handleAction(t,e){const n=t.entityToBeAppended;e.children&&(n.forEach((t=>{t.parent=e})),e.children=e.children.concat(n))}}class Et extends t{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[...t.childrenToBeInserted,t.referChildren])}replaceElementWithElements(t,e,n){t.children&&(n.forEach((e=>{e.parent=t})),t.children=t.children.flatMap((t=>t===e?n:t)))}}class At extends Et{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[t.referChildren,...t.childrenToBeInserted])}}class kt extends N{constructor(t,e){super(),this.type=j.IMAGE,this.size=t,this.alt=e}static from(t,e){return[j.IMAGE,new kt(t,e)]}static getDefaultStyles(){return{verticalAlign:"bottom"}}toJSON(){return at(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new kt(this.size,this.alt)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.size?`v-rte--image-size-${this.size}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e=kt.getDefaultStyles();switch(this.size){case"sm":return Object.assign(Object.assign({},e),{width:"25%"});case"md":return Object.assign(Object.assign({},e),{width:"50%"});case"lg":return Object.assign(Object.assign({},e),{width:"100%"})}}}kt.BASE_STYLES={verticalAlign:"bottom"};class Ht extends C{constructor(t,e,n,s){super(t,s),this.dtoName=Ht.dtoName,this.type=B.IMAGE,this.url=e,this.parent=n}static from(t,e,n={autoMatchFormat:!0}){const s=new Ht(t.id,t.url,e),r=!!n.autoMatchFormat,i=Object.assign({},t.annotations),{size:a}=i,o=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(i,["size"]),l=Object.assign(Object.assign({},o),{size:null!=a?a:r?"md":void 0});return s.annotationMap=new Map(Object.keys(l).map((t=>"size"===t||"alt"===t?kt.from(l.size,l.alt):this.createAnnotationEntity(t,l[t]))).filter(at)),s}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof kt||t instanceof v)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return""==t.alt&&delete t.alt,Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"image",url:this.url})}clone(t){return new Ht(this.id,this.url,t,super.cloneAnnotations())}toHtml(t){const e=this.getAnnotationByType(j.IMAGE);return`<img${super.generateAttributeString(t,...[e&&e.alt?`alt="${e.alt}"`:null,`src="${this.url}"`,e&&e.size?`data-size="${e.size}"`:null].filter(at))}>`}doAnnotationActionApply(t){const e=r.get(S.name,Ht.name);e&&e.execute(t,this)}doModifyActionApply(t){r.executeTheStrategy(t,this)}}r.register(c.UPDATE_IMAGE_NODE_URL,Ht.name,new class extends t{handleAction(t,e){e.url=t.url}}),r.register(S.name,Ht.name,new class extends t{handleAction(t,e){const n=t.toAnnotation();e.annotationMap.set(n.type,n)}}),Ht.dtoName="RTEImageNode";class Nt extends R{constructor(t,e){super(),this.type=c.INSERT_NEW_PARAGRAPH,this.startContainerNode=t,this.startOffset=e}}class jt extends O{constructor(t){super(t),this.dtoName=jt.dtoName,this.type="image",this.children=[]}static from(t,e={autoMatchFormat:!0}){const n=new jt(t.id),{annotations:s}=t;return n.children=t.nodes.map((t=>Ht.from(t,n,e))),s&&super.convertAnnotationsToMap(n.annotationMap,s),n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=super.generateAttributeString(t),n=this.children.map((e=>e.toHtml(t))).join("");return super.shouldRenderAsInternalWrapper()?n:[`<div${e}>`,n,"</div>"].join("")}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.url.length>0))}getLastNode(){return this.children[this.children.length-1]}createNewImageBlock(){return new jt(it())}clone(t){const e=new jt(this.id);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}}r.register(c.MERGE_TWO_BLOCKS_NODES,jt.name,new p),r.register(c.REPLACE_CHILD_NODES,jt.name,new w),r.register(c.SPLIT_BLOCK_WITH_NODE,jt.name,new class extends t{handleAction(t,e){t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode,e)}splitImageNodes(t,e,n){const s=n.children.indexOf(t);if(s>-1){const t=n.children.slice(0,s+e),r=n.children.slice(s+e);n.apply(new I(t));const i=this.cloneWithNodes(r,n);return n.parent.apply(new m(n,i)),i}}cloneWithNodes(t,e){const n=e.createNewImageBlock();return n.children=[],n.apply(new s(t)),n}}),r.register(c.LINE_BREAK_SINGLE_BLOCK,jt.name,new class extends t{handleAction(t,e){const n=new Nt(t.startContainerNode,t.startOffset);e.apply(n);const s=n.newBlock;s&&(t.lineBreakNode=s.children[0])}}),r.register(c.LINE_BREAK_MULTIPLE_BLOCKS,jt.name,new class extends t{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,r){const i=e.from({id:it(),type:"paragraph",nodes:[{id:it(),type:"text",text:"\n"}]});r.parent.apply(new m(r,i));const a=this.concatBlocksNodes(t.slice(1));return(0===a.length||a[0]&&""===a[0].text)&&a.push(new n(it(),"\n",i)),i.apply(new s(a)),i.children[0]}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new f(t)))})),e}}),r.register(c.INSERT_IMAGE_TO_BLOCK,jt.name,new class extends t{handleAction(t,e){const n=t.splitPointNode,r=t.startOffsetOfNode,i=t.imageBlockToBeInserted;e.children.length<1?e.apply(new s(i.children)):this.isCaretPositionAtBlockEnd(e,n,r)?e.parent.apply(new m(e,i)):this.isCaretPositionAtBlockStart(e,n,r)?e.parent.apply(new x(e,i)):(e.apply(new L(n,r)),e.parent.apply(new m(e,i)))}}),r.register(o.name,jt.name,new l),jt.dtoName="RTEImageBlock";class Ct extends O{constructor(t,e){super(t),this.dtoName=Ct.dtoName,this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new Ct(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=this.generateBlockChildren(t.children,e,n),n}clone(t){const e=new Ct(this.id,this.htmlTag);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return!0}toHtml(t){const e=this.htmlTag,n=super.generateAttributeString(t);return $.has(this.htmlTag)?`<${e}${n}>`:[`<${e}${n}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}Ct.dtoName="RTEHtmlBlock";class Bt extends R{constructor(t){super(),this.type=c.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class vt extends D{handleAction(t,e){const{startContainerNode:n}=t;n.isContentEditable()?n.isTextNode()&&this.deleteTextNodeContent(t,e):this.deleteDecoratorNodeContent(t,e);const s=e.parent;s&&e.isListItemBlock()&&0===s.children.length&&s.parent.apply(new f(s))}deleteTextNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;if(0!==s&&!n.isEmpty()){const r=n.text.slice(0,s-1)+n.text.slice(s);if(n.apply(new M(r)),r)return void(t.previousNode=n);{const s=this.getPreviousNode(n);return s&&s.parent===e&&"\n"===s.text||1===e.children.length?void(t.previousNode=n):(e.apply(new f(n)),void(t.previousNode=s))}}{let s=this.getPreviousNode(n),r=null;const i=n.isEmpty();if(e.children.length&&s&&s.parent!==e)i&&e.apply(new f(n)),e.type===s.parent.type&&s.parent.apply(new Bt(e));else if(this.isContentFirstNode(n)&&i&&(r=this.getNextNode(n)),i&&e.apply(new f(n)),s&&s.isTextNode()&&(s.isEmpty()||!s.isContentEditable()&&s.parent===e)){const t=s;s=this.getPreviousNode(s),t.parent.apply(new f(t)),s||i||(r=n)}0===e.children.length&&e.parent.apply(new f(e)),s?t.previousNode=s:r&&(t.nextNode=r)}}deleteDecoratorNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;let r=this.getPreviousNode(n),i=null;if(0!==s){const t=e;this.isContentFirstNode(n)&&(i=this.getNextNode(n)),1===t.children.length?t.parent.apply(new f(t)):t.apply(new f(n))}else{const e=r;e&&!e.isContentEditable()&&(r=this.getPreviousNode(e),e.parent.apply(new f(e)),r||(t.nextNode=n))}r?t.previousNode=r:i&&(t.nextNode=i)}}class St extends t{handleAction(t,e){const{startContainerNode:n}=t;t.newBlock=this.breakSingleBlock(n,t.startOffset,e)}breakSingleBlock(t,e,n){const s=this.getNewParagraph(t);if(s){if(this.isCaretPositionAtBlockEnd(n,t,e))n.parent.apply(new m(n,s));else{if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new L(t,e);return n.apply(s),s.newBlock}n.parent.apply(new x(n,s))}return s}}getNewParagraph(t){const e=this.createNewParagraph("");if(e){let n=e.children[0];return t.isTextNode()&&t.isContentEditable()&&(e.children=[],n=t.cloneWithText(""),n.annotationMap.delete(j.LINK),e.apply(new s([n]))),e}}}class It extends R{constructor(t,e,n=!1){super(),this.isFlushable=!0,this.type=c.UPDATE_CURSOR_POSITION,this.immediatelyRun=!1,this.nextFocusNode=t,this.offset=e,this.immediatelyRun=n,this.immediatelyRun&&(this.isFlushable=!1)}}class Rt extends t{handleAction(t,e){const{rteRange:n,nodeToBeInserted:s}=t,{startNode:r,startOffset:i}=n;if(r){const t=e;if(r.isContentEditable()&&r.isTextNode())if("\n"!==r.text&&r.text&&0!==i){const e=r.text.substring(0,i),n=r.text.substring(i),a=r.cloneWithText(e),o=r.cloneWithText(n),l=[a,s];n&&l.push(o),t.apply(new x(r,...l)),t.apply(new f(r))}else t.apply(new x(r,s));else t.apply(0!==i?new m(r,s):new x(r,s));this.updateCursorPosition(s)}}updateCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new It(t))}}class Lt extends t{handleAction(t,e){const{text:n,offset:s,decoratorNode:r}=t,i=this.createNewParagraph(n);if(i){const t=i.children[0];e.apply(0!==s?new m(r,t):new x(r,t)),this.setTheCursorPosition(t)}}setTheCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new It(t))}}class $t extends t{handleAction(t,e){t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset,e)}breakSingleListItemBlock(t,e,n){const r=n.createNewListItem(),i=this.copyInlineStyleToNewNode(t);if(r.apply(new s([i])),this.isCaretPositionAtBlockEnd(n,t,e))return this.breakListItemAtEnd(r,n);if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new L(t,e);return n.apply(s),s.newBlock}return n.parent.apply(new x(n,r)),r}breakListItemAtEnd(t,n){const r=n.parent.children[n.parent.children.length-1],i=1===n.children.length&&n.children[0].isEmpty();if(n===r&&i){const r=n.parent.parent;if("list-item"!==r.type){const i=e.from({id:it(),type:"paragraph",nodes:[]});return i.apply(new s(t.children)),r.apply(new m(n.parent,i)),n.parent.apply(new f(n)),i}r.parent.apply(new m(r,t)),n.parent.apply(new f(n))}else n.parent.apply(new m(n,t));return t}copyInlineStyleToNewNode(t){const e=t.cloneWithText("");return e.annotationMap.delete(j.LINK),e}}class Dt extends R{constructor(t){super(),this.type=c.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class Mt extends P{handleAction(t,e){super.handleAction(t,e);const n=e.parent;0===e.children.length&&n&&n.apply("list-item"===n.type?new Dt(e):new f(e))}}class Pt extends t{handleAction(t,e){if(e.parent){const{blocksToBeInserted:n,startNode:s,startOffset:r}=t;let i=e;if(s===e.children[0]&&0===r)e.parent.apply(new x(e,...n));else{const t=new L(s,r);e.apply(t),e.parent.apply(new m(e,...n)),i=t.newBlock}t.futureFocusBlock=i}}}const Ft=new class{registerBlockBasicStrategies(t){r.register(c.DELETE_CHILDREN,t,t===gt.name?new Mt:new P),r.register(c.APPEND_CHILDREN,t,new yt),r.register(c.INSERT_CHILDREN_BEFORE,t,new Et),r.register(c.INSERT_CHILDREN_AFTER,t,new At),r.register(c.DELETE_BLOCK_CONTENT,t,new vt),r.register(c.INSERT_NEW_PARAGRAPH,t,t===mt.name?new $t:new St),r.register(c.INSERT_TEXT_TO_DECORATOR_NODE,t,new Lt),r.register(c.INSERT_NODE_TO_NEAREST_ROOT,t,new Rt),r.register(c.PASTE_CONTENT,t,new Pt)}};class zt{}class Ut extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return this.isBold(t)||e.bold?{bold:!0}:{}}isBold(t){return"STRONG"===t.nodeName||"B"===t.nodeName||t.style.fontWeight===F||t.style.fontWeight===z||t.classList.contains("v-rte--bold")}}class Vt extends zt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getAttributes(t);return Object.keys(e).length>0?{customAttribute:e}:{}}getAttributes(t){return t.getAttributeNames().filter((t=>"style"!==t&&"class"!==t&&this.isValidAttr(t))).reduce(((e,n)=>(e[n]=t.getAttribute(n),e)),{})}isValidAttr(t){return/^[a-zA-Z_][\w-]*$/.test(t)}}class Wt extends zt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getCustomClass(t);return e.length>0?{customClass:e}:{}}getCustomClass(t){return t.classList.toString().split(" ").filter((t=>!t.includes("v-rte")&&""!==t))}}class Gt extends zt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=U(t);return Object.keys(e).length>0?{customStyle:e}:{}}}class Jt extends zt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.dtoName)}handle(t){const e=this.getIndent(t);return e?{indent:e}:{}}getIndent(t){const e=t.style;let n;if(e.marginLeft)n=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:n=t[3];break;case 2:case 3:n=t[1];break;default:n=t[0]}}}const s=Number(n.replace("px",""));return s&&s>=0?Math.floor(s/16):null}}class Kt extends zt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.dtoName)}handle(t){const e=this.getTextAlign(t);return e?{textAlign:e}:{}}getTextAlign(t){const e=t.classList;if(e.contains("v-rte--horizontal-alignment-left"))return"left";if(e.contains("v-rte--horizontal-alignment-center"))return"center";if(e.contains("v-rte--horizontal-alignment-right"))return"right";if(e.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}}class Yt extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return this.isCode(t)||e.code?{code:!0}:{}}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName||"PRE"===t.nodeName||"monospace"===t.style.fontFamily||"Roboto Mono"===t.style.fontFamily.replace(/["']/g,"")}}class Xt extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){const n=this.getColor(t)||e.textColor;return n?{textColor:n}:{}}getColor(t){var e;const n=null===(e=ut(t.style.color))||void 0===e?void 0:e.toUpperCase();if(n){const t=V.filter((t=>t.key!==W.key)).find((t=>t.light===n||t.dark===n));return t?t.key:null}for(const e of V)if(t.style.color.includes(e.key))return e.key;return null}}class Qt extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return this.isItalic(t)||e.italic?{italic:!0}:{}}isItalic(t){return"I"===t.nodeName||t.style.fontStyle===G||"EM"===t.nodeName||t.classList.contains("v-rte--italic")}}class Zt extends zt{canHandle(t,e){return!!e.autoMatchFormat&&"RTETextBlock"===t.dtoName}handle(t){const e=this.getTextStyle(t);return e?{textStyle:e}:{}}getTextStyle(t){const e=this.getElementTypeByDataType(t);if(e)return e;const n=this.getElementTypeByNodeName(t);if(n)return n;const s=this.getElementTypeByFontSize(t);if(s)return s;return this.getElementTypeByClassName(t)||null}getElementTypeByDataType(t){return t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type")?t.getAttribute("data-type"):null}getElementTypeByFontSize(t){var e;switch(null===(e=t.style)||void 0===e?void 0:e.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3";default:return null}}getElementTypeByNodeName(t){switch(t.nodeName){case"P":return"paragraph";case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";case"H4":return"heading-4";case"H5":return"heading-5";case"H6":return"heading-6";default:return null}}getElementTypeByClassName(t){if(t.className){const e=/\bv-rte-(?:-text-style-)?(title|subtitle|heading-1|heading-2|heading-3|heading-4|heading-5|heading-6|paragraph)\b/.exec(t.className);if(e)return e[1]}return null}}class _t{static isTitleOrSubtitle(t){if("DIV"===t.nodeName){const e=_t.textStyleHandler.getTextStyle(t);return"title"===e||"subtitle"===e}return!1}static isLinkElement(t){return"A"===t.nodeName}}_t.textStyleHandler=new Zt;class qt extends zt{constructor(){super(...arguments),this.handlers=[new Vt,new Wt,new Gt]}canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return e.link?{link:e.link}:_t.isLinkElement(t)?{link:this.generateLinkAnnotations(t)}:{}}generateLinkAnnotations(t){const e={href:t.getAttribute("href")||"",groupKey:it()};return this.handlers.forEach((n=>{Object.assign(e,n.handle(t))})),e}}class te extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return this.isStrikethrough(t)||e.strikethrough?{strikethrough:!0}:{}}isStrikethrough(t){return t.style.textDecoration.includes(J)||"S"===t.nodeName||"DEL"===t.nodeName||t.classList.contains("v-rte--strikethrough")}}class ee extends zt{canHandle(t){return"RTETextNode"===t.dtoName}handle(t,e={}){return this.isUnderline(t)||e.underline?{underline:!0}:{}}isUnderline(t){return t.style.textDecoration.includes(K)||"U"===t.nodeName||"INS"===t.nodeName||t.classList.contains("v-rte--underline")}}class ne extends zt{canHandle(t){return"RTEImageNode"===t.dtoName}handle(t){const e=this.getImageSize(t);return e?{size:e}:{}}getImageSize(t){return t.getAttribute("data-size")?t.getAttribute("data-size"):null}}class se extends zt{canHandle(t){return"RTEImageNode"===t.dtoName}handle(t){return t.hasAttribute("alt")?{alt:t.getAttribute("alt")}:{}}}const re=new Set(["P","H1","H2","H3","H4","H5","H6","LI"]),ie=new Set(["P","H1","H2","H3","H4","H5","H6","LI","UL","OL","IMG","CODE"]),ae=new Set(["BR","VEGA-RICH-TEXT-LINK-EDITOR","CODE","A"]),oe=new Set(["TABLE","THEAD","TBODY","TFOOT","TR","DL"]),le=new Set(["ABBR","B","BDI","BDO","CITE","DEL","DFN","EM","I","INS","KBD","MARK","METER","OUTPUT","PROGRESS","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR"]);function ce(t){return re.has(t.parentElement.nodeName)}class he extends zt{constructor(){super(...arguments),this.customAttributeHandler=new Vt,this.customStyleAnnotationHandler=new Gt,this.customClassAnnotationHandler=new Wt}canHandle(t,e){return"RTETextNode"===t.dtoName&&!1===e.autoMatchFormat}handle(t,e){if(ie.has(t.nodeName)&&!ae.has(t.nodeName))return{};const n=this.generateInlineHtmlAnnotation(t,Object.assign({},e));return n?{inlineHtml:n}:{}}generateInlineHtmlAnnotation(t,e){let{inlineHtml:s}=e;const r=Array.from(t.childNodes).some((t=>t.nodeType===Node.ELEMENT_NODE));if(!n.supportsHtmlTag(t.nodeName.toLowerCase())||r){const e=Object.assign(Object.assign({htmlTag:t.nodeName.toLowerCase()},r?{groupId:it()}:{}),{customAttribute:this.customAttributeHandler.handle(t).customAttribute,customStyle:this.customStyleAnnotationHandler.handle(t).customStyle,customClass:this.customClassAnnotationHandler.handle(t).customClass});s=s?this.appendToInlineHtmlChain(s,e,t.parentNode):e}return s?Object.assign({},s):null}appendToInlineHtmlChain(t,e,n){return t.child&&n&&t.child.htmlTag===n.nodeName.toLowerCase()?Object.assign(Object.assign({},t),{child:this.appendToInlineHtmlChain(t.child,e,n)}):Object.assign(Object.assign({},t),{child:e})}}const ue=new class{constructor(){this.handlers=[new Kt,new Jt,new Ut,new Qt,new ee,new te,new Xt,new qt,new Yt,new ne,new se,new Vt,new Wt,new Gt,new Zt,new he]}registerHandler(t){this.handlers.unshift(t)}generate(t,e,n={autoMatchFormat:!0}){n&&n.filterInlineStyles&&Y.executeTheStrategyRefillAction(t.dtoName,e);const s=_t.isLinkElement(e)&&"RTETextNode"===t.dtoName,r=this.handlers.filter((t=>!(!n.autoMatchFormat&&s)||t instanceof qt)).filter((r=>e.nodeType!==Node.TEXT_NODE&&r.canHandle(t,{skipCustomAnnotations:n.skipCustomAnnotations||s,autoMatchFormat:n.autoMatchFormat}))).reduce(((t,s)=>{const r=s.handle(e,n.parentAnnotations);return Object.assign(Object.assign({},t),r)}),{});this.removeTextStyleDefaultsFromCustomStyle(r);const i=Y.getStrategies(t.dtoName);for(const t of i)(n.autoMatchFormat||t.alwaysFilter)&&t.filterAnnotations(r);return r}removeTextStyleDefaultsFromCustomStyle(t){const e="textStyle"in t?t.textStyle:void 0,n=t.customStyle;if(!e||!n)return t;const s=X.getDefaultStyles(e);if(!s)return t;for(const t of Object.keys(s))n[t]===s[t]&&delete n[t];return 0===Object.keys(n).length&&delete t.customStyle,t}};class de extends xt{constructor(){super(...arguments),this.annotationHandler=new Zt}generateChildNodes(t,e,s){const r=[],i=!(!s||!1!==s.autoMatchFormat),a=Object.assign({},e);return t.forEach((t=>{const o=bt.getElementToNodeStrategies().find((e=>e.canHandle([t],0,s)>0));let l=null;if(o&&(l=o.handle([t],s,a)),l)r.push(l);else if(dt(t)&&t.childNodes.length>0){const o=ue.generate(n,t,Object.assign({parentAnnotations:i?{inlineHtml:a.inlineHtml,link:a.link,code:a.code}:e},s));r.push(...this.generateChildNodes(Array.from(t.childNodes),o,s))}})),r}matchTextBlockType(t){var e;return null!==(e=this.annotationHandler.handle(t).textStyle)&&void 0!==e?e:"paragraph"}}class we extends de{canHandle(t,e){return"PRE"!==t[e].tagName&&"CODE"!==t[e].tagName||!t[e].hasAttribute("data-language")?0:1}handle(t){const e=t[0];if(e){const t=e.textContent,n=e.dataset.language;return k.from({id:it(),type:"code-block",content:t,language:n})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class pe extends de{createRTEImageBlock(t,e){const n=!(e&&e.autoMatchFormat||!t.parentNode||"DIV"===t.parentNode.nodeName);return jt.from({id:it(),type:"image",nodes:[{id:it(),type:"image",url:t.src,annotations:ue.generate(Ht,t,e)}],annotations:Object.assign(Object.assign({},ue.generate(jt,t.parentElement,e)),{internalWrapper:n})},e)}}class me extends xt{shouldProceedToElementChildren(){return!1}appendChildBlocks(){}generateTextNode(t,e){return{id:it(),type:"text",text:t,annotations:e}}}class fe extends Q{constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const{textAlign:e,customStyle:n}=t;return e&&n?(this.stylesToBeFiltered=_.getDefaultStyles(e),super.filterAnnotations(t)):t}}class ge extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=X.getDefaultStyles("paragraph"),this.type="paragraph",this.elementTagName="p"}filterAnnotations(t){return t}canFilter(t){return Z.isTextBlock(t.dtoName)&&t.type===this.type}canRefill(t,e){const n=this.classNameToBeAdded?`.${this.classNameToBeAdded}`:this.elementTagName;return Z.isTextBlock(t)&&e.matches(n)}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}class xe extends ge{constructor(t){super(),this.type="heading-1",this.elementTagName="h1",this.type=`heading-${t}`,this.elementTagName=`h${t}`,this.stylesToBeFiltered=X.getDefaultStyles(this.type)}}class Te extends ge{constructor(t){super(),this.type="title",this.elementTagName="div",this.classNameToBeAdded="v-rte-title",this.type=t,this.classNameToBeAdded=`v-rte-${t}`,this.stylesToBeFiltered=X.getDefaultStyles(this.type)}}class be extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=be.BOLD_STYLES,this.elementTagName="span",this.parentBlockTypes=["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title"],this.parentElementSelectors=["h1","h2","h3","h4","h5","h6",".v-rte-title"],this.toBeCheckedSelector=this.parentElementSelectors.join(",")}filterAnnotations(t){return t}canFilter(t){return Z.isTextNode(t.dtoName)&&this.parentBlockIsHeadingOrTitle(t)}canRefill(t,e){return Z.isTextNode(t)&&"SPAN"===e.nodeName&&this.isHeadingOrTitleChild(e)}toCssText(){return`${this.parentElementSelectors.map((t=>`.${be.RTE_CONTENT_CONTAINER_CLASS_NAME} ${t}`)).join(",")} { ${this.convertStylesMapToCssText()} }`}parentBlockIsHeadingOrTitle(t){const e=t.parent;return!!e&&this.parentBlockTypes.includes(e.type)}isHeadingOrTitleChild(t){let e=t.parentElement;for(;e;){if(e.matches(this.toBeCheckedSelector))return!0;if(be.NON_HEADING_TITLE_ELEMENT_TAGS.includes(e.tagName))return!1;e=e.parentElement}return!1}}be.BOLD_STYLES={fontWeight:"700"},be.NON_HEADING_TITLE_ELEMENT_TAGS=["TD","TH","TR","TABLE","THEAD","TBODY","DIV","BODY"];class Oe extends xe{constructor(t){super(t),this.classNameToBeAdded=`v-rte-h${t}`,this.elementTagName="li"}canFilter(t){return Z.isListItemBlock(t.dtoName)&&this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"])}canRefill(t,e){return Z.isListItemBlock(t)&&e.matches(this.elementTagName)&&e.classList.contains(this.classNameToBeAdded)}}class ye extends Te{constructor(t){super(t),this.classNameToBeAdded=`v-rte-${t}`,this.elementTagName="li"}canFilter(t){return Z.isListItemBlock(t.dtoName)&&this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"])}canRefill(t,e){return Z.isListItemBlock(t)&&e.matches(this.elementTagName)&&e.classList.contains(this.classNameToBeAdded)}}tt.registerRTEDTOClass("paragraph",e),tt.registerRTEDTOClass("title",e),tt.registerRTEDTOClass("subtitle",e),tt.registerRTEDTOClass("heading-1",e),tt.registerRTEDTOClass("heading-2",e),tt.registerRTEDTOClass("heading-3",e),tt.registerRTEDTOClass("heading-4",e),tt.registerRTEDTOClass("heading-5",e),tt.registerRTEDTOClass("heading-6",e),tt.registerRTEDTOClass("heading-6",e),tt.registerRTEDTOClass("list-item",mt),tt.registerRTEDTOClass("bullet-list",gt),tt.registerRTEDTOClass("number-list",gt),tt.registerRTEDTOClass("image",jt),tt.registerRTEDTOClass("code-block",k),tt.registerRTEDTOClass("html-block",Ct),tt.registerRTEDTOClass("text",n),tt.registerRTEDTOClass("image",Ht),Ft.registerBlockBasicStrategies(e.name),Ft.registerBlockBasicStrategies(gt.name),Ft.registerBlockBasicStrategies(mt.name),Ft.registerBlockBasicStrategies(jt.name),Ft.registerBlockBasicStrategies(Ct.name),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e,n){let s=0;for(let r=e;r<t.length&&this.isInlineCandidate(t[r],n);r++)s++;return s}handle(t,s){const r=t[0].parentElement,i=s&&s.autoMatchFormat,a=this.generateChildNodes(t,i?ue.generate(n,r,Object.assign(Object.assign({},s),{skipCustomAnnotations:!0})):{},s),o=i?super.matchTextBlockType(r):this.matchTextBlockTypeByTagName(r),l=!i&&!o;return e.from(Object.assign({id:it(),type:o||"paragraph",nodes:a},l?{annotations:{internalWrapper:l}}:{annotations:ue.generate(e,r,s)}),s)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}matchTextBlockTypeByTagName(t){switch(t.nodeName){case"P":return"paragraph";default:return null}}isInlineCandidate(t,e){return t.nodeType===Node.TEXT_NODE||!!ae.has(t.nodeName)||!this.isDedicatedBlockTag(t.nodeName)&&(!(!1!==e.autoMatchFormat||!ce(t))||this.isInlineLeafOrWrapper(t))}isDedicatedBlockTag(t){return ie.has(t)&&!ae.has(t)}isInlineLeafOrWrapper(t){return 0===t.childNodes.length?le.has(t.nodeName):this.isTextOnlyElement(t)?le.has(t.nodeName)||ae.has(t.nodeName):this.hasOnlyInlineDescendants(t)}isTextOnlyElement(t){const e=Array.from(t.childNodes);return!e.some((t=>t.nodeType===Node.ELEMENT_NODE))&&e.some((t=>t.nodeType===Node.TEXT_NODE))}hasOnlyInlineDescendants(t){for(let e=0;e<t.children.length;e++){const n=t.children[e];if(this.isDedicatedBlockTag(n.nodeName))return!1;if(!n.hasChildNodes())return!1;if(!this.hasOnlyInlineDescendants(n))return!1}return!0}}),bt.registerElementToBlockStrategy(new class extends pe{canHandle(t,e){const n=t[e];return n.nodeType===Node.ELEMENT_NODE&&""===n.textContent&&n.querySelector("img")?1:0}handle(t,e){const n=t[0].querySelector("img");return this.createRTEImageBlock(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),bt.registerElementToBlockStrategy(new class extends pe{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t,e){const n=t[0],s=n.querySelector("img");if(at(s))return jt.from({id:it(),type:"image",nodes:[{id:it(),type:"image",url:s.src,annotations:ue.generate(Ht,n,e)}],annotations:ue.generate(jt,n.parentElement,e)},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),bt.registerElementToBlockStrategy(new class extends pe{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t,e){return this.createRTEImageBlock(t[0],e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e){return["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title","subtitle"].includes(super.matchTextBlockType(t[e]))?1:0}handle(t,n){const s=this.generateChildNodes(Array.from(t[0].childNodes),{},n);return 0===s.length?null:e.from({id:it(),type:super.matchTextBlockType(t[0]),nodes:s,annotations:ue.generate(e,t[0],n)},n)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e){if(!["UL","OL"].includes(t[e].parentElement.nodeName)&&t.some((t=>"LI"===t.nodeName))){let n=0;for(let s=e;s<t.length&&"LI"===t[s].nodeName;s++)n++;return n}return"LI"===t[e].tagName?1:0}handle(t,e){const n=t[0];return["UL","OL"].includes(n.parentElement.nodeName)?mt.from(this.generateListItemBlockDTO(n,e),e):this.generateWithListBlock(t,e)}appendChildBlocks(t,e){t.nestList=e.filter((t=>["bullet-list","number-list"].includes(t.type)))}shouldProceedToElementChildren(){return!0}generateWithListBlock(t,e){return gt.from({id:it(),type:"bullet-list",blocks:t.map((t=>this.generateListItemBlockDTO(t,e)))},e)}generateListItemBlockDTO(t,e){return{id:it(),type:"list-item",annotations:ue.generate(mt,t,e),nodes:this.generateChildNodes(Array.from(t.childNodes.length?t.childNodes:[t]).filter((t=>!["UL","OL"].includes(t.nodeName))),ue.generate(n,t,Object.assign(Object.assign({},e),{skipCustomAnnotations:!0})),e)}}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e){const n=t[e],s=n.parentElement,r="LI"!==n.nodeName,i=n.nodeType===Node.TEXT_NODE&&""===n.textContent.trim(),a=at(s)&&["UL","OL"].includes(s.nodeName);return r&&!i&&a?1:0}handle(t,e){const n=this.generateChildNodes(t,{},e);return mt.from({id:it(),type:"list-item",nodes:n,annotations:{}},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:gt.from({id:it(),type:"number-list",blocks:[],annotations:ue.generate(gt,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof mt)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:gt.from({id:it(),type:"bullet-list",blocks:[],annotations:ue.generate(gt,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof mt)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),bt.registerElementToBlockStrategy(new class extends de{canHandle(t,e,n){const s=t[e];return s.nodeType===Node.TEXT_NODE||this.isInlineTagWithoutBlockChildren(s,n)||ie.has(s.nodeName)&&!this.shouldFallBackToHtmlBlock(s)||n.autoMatchFormat||!this.isCustomHtmlContainer(s)||_t.isTitleOrSubtitle(s)?0:1}handle(t,e){return Ct.from(this.generateHtmlBlock(t[0],e),e)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}isInlineTagWithoutBlockChildren(t,e){if(ae.has(t.nodeName)&&0===t.childNodes.length)return!0;if(ce(t))return!(0===t.childNodes.length&&""===t.textContent&&!ae.has(t.nodeName)&&!le.has(t.nodeName));const n=Array.from(t.childNodes);return!(n.some((t=>t.nodeType===Node.ELEMENT_NODE))||!n.some((t=>t.nodeType===Node.TEXT_NODE)))&&(!1!==e.autoMatchFormat||!oe.has(t.parentElement.nodeName)&&(le.has(t.nodeName)||ae.has(t.nodeName)))}shouldFallBackToHtmlBlock(t){const e=Array.from(t.childNodes);if(0===e.length)return!1;const n=t.parentElement.nodeName;return"UL"!==n&&"OL"!==n&&e.every((t=>t.nodeType===Node.ELEMENT_NODE&&""===t.textContent&&!ae.has(t.nodeName)&&!le.has(t.nodeName)))}isCustomHtmlContainer(t){return"DIV"!==t.nodeName||t.childNodes.length>0&&"IMG"!==t.childNodes[0].nodeName}generateHtmlBlock(t,e){return{id:it(),type:"html-block",htmlTag:t.nodeName.toLowerCase(),annotations:ue.generate(Ct,t,e),children:[]}}}),
|
|
2
|
+
//!important: Code block strategies must be registered after HtmlBlockStrategy because registerElementToBlockStrategy uses unshift, giving later registrations higher priority.
|
|
3
|
+
bt.registerElementToBlockStrategy(new we),bt.registerElementToBlockStrategy(new class extends we{canHandle(t,e){return"VEGA-CODE-BLOCK"===t[e].tagName&&0==!!t[e].querySelector("vega-code-block")||this.isCodeBlockContainer(t[e])?1:0}handle(t){const e=this.isCodeBlockContainer(t[0])?t[0].querySelector("vega-code-block"):t[0],n=e.querySelector("code");if(n)return super.handle([n]);if(e.hasAttribute("data-content")){const t=document.createElement("code");return t.textContent=e.dataset.content,t.dataset.language=e.dataset.language,super.handle([t])}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isCodeBlockContainer(t){return"PRE"===t.tagName&&t.classList.contains("code-block-container")&&1===t.querySelectorAll("vega-code-block").length}}),bt.registerElementToNodeStrategy(new class extends me{canHandle(t,e){const n=t[e];return!dt(n)||"BR"!==n.nodeName&&0!==n.childNodes.length?0:1}handle(t,e,s){const r=!(!e||!1!==e.autoMatchFormat),i=Object.assign({},s),a=t[0],o=ue.generate(n,a,Object.assign({parentAnnotations:r?{inlineHtml:i.inlineHtml,link:i.link,code:i.code}:s},e));if("BR"===a.nodeName){const{inlineHtml:t}=o,e=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(o,["inlineHtml"]);return this.generateTextNode("\n",t&&"br"===t.htmlTag?e:o)}if(0===a.childNodes.length){const t=r?wt(Object.assign(Object.assign({},n.supportsHtmlTag(a.nodeName.toLowerCase())?o:{}),{inlineHtml:o.inlineHtml})):o;return Object.assign({},this.generateTextNode("",t))}}}),bt.registerElementToNodeStrategy(new class extends me{canHandle(t,e){return t[e].nodeType===Node.TEXT_NODE?1:0}handle(t,e,s){const r=Object.assign({},s),i=!(!e||!1!==e.autoMatchFormat),a=t[0],o=a.parentNode.nodeName.toLowerCase(),l=i&&!n.supportsHtmlTag(o),c=this.generateTextNode(String(a.textContent),i?wt(Object.assign(Object.assign({},"span"===o?r:{link:r.link,code:"code"===o?r.code:void 0}),{inlineHtml:r.inlineHtml,plainText:l||void 0})):r);return Object.assign({},c)}}),Y.register(e.dtoName,new fe),Y.register(gt.dtoName,new fe),Y.register(mt.dtoName,new fe),Y.register(n.dtoName,new class extends Q{constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const e=t,n=e.customStyle;if(!n)return t;e.bold&&n.fontWeight===z&&delete n.fontWeight,e.italic&&n.fontStyle===G&&delete n.fontStyle;const s=this.normalizeTextDecoration(n.textDecoration);return s&&this.shouldRemoveTextDecoration(s,e)&&delete n.textDecoration,0===Object.keys(n).length&&delete e.customStyle,t}normalizeTextDecoration(t){if(!t)return;const e=t.trim().toLowerCase().split(/\s+/);return e.some((t=>t!==K&&t!==J))?void 0:Array.from(new Set(e)).sort().join(" ")}shouldRemoveTextDecoration(t,e){const n=[];return e.underline&&n.push(K),e.strikethrough&&n.push(J),0!==n.length&&t===n.sort().join(" ")}}),Y.register(e.dtoName,new ge),Y.register(e.dtoName,new xe(1)),Y.register(e.dtoName,new xe(2)),Y.register(e.dtoName,new xe(3)),Y.register(e.dtoName,new xe(4)),Y.register(e.dtoName,new xe(5)),Y.register(e.dtoName,new xe(6)),Y.register(e.dtoName,new Te("title")),Y.register(e.dtoName,new Te("subtitle")),Y.register(n.dtoName,new be),Y.register(n.dtoName,new class extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=q.getDefaultStyles(),this.elementTagName="code"}filterAnnotations(t){const{code:e,customStyle:n}=t;return e&&n?super.filterAnnotations(t):t}canFilter(t){return Z.isCodeNode(t)}canRefill(t,e){return Z.isTextNode(t)&&e.matches(this.elementTagName)}toCssText(){return`.${Q.RTE_CONTENT_CONTAINER_CLASS_NAME} ${this.elementTagName} { ${this.convertStylesMapToCssText(Object.assign(Object.assign({},this.stylesToBeFiltered),{fontWeight:"500"}))} }`}}),Y.register(n.dtoName,new et),Y.register(Ht.dtoName,new class extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=kt.getDefaultStyles(),this.elementTagName="img"}get alwaysFilter(){return!0}canFilter(t){return Z.isImageNode(t)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}),Y.register(k.dtoName,new nt),Y.register(st.dtoName,new rt),Y.register(gt.dtoName,new class extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=ft.getDefaultStyles(),this.elementTagName="ol,ul"}canFilter(t){return Z.isListBlock(t.dtoName)}canRefill(t,e){return Z.isListBlock(t)&&e.matches(this.elementTagName)}toCssText(){return`${this.elementTagName.split(",").map((t=>`.${Q.RTE_CONTENT_CONTAINER_CLASS_NAME} ${t.trim()}`)).join(", ")} { ${this.convertStylesMapToCssText(this.stylesToBeFiltered)} }`}}),Y.register(mt.dtoName,new class extends Q{constructor(){super(...arguments),this.stylesToBeFiltered=X.getDefaultStyles("paragraph"),this.elementTagName="li",this.headingOrTitleClassNamePattern=/^v-rte-(h[1-6]|title|subtitle)$/}canFilter(t){const e=!t.getStyles().fontSize||this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"]);return Z.isListItemBlock(t.dtoName)&&e}canRefill(t,e){return Z.isListItemBlock(t)&&e.matches(this.elementTagName)&&this.isElementNotHeadingOrTitle(e)}toCssText(){return this.buildCssTextForStyles(this.elementTagName)}isElementNotHeadingOrTitle(t){return!t.className.split(" ").some((t=>this.headingOrTitleClassNamePattern.test(t.trim())))}}),Y.register(mt.dtoName,new Oe(1)),Y.register(mt.dtoName,new Oe(2)),Y.register(mt.dtoName,new Oe(3)),Y.register(mt.dtoName,new Oe(4)),Y.register(mt.dtoName,new Oe(5)),Y.register(mt.dtoName,new Oe(6)),Y.register(mt.dtoName,new ye("title")),Y.register(mt.dtoName,new ye("subtitle"));class Ee{static preserve(t){const e=t.replace(/\s+style=/g," data-style=");return new Ae(e)}}class Ae{constructor(t){this.processedHtml=t}getProcessedHtml(){return this.processedHtml}restore(t){this.walkNodes(t)}walkNodes(t){t.forEach((t=>{if(dt(t)){const e=t.getAttribute("data-style");e&&(t.style.cssText=e,t.removeAttribute("data-style")),t.children.length>0&&this.walkNodes(Array.from(t.children))}}))}}class ke{process(t){return t.replace(/(<[^>]+>)(\s+)(<[^>]+>)/g,((t,e,n,s)=>{const r=this.extractOpeningTagName(e),i=this.extractClosingTagName(s);return r&&i&&r===i?`${e}${n}${s}`:`${e}${s}`}))}extractOpeningTagName(t){const e=t.match(/<(\w[\w-]*)/);return e?e[1]:null}extractClosingTagName(t){const e=t.match(/<\/(\w[\w-]*)/);return e?e[1]:null}}class He{process(t){return t.replace(/(>)[\n\t]+(?=.)/g,"$1")}}class Ne{process(t){return t.replace(/(.?)[\n\t]+(?=<)/g,"$1")}}class je{constructor(){this.processors=[new ke,new He,new Ne]}clean(t){if(!t||0===t.trim().length)return t;let e,n=t;do{e=n;for(const t of this.processors)n=t.process(n)}while(n!==e);return n}}class Ce{constructor(t){this.dtoName=Ce.dtoName,t.forEach((t=>{t.parent=this})),this.children=t}static fromJSON(t,e={autoMatchFormat:!0}){const n=t.map((t=>{const n=tt.getRTEBlockClass(t.type);if(n)return n.from(t,e);throw new Error(`[Vega] Unknown block type: ${t.type}`)}));return new Ce(n)}static createEmptyContent(t={autoMatchFormat:!0}){return Ce.fromJSON([{id:it(),type:"paragraph",annotations:{internalWrapper:!t.autoMatchFormat},nodes:[{id:it(),annotations:{plainText:!t.autoMatchFormat},type:"text",text:""}]}],t)}static fromHtml(t,e={autoMatchFormat:!0,skipCustomAnnotations:!1}){const n=(new je).clean(t),s=Ee.preserve(n),r=s.getProcessedHtml(),i=(new DOMParser).parseFromString(r,"text/html").body,a=Array.from(i.childNodes);s.restore(a);const o=Ot.process(a,e).filter(at).map((t=>t.toDto(e))).filter(at);return new Ce(o)}static generateContentStyles(t){return Y.generateAllStylesContent(null==t?void 0:t.enableFontImports)}clone(t=!1){return new Ce(t?this.children.map((t=>t.clone(this))):[...this.children])}toJSON(){return this.children.map((t=>t.toJSON()))}toHtml(t){return t&&(at(t.autoMatchFormat)||at(t.skipCustomAnnotations))&&pt.warn("The 'options' parameter's properties 'autoMatchFormat' and 'skipCustomAnnotations' in toHtml method are deprecated and will be removed in the future."),this.isEmpty()?"":this.children.map((e=>e.toHtml({filterInlineStyles:null==t?void 0:t.filterInlineStyles}))).join("")}isEmpty(){return 0===this.children.length||1===this.children.length&&!this.children[0].isNotEmpty()}apply(t){if(r.executeTheStrategy(t,this),t.executedFlag&&t.isFlushable){const t=H.getDOMByEntity(this);t&&ot.notify(lt.getSubject(t,ht),{})}}getLastNode(){return 0===this.children.length?null:this.children[this.children.length-1].getLastNode()}toListItem(t){t.children.map((t=>t.apply(new g)));const e=new mt(it());return e.apply(new s(t.children)),e.annotationMap=t.annotationMap,e}createList(t){return new gt(it(),t)}findNodeById(t){return this.findNodeInBlocksById(t,this.children)}findNodeInBlocksById(t,e){for(const n of e){if("children"in n)for(const e of n.children)if(e.id===t)return e;if(n instanceof mt&&n.nestList)for(const e of n.nestList){const n=this.findNodeInBlocksById(t,e.children);if(n)return n}if(n instanceof gt&&n.children){const e=this.findNodeInBlocksById(t,n.children);if(e)return e}}return null}}r.register(c.DELETE_CHILDREN,Ce.name,new P),r.register(c.APPEND_CHILDREN,Ce.name,new yt),r.register(c.INSERT_CHILDREN_BEFORE,Ce.name,new Et),r.register(c.INSERT_CHILDREN_AFTER,Ce.name,new At),r.register(c.TRANSFORM_TO_CODE_BLOCK,Ce.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,s=new k(it(),this.getCodeContent(n),"plainText");e.apply(new x(n[0],s)),t.newCodeBlock=s,this.removeSelectBlocks(n,e)}getCodeContent(t){return t.filter((t=>"image"!==t.type&&"list-item"!==t.type)).map((t=>t.children.map((t=>t.text)).join(""))).join("\n")}removeSelectBlocks(t,e){for(let n=0;n<t.length;n++)e.apply(new f(t[n]))}}),r.register(c.UPDATE_CURSOR_POSITION,Ce.name,new class extends t{handleAction(t,e){const{offset:n,nextFocusNode:s,immediatelyRun:r}=t,i=H.getDOMByEntity(e);i&&ot.notify(lt.getSubject(i,ct),{node:s,offset:n,updateDirectly:r})}}),Ce.dtoName="VegaRTEContent";export{zt as A,de as B,xt as E,Nt as I,Bt as M,Pt as P,jt as R,Ee as S,It as U,Ce as V,Et as a,mt as b,Ft as c,bt as d,gt as e,Ht as f,kt as g,ue as h,Ot as i}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as t,I as e,c as s,M as i}from"./p-6e1ab235.js";import{c as r}from"./p-02841589.js";import{C as o}from"./p-2d0d575f.js";import{O as n}from"./p-331a62d5.js";import{U as a,a as l,b as h,F as c,c as d,d as u,e as f}from"./p-cb378636.js";import{f as m,d as p}from"./p-528748fa.js";import{a as v,g as b}from"./p-8b5d3a52.js";import{c as R}from"./p-6a334573.js";import{d as g,D as j}from"./p-526e3634.js";import{h as y,f as w,i as O}from"./p-3a93730e.js";import{V as E}from"./p-091fbc35.js";import{h as V,l as F}from"./p-f0e828d8.js";import{P as I}from"./p-81dd00d0.js";import{I as C}from"./p-abd7aeaa.js";import{M as S}from"./p-78a57a17.js";import{A}from"./p-52b8f2d2.js";import{i as k}from"./p-d27ae9ff.js";import{S as T}from"./p-a58cacca.js";class L{constructor(t){this.rule=t}getStatus(t,e,s){return{canEvaluate:this.rule.canEvaluate(t,e,s),isAsync:v(this.rule.evaluate)}}shouldShowError(t,e){try{return this.rule.shouldShowError?this.rule.shouldShowError(t,e):this.defaultShouldShowError(t)}catch(t){return!1}}handle(t){try{return this.rule.evaluate(t)}catch(t){return{isValid:!0,message:""}}}defaultShouldShowError(t){return!t.disabled&&t.visible&&(t.touched||t.modified)}}class M{constructor(){this.handlers=[],this.processId=""}checkIncludesAsyncRuleHandler(t,e,s){return!!this.handlers.find((i=>{const r=i.getStatus(t,e,s);return r.canEvaluate&&r.isAsync}))}setHandlersByRules(t){this.handlers=t&&t.length?t.map((t=>new L(t))):[]}async process(t,e,s,i,r){const o=this.preProcess();let n;for(const i of this.handlers){if(o!==this.processId)break;const r=i.getStatus(t,e,s);if(!r.canEvaluate)continue;let a;if(r.isAsync)try{a=await i.handle(t)}catch(t){}else a=i.handle(t);if(a&&!a.isValid){const t=i.shouldShowError(e,s);n=Object.assign(Object.assign({},a),{shouldShowError:t});break}}return this.postProcess(o,i,n,r),n?{isValid:!1,message:n.message}:{isValid:!0,message:""}}preProcess(){const t=b();return this.processId=t,t}postProcess(t,e,s,i){this.processId===t&&i(e,s)}}class D{run(t){const e=t.nextElementSibling;return e&&e.querySelector(".vega-error")?e.querySelector(".vega-error"):null}}class B{run(t){let e=t.nextElementSibling;return e&&!e.classList.contains("vega-error")&&(e=document.createElement("label"),e.classList.add("vega-error"),e.setAttribute("part","field-error-message"),t.after(e)),e}}class H{run(t){let e=t.nextElementSibling;return e||(e=document.createElement("label"),e.classList.add("vega-error"),e.setAttribute("part","field-error-message"),t.after(e)),e}}class U extends t{getTranslatedMessage(t){return"string"==typeof t?E.t(t):E.t(t.key,...t.args||[])}}var x=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class G extends t{constructor(){super(),this.formFieldMessageTranslatorSlimmer=new U,this.fieldErrorUiControllerStrategies=[new D,new B,new H],this.initTranslationObserver()}applyInputInvalidUI(t){const e=this.getInputElementContainer();if(o.notify(g.getSubject(this.host,y),{host:this.host,showError:!0}),e&&(e.classList.add("error"),t)){this.errorMessage=t;const s=this.getErrorContainer(e);s.innerHTML=V.sanitize(this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(t),F),s.classList.remove("vega-hidden")}}resetInputInvalidUI(){this.errorMessage="";const t=this.getInputElementContainer();t&&(this.getErrorContainer(t).classList.add("vega-hidden"),t.classList.remove("error"),o.notify(g.getSubject(this.host,y),{host:this.host,showError:!1}))}getInputElementContainer(){return this.options&&this.options.inputContainerGetter?this.options.inputContainerGetter():null}getErrorContainer(t){for(const e of this.fieldErrorUiControllerStrategies){const s=e.run(t);if(s)return s}}initTranslationObserver(){const t=new n(this.isAcceptableTranslationObserver.bind(this),(()=>{if(!this.errorMessage)return;const t=this.getInputElementContainer();if(t){const e=this.getErrorContainer(t);e&&(e.innerHTML=V.sanitize(this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(this.errorMessage),F))}}));o.register(a,t)}isAcceptableTranslationObserver(){return!0}}x([e()],G.prototype,"formFieldMessageTranslatorSlimmer",void 0),x([s()],G.prototype,"host",void 0),x([s()],G.prototype,"options",void 0);var P=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class W{constructor(t,e,s,i){var r,n;this.formFieldMessageTranslatorSlimmer=new U,this.fieldErrorUIController=new G,this.resizeObserverSlimmer=R(W,I,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"}],[{callback:t=>{const e=this.isVisible,s=t[0].contentRect.height>0;this.isVisible=s,this.isAutoValidationEnabled()&&m(this.host,"vega-form")&&e!==s&&this.valid(["visible"])},target:()=>this.host}]),this.defaultRules=[],this.additionalRules=[],this.listeners=[],this.isTouched=!1,this.isModified=!1,this.isVisible=!1,this.formFieldValidationRuleHandlerChain=new M,this.hostChildAddedBlurEventMap=new WeakMap,this.handleValidationResult=(t,e)=>{let s=!0;return e?("rule"===t?e.shouldShowError?this.fieldErrorUIController.applyInputInvalidUI(e.message):this.fieldErrorUIController.resetInputInvalidUI():t?this.fieldErrorUIController.applyInputInvalidUI(e.message):this.fieldErrorUIController.resetInputInvalidUI(),s=!1):this.fieldErrorUIController.resetInputInvalidUI(),this.invokeListeners(s),o.notify(l,{host:this.host,detail:s}),s},this.setupTouchedListener=()=>{this.getTouchableAreaElements().filter((t=>t&&!0!==this.hostChildAddedBlurEventMap.get(t))).forEach((t=>{t.addEventListener("blur",(()=>{this.updateIsTouched(!0)})),this.hostChildAddedBlurEventMap.set(t,!0)}))},this.defaultRules=t||[],this.host=e,this.defaultValue=s,this.options=i,this.initDisabledAttrObserver(),this.connectResizeObserver(),this.initFormResetObserver(),null===(n=(r=this.host).componentOnReady)||void 0===n||n.call(r).then((()=>{this.didRender()})),this.setupModifiedListener(),this.listenHostElementKeydown(),this.updateValidationHandlers()}async validate(t){return await this.valid([],t)}addListener(t){this.listeners.push(t)}getRules(){const t=[...this.additionalRules];return[...this.defaultRules.map((e=>this.overrideDefaultRuleByAdditionalRule(e,t))),...t]}setDefaultRules(t){this.defaultRules=t,this.updateValidationHandlers()}setAdditionalRules(t){this.additionalRules=t,this.updateValidationHandlers()}destroy(){o.notify(h,{host:this.host}),this.unregisterFormResetObserver(),o.unregister(c,this.hostValueChangeObserver),this.hostChildrenObserver&&this.hostChildrenObserver.disconnect()}connectResizeObserver(){}updateDisableBlurValidation(t){this.disableBlurValidation=t}updateValidationHandlers(){this.formFieldValidationRuleHandlerChain.setHandlersByRules(this.getRules())}async valid(t,e="rule"){const s=this.getStatus(),i=this.host.value;this.formFieldValidationRuleHandlerChain.checkIncludesAsyncRuleHandler(i,s,t)&&o.notify(l,{host:this.host,detail:null});const{isValid:r,message:n}=await this.formFieldValidationRuleHandlerChain.process(i,s,t,e,this.handleValidationResult);return{isValid:r,message:this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(n)}}invokeListeners(t){this.listeners.forEach((e=>e.callback(t)))}getStatus(){return{touched:this.isTouched,modified:this.isModified,disabled:this.host.disabled,visible:this.isVisible}}updateIsTouched(t){const e=this.isTouched;this.isTouched=t,!this.disableBlurValidation&&this.isAutoValidationEnabled()&&this.valid(e===t?[]:["touched"])}updateIsModified(t){const e=this.isModified;this.isModified=t,this.isAutoValidationEnabled()&&this.valid(e===t?[]:["modified"])}initDisabledAttrObserver(){this.disabledAttrObserver=new MutationObserver((()=>{this.isAutoValidationEnabled()&&this.valid(["disabled"])})),this.disabledAttrObserver.observe(this.host,{attributes:!0,attributeFilter:["disabled"]})}canAcceptFormResetOperation(t){return m(this.host,"vega-form")===t.host}unregisterFormResetObserver(){o.unregister(d,this.formResetTriggeredObserver)}monitorTouchedListener(){const t=this.getInputContainerElements();t&&(this.hostChildrenObserver=new MutationObserver((()=>{this.setupTouchedListener()})),this.hostChildrenObserver.observe(t,{childList:!0,subtree:!0})),this.setupTouchedListener()}getTouchableAreaElements(){return this.options&&this.options.touchableAreaGetter?this.options.touchableAreaGetter():[]}getInputContainerElements(){return this.options&&this.options.inputContainerGetter?this.options.inputContainerGetter():null}setupModifiedListener(){this.hostValueChangeObserver=new n(this.isCurrentTarget.bind(this),(()=>this.updateIsModified(!0))),o.register(c,this.hostValueChangeObserver)}isCurrentTarget(t){return this.host===t.host}async reset(t){var e,s;if(this.shouldVisitElement(this.host,null===(e=t.option)||void 0===e?void 0:e.skipDisabled,null===(s=t.option)||void 0===s?void 0:s.skipInvisible)){const e=t.defaultValueMap,s=this.host.dataset.vegaForm,i=null==e[s]?this.getDefaultValue():e[s];"function"==typeof this.host.setValue?await this.host.setValue(i):this.host.value=i,this.isTouched=!1,this.isModified=!1,this.fieldErrorUIController.resetInputInvalidUI()}}getDefaultValue(){return this.defaultValue instanceof Function?this.defaultValue(this.host):this.defaultValue}didRender(){this.monitorTouchedListener()}initFormResetObserver(){this.formResetTriggeredObserver=new n(this.canAcceptFormResetOperation.bind(this),this.reset.bind(this)),o.register(d,this.formResetTriggeredObserver)}isAutoValidationEnabled(){return!1!==this.host.autoValidation}shouldVisitElement(t,e,s){return!(!t.dataset.vegaForm||e&&t.disabled||s&&!p(t))}listenHostElementKeydown(){this.host.addEventListener("keydown",(t=>{if(this.canSubmitFormByEvent(t)){const t=m(this.host,"vega-form",{outerMost:!0});t&&o.notify(g.getSubject(t,w),{host:this.host})}}))}canSubmitFormByEvent(t){const e="Enter"===t.key||13===t.keyCode,s=e&&t.shiftKey;switch(this.host.tagName){case"VEGA-TEXTAREA":case"VEGA-DATE-PICKER":case"VEGA-TIME-PICKER":return s&&t.preventDefault(),s;case"VEGA-RICH-TEXT-EDITOR":return!1;default:return e}}overrideDefaultRuleByAdditionalRule(t,e){if(t&&e){const s=e.findIndex((e=>e instanceof C&&e instanceof t.constructor&&e.overrideDefault));if(s>-1)return e.splice(s,1)[0]}return t}}P([e()],W.prototype,"formFieldMessageTranslatorSlimmer",void 0),P([e()],W.prototype,"fieldErrorUIController",void 0),P([e()],W.prototype,"resizeObserverSlimmer",void 0);var z=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class K extends t{constructor(){super(...arguments),this.fieldErrorUIController=new G,this.handleFieldErrorMessageUpdate=t=>{const{message:e,isValid:s}=t;s?this.fieldErrorUIController.resetInputInvalidUI():this.fieldErrorUIController.applyInputInvalidUI(e)}}handleComponentWillLoadByFieldErrorSlimmer(){this.fieldErrorMessageChangeObserver=new n(this.canAcceptFieldErrorMessageUpdate.bind(this),this.handleFieldErrorMessageUpdate),o.register(u,this.fieldErrorMessageChangeObserver)}handleUnregisterObserver(){o.unregister(u,this.fieldErrorMessageChangeObserver)}canAcceptFieldErrorMessageUpdate(t){const{host:e}=t,s=this.host.parentElement;return s&&s===e&&"VEGA-FIELD-ERROR"===s.tagName||this.host===e}}z([s()],K.prototype,"host",void 0),z([s()],K.prototype,"options",void 0),z([e()],K.prototype,"fieldErrorUIController",void 0),z([i("setInjectFormFieldHelper")],K.prototype,"handleComponentWillLoadByFieldErrorSlimmer",null),z([i("disconnectedCallback")],K.prototype,"handleUnregisterObserver",null);var N=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class X extends t{constructor(){super(...arguments),this.handleValidInvocation=async t=>{if(this.validator){void 0!==t.timerId&&clearTimeout(t.timerId);const e=await this.validator.validate(t.message);if(e){const{isValid:s,message:i}=e;"function"==typeof t.promiseResolve&&t.promiseResolve({isValid:s,message:i})}}}}registerValidInvocationObserver(){j.addUniqueObserverToNode(this.host,O,this.handleValidInvocation)}handleUnregisterObserver(){j.removeUniqueObserverFromNode(this.host,O)}}N([s()],X.prototype,"host",void 0),N([s()],X.prototype,"validator",void 0),N([i("setInjectFormFieldHelper")],X.prototype,"registerValidInvocationObserver",null),N([i("disconnectedCallback")],X.prototype,"handleUnregisterObserver",null);var q=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class J extends T{constructor(){super({parent:"vega-form",subStates:[{subStateName:"disableBlurValidation",parentStateName:"disableBlurValidation",callback:t=>{var e;null===(e=this.validator)||void 0===e||e.updateDisableBlurValidation(t)}}]})}componentWillLoad(){super.componentWillLoad()}}q([s()],J.prototype,"host",void 0),q([s()],J.prototype,"validator",void 0),q([i("setInjectFormFieldHelper")],J.prototype,"componentWillLoad",null);var Q=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class Y extends t{constructor(t){super(),this.fieldErrorSlimmer=new K,this.formFieldValidInvokeSlimmer=new X,this.formFormStateController=new J,this.mutationObserverCallBack=()=>{this.validator&&(this.setDefaultRules(),this.internalValidate())},this.options=t,this.setMutationObserverSlimmer()}connectedCallback(){null===this.validator&&this.setInjectFormFieldHelper()}disconnectedCallback(){this.validator&&(this.validator.destroy(),this.validator=null)}componentDidLoad(){}static isValidFormField(t){return t&&Boolean(t.getAttribute("data-vega-form"))}watchValidationRulesByFormControllerSlimmer(t,e){k(t,e,!1,((t,e)=>t===e?0:-1))||(this.setAdditionalRules(),this.internalValidate())}setInjectFormFieldHelper(){if(Y.isValidFormField(this.host)){const{defaultValue:t}=this.options,e=new W(this.getPropertyRules(),this.host,t,this.options);e.addListener({callback:t=>{this.isValid!=t&&(this.isValid=t,o.notify(f,{host:this.host,detail:t}))}}),this.validator=e,this.setAdditionalRules()}}setAdditionalRules(){this.options.validationRulesName&&"validationRules"===this.options.validationRulesName&&this.validator&&this.validator.setAdditionalRules(this.validationRules||[])}setDefaultRules(){this.validator&&this.validator.setDefaultRules(this.getPropertyRules())}getPropertyRules(){const{propertyRules:t,attributeGetter:e}=this.options;return t.map((t=>{const s=t.dependence&&"string"==typeof t.dependence?[e(t.dependence)]:Array.isArray(t.dependence)?t.dependence.map((t=>e(t))):[null];return t.ruleFactory(e(t.propertyName),...s)})).filter(Boolean)}internalValidate(){!this.disabled&&this.validator&&this.validator.validate()}setMutationObserverSlimmer(){this.mutationObserverSlimmer=new S({options:{attributeFilter:this.options.propertyRules.map((t=>r(t.propertyName))),attributeOldValue:!0},mutationFilter:A(),callback:this.mutationObserverCallBack})}}Q([s()],Y.prototype,"host",void 0),Q([s({writable:!0})],Y.prototype,"validationRules",void 0),Q([s()],Y.prototype,"disabled",void 0),Q([s()],Y.prototype,"autoValidation",void 0),Q([s({writable:!0})],Y.prototype,"isValid",void 0),Q([e()],Y.prototype,"fieldErrorSlimmer",void 0),Q([e()],Y.prototype,"formFieldValidInvokeSlimmer",void 0),Q([e()],Y.prototype,"mutationObserverSlimmer",void 0),Q([e()],Y.prototype,"formFormStateController",void 0),Q([i("connectedCallback")],Y.prototype,"connectedCallback",null),Q([i("disconnectedCallback")],Y.prototype,"disconnectedCallback",null),Q([i("componentDidLoad")],Y.prototype,"componentDidLoad",null),Q([i("watchValidationRules")],Y.prototype,"watchValidationRulesByFormControllerSlimmer",null),Q([i("componentWillLoad")],Y.prototype,"setInjectFormFieldHelper",null);export{Y as F}
|
|
1
|
+
import{V as t,I as e,c as s,M as i}from"./p-6e1ab235.js";import{c as r}from"./p-02841589.js";import{C as o}from"./p-2d0d575f.js";import{O as n}from"./p-331a62d5.js";import{U as a,a as l,b as h,F as c,c as d,d as u,e as f}from"./p-cb378636.js";import{f as m,d as p}from"./p-528748fa.js";import{a as v,g as b}from"./p-8b5d3a52.js";import{c as R}from"./p-6a334573.js";import{d as g,D as j}from"./p-526e3634.js";import{h as y,f as w,i as O}from"./p-3a93730e.js";import{V as E}from"./p-eb927e2b.js";import{h as V,l as F}from"./p-f0e828d8.js";import{P as I}from"./p-81dd00d0.js";import{I as C}from"./p-abd7aeaa.js";import{M as S}from"./p-78a57a17.js";import{A}from"./p-52b8f2d2.js";import{i as k}from"./p-d27ae9ff.js";import{S as T}from"./p-a58cacca.js";class L{constructor(t){this.rule=t}getStatus(t,e,s){return{canEvaluate:this.rule.canEvaluate(t,e,s),isAsync:v(this.rule.evaluate)}}shouldShowError(t,e){try{return this.rule.shouldShowError?this.rule.shouldShowError(t,e):this.defaultShouldShowError(t)}catch(t){return!1}}handle(t){try{return this.rule.evaluate(t)}catch(t){return{isValid:!0,message:""}}}defaultShouldShowError(t){return!t.disabled&&t.visible&&(t.touched||t.modified)}}class M{constructor(){this.handlers=[],this.processId=""}checkIncludesAsyncRuleHandler(t,e,s){return!!this.handlers.find((i=>{const r=i.getStatus(t,e,s);return r.canEvaluate&&r.isAsync}))}setHandlersByRules(t){this.handlers=t&&t.length?t.map((t=>new L(t))):[]}async process(t,e,s,i,r){const o=this.preProcess();let n;for(const i of this.handlers){if(o!==this.processId)break;const r=i.getStatus(t,e,s);if(!r.canEvaluate)continue;let a;if(r.isAsync)try{a=await i.handle(t)}catch(t){}else a=i.handle(t);if(a&&!a.isValid){const t=i.shouldShowError(e,s);n=Object.assign(Object.assign({},a),{shouldShowError:t});break}}return this.postProcess(o,i,n,r),n?{isValid:!1,message:n.message}:{isValid:!0,message:""}}preProcess(){const t=b();return this.processId=t,t}postProcess(t,e,s,i){this.processId===t&&i(e,s)}}class D{run(t){const e=t.nextElementSibling;return e&&e.querySelector(".vega-error")?e.querySelector(".vega-error"):null}}class B{run(t){let e=t.nextElementSibling;return e&&!e.classList.contains("vega-error")&&(e=document.createElement("label"),e.classList.add("vega-error"),e.setAttribute("part","field-error-message"),t.after(e)),e}}class H{run(t){let e=t.nextElementSibling;return e||(e=document.createElement("label"),e.classList.add("vega-error"),e.setAttribute("part","field-error-message"),t.after(e)),e}}class U extends t{getTranslatedMessage(t){return"string"==typeof t?E.t(t):E.t(t.key,...t.args||[])}}var x=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class G extends t{constructor(){super(),this.formFieldMessageTranslatorSlimmer=new U,this.fieldErrorUiControllerStrategies=[new D,new B,new H],this.initTranslationObserver()}applyInputInvalidUI(t){const e=this.getInputElementContainer();if(o.notify(g.getSubject(this.host,y),{host:this.host,showError:!0}),e&&(e.classList.add("error"),t)){this.errorMessage=t;const s=this.getErrorContainer(e);s.innerHTML=V.sanitize(this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(t),F),s.classList.remove("vega-hidden")}}resetInputInvalidUI(){this.errorMessage="";const t=this.getInputElementContainer();t&&(this.getErrorContainer(t).classList.add("vega-hidden"),t.classList.remove("error"),o.notify(g.getSubject(this.host,y),{host:this.host,showError:!1}))}getInputElementContainer(){return this.options&&this.options.inputContainerGetter?this.options.inputContainerGetter():null}getErrorContainer(t){for(const e of this.fieldErrorUiControllerStrategies){const s=e.run(t);if(s)return s}}initTranslationObserver(){const t=new n(this.isAcceptableTranslationObserver.bind(this),(()=>{if(!this.errorMessage)return;const t=this.getInputElementContainer();if(t){const e=this.getErrorContainer(t);e&&(e.innerHTML=V.sanitize(this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(this.errorMessage),F))}}));o.register(a,t)}isAcceptableTranslationObserver(){return!0}}x([e()],G.prototype,"formFieldMessageTranslatorSlimmer",void 0),x([s()],G.prototype,"host",void 0),x([s()],G.prototype,"options",void 0);var P=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class W{constructor(t,e,s,i){var r,n;this.formFieldMessageTranslatorSlimmer=new U,this.fieldErrorUIController=new G,this.resizeObserverSlimmer=R(W,I,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"}],[{callback:t=>{const e=this.isVisible,s=t[0].contentRect.height>0;this.isVisible=s,this.isAutoValidationEnabled()&&m(this.host,"vega-form")&&e!==s&&this.valid(["visible"])},target:()=>this.host}]),this.defaultRules=[],this.additionalRules=[],this.listeners=[],this.isTouched=!1,this.isModified=!1,this.isVisible=!1,this.formFieldValidationRuleHandlerChain=new M,this.hostChildAddedBlurEventMap=new WeakMap,this.handleValidationResult=(t,e)=>{let s=!0;return e?("rule"===t?e.shouldShowError?this.fieldErrorUIController.applyInputInvalidUI(e.message):this.fieldErrorUIController.resetInputInvalidUI():t?this.fieldErrorUIController.applyInputInvalidUI(e.message):this.fieldErrorUIController.resetInputInvalidUI(),s=!1):this.fieldErrorUIController.resetInputInvalidUI(),this.invokeListeners(s),o.notify(l,{host:this.host,detail:s}),s},this.setupTouchedListener=()=>{this.getTouchableAreaElements().filter((t=>t&&!0!==this.hostChildAddedBlurEventMap.get(t))).forEach((t=>{t.addEventListener("blur",(()=>{this.updateIsTouched(!0)})),this.hostChildAddedBlurEventMap.set(t,!0)}))},this.defaultRules=t||[],this.host=e,this.defaultValue=s,this.options=i,this.initDisabledAttrObserver(),this.connectResizeObserver(),this.initFormResetObserver(),null===(n=(r=this.host).componentOnReady)||void 0===n||n.call(r).then((()=>{this.didRender()})),this.setupModifiedListener(),this.listenHostElementKeydown(),this.updateValidationHandlers()}async validate(t){return await this.valid([],t)}addListener(t){this.listeners.push(t)}getRules(){const t=[...this.additionalRules];return[...this.defaultRules.map((e=>this.overrideDefaultRuleByAdditionalRule(e,t))),...t]}setDefaultRules(t){this.defaultRules=t,this.updateValidationHandlers()}setAdditionalRules(t){this.additionalRules=t,this.updateValidationHandlers()}destroy(){o.notify(h,{host:this.host}),this.unregisterFormResetObserver(),o.unregister(c,this.hostValueChangeObserver),this.hostChildrenObserver&&this.hostChildrenObserver.disconnect()}connectResizeObserver(){}updateDisableBlurValidation(t){this.disableBlurValidation=t}updateValidationHandlers(){this.formFieldValidationRuleHandlerChain.setHandlersByRules(this.getRules())}async valid(t,e="rule"){const s=this.getStatus(),i=this.host.value;this.formFieldValidationRuleHandlerChain.checkIncludesAsyncRuleHandler(i,s,t)&&o.notify(l,{host:this.host,detail:null});const{isValid:r,message:n}=await this.formFieldValidationRuleHandlerChain.process(i,s,t,e,this.handleValidationResult);return{isValid:r,message:this.formFieldMessageTranslatorSlimmer.getTranslatedMessage(n)}}invokeListeners(t){this.listeners.forEach((e=>e.callback(t)))}getStatus(){return{touched:this.isTouched,modified:this.isModified,disabled:this.host.disabled,visible:this.isVisible}}updateIsTouched(t){const e=this.isTouched;this.isTouched=t,!this.disableBlurValidation&&this.isAutoValidationEnabled()&&this.valid(e===t?[]:["touched"])}updateIsModified(t){const e=this.isModified;this.isModified=t,this.isAutoValidationEnabled()&&this.valid(e===t?[]:["modified"])}initDisabledAttrObserver(){this.disabledAttrObserver=new MutationObserver((()=>{this.isAutoValidationEnabled()&&this.valid(["disabled"])})),this.disabledAttrObserver.observe(this.host,{attributes:!0,attributeFilter:["disabled"]})}canAcceptFormResetOperation(t){return m(this.host,"vega-form")===t.host}unregisterFormResetObserver(){o.unregister(d,this.formResetTriggeredObserver)}monitorTouchedListener(){const t=this.getInputContainerElements();t&&(this.hostChildrenObserver=new MutationObserver((()=>{this.setupTouchedListener()})),this.hostChildrenObserver.observe(t,{childList:!0,subtree:!0})),this.setupTouchedListener()}getTouchableAreaElements(){return this.options&&this.options.touchableAreaGetter?this.options.touchableAreaGetter():[]}getInputContainerElements(){return this.options&&this.options.inputContainerGetter?this.options.inputContainerGetter():null}setupModifiedListener(){this.hostValueChangeObserver=new n(this.isCurrentTarget.bind(this),(()=>this.updateIsModified(!0))),o.register(c,this.hostValueChangeObserver)}isCurrentTarget(t){return this.host===t.host}async reset(t){var e,s;if(this.shouldVisitElement(this.host,null===(e=t.option)||void 0===e?void 0:e.skipDisabled,null===(s=t.option)||void 0===s?void 0:s.skipInvisible)){const e=t.defaultValueMap,s=this.host.dataset.vegaForm,i=null==e[s]?this.getDefaultValue():e[s];"function"==typeof this.host.setValue?await this.host.setValue(i):this.host.value=i,this.isTouched=!1,this.isModified=!1,this.fieldErrorUIController.resetInputInvalidUI()}}getDefaultValue(){return this.defaultValue instanceof Function?this.defaultValue(this.host):this.defaultValue}didRender(){this.monitorTouchedListener()}initFormResetObserver(){this.formResetTriggeredObserver=new n(this.canAcceptFormResetOperation.bind(this),this.reset.bind(this)),o.register(d,this.formResetTriggeredObserver)}isAutoValidationEnabled(){return!1!==this.host.autoValidation}shouldVisitElement(t,e,s){return!(!t.dataset.vegaForm||e&&t.disabled||s&&!p(t))}listenHostElementKeydown(){this.host.addEventListener("keydown",(t=>{if(this.canSubmitFormByEvent(t)){const t=m(this.host,"vega-form",{outerMost:!0});t&&o.notify(g.getSubject(t,w),{host:this.host})}}))}canSubmitFormByEvent(t){const e="Enter"===t.key||13===t.keyCode,s=e&&t.shiftKey;switch(this.host.tagName){case"VEGA-TEXTAREA":case"VEGA-DATE-PICKER":case"VEGA-TIME-PICKER":return s&&t.preventDefault(),s;case"VEGA-RICH-TEXT-EDITOR":return!1;default:return e}}overrideDefaultRuleByAdditionalRule(t,e){if(t&&e){const s=e.findIndex((e=>e instanceof C&&e instanceof t.constructor&&e.overrideDefault));if(s>-1)return e.splice(s,1)[0]}return t}}P([e()],W.prototype,"formFieldMessageTranslatorSlimmer",void 0),P([e()],W.prototype,"fieldErrorUIController",void 0),P([e()],W.prototype,"resizeObserverSlimmer",void 0);var z=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class K extends t{constructor(){super(...arguments),this.fieldErrorUIController=new G,this.handleFieldErrorMessageUpdate=t=>{const{message:e,isValid:s}=t;s?this.fieldErrorUIController.resetInputInvalidUI():this.fieldErrorUIController.applyInputInvalidUI(e)}}handleComponentWillLoadByFieldErrorSlimmer(){this.fieldErrorMessageChangeObserver=new n(this.canAcceptFieldErrorMessageUpdate.bind(this),this.handleFieldErrorMessageUpdate),o.register(u,this.fieldErrorMessageChangeObserver)}handleUnregisterObserver(){o.unregister(u,this.fieldErrorMessageChangeObserver)}canAcceptFieldErrorMessageUpdate(t){const{host:e}=t,s=this.host.parentElement;return s&&s===e&&"VEGA-FIELD-ERROR"===s.tagName||this.host===e}}z([s()],K.prototype,"host",void 0),z([s()],K.prototype,"options",void 0),z([e()],K.prototype,"fieldErrorUIController",void 0),z([i("setInjectFormFieldHelper")],K.prototype,"handleComponentWillLoadByFieldErrorSlimmer",null),z([i("disconnectedCallback")],K.prototype,"handleUnregisterObserver",null);var N=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class X extends t{constructor(){super(...arguments),this.handleValidInvocation=async t=>{if(this.validator){void 0!==t.timerId&&clearTimeout(t.timerId);const e=await this.validator.validate(t.message);if(e){const{isValid:s,message:i}=e;"function"==typeof t.promiseResolve&&t.promiseResolve({isValid:s,message:i})}}}}registerValidInvocationObserver(){j.addUniqueObserverToNode(this.host,O,this.handleValidInvocation)}handleUnregisterObserver(){j.removeUniqueObserverFromNode(this.host,O)}}N([s()],X.prototype,"host",void 0),N([s()],X.prototype,"validator",void 0),N([i("setInjectFormFieldHelper")],X.prototype,"registerValidInvocationObserver",null),N([i("disconnectedCallback")],X.prototype,"handleUnregisterObserver",null);var q=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class J extends T{constructor(){super({parent:"vega-form",subStates:[{subStateName:"disableBlurValidation",parentStateName:"disableBlurValidation",callback:t=>{var e;null===(e=this.validator)||void 0===e||e.updateDisableBlurValidation(t)}}]})}componentWillLoad(){super.componentWillLoad()}}q([s()],J.prototype,"host",void 0),q([s()],J.prototype,"validator",void 0),q([i("setInjectFormFieldHelper")],J.prototype,"componentWillLoad",null);var Q=function(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n};class Y extends t{constructor(t){super(),this.fieldErrorSlimmer=new K,this.formFieldValidInvokeSlimmer=new X,this.formFormStateController=new J,this.mutationObserverCallBack=()=>{this.validator&&(this.setDefaultRules(),this.internalValidate())},this.options=t,this.setMutationObserverSlimmer()}connectedCallback(){null===this.validator&&this.setInjectFormFieldHelper()}disconnectedCallback(){this.validator&&(this.validator.destroy(),this.validator=null)}componentDidLoad(){}static isValidFormField(t){return t&&Boolean(t.getAttribute("data-vega-form"))}watchValidationRulesByFormControllerSlimmer(t,e){k(t,e,!1,((t,e)=>t===e?0:-1))||(this.setAdditionalRules(),this.internalValidate())}setInjectFormFieldHelper(){if(Y.isValidFormField(this.host)){const{defaultValue:t}=this.options,e=new W(this.getPropertyRules(),this.host,t,this.options);e.addListener({callback:t=>{this.isValid!=t&&(this.isValid=t,o.notify(f,{host:this.host,detail:t}))}}),this.validator=e,this.setAdditionalRules()}}setAdditionalRules(){this.options.validationRulesName&&"validationRules"===this.options.validationRulesName&&this.validator&&this.validator.setAdditionalRules(this.validationRules||[])}setDefaultRules(){this.validator&&this.validator.setDefaultRules(this.getPropertyRules())}getPropertyRules(){const{propertyRules:t,attributeGetter:e}=this.options;return t.map((t=>{const s=t.dependence&&"string"==typeof t.dependence?[e(t.dependence)]:Array.isArray(t.dependence)?t.dependence.map((t=>e(t))):[null];return t.ruleFactory(e(t.propertyName),...s)})).filter(Boolean)}internalValidate(){!this.disabled&&this.validator&&this.validator.validate()}setMutationObserverSlimmer(){this.mutationObserverSlimmer=new S({options:{attributeFilter:this.options.propertyRules.map((t=>r(t.propertyName))),attributeOldValue:!0},mutationFilter:A(),callback:this.mutationObserverCallBack})}}Q([s()],Y.prototype,"host",void 0),Q([s({writable:!0})],Y.prototype,"validationRules",void 0),Q([s()],Y.prototype,"disabled",void 0),Q([s()],Y.prototype,"autoValidation",void 0),Q([s({writable:!0})],Y.prototype,"isValid",void 0),Q([e()],Y.prototype,"fieldErrorSlimmer",void 0),Q([e()],Y.prototype,"formFieldValidInvokeSlimmer",void 0),Q([e()],Y.prototype,"mutationObserverSlimmer",void 0),Q([e()],Y.prototype,"formFormStateController",void 0),Q([i("connectedCallback")],Y.prototype,"connectedCallback",null),Q([i("disconnectedCallback")],Y.prototype,"disconnectedCallback",null),Q([i("componentDidLoad")],Y.prototype,"componentDidLoad",null),Q([i("watchValidationRules")],Y.prototype,"watchValidationRulesByFormControllerSlimmer",null),Q([i("componentWillLoad")],Y.prototype,"setInjectFormFieldHelper",null);export{Y as F}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,H as t,r as o,c as i,g as r}from"./p-6b2342e0.js";import{s as a}from"./p-519a7d55.js";import{R as n}from"./p-280cbcdb.js";import{c as s,V as l,M as d,I as p}from"./p-6e1ab235.js";import{R as c}from"./p-94a064a3.js";import{m as h}from"./p-6bd5c49b.js";import{V as v,I as g}from"./p-8ce9e214.js";import{D as m}from"./p-526e3634.js";import{a as f,i as u,q as b,H as x}from"./p-fcefb62c.js";import{F as w}from"./p-cb378636.js";import{C as y}from"./p-2d0d575f.js";import{c as j}from"./p-3a620268.js";import{V as R}from"./p-b6be1f33.js";import{D as C}from"./p-b19b1c08.js";import{F as I}from"./p-3a49089e.js";import{f as k,e as U}from"./p-528748fa.js";import{C as O}from"./p-328dbe8e.js";import{c as D}from"./p-d7790113.js";import{T as F}from"./p-7fbd11b0.js";import{D as z}from"./p-4edd7f8c.js";import{V}from"./p-3e09aeed.js";import"./p-abd7aeaa.js";import"./p-b2488adb.js";import"./p-ed45b3b6.js";import"./p-d4ea8e22.js";import"./p-d884c644.js";import"./p-091fbc35.js";import"./p-49a2e141.js";import"./p-262ec334.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-dcf162e9.js";import"./p-982747ef.js";import"./p-331a62d5.js";import"./p-8b5d3a52.js";import"./p-9a6bd32c.js";import"./p-6a334573.js";import"./p-02841589.js";import"./p-3a93730e.js";import"./p-f0e828d8.js";import"./p-b75ee3ba.js";import"./p-81dd00d0.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-a58cacca.js";import"./p-46cab60a.js";import"./p-5f377954.js";import"./p-fb5ea4b2.js";import"./p-4866e390.js";var N=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class E extends l{getImageUploaderContainer(){return this.imageUploaderContainerRef}render(){return e(t,{class:{disabled:this.disabled}},this.renderLabelDom(),e("div",{ref:e=>this.imageUploaderContainerRef=e,class:{"vega-image-uploader-select":!0,"disabled-border":this.disabled&&!this.value},style:{width:this.getSize(this.width),height:this.getSize(this.height)}},this.renderContentByStatus()),this.inputRenderer.render(),this.renderHint())}renderLabelDom(){return e("vega-field-label",{"is-field-required":this.required,disabled:this.disabled,optional:this.optional,label:this.label})}renderContentByStatus(){if("uploading"===this.status)return this.uploadingContentRenderer.render();{const e=this.previewController.getImagePreviewURL();return e?this.previewContentRenderer.render(e):this.defaultContentRenderer.render()}}renderHint(){return this.hint&&e("div",{class:"vega-hint"},e("label",null,this.hint))}getSize(e){if(e){const t=c.format(e,"size");return"number"==typeof t?`${t}px`:`${t}`}}}N([s({componentFieldName:"vegaImageUploaderInputRenderer"})],E.prototype,"inputRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderDefaultContentRenderer"})],E.prototype,"defaultContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderPreviewContentRenderer"})],E.prototype,"previewContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderUploadingContentRenderer"})],E.prototype,"uploadingContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderPreviewController"})],E.prototype,"previewController",void 0),N([s()],E.prototype,"value",void 0),N([s()],E.prototype,"disabled",void 0),N([s()],E.prototype,"status",void 0),N([s()],E.prototype,"label",void 0),N([s()],E.prototype,"required",void 0),N([s()],E.prototype,"optional",void 0),N([s()],E.prototype,"width",void 0),N([s()],E.prototype,"height",void 0),N([s()],E.prototype,"hint",void 0);var A=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class S extends l{constructor(){super(...arguments),this.handleFileInputChange=e=>{e.stopPropagation();const t=e.target;t.files.length&&this.valueController.setValue(t.files[0])}}getFileInputRef(){return this.fileInputRef}render(){return e("input",{type:"file",accept:this.accept,class:"v-hidden",ref:e=>this.fileInputRef=e,onChange:this.handleFileInputChange})}}A([s({componentFieldName:"vegaImageUploaderValueController"})],S.prototype,"valueController",void 0),A([s()],S.prototype,"accept",void 0);var P=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class L extends l{triggerInputClick(){this.disabled||this.inputRenderer.getFileInputRef().click()}resetInput(){this.inputRenderer.getFileInputRef().value=""}}P([s({componentFieldName:"vegaImageUploaderInputRenderer"})],L.prototype,"inputRenderer",void 0),P([s()],L.prototype,"disabled",void 0);var T=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class _ extends l{constructor(){super(...arguments),this.renderActionButton=t=>{const o=this.getButtonOptions(t);return e("vega-button-circle",Object.assign({size:"small",variant:"icon-only",iconColor:this.isInDarkMode?"text-primary":"text-inverted-primary",role:"menuitem",ref:e=>{m.addUniqueObserverToNode(e,f,(()=>{this.handleClick(t)}))}},o))}}handleClick(e){switch(e){case"Preview":this.previewController.showPreview();break;case"Delete":this.removeController.showRemoveDialog();break;case"Replace":this.inputController.triggerInputClick()}}render(){return this.showRemoveButton||this.showPreviewButton||this.showReplaceButton?e("span",{class:"actions"},this.showPreviewButton&&this.renderActionButton("Preview"),this.showReplaceButton&&!this.disabled&&this.renderActionButton("Replace"),this.showRemoveButton&&!this.disabled&&this.renderActionButton("Delete")):null}getButtonOptions(e){let t;switch(e){case"Preview":t={icon:"zoom-in",label:e};break;case"Delete":t={icon:"delete-bin",label:e};break;case"Replace":t={icon:"photo",label:e}}return t}}T([s({componentFieldName:"vegaImageUploaderInputController"})],_.prototype,"inputController",void 0),T([s({componentFieldName:"vegaImageUploaderValueController"})],_.prototype,"valueController",void 0),T([s({componentFieldName:"vegaImageUploaderPreviewController"})],_.prototype,"previewController",void 0),T([s({componentFieldName:"vegaImageUploaderRemoveController"})],_.prototype,"removeController",void 0),T([s()],_.prototype,"disabled",void 0),T([s()],_.prototype,"showPreviewButton",void 0),T([s()],_.prototype,"showRemoveButton",void 0),T([s()],_.prototype,"showReplaceButton",void 0),T([s()],_.prototype,"removeEventEmitter",void 0),T([s()],_.prototype,"isInDarkMode",void 0);var B=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class q extends l{handleValueChange(){this.value||this.inputController.resetInput(),this.changeEventEmitter.emit(this.value),y.notify(w,{host:this.host,detail:this.value})}setValue(e){this.value=e}}B([s({writable:!0})],q.prototype,"value",void 0),B([s()],q.prototype,"changeEventEmitter",void 0),B([s()],q.prototype,"host",void 0),B([s({componentFieldName:"vegaImageUploaderInputController"})],q.prototype,"inputController",void 0),B([d("watchValue")],q.prototype,"handleValueChange",null);var K=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class M extends l{constructor(){super(...arguments),this.getImagePreviewURL=e=>{if(e=e||this.value)return e.url||URL.createObjectURL(e)},this.generatePreviewModal=e=>{const t=document.createElement("vega-modal");this.value&&this.value.name&&(t.modalTitle=this.value.name);const o=document.createElement("div");o.style.textAlign="center";const i=document.createElement("img");return i.width=0,i.className="preview-image",e&&(i.src=e),i.alt="",i.style.width="100%",o.appendChild(i),t.appendChild(o),this.previewModalRef=t,document.body.append(t),t}}disconnectedCallback(){var e;null===(e=this.previewModalRef)||void 0===e||e.remove()}showPreview(){const e=this.getImagePreviewURL();if(this.previewModalRef){const t=this.previewModalRef.querySelector(".preview-image");t&&e&&(t.src=e),this.value&&this.value.name&&(this.previewModalRef.modalTitle=this.value.name),this.previewModalRef.modal("show")}else this.generatePreviewModal(e).modal("show")}}K([s()],M.prototype,"value",void 0),K([d("disconnectedCallback")],M.prototype,"disconnectedCallback",null),K([d("getContentURL")],M.prototype,"getImagePreviewURL",void 0);class G extends l{constructor(){super(...arguments),this.preventDefaultDragEvent=e=>{e.preventDefault()}}render(t){const o=this.actionsRenderer.render();return e("div",{class:{"image-preview-container":!0,"actions-backdrop":!!o},tabIndex:0,role:"menu",onDrop:this.preventDefaultDragEvent,onDragEnter:this.preventDefaultDragEvent,onDragOver:this.preventDefaultDragEvent},e("img",{src:t,alt:""}),o)}}!function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);a>3&&n&&Object.defineProperty(t,o,n)}([s({componentFieldName:"vegaImageUploaderActionsRenderer"})],G.prototype,"actionsRenderer",void 0);var H=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class $ extends l{constructor(){super(...arguments),this.handleCancelUploading=e=>{e.stopPropagation(),this.status=void 0,this.removeController.handleRemoveFile(),this.cancelEventEmitter.emit()}}render(){return e("div",{class:"action-wrapper",role:"button",tabIndex:0,onClick:this.handleCancelUploading,onKeyDown:j()},e("span",{class:"action-loading"}),e("div",{class:"vega-image-uploader-text cancel-action"},"Cancel"))}}H([s({componentFieldName:"vegaImageUploaderRemoveController"})],$.prototype,"removeController",void 0),H([s({writable:!0})],$.prototype,"status",void 0),H([s()],$.prototype,"cancelEventEmitter",void 0);var J=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class Q extends l{constructor(){super(...arguments),this.handleUploaderClick=e=>{e.stopPropagation(),this.inputController.triggerInputClick()},this.dropHandler=e=>{var t;if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const o=this.dropFileFilterController.process(null===(t=e.dataTransfer)||void 0===t?void 0:t.files);o.length&&this.valueController.setValue(o[0])},this.handleDragEvent=e=>{e.preventDefault()}}render(){return e("div",{class:"action-wrapper",role:"button",tabIndex:0,onClick:this.handleUploaderClick,onKeyDown:j(),onDrop:this.dropHandler,onDragEnter:this.handleDragEvent,onDragOver:this.handleDragEvent},e("vega-icon",{icon:"plus-sign",size:"size-24"}),e("div",{class:"vega-image-uploader-text"},this.translationSlimmer.t(this.actionTitle)),this.renderSubtitle())}renderSubtitle(){return this.actionSubTitle&&e("div",{class:"sub-title"},this.actionSubTitle)}}J([s({componentFieldName:"vegaImageUploaderInputController"})],Q.prototype,"inputController",void 0),J([s({componentFieldName:"vegaImageUploaderValueController"})],Q.prototype,"valueController",void 0),J([s()],Q.prototype,"disabled",void 0),J([s()],Q.prototype,"dropFileFilterController",void 0),J([s()],Q.prototype,"actionTitle",void 0),J([s()],Q.prototype,"actionSubTitle",void 0),J([s()],Q.prototype,"translationSlimmer",void 0);var W=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class X extends l{constructor(){super(...arguments),this.showRemoveDialog=()=>{this.removeDialogRef=R.open({type:"danger",title:"Delete Image",content:"Are you sure you want to delete this image?",handleOk:()=>(this.handleRemoveFile(),!0),okButton:{label:"Delete"}})},this.handleRemoveFile=()=>{this.valueController.setValue(null),this.removeEventEmitter.emit()}}disconnectedCallback(){var e;null===(e=this.removeDialogRef)||void 0===e||e.remove()}}W([s({componentFieldName:"vegaImageUploaderValueController"})],X.prototype,"valueController",void 0),W([s()],X.prototype,"removeEventEmitter",void 0),W([d("disconnectedCallback")],X.prototype,"disconnectedCallback",null);var Y=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class Z extends l{handleValueChange(){this.value&&this.hideBackDropAndActions()}hideBackDropAndActions(){const e=U();e&&k(e,"vega-image-uploader")===this.host&&e.blur()}}Y([s()],Z.prototype,"host",void 0),Y([s()],Z.prototype,"value",void 0),Y([d("watchValue")],Z.prototype,"handleValueChange",null);const ee=[{payloadKey:"AUTO_VALIDATION_IS_TRUE",payloadDescription:"Determines whether automatic validation should be implemented for image uploads",payloadValue:e=>!0===e.autoValidation},{payloadKey:"AUTO_VALIDATION_IS_FALSE",payloadDescription:"Determines whether automatic validation should be implemented for image uploads",payloadValue:e=>!1===e.autoValidation}];var te=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};const oe=["jpg","png","jpeg"],ie=class{constructor(e){o(this,e),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.vegaRemove=i(this,"vegaRemove",7),this.remove=i(this,"remove",7),this.vegaCancel=i(this,"vegaCancel",7),this.cancel=i(this,"cancel",7),this.globalSlimmers={},this.translationSlimmer=new F,this.vegaImageUploaderRenderer=new E,this.vegaImageUploaderUploadingContentRenderer=new $,this.vegaImageUploaderPreviewContentRenderer=new G,this.vegaImageUploaderDefaultContentRenderer=new Q,this.vegaImageUploaderInputRenderer=new S,this.vegaImageUploaderActionsRenderer=new _,this.vegaImageUploaderInputController=new L,this.vegaImageUploaderValueController=new q,this.vegaImageUploaderPreviewController=new M,this.vegaImageUploaderRemoveController=new X,this.dropFileFilterController=new C,this.actionsVisibilityController=new Z,this.darkModeStateControllerSlimmer=new z,this.formFieldController=new I({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new n:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:e=>this[e],inputContainerGetter:()=>this.vegaImageUploaderRenderer.getImageUploaderContainer(),touchableAreaGetter:()=>[this.vegaImageUploaderInputRenderer.getFileInputRef()]}),this.changeEventEmitter=D(ie,u),this.removeEventEmitter=D(ie,b),this.cancelEventEmitter=D(ie,x),this.buttonCircleEventPrevent=new O([f],(()=>this.vegaImageUploaderRenderer.getImageUploaderContainer())),this.vegaComponentUsageRuntimeMetricsSlimmer=new v(ee),this.isInDarkMode=V.isDarkMode(),this.value=null,this.accept=oe.map((e=>`.${e}`)).join(","),this.showPreviewButton=!0,this.showRemoveButton=!0,this.showReplaceButton=!0,this.disabled=!1,this.required=!1,this.optional=!1,this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.label="",this.actionTitle="Upload",this.width=120,this.height=120}watchValue(){}watchValidationRules(){}disconnectedCallback(){}async getContentURL(e){return h(e)}render(){return a(this.vegaImageUploaderRenderer.render(),this.host)}get host(){return r(this)}static get watchers(){return{value:["watchValue"],validationRules:["watchValidationRules"]}}};te([g()],ie.prototype,"globalSlimmers",void 0),te([p()],ie.prototype,"translationSlimmer",void 0),te([p()],ie.prototype,"vegaImageUploaderRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderUploadingContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderPreviewContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderDefaultContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderInputRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderActionsRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderInputController",void 0),te([p()],ie.prototype,"vegaImageUploaderValueController",void 0),te([p()],ie.prototype,"vegaImageUploaderPreviewController",void 0),te([p()],ie.prototype,"vegaImageUploaderRemoveController",void 0),te([p()],ie.prototype,"dropFileFilterController",void 0),te([p()],ie.prototype,"actionsVisibilityController",void 0),te([p()],ie.prototype,"darkModeStateControllerSlimmer",void 0),te([p()],ie.prototype,"formFieldController",void 0),te([p()],ie.prototype,"changeEventEmitter",void 0),te([p()],ie.prototype,"removeEventEmitter",void 0),te([p()],ie.prototype,"cancelEventEmitter",void 0),te([p()],ie.prototype,"buttonCircleEventPrevent",void 0),te([p()],ie.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),ie.style=':host{display:inline-block;vertical-align:middle}:host .vega-image-uploader-select{box-sizing:border-box;background-color:rgba(var(--v-bg-tertiary, 240, 243, 247, 1));border-radius:8px;border-color:rgba(var(--v-border-color-input-field, 171, 198, 216, 1));display:flex;flex-direction:row;align-items:center;border-width:1px;border-style:dashed;min-width:120px;min-height:120px}:host .vega-image-uploader-select .action-wrapper{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:8px;width:100%;height:100%;padding:12px;box-sizing:border-box;cursor:pointer;flex-grow:1;outline:none}:host(.disabled) .vega-image-uploader-select.disabled-border{border-color:rgba(var(--v-border-color-input-field-disabled, 222, 225, 227, 1))}:host(:not(.disabled)) .vega-image-uploader-select:hover{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-input-field-hover, 115, 160, 190, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1))}:host(:not(.disabled)) .vega-image-uploader-select:hover .vega-image-uploader-text{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host(:not(.disabled)) .vega-image-uploader-select .action-wrapper:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1));border-style:none}:host(:not(.disabled)) .vega-image-uploader-select .actions-backdrop:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1));border-style:none}:host(:not(.disabled)) .vega-image-uploader-select .error .action-wrapper:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host(.disabled) .vega-image-uploader-select .action-wrapper{cursor:not-allowed}:host(.disabled) .vega-image-uploader-select .action-wrapper vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host(.disabled) .vega-image-uploader-select .action-wrapper .vega-image-uploader-text{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-image-uploader-select .vega-image-uploader-text{padding-top:20px;color:rgba(var(--v-text-link, 19, 98, 226, 1));font-family:"Inter", sans-serif;font-size:16px;font-weight:700;line-height:24px;letter-spacing:0px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}:host .vega-image-uploader-select .action-wrapper vega-icon{color:rgba(var(--v-text-link, 19, 98, 226, 1))}:host .image-preview-container{display:flex;align-items:center;justify-content:center;position:relative;height:100%;width:100%;border-radius:8px;outline:none}:host .image-preview-container img{width:100%;height:100%;border-radius:8px;object-fit:contain}:host .image-preview-container.actions-backdrop::before{width:100%;height:100%;border-radius:8px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;background-color:rgba(0, 0, 0, 0.6);content:" "}:host .vega-image-uploader-select .actions{position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;display:flex;align-items:center;justify-content:center;gap:2px;pointer-events:none}:host .image-preview-container.actions-backdrop:hover::before{opacity:1;pointer-events:auto}:host .image-preview-container:hover .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-visible::before{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-visible .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-within::before{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-within .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .action-loading{position:relative;display:inline-block;width:24px;height:24px}:host .vega-image-uploader-select .action-loading::before{content:" ";display:block;border-radius:9999px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;border:4px solid rgb(229, 239, 255)}:host .vega-image-uploader-select .action-loading::after{display:block;border-radius:9999px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;content:" ";border-style:solid;border-width:4px;border-color:rgb(153, 192, 255) transparent transparent transparent;animation:loading 1.2s linear infinite}@keyframes loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host .vega-image-uploader-select .action-wrapper .cancel-action{color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}:host vega-input{display:none}:host input[type=file]{display:none}:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;padding-top:12px;padding-right:8px;padding-left:8px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-image-uploader-select.error{border-color:rgba(var(--v-border-color-input-field-danger, 230, 50, 87, 1))}:host .vega-image-uploader-select.error:hover{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-image-uploader-select.error .action-wrapper:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1));border-style:none}:host .vega-image-uploader-select.error .actions-backdrop:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1));border-style:none}:host .vega-hidden{display:none}:host vega-field-label{margin-bottom:8px}:host .sub-title{padding-top:4px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}:host .vega-hint{padding-left:8px;padding-right:8px;padding-top:12px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}';export{ie as vega_image_uploader}
|
|
1
|
+
import{h as e,H as t,r as o,c as i,g as r}from"./p-6b2342e0.js";import{s as a}from"./p-519a7d55.js";import{R as n}from"./p-280cbcdb.js";import{c as s,V as l,M as d,I as p}from"./p-6e1ab235.js";import{R as c}from"./p-c596bb49.js";import{m as h}from"./p-6bd5c49b.js";import{V as v,I as g}from"./p-8ce9e214.js";import{D as m}from"./p-526e3634.js";import{a as f,i as u,q as b,H as x}from"./p-fcefb62c.js";import{F as w}from"./p-cb378636.js";import{C as y}from"./p-2d0d575f.js";import{c as j}from"./p-3a620268.js";import{V as R}from"./p-b6be1f33.js";import{D as C}from"./p-b19b1c08.js";import{F as I}from"./p-881622fd.js";import{f as k,e as U}from"./p-528748fa.js";import{C as O}from"./p-328dbe8e.js";import{c as D}from"./p-d7790113.js";import{T as F}from"./p-0a1c7f80.js";import{D as z}from"./p-4edd7f8c.js";import{V}from"./p-3e09aeed.js";import"./p-abd7aeaa.js";import"./p-b0f55f5f.js";import"./p-ed45b3b6.js";import"./p-d4ea8e22.js";import"./p-d884c644.js";import"./p-eb927e2b.js";import"./p-49a2e141.js";import"./p-262ec334.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-dcf162e9.js";import"./p-982747ef.js";import"./p-331a62d5.js";import"./p-8b5d3a52.js";import"./p-9a6bd32c.js";import"./p-6a334573.js";import"./p-02841589.js";import"./p-3a93730e.js";import"./p-f0e828d8.js";import"./p-b75ee3ba.js";import"./p-81dd00d0.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-a58cacca.js";import"./p-46cab60a.js";import"./p-5f377954.js";import"./p-fb5ea4b2.js";import"./p-4866e390.js";var N=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class E extends l{getImageUploaderContainer(){return this.imageUploaderContainerRef}render(){return e(t,{class:{disabled:this.disabled}},this.renderLabelDom(),e("div",{ref:e=>this.imageUploaderContainerRef=e,class:{"vega-image-uploader-select":!0,"disabled-border":this.disabled&&!this.value},style:{width:this.getSize(this.width),height:this.getSize(this.height)}},this.renderContentByStatus()),this.inputRenderer.render(),this.renderHint())}renderLabelDom(){return e("vega-field-label",{"is-field-required":this.required,disabled:this.disabled,optional:this.optional,label:this.label})}renderContentByStatus(){if("uploading"===this.status)return this.uploadingContentRenderer.render();{const e=this.previewController.getImagePreviewURL();return e?this.previewContentRenderer.render(e):this.defaultContentRenderer.render()}}renderHint(){return this.hint&&e("div",{class:"vega-hint"},e("label",null,this.hint))}getSize(e){if(e){const t=c.format(e,"size");return"number"==typeof t?`${t}px`:`${t}`}}}N([s({componentFieldName:"vegaImageUploaderInputRenderer"})],E.prototype,"inputRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderDefaultContentRenderer"})],E.prototype,"defaultContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderPreviewContentRenderer"})],E.prototype,"previewContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderUploadingContentRenderer"})],E.prototype,"uploadingContentRenderer",void 0),N([s({componentFieldName:"vegaImageUploaderPreviewController"})],E.prototype,"previewController",void 0),N([s()],E.prototype,"value",void 0),N([s()],E.prototype,"disabled",void 0),N([s()],E.prototype,"status",void 0),N([s()],E.prototype,"label",void 0),N([s()],E.prototype,"required",void 0),N([s()],E.prototype,"optional",void 0),N([s()],E.prototype,"width",void 0),N([s()],E.prototype,"height",void 0),N([s()],E.prototype,"hint",void 0);var A=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class S extends l{constructor(){super(...arguments),this.handleFileInputChange=e=>{e.stopPropagation();const t=e.target;t.files.length&&this.valueController.setValue(t.files[0])}}getFileInputRef(){return this.fileInputRef}render(){return e("input",{type:"file",accept:this.accept,class:"v-hidden",ref:e=>this.fileInputRef=e,onChange:this.handleFileInputChange})}}A([s({componentFieldName:"vegaImageUploaderValueController"})],S.prototype,"valueController",void 0),A([s()],S.prototype,"accept",void 0);var P=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class L extends l{triggerInputClick(){this.disabled||this.inputRenderer.getFileInputRef().click()}resetInput(){this.inputRenderer.getFileInputRef().value=""}}P([s({componentFieldName:"vegaImageUploaderInputRenderer"})],L.prototype,"inputRenderer",void 0),P([s()],L.prototype,"disabled",void 0);var T=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class _ extends l{constructor(){super(...arguments),this.renderActionButton=t=>{const o=this.getButtonOptions(t);return e("vega-button-circle",Object.assign({size:"small",variant:"icon-only",iconColor:this.isInDarkMode?"text-primary":"text-inverted-primary",role:"menuitem",ref:e=>{m.addUniqueObserverToNode(e,f,(()=>{this.handleClick(t)}))}},o))}}handleClick(e){switch(e){case"Preview":this.previewController.showPreview();break;case"Delete":this.removeController.showRemoveDialog();break;case"Replace":this.inputController.triggerInputClick()}}render(){return this.showRemoveButton||this.showPreviewButton||this.showReplaceButton?e("span",{class:"actions"},this.showPreviewButton&&this.renderActionButton("Preview"),this.showReplaceButton&&!this.disabled&&this.renderActionButton("Replace"),this.showRemoveButton&&!this.disabled&&this.renderActionButton("Delete")):null}getButtonOptions(e){let t;switch(e){case"Preview":t={icon:"zoom-in",label:e};break;case"Delete":t={icon:"delete-bin",label:e};break;case"Replace":t={icon:"photo",label:e}}return t}}T([s({componentFieldName:"vegaImageUploaderInputController"})],_.prototype,"inputController",void 0),T([s({componentFieldName:"vegaImageUploaderValueController"})],_.prototype,"valueController",void 0),T([s({componentFieldName:"vegaImageUploaderPreviewController"})],_.prototype,"previewController",void 0),T([s({componentFieldName:"vegaImageUploaderRemoveController"})],_.prototype,"removeController",void 0),T([s()],_.prototype,"disabled",void 0),T([s()],_.prototype,"showPreviewButton",void 0),T([s()],_.prototype,"showRemoveButton",void 0),T([s()],_.prototype,"showReplaceButton",void 0),T([s()],_.prototype,"removeEventEmitter",void 0),T([s()],_.prototype,"isInDarkMode",void 0);var B=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class q extends l{handleValueChange(){this.value||this.inputController.resetInput(),this.changeEventEmitter.emit(this.value),y.notify(w,{host:this.host,detail:this.value})}setValue(e){this.value=e}}B([s({writable:!0})],q.prototype,"value",void 0),B([s()],q.prototype,"changeEventEmitter",void 0),B([s()],q.prototype,"host",void 0),B([s({componentFieldName:"vegaImageUploaderInputController"})],q.prototype,"inputController",void 0),B([d("watchValue")],q.prototype,"handleValueChange",null);var K=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class M extends l{constructor(){super(...arguments),this.getImagePreviewURL=e=>{if(e=e||this.value)return e.url||URL.createObjectURL(e)},this.generatePreviewModal=e=>{const t=document.createElement("vega-modal");this.value&&this.value.name&&(t.modalTitle=this.value.name);const o=document.createElement("div");o.style.textAlign="center";const i=document.createElement("img");return i.width=0,i.className="preview-image",e&&(i.src=e),i.alt="",i.style.width="100%",o.appendChild(i),t.appendChild(o),this.previewModalRef=t,document.body.append(t),t}}disconnectedCallback(){var e;null===(e=this.previewModalRef)||void 0===e||e.remove()}showPreview(){const e=this.getImagePreviewURL();if(this.previewModalRef){const t=this.previewModalRef.querySelector(".preview-image");t&&e&&(t.src=e),this.value&&this.value.name&&(this.previewModalRef.modalTitle=this.value.name),this.previewModalRef.modal("show")}else this.generatePreviewModal(e).modal("show")}}K([s()],M.prototype,"value",void 0),K([d("disconnectedCallback")],M.prototype,"disconnectedCallback",null),K([d("getContentURL")],M.prototype,"getImagePreviewURL",void 0);class G extends l{constructor(){super(...arguments),this.preventDefaultDragEvent=e=>{e.preventDefault()}}render(t){const o=this.actionsRenderer.render();return e("div",{class:{"image-preview-container":!0,"actions-backdrop":!!o},tabIndex:0,role:"menu",onDrop:this.preventDefaultDragEvent,onDragEnter:this.preventDefaultDragEvent,onDragOver:this.preventDefaultDragEvent},e("img",{src:t,alt:""}),o)}}!function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);a>3&&n&&Object.defineProperty(t,o,n)}([s({componentFieldName:"vegaImageUploaderActionsRenderer"})],G.prototype,"actionsRenderer",void 0);var H=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class $ extends l{constructor(){super(...arguments),this.handleCancelUploading=e=>{e.stopPropagation(),this.status=void 0,this.removeController.handleRemoveFile(),this.cancelEventEmitter.emit()}}render(){return e("div",{class:"action-wrapper",role:"button",tabIndex:0,onClick:this.handleCancelUploading,onKeyDown:j()},e("span",{class:"action-loading"}),e("div",{class:"vega-image-uploader-text cancel-action"},"Cancel"))}}H([s({componentFieldName:"vegaImageUploaderRemoveController"})],$.prototype,"removeController",void 0),H([s({writable:!0})],$.prototype,"status",void 0),H([s()],$.prototype,"cancelEventEmitter",void 0);var J=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class Q extends l{constructor(){super(...arguments),this.handleUploaderClick=e=>{e.stopPropagation(),this.inputController.triggerInputClick()},this.dropHandler=e=>{var t;if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const o=this.dropFileFilterController.process(null===(t=e.dataTransfer)||void 0===t?void 0:t.files);o.length&&this.valueController.setValue(o[0])},this.handleDragEvent=e=>{e.preventDefault()}}render(){return e("div",{class:"action-wrapper",role:"button",tabIndex:0,onClick:this.handleUploaderClick,onKeyDown:j(),onDrop:this.dropHandler,onDragEnter:this.handleDragEvent,onDragOver:this.handleDragEvent},e("vega-icon",{icon:"plus-sign",size:"size-24"}),e("div",{class:"vega-image-uploader-text"},this.translationSlimmer.t(this.actionTitle)),this.renderSubtitle())}renderSubtitle(){return this.actionSubTitle&&e("div",{class:"sub-title"},this.actionSubTitle)}}J([s({componentFieldName:"vegaImageUploaderInputController"})],Q.prototype,"inputController",void 0),J([s({componentFieldName:"vegaImageUploaderValueController"})],Q.prototype,"valueController",void 0),J([s()],Q.prototype,"disabled",void 0),J([s()],Q.prototype,"dropFileFilterController",void 0),J([s()],Q.prototype,"actionTitle",void 0),J([s()],Q.prototype,"actionSubTitle",void 0),J([s()],Q.prototype,"translationSlimmer",void 0);var W=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class X extends l{constructor(){super(...arguments),this.showRemoveDialog=()=>{this.removeDialogRef=R.open({type:"danger",title:"Delete Image",content:"Are you sure you want to delete this image?",handleOk:()=>(this.handleRemoveFile(),!0),okButton:{label:"Delete"}})},this.handleRemoveFile=()=>{this.valueController.setValue(null),this.removeEventEmitter.emit()}}disconnectedCallback(){var e;null===(e=this.removeDialogRef)||void 0===e||e.remove()}}W([s({componentFieldName:"vegaImageUploaderValueController"})],X.prototype,"valueController",void 0),W([s()],X.prototype,"removeEventEmitter",void 0),W([d("disconnectedCallback")],X.prototype,"disconnectedCallback",null);var Y=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};class Z extends l{handleValueChange(){this.value&&this.hideBackDropAndActions()}hideBackDropAndActions(){const e=U();e&&k(e,"vega-image-uploader")===this.host&&e.blur()}}Y([s()],Z.prototype,"host",void 0),Y([s()],Z.prototype,"value",void 0),Y([d("watchValue")],Z.prototype,"handleValueChange",null);const ee=[{payloadKey:"AUTO_VALIDATION_IS_TRUE",payloadDescription:"Determines whether automatic validation should be implemented for image uploads",payloadValue:e=>!0===e.autoValidation},{payloadKey:"AUTO_VALIDATION_IS_FALSE",payloadDescription:"Determines whether automatic validation should be implemented for image uploads",payloadValue:e=>!1===e.autoValidation}];var te=function(e,t,o,i){var r,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(a<3?r(n):a>3?r(t,o,n):r(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};const oe=["jpg","png","jpeg"],ie=class{constructor(e){o(this,e),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.vegaRemove=i(this,"vegaRemove",7),this.remove=i(this,"remove",7),this.vegaCancel=i(this,"vegaCancel",7),this.cancel=i(this,"cancel",7),this.globalSlimmers={},this.translationSlimmer=new F,this.vegaImageUploaderRenderer=new E,this.vegaImageUploaderUploadingContentRenderer=new $,this.vegaImageUploaderPreviewContentRenderer=new G,this.vegaImageUploaderDefaultContentRenderer=new Q,this.vegaImageUploaderInputRenderer=new S,this.vegaImageUploaderActionsRenderer=new _,this.vegaImageUploaderInputController=new L,this.vegaImageUploaderValueController=new q,this.vegaImageUploaderPreviewController=new M,this.vegaImageUploaderRemoveController=new X,this.dropFileFilterController=new C,this.actionsVisibilityController=new Z,this.darkModeStateControllerSlimmer=new z,this.formFieldController=new I({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new n:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:e=>this[e],inputContainerGetter:()=>this.vegaImageUploaderRenderer.getImageUploaderContainer(),touchableAreaGetter:()=>[this.vegaImageUploaderInputRenderer.getFileInputRef()]}),this.changeEventEmitter=D(ie,u),this.removeEventEmitter=D(ie,b),this.cancelEventEmitter=D(ie,x),this.buttonCircleEventPrevent=new O([f],(()=>this.vegaImageUploaderRenderer.getImageUploaderContainer())),this.vegaComponentUsageRuntimeMetricsSlimmer=new v(ee),this.isInDarkMode=V.isDarkMode(),this.value=null,this.accept=oe.map((e=>`.${e}`)).join(","),this.showPreviewButton=!0,this.showRemoveButton=!0,this.showReplaceButton=!0,this.disabled=!1,this.required=!1,this.optional=!1,this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.label="",this.actionTitle="Upload",this.width=120,this.height=120}watchValue(){}watchValidationRules(){}disconnectedCallback(){}async getContentURL(e){return h(e)}render(){return a(this.vegaImageUploaderRenderer.render(),this.host)}get host(){return r(this)}static get watchers(){return{value:["watchValue"],validationRules:["watchValidationRules"]}}};te([g()],ie.prototype,"globalSlimmers",void 0),te([p()],ie.prototype,"translationSlimmer",void 0),te([p()],ie.prototype,"vegaImageUploaderRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderUploadingContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderPreviewContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderDefaultContentRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderInputRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderActionsRenderer",void 0),te([p()],ie.prototype,"vegaImageUploaderInputController",void 0),te([p()],ie.prototype,"vegaImageUploaderValueController",void 0),te([p()],ie.prototype,"vegaImageUploaderPreviewController",void 0),te([p()],ie.prototype,"vegaImageUploaderRemoveController",void 0),te([p()],ie.prototype,"dropFileFilterController",void 0),te([p()],ie.prototype,"actionsVisibilityController",void 0),te([p()],ie.prototype,"darkModeStateControllerSlimmer",void 0),te([p()],ie.prototype,"formFieldController",void 0),te([p()],ie.prototype,"changeEventEmitter",void 0),te([p()],ie.prototype,"removeEventEmitter",void 0),te([p()],ie.prototype,"cancelEventEmitter",void 0),te([p()],ie.prototype,"buttonCircleEventPrevent",void 0),te([p()],ie.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),ie.style=':host{display:inline-block;vertical-align:middle}:host .vega-image-uploader-select{box-sizing:border-box;background-color:rgba(var(--v-bg-tertiary, 240, 243, 247, 1));border-radius:8px;border-color:rgba(var(--v-border-color-input-field, 171, 198, 216, 1));display:flex;flex-direction:row;align-items:center;border-width:1px;border-style:dashed;min-width:120px;min-height:120px}:host .vega-image-uploader-select .action-wrapper{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:8px;width:100%;height:100%;padding:12px;box-sizing:border-box;cursor:pointer;flex-grow:1;outline:none}:host(.disabled) .vega-image-uploader-select.disabled-border{border-color:rgba(var(--v-border-color-input-field-disabled, 222, 225, 227, 1))}:host(:not(.disabled)) .vega-image-uploader-select:hover{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-input-field-hover, 115, 160, 190, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1))}:host(:not(.disabled)) .vega-image-uploader-select:hover .vega-image-uploader-text{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host(:not(.disabled)) .vega-image-uploader-select .action-wrapper:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1));border-style:none}:host(:not(.disabled)) .vega-image-uploader-select .actions-backdrop:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1));border-style:none}:host(:not(.disabled)) .vega-image-uploader-select .error .action-wrapper:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host(.disabled) .vega-image-uploader-select .action-wrapper{cursor:not-allowed}:host(.disabled) .vega-image-uploader-select .action-wrapper vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host(.disabled) .vega-image-uploader-select .action-wrapper .vega-image-uploader-text{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-image-uploader-select .vega-image-uploader-text{padding-top:20px;color:rgba(var(--v-text-link, 19, 98, 226, 1));font-family:"Inter", sans-serif;font-size:16px;font-weight:700;line-height:24px;letter-spacing:0px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-image-uploader-select .vega-image-uploader-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px;letter-spacing:0px}}:host .vega-image-uploader-select .action-wrapper vega-icon{color:rgba(var(--v-text-link, 19, 98, 226, 1))}:host .image-preview-container{display:flex;align-items:center;justify-content:center;position:relative;height:100%;width:100%;border-radius:8px;outline:none}:host .image-preview-container img{width:100%;height:100%;border-radius:8px;object-fit:contain}:host .image-preview-container.actions-backdrop::before{width:100%;height:100%;border-radius:8px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;background-color:rgba(0, 0, 0, 0.6);content:" "}:host .vega-image-uploader-select .actions{position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;display:flex;align-items:center;justify-content:center;gap:2px;pointer-events:none}:host .image-preview-container.actions-backdrop:hover::before{opacity:1;pointer-events:auto}:host .image-preview-container:hover .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-visible::before{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-visible .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-within::before{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .actions-backdrop:focus-within .actions{opacity:1;pointer-events:auto}:host .vega-image-uploader-select .action-loading{position:relative;display:inline-block;width:24px;height:24px}:host .vega-image-uploader-select .action-loading::before{content:" ";display:block;border-radius:9999px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;border:4px solid rgb(229, 239, 255)}:host .vega-image-uploader-select .action-loading::after{display:block;border-radius:9999px;position:absolute;top:0px;right:0px;bottom:0px;left:0px;content:" ";border-style:solid;border-width:4px;border-color:rgb(153, 192, 255) transparent transparent transparent;animation:loading 1.2s linear infinite}@keyframes loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host .vega-image-uploader-select .action-wrapper .cancel-action{color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}:host vega-input{display:none}:host input[type=file]{display:none}:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;padding-top:12px;padding-right:8px;padding-left:8px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-image-uploader-select.error{border-color:rgba(var(--v-border-color-input-field-danger, 230, 50, 87, 1))}:host .vega-image-uploader-select.error:hover{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-image-uploader-select.error .action-wrapper:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1));border-style:none}:host .vega-image-uploader-select.error .actions-backdrop:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1));border-style:none}:host .vega-hidden{display:none}:host vega-field-label{margin-bottom:8px}:host .sub-title{padding-top:4px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px;text-align:center}@media screen and (min-width: 768px) and (max-width: 1023px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .sub-title{font-family:"Inter", sans-serif;font-size:12px;font-weight:400;line-height:16px}}:host .vega-hint{padding-left:8px;padding-right:8px;padding-top:12px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}';export{ie as vega_image_uploader}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as n}from"./p-
|
|
1
|
+
import{K as n}from"./p-c9c42a07.js";function t(t){return i=>{const{connectedCallback:o,componentDidLoad:s,disconnectedCallback:e}=i;i.connectedCallback=function(){const{keyboardEventListeners:t=[]}=this;return n.register(t),null==o?void 0:o.call(this)},i.componentDidLoad=function(){return this.keyboardEventListeners=t(this),n.register(this.keyboardEventListeners),null==s?void 0:s.call(this)},i.disconnectedCallback=function(){const{keyboardEventListeners:t=[]}=this;return n.deregister(t),null==e?void 0:e.call(this)}}}export{t as I}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,f as e,r as i,c as o,H as s,g as r}from"./p-6b2342e0.js";import{V as a,I as l}from"./p-8ce9e214.js";import{R as n}from"./p-280cbcdb.js";import{c,V as h,M as p,I as d}from"./p-6e1ab235.js";import{s as f}from"./p-519a7d55.js";import{F as u}from"./p-3a49089e.js";import{D as v}from"./p-526e3634.js";import{c as m,b as g,a as w,i as b,K as j}from"./p-fcefb62c.js";import{c as x}from"./p-d7790113.js";import{V as C}from"./p-724df1f5.js";import{F as R}from"./p-cb378636.js";import{C as y}from"./p-2d0d575f.js";import{T as F}from"./p-7fbd11b0.js";import{C as S}from"./p-328dbe8e.js";import"./p-abd7aeaa.js";import"./p-02841589.js";import"./p-331a62d5.js";import"./p-528748fa.js";import"./p-8b5d3a52.js";import"./p-6a334573.js";import"./p-3a93730e.js";import"./p-091fbc35.js";import"./p-f0e828d8.js";import"./p-b75ee3ba.js";import"./p-81dd00d0.js";import"./p-49a2e141.js";import"./p-d4ea8e22.js";import"./p-ed45b3b6.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-d27ae9ff.js";import"./p-262ec334.js";import"./p-a58cacca.js";import"./p-46cab60a.js";import"./p-1704ff25.js";import"./p-9a6bd32c.js";import"./p-5f377954.js";import"./p-dcf162e9.js";import"./p-982747ef.js";var k=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class I extends h{constructor(){super(...arguments),this.handlePopoverShow=()=>{v.addUniqueObserverToNode(this.popoverRef,m,(()=>{this.isPopoverOpen=!0,this.internalColor!==this.value&&this.colorSwatchPickerValueController.updateInternalColor(this.value)}))},this.handlePopoverHide=()=>{v.addUniqueObserverToNode(this.popoverRef,g,(()=>{this.isPopoverOpen=!1}))},this.registerButtonClickHandler=t=>{v.addUniqueObserverToNode(t,w,(()=>{this.popoverRef&&this.popoverRef.hide(),this.colorSwatchPickerValueController.updateValue("clear"===t.dataset.actionType?"":this.internalColor)}))}}hidePopover(){this.popoverRef&&this.popoverRef.hide()}getContainerRef(){return this.containerRef}getLeftContainerRef(){return this.leftContainerRef}render(){const e=this.leftSlotProjection.hasSlot();return t("div",{ref:t=>this.containerRef=t,class:"swatch-picker-container"},t("vega-popover",{ref:t=>{this.popoverRef=t,this.handlePopoverShow(),this.handlePopoverHide()},class:"swatch-popover",alignment:"center",isScreenPosition:!0,trigger:"click"},t("div",{slot:"popover-content"},t("vega-color-swatch",{class:"swatch-picker-trigger","aria-expanded":this.isPopoverOpen?"true":"false","aria-haspopup":"dialog",disabled:this.disabled,color:this.value,size:"small"})),t("vega-box",{slot:"popover",class:"swatch-popover-content",width:"min-content"},t("vega-flex",{gap:"size-16"},e&&t("div",{ref:t=>this.leftContainerRef=t}),e&&t("div",null,t("vega-divider",{direction:"vertical"})),t("div",null,this.colorSwatchInputRenderer.render(),this.colorSwatchGridRenderer.render(),this.renderButtonGroup())))),t("vega-field-label",{label:this.label,disabled:this.disabled,isFieldRequired:this.required}))}renderButtonGroup(){return t("vega-flex",{gap:"size-8",justifyContent:"end",margin:{top:"size-16"}},this.showClearButton&&t("vega-button-link",{ref:this.registerButtonClickHandler,"data-action-type":"clear",label:this.translationSlimmer.t("Clear"),size:"small"}),t("vega-button-link",{ref:this.registerButtonClickHandler,"data-action-type":"apply",label:this.translationSlimmer.t("Apply"),size:"small"}))}}k([c()],I.prototype,"host",void 0),k([c()],I.prototype,"value",void 0),k([c()],I.prototype,"internalColor",void 0),k([c()],I.prototype,"label",void 0),k([c()],I.prototype,"required",void 0),k([c({writable:!0})],I.prototype,"isPopoverOpen",void 0),k([c()],I.prototype,"disabled",void 0),k([c()],I.prototype,"showClearButton",void 0),k([c()],I.prototype,"colorSwatchGridRenderer",void 0),k([c()],I.prototype,"colorSwatchInputRenderer",void 0),k([c()],I.prototype,"colorSwatchPickerValueController",void 0),k([c()],I.prototype,"translationSlimmer",void 0),k([c()],I.prototype,"leftSlotProjection",void 0);var z=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class V extends h{constructor(){super(...arguments),this.handleColorSwatchClick=t=>{v.addUniqueObserverToNode(t,w,(()=>{this.colorSwatchPickerValueController.updateInternalColor(t.color)}))}}render(){return t("vega-grid",{column:this.swatchGridColumns,justifyItems:"start",gap:"size-8",style:{width:"max-content"}},this.colors.map((e=>t("vega-color-swatch",{ref:this.handleColorSwatchClick,selected:this.isColorMatched(this.internalColor,e),color:e,size:"extra-small"}))))}isColorMatched(t,e){return t&&e?t.toLowerCase()===e.toLowerCase():t===e}}z([c()],V.prototype,"colors",void 0),z([c()],V.prototype,"internalColor",void 0),z([c()],V.prototype,"swatchGridColumns",void 0),z([c()],V.prototype,"colorSwatchPickerValueController",void 0);var O=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class P extends h{constructor(){super(...arguments),this.handleInputEvent=t=>{v.addUniqueObserverToNode(t,b,(()=>{const e=this.colorSwatchPickerColorFormatController.formatColor("output",t.value);e&&!this.isValidColor(e)||this.colorSwatchPickerValueController.updateInternalColor(e)})),v.addUniqueObserverToNode(t,j,(()=>{t.value&&!this.isValidColor(t.value)&&(t.value=this.colorSwatchPickerColorFormatController.formatColor("input",this.internalColor))}))}}render(){return this.showInput?t("vega-flex",{gap:"size-8",alignItems:"center",margin:{bottom:"size-16"}},t("vega-color-swatch",{color:this.internalColor,size:"extra-small"}),t("vega-input",{ref:this.handleInputEvent,size:"small",value:this.colorSwatchPickerColorFormatController.formatColor("input",this.internalColor),placeholder:this.inputPlaceholder||this.translationSlimmer.t("Enter color"),prefixIcon:this.inputPrefixIcon===P.DEFAULT_INPUT_ICON?C.getIconKey("hashtag"):this.inputPrefixIcon})):null}isValidColor(t){let e=!0;return globalThis.CSS&&"function"==typeof globalThis.CSS.supports&&(e=globalThis.CSS.supports("color",t)),e}}C.register({hashtag:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M188.7 32.5c13 2.6 21.4 15.2 18.8 28.2L192.5 136h111l16.9-84.7c2.6-13 15.2-21.4 28.2-18.8s21.4 15.2 18.8 28.2L352.5 136H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H342.9L314.1 328H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H304.5l-16.9 84.7c-2.6 13-15.2 21.4-28.2 18.8s-21.4-15.2-18.8-28.2L255.5 376h-111l-16.9 84.7c-2.6 13-15.2 21.4-28.2 18.8s-21.4-15.2-18.8-28.2L95.5 376H24c-13.3 0-24-10.7-24-24s10.7-24 24-24h81.1l28.8-144H56c-13.3 0-24-10.7-24-24s10.7-24 24-24h87.5l16.9-84.7c2.6-13 15.2-21.4 28.2-18.8zM182.9 184L154.1 328h111l28.8-144h-111z"/></svg>'}}),P.DEFAULT_INPUT_ICON="hexColorIcon",O([c()],P.prototype,"internalColor",void 0),O([c()],P.prototype,"showInput",void 0),O([c()],P.prototype,"inputPlaceholder",void 0),O([c()],P.prototype,"inputPrefixIcon",void 0),O([c()],P.prototype,"colorSwatchPickerValueController",void 0),O([c()],P.prototype,"colorSwatchPickerColorFormatController",void 0),O([c()],P.prototype,"translationSlimmer",void 0);var L=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class H extends h{updateValue(t){this.value=t}updateInternalColor(t){this.internalColor=t}initializeInternalColor(){this.internalColor=this.value}listenToValueChange(){this.internalColor=this.value,this.changeEventEmitter.emit(this.value),y.notify(R,{host:this.host,detail:this.value})}}L([c()],H.prototype,"host",void 0),L([c({writable:!0})],H.prototype,"value",void 0),L([c({writable:!0})],H.prototype,"internalColor",void 0),L([c()],H.prototype,"changeEventEmitter",void 0),L([p("componentWillLoad")],H.prototype,"initializeInternalColor",null),L([p("watchValue")],H.prototype,"listenToValueChange",null);var T=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class D extends h{updateTheColor(){this.internalColor&&this.colorSwatchPickerValueController.updateInternalColor(this.formatColor("input",this.internalColor))}formatColor(t,e){return this.inputFormatter===D.DEFAULT_INPUT_FORMATTER?this.handleHexFormat(t,e):"function"==typeof this.inputFormatter?this.inputFormatter(t,e):e}handleHexFormat(t,e){return"input"===t?e.startsWith("#")?e.slice(1):e:e.startsWith("#")?e:e?`#${e}`:e}}D.DEFAULT_INPUT_FORMATTER="hexColorFormatter",T([c()],D.prototype,"inputFormatter",void 0),T([c()],D.prototype,"internalColor",void 0),T([c()],D.prototype,"colorSwatchPickerValueController",void 0),T([p("watchInputFormatter")],D.prototype,"updateTheColor",null);var E=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class G extends h{constructor(t,i){super(),this.slotElement=null,this.syncSlotElementFromHost=()=>{var t;const i=this.host.querySelector(this.slotSelector());i&&(this.slotElement=i,null===(t=this.getContainerRef())||void 0===t||t.replaceChildren(i),e(this.host))},this.syncRemovedSlotElement=()=>{this.slotElement&&!this.slotElement.isConnected&&(this.slotElement=null,e(this.host))},this.slotName=t,this.getContainerRef=i}hasSlot(){return!!this.slotElement}detectSlot(){this.slotElement=this.host.querySelector(this.slotSelector()),this.hostMutationObserver=new MutationObserver(this.syncSlotElementFromHost),this.hostMutationObserver.observe(this.host,{childList:!0}),this.containerMutationObserver=new MutationObserver(this.syncRemovedSlotElement)}appendSlotContent(){const t=this.getContainerRef();t&&this.containerMutationObserver.observe(t,{childList:!0}),this.slotElement&&t&&this.slotElement.parentElement!==t&&t.appendChild(this.slotElement)}cleanup(){this.hostMutationObserver&&this.hostMutationObserver.disconnect(),this.containerMutationObserver&&this.containerMutationObserver.disconnect()}slotSelector(){return`[slot="${this.slotName}"]`}}E([c()],G.prototype,"host",void 0),E([p("componentWillLoad")],G.prototype,"detectSlot",null),E([p("componentDidRender")],G.prototype,"appendSlotContent",null),E([p("disconnectedCallback")],G.prototype,"cleanup",null);var M=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const B=class{constructor(t){i(this,t),this.vegaChange=o(this,"vegaChange",7),this.change=o(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new a,this.formFieldController=new u({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new n:null}],validationRulesName:"validationRules",defaultValue:"",attributeGetter:t=>this[t],inputContainerGetter:()=>this.colorSwatchPickerRenderer.getContainerRef(),touchableAreaGetter:()=>[]}),this.translationSlimmer=new F,this.leftSlotProjection=new G("swatch-picker-left",(()=>this.colorSwatchPickerRenderer.getLeftContainerRef())),this.colorSwatchPickerRenderer=new I,this.colorSwatchGridRenderer=new V,this.colorSwatchInputRenderer=new P,this.colorSwatchPickerValueController=new H,this.colorSwatchPickerColorFormatController=new D,this.childNodeEventPreventSlimmer=new S([b],(()=>this.colorSwatchPickerRenderer.getContainerRef())),this.changeEventEmitter=x(B,b),this.internalColor="",this.isPopoverOpen=!1,this.value="",this.label="",this.disabled=!1,this.required=!1,this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.colors=["#73E6DC","#806BFF","#FFDC83","#FF9571","#00BBFF","#FF82C9","#259F9F","#563D82"],this.swatchGridColumns=8,this.showInput=!0,this.inputPlaceholder="",this.inputPrefixIcon=P.DEFAULT_INPUT_ICON,this.showClearButton=!1,this.inputFormatter=D.DEFAULT_INPUT_FORMATTER}watchValue(){}watchDisabled(){this.disabled&&this.colorSwatchPickerRenderer.hidePopover()}watchValidationRules(){}watchInputFormatter(){}render(){return f(t(s,{class:{disabled:this.disabled}},this.colorSwatchPickerRenderer.render(),t("div",{class:"vega-error vega-hidden",part:"field-error-message"})),this.host)}get host(){return r(this)}static get watchers(){return{value:["watchValue"],disabled:["watchDisabled"],validationRules:["watchValidationRules"],inputFormatter:["watchInputFormatter"]}}};M([l()],B.prototype,"globalSlimmers",void 0),M([d()],B.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),M([d()],B.prototype,"formFieldController",void 0),M([d()],B.prototype,"translationSlimmer",void 0),M([d()],B.prototype,"leftSlotProjection",void 0),M([d()],B.prototype,"colorSwatchPickerRenderer",void 0),M([d()],B.prototype,"colorSwatchGridRenderer",void 0),M([d()],B.prototype,"colorSwatchInputRenderer",void 0),M([d()],B.prototype,"colorSwatchPickerValueController",void 0),M([d()],B.prototype,"colorSwatchPickerColorFormatController",void 0),M([d()],B.prototype,"childNodeEventPreventSlimmer",void 0),M([d()],B.prototype,"changeEventEmitter",void 0),B.style=':host{display:inline-block}.swatch-picker-container{display:flex;flex-direction:row;align-items:center;gap:8px}.swatch-picker-container.error vega-color-swatch.swatch-picker-trigger::part(swatch){border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}.swatch-picker-container.error vega-color-swatch.swatch-picker-trigger::part(swatch-container):focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}.vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}';export{B as vega_color_swatch_picker}
|
|
1
|
+
import{h as t,f as e,r as i,c as o,H as s,g as r}from"./p-6b2342e0.js";import{V as a,I as l}from"./p-8ce9e214.js";import{R as n}from"./p-280cbcdb.js";import{c,V as h,M as p,I as d}from"./p-6e1ab235.js";import{s as f}from"./p-519a7d55.js";import{F as u}from"./p-881622fd.js";import{D as v}from"./p-526e3634.js";import{c as m,b as g,a as w,i as b,K as j}from"./p-fcefb62c.js";import{c as x}from"./p-d7790113.js";import{V as C}from"./p-724df1f5.js";import{F as R}from"./p-cb378636.js";import{C as y}from"./p-2d0d575f.js";import{T as F}from"./p-0a1c7f80.js";import{C as S}from"./p-328dbe8e.js";import"./p-abd7aeaa.js";import"./p-02841589.js";import"./p-331a62d5.js";import"./p-528748fa.js";import"./p-8b5d3a52.js";import"./p-6a334573.js";import"./p-3a93730e.js";import"./p-eb927e2b.js";import"./p-f0e828d8.js";import"./p-b75ee3ba.js";import"./p-81dd00d0.js";import"./p-49a2e141.js";import"./p-d4ea8e22.js";import"./p-ed45b3b6.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-d27ae9ff.js";import"./p-262ec334.js";import"./p-a58cacca.js";import"./p-46cab60a.js";import"./p-1704ff25.js";import"./p-9a6bd32c.js";import"./p-5f377954.js";import"./p-dcf162e9.js";import"./p-982747ef.js";var k=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class I extends h{constructor(){super(...arguments),this.handlePopoverShow=()=>{v.addUniqueObserverToNode(this.popoverRef,m,(()=>{this.isPopoverOpen=!0,this.internalColor!==this.value&&this.colorSwatchPickerValueController.updateInternalColor(this.value)}))},this.handlePopoverHide=()=>{v.addUniqueObserverToNode(this.popoverRef,g,(()=>{this.isPopoverOpen=!1}))},this.registerButtonClickHandler=t=>{v.addUniqueObserverToNode(t,w,(()=>{this.popoverRef&&this.popoverRef.hide(),this.colorSwatchPickerValueController.updateValue("clear"===t.dataset.actionType?"":this.internalColor)}))}}hidePopover(){this.popoverRef&&this.popoverRef.hide()}getContainerRef(){return this.containerRef}getLeftContainerRef(){return this.leftContainerRef}render(){const e=this.leftSlotProjection.hasSlot();return t("div",{ref:t=>this.containerRef=t,class:"swatch-picker-container"},t("vega-popover",{ref:t=>{this.popoverRef=t,this.handlePopoverShow(),this.handlePopoverHide()},class:"swatch-popover",alignment:"center",isScreenPosition:!0,trigger:"click"},t("div",{slot:"popover-content"},t("vega-color-swatch",{class:"swatch-picker-trigger","aria-expanded":this.isPopoverOpen?"true":"false","aria-haspopup":"dialog",disabled:this.disabled,color:this.value,size:"small"})),t("vega-box",{slot:"popover",class:"swatch-popover-content",width:"min-content"},t("vega-flex",{gap:"size-16"},e&&t("div",{ref:t=>this.leftContainerRef=t}),e&&t("div",null,t("vega-divider",{direction:"vertical"})),t("div",null,this.colorSwatchInputRenderer.render(),this.colorSwatchGridRenderer.render(),this.renderButtonGroup())))),t("vega-field-label",{label:this.label,disabled:this.disabled,isFieldRequired:this.required}))}renderButtonGroup(){return t("vega-flex",{gap:"size-8",justifyContent:"end",margin:{top:"size-16"}},this.showClearButton&&t("vega-button-link",{ref:this.registerButtonClickHandler,"data-action-type":"clear",label:this.translationSlimmer.t("Clear"),size:"small"}),t("vega-button-link",{ref:this.registerButtonClickHandler,"data-action-type":"apply",label:this.translationSlimmer.t("Apply"),size:"small"}))}}k([c()],I.prototype,"host",void 0),k([c()],I.prototype,"value",void 0),k([c()],I.prototype,"internalColor",void 0),k([c()],I.prototype,"label",void 0),k([c()],I.prototype,"required",void 0),k([c({writable:!0})],I.prototype,"isPopoverOpen",void 0),k([c()],I.prototype,"disabled",void 0),k([c()],I.prototype,"showClearButton",void 0),k([c()],I.prototype,"colorSwatchGridRenderer",void 0),k([c()],I.prototype,"colorSwatchInputRenderer",void 0),k([c()],I.prototype,"colorSwatchPickerValueController",void 0),k([c()],I.prototype,"translationSlimmer",void 0),k([c()],I.prototype,"leftSlotProjection",void 0);var z=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class V extends h{constructor(){super(...arguments),this.handleColorSwatchClick=t=>{v.addUniqueObserverToNode(t,w,(()=>{this.colorSwatchPickerValueController.updateInternalColor(t.color)}))}}render(){return t("vega-grid",{column:this.swatchGridColumns,justifyItems:"start",gap:"size-8",style:{width:"max-content"}},this.colors.map((e=>t("vega-color-swatch",{ref:this.handleColorSwatchClick,selected:this.isColorMatched(this.internalColor,e),color:e,size:"extra-small"}))))}isColorMatched(t,e){return t&&e?t.toLowerCase()===e.toLowerCase():t===e}}z([c()],V.prototype,"colors",void 0),z([c()],V.prototype,"internalColor",void 0),z([c()],V.prototype,"swatchGridColumns",void 0),z([c()],V.prototype,"colorSwatchPickerValueController",void 0);var O=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class P extends h{constructor(){super(...arguments),this.handleInputEvent=t=>{v.addUniqueObserverToNode(t,b,(()=>{const e=this.colorSwatchPickerColorFormatController.formatColor("output",t.value);e&&!this.isValidColor(e)||this.colorSwatchPickerValueController.updateInternalColor(e)})),v.addUniqueObserverToNode(t,j,(()=>{t.value&&!this.isValidColor(t.value)&&(t.value=this.colorSwatchPickerColorFormatController.formatColor("input",this.internalColor))}))}}render(){return this.showInput?t("vega-flex",{gap:"size-8",alignItems:"center",margin:{bottom:"size-16"}},t("vega-color-swatch",{color:this.internalColor,size:"extra-small"}),t("vega-input",{ref:this.handleInputEvent,size:"small",value:this.colorSwatchPickerColorFormatController.formatColor("input",this.internalColor),placeholder:this.inputPlaceholder||this.translationSlimmer.t("Enter color"),prefixIcon:this.inputPrefixIcon===P.DEFAULT_INPUT_ICON?C.getIconKey("hashtag"):this.inputPrefixIcon})):null}isValidColor(t){let e=!0;return globalThis.CSS&&"function"==typeof globalThis.CSS.supports&&(e=globalThis.CSS.supports("color",t)),e}}C.register({hashtag:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M188.7 32.5c13 2.6 21.4 15.2 18.8 28.2L192.5 136h111l16.9-84.7c2.6-13 15.2-21.4 28.2-18.8s21.4 15.2 18.8 28.2L352.5 136H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H342.9L314.1 328H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H304.5l-16.9 84.7c-2.6 13-15.2 21.4-28.2 18.8s-21.4-15.2-18.8-28.2L255.5 376h-111l-16.9 84.7c-2.6 13-15.2 21.4-28.2 18.8s-21.4-15.2-18.8-28.2L95.5 376H24c-13.3 0-24-10.7-24-24s10.7-24 24-24h81.1l28.8-144H56c-13.3 0-24-10.7-24-24s10.7-24 24-24h87.5l16.9-84.7c2.6-13 15.2-21.4 28.2-18.8zM182.9 184L154.1 328h111l28.8-144h-111z"/></svg>'}}),P.DEFAULT_INPUT_ICON="hexColorIcon",O([c()],P.prototype,"internalColor",void 0),O([c()],P.prototype,"showInput",void 0),O([c()],P.prototype,"inputPlaceholder",void 0),O([c()],P.prototype,"inputPrefixIcon",void 0),O([c()],P.prototype,"colorSwatchPickerValueController",void 0),O([c()],P.prototype,"colorSwatchPickerColorFormatController",void 0),O([c()],P.prototype,"translationSlimmer",void 0);var L=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class H extends h{updateValue(t){this.value=t}updateInternalColor(t){this.internalColor=t}initializeInternalColor(){this.internalColor=this.value}listenToValueChange(){this.internalColor=this.value,this.changeEventEmitter.emit(this.value),y.notify(R,{host:this.host,detail:this.value})}}L([c()],H.prototype,"host",void 0),L([c({writable:!0})],H.prototype,"value",void 0),L([c({writable:!0})],H.prototype,"internalColor",void 0),L([c()],H.prototype,"changeEventEmitter",void 0),L([p("componentWillLoad")],H.prototype,"initializeInternalColor",null),L([p("watchValue")],H.prototype,"listenToValueChange",null);var T=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class D extends h{updateTheColor(){this.internalColor&&this.colorSwatchPickerValueController.updateInternalColor(this.formatColor("input",this.internalColor))}formatColor(t,e){return this.inputFormatter===D.DEFAULT_INPUT_FORMATTER?this.handleHexFormat(t,e):"function"==typeof this.inputFormatter?this.inputFormatter(t,e):e}handleHexFormat(t,e){return"input"===t?e.startsWith("#")?e.slice(1):e:e.startsWith("#")?e:e?`#${e}`:e}}D.DEFAULT_INPUT_FORMATTER="hexColorFormatter",T([c()],D.prototype,"inputFormatter",void 0),T([c()],D.prototype,"internalColor",void 0),T([c()],D.prototype,"colorSwatchPickerValueController",void 0),T([p("watchInputFormatter")],D.prototype,"updateTheColor",null);var E=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class G extends h{constructor(t,i){super(),this.slotElement=null,this.syncSlotElementFromHost=()=>{var t;const i=this.host.querySelector(this.slotSelector());i&&(this.slotElement=i,null===(t=this.getContainerRef())||void 0===t||t.replaceChildren(i),e(this.host))},this.syncRemovedSlotElement=()=>{this.slotElement&&!this.slotElement.isConnected&&(this.slotElement=null,e(this.host))},this.slotName=t,this.getContainerRef=i}hasSlot(){return!!this.slotElement}detectSlot(){this.slotElement=this.host.querySelector(this.slotSelector()),this.hostMutationObserver=new MutationObserver(this.syncSlotElementFromHost),this.hostMutationObserver.observe(this.host,{childList:!0}),this.containerMutationObserver=new MutationObserver(this.syncRemovedSlotElement)}appendSlotContent(){const t=this.getContainerRef();t&&this.containerMutationObserver.observe(t,{childList:!0}),this.slotElement&&t&&this.slotElement.parentElement!==t&&t.appendChild(this.slotElement)}cleanup(){this.hostMutationObserver&&this.hostMutationObserver.disconnect(),this.containerMutationObserver&&this.containerMutationObserver.disconnect()}slotSelector(){return`[slot="${this.slotName}"]`}}E([c()],G.prototype,"host",void 0),E([p("componentWillLoad")],G.prototype,"detectSlot",null),E([p("componentDidRender")],G.prototype,"appendSlotContent",null),E([p("disconnectedCallback")],G.prototype,"cleanup",null);var M=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const B=class{constructor(t){i(this,t),this.vegaChange=o(this,"vegaChange",7),this.change=o(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new a,this.formFieldController=new u({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new n:null}],validationRulesName:"validationRules",defaultValue:"",attributeGetter:t=>this[t],inputContainerGetter:()=>this.colorSwatchPickerRenderer.getContainerRef(),touchableAreaGetter:()=>[]}),this.translationSlimmer=new F,this.leftSlotProjection=new G("swatch-picker-left",(()=>this.colorSwatchPickerRenderer.getLeftContainerRef())),this.colorSwatchPickerRenderer=new I,this.colorSwatchGridRenderer=new V,this.colorSwatchInputRenderer=new P,this.colorSwatchPickerValueController=new H,this.colorSwatchPickerColorFormatController=new D,this.childNodeEventPreventSlimmer=new S([b],(()=>this.colorSwatchPickerRenderer.getContainerRef())),this.changeEventEmitter=x(B,b),this.internalColor="",this.isPopoverOpen=!1,this.value="",this.label="",this.disabled=!1,this.required=!1,this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.colors=["#73E6DC","#806BFF","#FFDC83","#FF9571","#00BBFF","#FF82C9","#259F9F","#563D82"],this.swatchGridColumns=8,this.showInput=!0,this.inputPlaceholder="",this.inputPrefixIcon=P.DEFAULT_INPUT_ICON,this.showClearButton=!1,this.inputFormatter=D.DEFAULT_INPUT_FORMATTER}watchValue(){}watchDisabled(){this.disabled&&this.colorSwatchPickerRenderer.hidePopover()}watchValidationRules(){}watchInputFormatter(){}render(){return f(t(s,{class:{disabled:this.disabled}},this.colorSwatchPickerRenderer.render(),t("div",{class:"vega-error vega-hidden",part:"field-error-message"})),this.host)}get host(){return r(this)}static get watchers(){return{value:["watchValue"],disabled:["watchDisabled"],validationRules:["watchValidationRules"],inputFormatter:["watchInputFormatter"]}}};M([l()],B.prototype,"globalSlimmers",void 0),M([d()],B.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),M([d()],B.prototype,"formFieldController",void 0),M([d()],B.prototype,"translationSlimmer",void 0),M([d()],B.prototype,"leftSlotProjection",void 0),M([d()],B.prototype,"colorSwatchPickerRenderer",void 0),M([d()],B.prototype,"colorSwatchGridRenderer",void 0),M([d()],B.prototype,"colorSwatchInputRenderer",void 0),M([d()],B.prototype,"colorSwatchPickerValueController",void 0),M([d()],B.prototype,"colorSwatchPickerColorFormatController",void 0),M([d()],B.prototype,"childNodeEventPreventSlimmer",void 0),M([d()],B.prototype,"changeEventEmitter",void 0),B.style=':host{display:inline-block}.swatch-picker-container{display:flex;flex-direction:row;align-items:center;gap:8px}.swatch-picker-container.error vega-color-swatch.swatch-picker-trigger::part(swatch){border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}.swatch-picker-container.error vega-color-swatch.swatch-picker-trigger::part(swatch-container):focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}.vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}';export{B as vega_color_swatch_picker}
|