@globalpayments/vega 2.50.0 → 2.52.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/LICENSE +9 -17
- package/dist/cjs/{app-globals-7f879795.js → app-globals-4ecf85bb.js} +9 -6
- package/dist/cjs/{child-nodes-event-prevent-slimmer-26ecfb15.js → child-nodes-event-prevent-slimmer-29020cc8.js} +1 -1
- package/dist/cjs/{child-nodes-notify-observer-slimmer-5817a53b.js → child-nodes-notify-observer-slimmer-30ba81ac.js} +1 -1
- package/dist/cjs/{code-block-d0b98262.js → code-block-2d014e17.js} +2 -2
- package/dist/cjs/{component-73a88c4e.js → component-1e352960.js} +1 -0
- package/dist/cjs/{component-global-style-slimmer-6749808c.js → component-global-style-slimmer-b0b4b997.js} +3 -0
- package/dist/cjs/{content-state-d2f6a5ac.js → content-state-6a5da7ec.js} +1 -1
- package/dist/cjs/{dark-mode-style-controller-4adb7fb2.js → dark-mode-style-controller-f9a32d68.js} +8 -0
- package/dist/cjs/{design-token-36495784.js → design-token-3f4f0bc3.js} +1 -1
- package/dist/cjs/{dom-node-subject-factory-d5826bff.js → dom-node-subject-factory-769dd00f.js} +1 -1
- package/dist/cjs/{dom-node-subject-observer-factory-a7a3b196.js → dom-node-subject-observer-factory-5aa4cc83.js} +1 -1
- package/dist/cjs/{effect-37695d3d.js → effect-98e88068.js} +2 -8
- package/dist/cjs/{element-appender-slimmer-e5ca155e.js → element-appender-slimmer-1946ff07.js} +14 -9
- package/dist/cjs/{event-emit-slimmer-ee7a8c06.js → event-emit-slimmer-6154c759.js} +6 -4
- package/dist/cjs/{form-field-controller-slimmer-ff6d7dfc.js → form-field-controller-slimmer-e721359b.js} +10 -8
- package/dist/cjs/{image-annotation-action-e11f242e.js → image-annotation-action-617bbb13.js} +4 -4
- package/dist/cjs/{index-73624bb3.js → index-ebb1bb17.js} +2 -2
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/{inject-keyboard-manager-b301e887.js → inject-keyboard-manager-dd628ccc.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-58afcde7.js → internal-vega-event-manager-e98944ac.js} +7 -1
- package/dist/cjs/{keyboard-manager-2ccf4b16.js → keyboard-manager-8c74eeb9.js} +3 -1
- package/dist/cjs/{keyboard-manager-slimmer-900cf2f5.js → keyboard-manager-slimmer-eb364bee.js} +1 -1
- package/dist/cjs/{legend-input-processor-8bcce3bf.js → legend-input-processor-b1f323fa.js} +2 -0
- package/dist/cjs/loader.cjs.js +12 -12
- package/dist/cjs/{mutation-observer-slimmer-895b3d3e.js → mutation-observer-slimmer-749d5020.js} +5 -2
- package/dist/cjs/{page-resize-observer-slimmer-44e08878.js → page-resize-observer-slimmer-efa79728.js} +1 -0
- package/dist/cjs/{public-rules-8e2542d9.js → public-rules-a3b7e267.js} +6 -6
- package/dist/cjs/{responsive-format-facade-325d3d90.js → responsive-format-facade-6b81192d.js} +5 -5
- package/dist/cjs/{rich-text-editor-required-rule-e325cd21.js → rich-text-editor-required-rule-e9c7c379.js} +1 -1
- package/dist/cjs/{selection-controller-93e9b350.js → selection-controller-1d7c0999.js} +7 -4
- package/dist/cjs/{string-input-formatter-slimmer-b28c6bd2.js → string-input-formatter-slimmer-a5feb2ed.js} +2 -2
- package/dist/cjs/{style-formatter-0c3f5ada.js → style-formatter-497d0fa4.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-06e0a8db.js → sub-state-notify-slimmer-f68fbf29.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-66f3038c.js → sub-state-observer-slimmer-e06cdf7e.js} +2 -2
- package/dist/cjs/try-get-document-c0ebd39a.js +13 -0
- package/dist/cjs/{ui-13b42af0.js → ui-6c069604.js} +2 -0
- package/dist/cjs/vega-accordion.cjs.entry.js +15 -14
- package/dist/cjs/vega-app-footer.cjs.entry.js +2 -2
- package/dist/cjs/vega-app-header-button.cjs.entry.js +16 -15
- package/dist/cjs/vega-backdrop.cjs.entry.js +2 -2
- package/dist/cjs/vega-banner.cjs.entry.js +7 -6
- package/dist/cjs/vega-bar-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +15 -13
- package/dist/cjs/vega-brand-logo.cjs.entry.js +2 -2
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +8 -7
- package/dist/cjs/vega-button-circle.cjs.entry.js +16 -15
- package/dist/cjs/vega-button-group_2.cjs.entry.js +10 -9
- package/dist/cjs/vega-button-link.cjs.entry.js +8 -7
- package/dist/cjs/vega-button.cjs.entry.js +15 -14
- package/dist/cjs/vega-calendar_3.cjs.entry.js +11 -10
- package/dist/cjs/vega-card.cjs.entry.js +12 -12
- package/dist/cjs/vega-carousel.cjs.entry.js +18 -14
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +13 -12
- package/dist/cjs/vega-chip.cjs.entry.js +16 -15
- package/dist/cjs/vega-code-block.cjs.entry.js +97 -102
- package/dist/cjs/vega-color-picker.cjs.entry.js +11 -10
- package/dist/cjs/vega-combo-box.cjs.entry.js +14 -13
- package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +32 -22
- package/dist/cjs/vega-dialog_2.cjs.entry.js +24 -17
- package/dist/cjs/vega-divider.cjs.entry.js +12 -12
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +23 -22
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-field-label.cjs.entry.js +7 -6
- package/dist/cjs/vega-file-uploader.cjs.entry.js +11 -10
- package/dist/cjs/vega-flag-icon.cjs.entry.js +12 -12
- package/dist/cjs/vega-flex.cjs.entry.js +13 -13
- package/dist/cjs/vega-font.cjs.entry.js +12 -12
- package/dist/cjs/vega-form.cjs.entry.js +14 -13
- package/dist/cjs/vega-grid.cjs.entry.js +12 -12
- package/dist/cjs/vega-hint.cjs.entry.js +1 -1
- package/dist/cjs/vega-icon.cjs.entry.js +34 -31
- package/dist/cjs/vega-image-uploader.cjs.entry.js +20 -17
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +12 -11
- package/dist/cjs/vega-input-numeric.cjs.entry.js +25 -15
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +17 -16
- package/dist/cjs/vega-input-range.cjs.entry.js +14 -13
- package/dist/cjs/vega-input-select.cjs.entry.js +18 -17
- package/dist/cjs/vega-input.cjs.entry.js +34 -15
- package/dist/cjs/vega-item-toggle.cjs.entry.js +7 -6
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +36 -20
- package/dist/cjs/vega-line-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +12 -11
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +6 -6
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +15 -14
- package/dist/cjs/vega-pie-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-popover_2.cjs.entry.js +17 -16
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +7 -6
- package/dist/cjs/vega-radio_2.cjs.entry.js +15 -14
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +13 -16
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +25 -22
- package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
- package/dist/cjs/vega-segment-control.cjs.entry.js +8 -7
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +19 -18
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +14 -13
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +21 -16
- package/dist/cjs/vega-signature-capture.cjs.entry.js +19 -17
- package/dist/cjs/{vega-skeleton-loader-controller-83e05b6c.js → vega-skeleton-loader-controller-ae2ab090.js} +15 -5
- package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +12 -11
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +9 -8
- package/dist/cjs/vega-table_8.cjs.entry.js +18 -17
- package/dist/cjs/vega-text.cjs.entry.js +4 -2
- package/dist/cjs/vega-textarea.cjs.entry.js +12 -11
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +24 -23
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +11 -10
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +15 -15
- package/dist/cjs/vega.cjs.js +12 -12
- package/dist/cjs/{wait-for-vega-handler-0a0738ac.js → wait-for-vega-handler-4491efc9.js} +3 -1
- package/dist/cjs/{y-axis-input-processor-e371c142.js → y-axis-input-processor-19a07af5.js} +1 -1
- package/dist/collection/components/vega-box/slimmers/controllers/vega-box-responsive-style-controller.js +1 -0
- package/dist/collection/components/vega-box/slimmers/controllers/vega-box-state-styles-controller.js +1 -0
- package/dist/collection/components/vega-carousel/vega-carousel.js +3 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +25 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +6 -20
- package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +1 -14
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +50 -56
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +2 -0
- package/dist/collection/components/vega-code-block/vega-code-block.css +1 -1
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-month-year-dropdown-renderer.js +5 -0
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +4 -0
- package/dist/collection/components/vega-dialog/vega-dialog.css +1 -0
- package/dist/collection/components/vega-icon/vega-icon.js +22 -19
- package/dist/collection/components/vega-image-uploader/slimmers/controllers/vega-image-uploader-preview-controller.js +2 -0
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-compact-width-controller.js +1 -0
- package/dist/collection/components/vega-input/vega-input.css +12 -2
- package/dist/collection/components/vega-input/vega-input.js +27 -3
- package/dist/collection/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.js +4 -1
- package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +27 -0
- package/dist/collection/components/vega-input-range/slimmers/renderers/vega-input-range-clear-icon-renderer.js +1 -1
- package/dist/collection/components/vega-input-range/vega-input-range.css +10 -0
- package/dist/collection/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.js +1 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.js +2 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-nested-modal-controller.js +1 -0
- package/dist/collection/components/vega-nav/slimmers/renderers/vega-nav-list-renderer.js +1 -1
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +2 -0
- package/dist/collection/components/vega-nav/vega-left-nav-link/slimmers/renderers/vega-left-nav-link-renderer.js +4 -1
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +2 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/test/e2e-utils.js +5 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-open-status-controller.js +1 -0
- package/dist/collection/components/vega-signature-capture/slimmers/written-mode/controllers/written-mode-svg-controller.js +1 -0
- package/dist/collection/components/vega-text/slimmers/renderers/vega-text-tooltip-renderer.js +2 -0
- package/dist/collection/components/vega-time-picker/slimmers/renderers/vega-time-picker-range-clear-button-renderer.js +1 -1
- package/dist/collection/components/vega-time-picker/vega-time-picker-dropdown/vega-time-picker-dropdown.css +4 -0
- package/dist/collection/components/vega-time-picker/vega-time-picker.css +10 -0
- package/dist/collection/global/scripts/before-vega-load.js +3 -0
- package/dist/collection/helpers/chart/graph-context-factory.js +2 -0
- package/dist/collection/helpers/common/wait-for-vega-handler.js +3 -1
- package/dist/collection/helpers/dialog/vega-dialog-controller.js +2 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-button-click-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-checkbox-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-input-select-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-input-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-radio-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-textarea-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/slimmers/event-emit-slimmer.js +3 -1
- package/dist/collection/helpers/event-manager/test/event-emit-slimmer.test.js +11 -1
- package/dist/collection/helpers/keyboard/keyboard-manager.js +2 -0
- package/dist/collection/helpers/notify/vega-notify-controller.js +6 -1
- package/dist/collection/helpers/skeleton-loader/vega-skeleton-loader-controller.js +3 -0
- package/dist/collection/helpers/slimmers/component-global-style-slimmer.js +3 -0
- package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/default-wrapper.js +1 -0
- package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/position-relative-to-wrapper.js +2 -0
- package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +4 -2
- package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-error-label-container-retrieval-strategy.js +1 -0
- package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-self-retrieval-strategy.js +1 -0
- package/dist/collection/helpers/slimmers/mutation-observer/mutation-observer-slimmer.js +5 -2
- package/dist/collection/helpers/slimmers/mutation-observer/test/mutation-observer-slimmer.test.js +14 -0
- package/dist/collection/helpers/slimmers/page-resize-observer-slimmer.js +1 -0
- package/dist/collection/helpers/theme/controllers/color-schema-overriding-controller.js +2 -0
- package/dist/collection/helpers/theme/controllers/style-controller.abstract.js +3 -0
- package/dist/collection/helpers/theme/internal-theme-manager.js +3 -0
- package/dist/collection/helpers/ui/element-appender.js +1 -1
- package/dist/collection/helpers/validator/form-field-controller.js +2 -2
- package/dist/collection/helpers/validator/test/validator/form-field-controller.test.js +12 -0
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +2 -0
- package/dist/collection/utils/component.js +1 -0
- package/dist/collection/utils/e2e-utils.js +3 -0
- package/dist/collection/utils/effect.js +2 -0
- package/dist/collection/utils/test/safe-document.test.js +13 -0
- package/dist/collection/utils/test-utils.js +1 -0
- package/dist/collection/utils/try-get-document.js +9 -0
- package/dist/collection/utils/ui.js +3 -0
- package/dist/esm/{app-globals-6614c573.js → app-globals-d96d623d.js} +9 -6
- package/dist/esm/{child-nodes-event-prevent-slimmer-1142fb79.js → child-nodes-event-prevent-slimmer-2b975cbf.js} +1 -1
- package/dist/esm/{child-nodes-notify-observer-slimmer-ddaad39a.js → child-nodes-notify-observer-slimmer-eeed5986.js} +1 -1
- package/dist/esm/{code-block-527df049.js → code-block-ef2f04ca.js} +2 -2
- package/dist/esm/{component-cae24190.js → component-7d906393.js} +1 -0
- package/dist/esm/{component-global-style-slimmer-000e0c11.js → component-global-style-slimmer-dad40b64.js} +3 -0
- package/dist/esm/{content-state-120176f3.js → content-state-69d29a07.js} +1 -1
- package/dist/esm/{dark-mode-style-controller-2ada8e22.js → dark-mode-style-controller-ea798fc8.js} +8 -0
- package/dist/esm/{design-token-5672a708.js → design-token-2060cd0d.js} +1 -1
- package/dist/esm/{dom-node-subject-factory-eb6bba5d.js → dom-node-subject-factory-6374611f.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-6083d518.js → dom-node-subject-observer-factory-c345ca2e.js} +1 -1
- package/dist/esm/{effect-8efd2c3c.js → effect-f50e072d.js} +2 -8
- package/dist/esm/{element-appender-slimmer-be7ccd98.js → element-appender-slimmer-dbdad1df.js} +14 -9
- package/dist/esm/{event-emit-slimmer-480d3b54.js → event-emit-slimmer-b5cb9b81.js} +6 -4
- package/dist/esm/{form-field-controller-slimmer-ec2000c0.js → form-field-controller-slimmer-846cda92.js} +10 -8
- package/dist/esm/{image-annotation-action-07f3d354.js → image-annotation-action-1497f70e.js} +4 -4
- package/dist/esm/{index-ae88803d.js → index-f5d2fe61.js} +2 -2
- package/dist/esm/index.js +13 -13
- package/dist/esm/{inject-keyboard-manager-f513be4a.js → inject-keyboard-manager-e39c0fd9.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-56c6469a.js → internal-vega-event-manager-d80c53c5.js} +7 -1
- package/dist/esm/{keyboard-manager-262be5ce.js → keyboard-manager-9564ad83.js} +3 -1
- package/dist/esm/{keyboard-manager-slimmer-42bf9773.js → keyboard-manager-slimmer-2218e6ba.js} +1 -1
- package/dist/esm/{legend-input-processor-8f76ce8a.js → legend-input-processor-1d266967.js} +2 -0
- package/dist/esm/loader.js +12 -12
- package/dist/esm/{mutation-observer-slimmer-6cef9549.js → mutation-observer-slimmer-58ebc13c.js} +5 -2
- package/dist/esm/{page-resize-observer-slimmer-15a84d26.js → page-resize-observer-slimmer-c51f1912.js} +1 -0
- package/dist/esm/{public-rules-b315bf89.js → public-rules-3436034b.js} +6 -6
- package/dist/esm/{responsive-format-facade-738b3413.js → responsive-format-facade-8c0ce819.js} +5 -5
- package/dist/esm/{rich-text-editor-required-rule-3b87fb40.js → rich-text-editor-required-rule-cc5b6a2d.js} +1 -1
- package/dist/esm/{selection-controller-c04f1e18.js → selection-controller-3d6dfc87.js} +7 -4
- package/dist/esm/{string-input-formatter-slimmer-4f0eadb0.js → string-input-formatter-slimmer-e53b6412.js} +2 -2
- package/dist/esm/{style-formatter-5870bbe1.js → style-formatter-1eca1299.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-6768a092.js → sub-state-notify-slimmer-b6c8051c.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-2958d1a3.js → sub-state-observer-slimmer-93eeb87d.js} +2 -2
- package/dist/esm/try-get-document-bef0f526.js +11 -0
- package/dist/esm/{ui-ed1283bb.js → ui-7d177fb0.js} +2 -0
- package/dist/esm/vega-accordion.entry.js +15 -14
- package/dist/esm/vega-app-footer.entry.js +2 -2
- package/dist/esm/vega-app-header-button.entry.js +16 -15
- package/dist/esm/vega-backdrop.entry.js +2 -2
- package/dist/esm/vega-banner.entry.js +7 -6
- package/dist/esm/vega-bar-chart.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +15 -13
- package/dist/esm/vega-brand-logo.entry.js +2 -2
- package/dist/esm/vega-breadcrumb.entry.js +8 -7
- package/dist/esm/vega-button-circle.entry.js +16 -15
- package/dist/esm/vega-button-group_2.entry.js +10 -9
- package/dist/esm/vega-button-link.entry.js +8 -7
- package/dist/esm/vega-button.entry.js +15 -14
- package/dist/esm/vega-calendar_3.entry.js +11 -10
- package/dist/esm/vega-card.entry.js +12 -12
- package/dist/esm/vega-carousel.entry.js +18 -14
- package/dist/esm/vega-checkbox_2.entry.js +13 -12
- package/dist/esm/vega-chip.entry.js +16 -15
- package/dist/esm/vega-code-block.entry.js +97 -102
- package/dist/esm/vega-color-picker.entry.js +11 -10
- package/dist/esm/vega-combo-box.entry.js +14 -13
- package/dist/esm/vega-counter-badge.entry.js +1 -1
- package/dist/esm/vega-date-picker_2.entry.js +32 -22
- package/dist/esm/vega-dialog_2.entry.js +24 -17
- package/dist/esm/vega-divider.entry.js +12 -12
- package/dist/esm/vega-dropdown_5.entry.js +23 -22
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-field-label.entry.js +7 -6
- package/dist/esm/vega-file-uploader.entry.js +11 -10
- package/dist/esm/vega-flag-icon.entry.js +12 -12
- package/dist/esm/vega-flex.entry.js +13 -13
- package/dist/esm/vega-font.entry.js +12 -12
- package/dist/esm/vega-form.entry.js +14 -13
- package/dist/esm/vega-grid.entry.js +12 -12
- package/dist/esm/vega-hint.entry.js +1 -1
- package/dist/esm/vega-icon.entry.js +34 -31
- package/dist/esm/vega-image-uploader.entry.js +20 -17
- package/dist/esm/vega-input-credit-card.entry.js +12 -11
- package/dist/esm/vega-input-numeric.entry.js +25 -15
- package/dist/esm/vega-input-phone-number.entry.js +17 -16
- package/dist/esm/vega-input-range.entry.js +14 -13
- package/dist/esm/vega-input-select.entry.js +18 -17
- package/dist/esm/vega-input.entry.js +34 -15
- package/dist/esm/vega-item-toggle.entry.js +7 -6
- package/dist/esm/vega-left-nav_5.entry.js +36 -20
- package/dist/esm/vega-line-chart.entry.js +3 -3
- package/dist/esm/vega-loader-wrapper_2.entry.js +12 -11
- package/dist/esm/vega-page-notification_2.entry.js +4 -4
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +6 -6
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination.entry.js +15 -14
- package/dist/esm/vega-pie-chart.entry.js +2 -2
- package/dist/esm/vega-popover_2.entry.js +17 -16
- package/dist/esm/vega-progress-tracker.entry.js +7 -6
- package/dist/esm/vega-radio_2.entry.js +15 -14
- package/dist/esm/vega-rich-text-content.entry.js +13 -16
- package/dist/esm/vega-rich-text-editor_4.entry.js +25 -22
- package/dist/esm/vega-section-title.entry.js +1 -1
- package/dist/esm/vega-segment-control.entry.js +8 -7
- package/dist/esm/vega-selection-chip_2.entry.js +19 -18
- package/dist/esm/vega-selection-tile_2.entry.js +14 -13
- package/dist/esm/vega-sidenav_3.entry.js +21 -16
- package/dist/esm/vega-signature-capture.entry.js +19 -17
- package/dist/esm/{vega-skeleton-loader-controller-878e1b28.js → vega-skeleton-loader-controller-06f48dd2.js} +15 -5
- package/dist/esm/vega-skeleton.entry.js +1 -1
- package/dist/esm/vega-stepper.entry.js +12 -11
- package/dist/esm/vega-tab-group_2.entry.js +9 -8
- package/dist/esm/vega-table_8.entry.js +18 -17
- package/dist/esm/vega-text.entry.js +4 -2
- package/dist/esm/vega-textarea.entry.js +12 -11
- package/dist/esm/vega-time-picker_2.entry.js +24 -23
- package/dist/esm/vega-toggle-switch.entry.js +11 -10
- package/dist/esm/vega-tooltip_2.entry.js +15 -15
- package/dist/esm/vega.js +12 -12
- package/dist/esm/{wait-for-vega-handler-b18eb955.js → wait-for-vega-handler-e0a928cd.js} +3 -1
- package/dist/esm/{y-axis-input-processor-e090b01c.js → y-axis-input-processor-95995d34.js} +1 -1
- package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +7 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +15 -14
- package/dist/types/components/vega-input/types.d.ts +2 -0
- package/dist/types/components/vega-input/vega-input.d.ts +9 -2
- package/dist/types/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.d.ts +1 -0
- package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +6 -0
- package/dist/types/components/vega-nav/interface.d.ts +1 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/slimmers/renderers/vega-left-nav-link-renderer.d.ts +1 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/vega-left-nav-link.d.ts +7 -0
- package/dist/types/components.d.ts +23 -3
- package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +1 -1
- package/dist/types/helpers/validator/form-field-controller.d.ts +1 -1
- package/dist/types/types/components.type.d.ts +1 -1
- package/dist/types/utils/test/safe-document.test.d.ts +1 -0
- package/dist/types/utils/try-get-document.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-012cbd8f.js +1 -0
- package/dist/vega/p-029300db.entry.js +1 -0
- package/dist/vega/p-05383290.entry.js +1 -0
- package/dist/vega/p-05588c85.entry.js +1 -0
- package/dist/vega/{p-5ce386c8.entry.js → p-06cd4a19.entry.js} +1 -1
- package/dist/vega/p-06db5a2e.entry.js +1 -0
- package/dist/vega/p-06fb002a.js +1 -0
- package/dist/vega/p-092c87b5.entry.js +1 -0
- package/dist/vega/{p-29f9be26.entry.js → p-0ce88865.entry.js} +1 -1
- package/dist/vega/p-0f034db5.entry.js +1 -0
- package/dist/vega/p-0fb26be0.entry.js +9 -0
- package/dist/vega/p-10edaab7.entry.js +1 -0
- package/dist/vega/{p-45e28b9b.js → p-111d41fe.js} +1 -1
- package/dist/vega/{p-6934013c.js → p-138fcf6e.js} +1 -1
- package/dist/vega/{p-27ccf34d.entry.js → p-151dec6a.entry.js} +1 -1
- package/dist/vega/{p-56a0b13d.js → p-1df029c2.js} +1 -1
- package/dist/vega/p-2490a391.entry.js +1 -0
- package/dist/vega/p-2a4c313e.entry.js +1 -0
- package/dist/vega/p-2f5d9aab.js +1 -0
- package/dist/vega/p-310f0791.entry.js +1 -0
- package/dist/vega/{p-d00fbc11.entry.js → p-32a24ef1.entry.js} +1 -1
- package/dist/vega/{p-829d0394.js → p-33bd7e31.js} +1 -1
- package/dist/vega/p-35c9cd1d.entry.js +1 -0
- package/dist/vega/{p-7b0a4688.entry.js → p-36827489.entry.js} +1 -1
- package/dist/vega/p-3a6b4208.entry.js +1 -0
- package/dist/vega/{p-bdd3147b.js → p-3b34389d.js} +1 -1
- package/dist/vega/p-3e8a8aa5.entry.js +1 -0
- package/dist/vega/{p-05373557.js → p-3eb2d433.js} +1 -1
- package/dist/vega/{p-9a72d29f.js → p-3fa7d356.js} +1 -1
- package/dist/vega/{p-0bc7c935.js → p-40577e8e.js} +1 -1
- package/dist/vega/p-44dee180.entry.js +1 -0
- package/dist/vega/{p-b518e1a0.entry.js → p-5016b57e.entry.js} +1 -1
- package/dist/vega/p-517615af.entry.js +1 -0
- package/dist/vega/{p-01e6e55a.entry.js → p-52905c68.entry.js} +1 -1
- package/dist/vega/{p-d7937711.js → p-55563f5f.js} +1 -1
- package/dist/vega/{p-7f5a85c6.entry.js → p-578ac47f.entry.js} +1 -1
- package/dist/vega/{p-8e66b9b0.entry.js → p-586139ce.entry.js} +1 -1
- package/dist/vega/{p-64f452fe.entry.js → p-5c9efff8.entry.js} +1 -1
- package/dist/vega/{p-21b18100.js → p-5e530257.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-5f594deb.entry.js +1 -0
- package/dist/vega/{p-020b04ed.js → p-613ee009.js} +1 -1
- package/dist/vega/p-62734ef7.entry.js +1 -0
- package/dist/vega/p-6419abd9.entry.js +1 -0
- package/dist/vega/{p-36499e56.entry.js → p-642da014.entry.js} +1 -1
- package/dist/vega/{p-cd205d96.js → p-65cca90f.js} +1 -1
- package/dist/vega/{p-872de7ee.js → p-6681efd5.js} +1 -1
- package/dist/vega/p-685939dc.entry.js +1 -0
- package/dist/vega/{p-419697c6.js → p-6b7dca3e.js} +1 -1
- package/dist/vega/{p-e1a2a701.js → p-6e01f0a2.js} +1 -1
- package/dist/vega/p-6ec0e3ce.entry.js +1 -0
- package/dist/vega/p-72a4edf2.entry.js +1 -0
- package/dist/vega/p-72e64237.js +1 -0
- package/dist/vega/p-72eb8998.entry.js +1 -0
- package/dist/vega/p-75855aaf.entry.js +1 -0
- package/dist/vega/p-78a57a17.js +1 -0
- package/dist/vega/p-7a8b6f2f.entry.js +1 -0
- package/dist/vega/p-7e70938a.entry.js +1 -0
- package/dist/vega/p-7f0def5a.entry.js +1 -0
- package/dist/vega/p-7f2c98df.entry.js +1 -0
- package/dist/vega/p-812b9d6d.entry.js +1 -0
- package/dist/vega/{p-5064a804.js → p-864de9a1.js} +1 -1
- package/dist/vega/p-888e3f52.entry.js +1 -0
- package/dist/vega/{p-acf6908c.entry.js → p-8a0d7805.entry.js} +1 -1
- package/dist/vega/p-8d3764d3.entry.js +1 -0
- package/dist/vega/p-8e31e7ea.js +1 -0
- package/dist/vega/{p-81ffd087.entry.js → p-90954fe4.entry.js} +1 -1
- package/dist/vega/p-9a9766cc.entry.js +1 -0
- package/dist/vega/{p-7893d070.js → p-9c0cda62.js} +1 -1
- package/dist/vega/{p-a6ef59b9.js → p-a0dab2d0.js} +1 -1
- package/dist/vega/p-a2d47741.entry.js +1 -0
- package/dist/vega/{p-9524e48a.entry.js → p-aab6f547.entry.js} +1 -1
- package/dist/vega/p-ab2a6d14.entry.js +1 -0
- package/dist/vega/p-abac6b00.entry.js +1 -0
- package/dist/vega/p-ac3a2d9c.entry.js +1 -0
- package/dist/vega/p-adadb1a1.entry.js +1 -0
- package/dist/vega/p-afc49b98.entry.js +1 -0
- package/dist/vega/p-b13fff4d.entry.js +1 -0
- package/dist/vega/p-b4a1a8e1.entry.js +1 -0
- package/dist/vega/{p-43701910.entry.js → p-b7594b78.entry.js} +1 -1
- package/dist/vega/p-b75ee3ba.js +1 -0
- package/dist/vega/p-bba5b112.entry.js +1 -0
- package/dist/vega/p-c22c628b.entry.js +1 -0
- package/dist/vega/{p-5fbb2aba.entry.js → p-c91190df.entry.js} +1 -1
- package/dist/vega/p-ca0294c9.entry.js +1 -0
- package/dist/vega/{p-392cf0cf.entry.js → p-cb643d8d.entry.js} +1 -1
- package/dist/vega/p-d8eec0bb.entry.js +1 -0
- package/dist/vega/p-e00da6d4.entry.js +1 -0
- package/dist/vega/p-e16e23b7.entry.js +1 -0
- package/dist/vega/p-e1ba6325.entry.js +1 -0
- package/dist/vega/{p-aa7037b1.entry.js → p-e5f1fd0b.entry.js} +1 -1
- package/dist/vega/p-e7b00bf0.js +1 -0
- package/dist/vega/{p-bc8fd0ee.entry.js → p-e860318d.entry.js} +1 -1
- package/dist/vega/{p-1e194737.js → p-eb832119.js} +1 -1
- package/dist/vega/p-eeab4167.entry.js +1 -0
- package/dist/vega/{p-dc94d914.entry.js → p-efb06a25.entry.js} +1 -1
- package/dist/vega/p-f2f31686.entry.js +1 -0
- package/dist/vega/p-f3ec4ae6.entry.js +1 -0
- package/dist/vega/{p-fc21fb2d.entry.js → p-f41ae5e0.entry.js} +1 -1
- package/dist/vega/p-f4a13f3f.js +1 -0
- package/dist/vega/{p-dbd2a79b.entry.js → p-fac5990f.entry.js} +1 -1
- package/dist/vega/{p-044f6193.js → p-fecb4044.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +2 -2
- package/dist/vega/p-0228c197.entry.js +0 -1
- package/dist/vega/p-055d7856.entry.js +0 -1
- package/dist/vega/p-0e1872b7.entry.js +0 -1
- package/dist/vega/p-0f9b3ffd.entry.js +0 -1
- package/dist/vega/p-12e6173c.entry.js +0 -1
- package/dist/vega/p-1e172471.entry.js +0 -1
- package/dist/vega/p-2fb5cef7.entry.js +0 -1
- package/dist/vega/p-30dcf606.entry.js +0 -1
- package/dist/vega/p-36a19c06.entry.js +0 -1
- package/dist/vega/p-38c9f0a2.entry.js +0 -1
- package/dist/vega/p-3f191ec3.entry.js +0 -1
- package/dist/vega/p-3f5bac0f.entry.js +0 -1
- package/dist/vega/p-4a9a42e7.entry.js +0 -1
- package/dist/vega/p-4ea06c45.entry.js +0 -1
- package/dist/vega/p-539bf755.entry.js +0 -1
- package/dist/vega/p-5477b0ef.entry.js +0 -1
- package/dist/vega/p-5eec1e1f.entry.js +0 -1
- package/dist/vega/p-5f7e87d8.entry.js +0 -1
- package/dist/vega/p-66759f4e.js +0 -1
- package/dist/vega/p-67cf7b9d.entry.js +0 -1
- package/dist/vega/p-6c6a91fe.entry.js +0 -1
- package/dist/vega/p-6d073cd2.entry.js +0 -1
- package/dist/vega/p-6dc2cae8.entry.js +0 -1
- package/dist/vega/p-6ece526e.entry.js +0 -1
- package/dist/vega/p-767b257b.entry.js +0 -1
- package/dist/vega/p-7703176f.entry.js +0 -1
- package/dist/vega/p-7f6d6c20.js +0 -1
- package/dist/vega/p-854849ea.entry.js +0 -1
- package/dist/vega/p-86782109.js +0 -1
- package/dist/vega/p-87019626.entry.js +0 -1
- package/dist/vega/p-87a1fc77.entry.js +0 -1
- package/dist/vega/p-8aa7e56e.entry.js +0 -1
- package/dist/vega/p-8f4e3a60.js +0 -1
- package/dist/vega/p-987fbbd0.js +0 -1
- package/dist/vega/p-99b9b320.entry.js +0 -1
- package/dist/vega/p-9ba14b7c.entry.js +0 -1
- package/dist/vega/p-9eed80df.entry.js +0 -1
- package/dist/vega/p-9f002a09.js +0 -1
- package/dist/vega/p-9f64b39a.entry.js +0 -1
- package/dist/vega/p-a0e122a6.entry.js +0 -1
- package/dist/vega/p-a88c382b.entry.js +0 -1
- package/dist/vega/p-ad1460f2.entry.js +0 -1
- package/dist/vega/p-ae3048da.entry.js +0 -1
- package/dist/vega/p-b257180d.entry.js +0 -9
- package/dist/vega/p-b4bfbcb9.entry.js +0 -1
- package/dist/vega/p-b59c8fdf.entry.js +0 -1
- package/dist/vega/p-b8d9d3a0.entry.js +0 -1
- package/dist/vega/p-cd0575c3.entry.js +0 -1
- package/dist/vega/p-cd437a76.entry.js +0 -1
- package/dist/vega/p-d2284b8a.js +0 -1
- package/dist/vega/p-d2a2af2c.entry.js +0 -1
- package/dist/vega/p-d3765409.entry.js +0 -1
- package/dist/vega/p-d516cc5d.entry.js +0 -1
- package/dist/vega/p-e8fc027e.entry.js +0 -1
- package/dist/vega/p-efdda17c.entry.js +0 -1
- package/dist/vega/p-f5a2038f.js +0 -1
- package/dist/vega/p-fba8f692.entry.js +0 -1
- package/dist/vega/p-fed9220b.entry.js +0 -1
- /package/dist/vega/{p-eda5b7fd.js → p-05b10af4.js} +0 -0
- /package/dist/vega/{p-50677c8e.js → p-0c8bd757.js} +0 -0
- /package/dist/vega/{p-af7a3154.js → p-13effc6b.js} +0 -0
- /package/dist/vega/{p-ecfa7534.js → p-272440e8.js} +0 -0
- /package/dist/vega/{p-9b797118.js → p-519a7d55.js} +0 -0
- /package/dist/vega/{p-c0291e2e.js → p-834434d5.js} +0 -0
- /package/dist/vega/{p-bf953152.js → p-d5776087.js} +0 -0
- /package/dist/vega/{p-0fd6c35b.js → p-fa5eb496.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as t,H as e,F as i,r as o,c as s,g as n}from"./p-21d26bb4.js";import{c as r,M as c,V as l,I as a}from"./p-6e1ab235.js";import{V as h,I as d}from"./p-4387d550.js";import{s as u}from"./p-519a7d55.js";import{c as p}from"./p-86194314.js";import{C as f}from"./p-2d0d575f.js";import{d as v,b as m,f as b,P as g,a as x,M as w,N as C}from"./p-6e01f0a2.js";import{V as y,a as R,v as j,w as k,x as O,r as S}from"./p-425ba7d6.js";import{b as H,I as T,T as L,a as z}from"./p-6681efd5.js";import{V as E}from"./p-c9b9322b.js";import{g as B,J as I,N as M,G as A,T as D,K as N,O as P,d as F,P as V,Q as U,V as K,W,X as _,Y as G,_ as q,D as $,L as J,H as X,$ as Y,a as Z,M as Q,f as tt,a0 as et,c as it,Z as ot,a1 as st,a2 as nt,S as rt,R as ct,b as lt,e as at,F as ht,u as dt,I as ut,w as pt}from"./p-3eb2d433.js";import{D as ft}from"./p-e7b00bf0.js";import{g as vt}from"./p-37b05e0b.js";import{a as mt}from"./p-f4a13f3f.js";import{F as bt}from"./p-72e64237.js";import{c as gt}from"./p-012cbd8f.js";import{c as xt}from"./p-8e31e7ea.js";import{a as wt,V as Ct,B as yt,b as Rt,R as jt}from"./p-fecb4044.js";import{R as kt,A as Ot,a as St}from"./p-3b34389d.js";import{b as Ht,D as Tt}from"./p-5773a9a3.js";import{O as Lt}from"./p-331a62d5.js";import{d as zt}from"./p-1bc5b3bc.js";import{D as Et}from"./p-6be16084.js";import{i as Bt}from"./p-b1f65b13.js";import{r as It,f as Mt}from"./p-d5776087.js";import{R as At}from"./p-3fa7d356.js";import{C as Dt}from"./p-6b7dca3e.js";import{T as Nt}from"./p-d64b20c2.js";import{V as Pt}from"./p-0c8bd757.js";import{K as Ft}from"./p-55563f5f.js";import{c as Vt}from"./p-613ddaab.js";import{t as Ut}from"./p-aacf6920.js";import{r as Kt}from"./p-77e64f26.js";import"./p-cc63e827.js";import"./p-6a334573.js";import"./p-fa5eb496.js";import"./p-0bb29d98.js";import"./p-4ab3df00.js";import"./p-834434d5.js";import"./p-74168615.js";import"./p-ed45b3b6.js";import"./p-abd7aeaa.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-d27ae9ff.js";import"./p-262ec334.js";import"./p-138fcf6e.js";import"./p-613ee009.js";import"./p-b75ee3ba.js";import"./p-1fb56e14.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-5f377954.js";import"./p-4d793cb0.js";import"./p-7a40e033.js";import"./p-112455b1.js";import"./p-1df029c2.js";var Wt=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class _t extends l{constructor(){super(...arguments),this.renderHintMessage=()=>t("vega-text",null,this.hint),this.renderTextContent=()=>t("div",{class:{"rich-text-editor-container":!0,disabled:this.disabled},style:{minHeight:24*this.rows+"px"},onClick:this.richTextContentFocus,role:"textbox",tabIndex:this.disabled?0:-1,onKeyDown:p(),ref:t=>this.richTextContainerRef=t},t("vega-rich-text-content",{ref:t=>this.richTextContentRef=t,content:this.value}),this.renderCharacterCounter()),this.renderCharacterCounter=()=>t("div",{class:{"text-editor-counter":!0,"counter-exceed-max-length":!1},style:{display:"none"}},t("span",null,"0"),t("span",null,"/100")),this.renderErrorMessage=()=>t("div",{class:"vega-error vega-hidden"}),this.richTextContentFocus=()=>{this.richTextContentRef.vegaFocus()}}componentDidRender(){f.notify(v.getSubject(this.host,y),{})}getRichTextContainerRef(){return this.richTextContainerRef}getRichTextContentRef(){return this.richTextContentRef}getRichTextWrapperRef(){return this.richTextWrapperRef}getRTEEditableElementRef(){if(this.richTextContentRef&&this.richTextContentRef.shadowRoot)return this.richTextContentRef.shadowRoot.querySelector(".rich-text-content")}render(){return t(e,null,this.renderRichTextEditor())}renderRichTextEditor(){return t("vega-flex",{direction:"col",gap:"0",ref:t=>this.richTextWrapperRef=t},this.renderLabel(),this.hint&&this.renderHintMessage(),this.toolbarRenderer.render(),this.renderTextContent(),this.renderErrorMessage())}renderLabel(){return this.label&&t("vega-field-label",{onClick:this.richTextContentFocus,isFieldRequired:this.required,disabled:this.disabled,label:this.label})}}Wt([r()],_t.prototype,"host",void 0),Wt([r()],_t.prototype,"toolbarRenderer",void 0),Wt([r()],_t.prototype,"label",void 0),Wt([r()],_t.prototype,"required",void 0),Wt([r()],_t.prototype,"hint",void 0),Wt([r()],_t.prototype,"disabled",void 0),Wt([r()],_t.prototype,"rows",void 0),Wt([r()],_t.prototype,"placeholder",void 0),Wt([r()],_t.prototype,"value",void 0),Wt([c("componentDidRender")],_t.prototype,"componentDidRender",null);var Gt=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class qt extends l{constructor(){super(...arguments),this.getToolbarBtnRenderer=t=>{switch(t){case"clearStyle":return this.clearStyleToolbarButtonSlimmer;case"bold":return this.boldToolbarButtonSlimmer;case"textStyles":return this.textStylesToolbarButtonSlimmer;case"italic":return this.italicToolbarButtonSlimmer;case"underline":return this.underlineToolbarButtonSlimmer;case"textColor":return this.textColorToolbarButtonSlimmer;case"moreIndent":return this.moreIndentToolbarButtonSlimmer;case"lessIndent":return this.lessIndentToolbarButtonSlimmer;case"code":return this.codeToolbarButtonSlimmer;case"strikethrough":return this.strikethroughToolbarButtonSlimmer;case"link":return this.linkToolbarButtonSlimmer;case"image":return this.imageToolbarButtonSlimmer;case"bulletsNumbers":return this.bulletsNumbersToolbarButtonSlimmer;case"horizontalAlignment":return this.horizontalAlignmentToolbarButtonSlimmer;case"codeBlock":return this.codeBlockToolbarButtonSlimmer}}}render(){return t("vega-flex",{gap:"size-8",alignItems:"center",flexWrap:"wrap"},this.toolbarItems.map((e=>t("div",{class:"toolbar-btn-group"},e.map((t=>this.getToolbarBtnRenderer(t).render()))))))}}Gt([r()],qt.prototype,"toolbarItems",void 0),Gt([r()],qt.prototype,"clearStyleToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"boldToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"textStylesToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"italicToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"underlineToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"textColorToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"strikethroughToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"imageToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"moreIndentToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"lessIndentToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"codeToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"linkToolbarButtonSlimmer",void 0),Gt([r()],qt.prototype,"codeBlockToolbarButtonSlimmer",void 0);class $t extends H{constructor(){super({icon:"bold",tooltip:{text:"Bold"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((e=>e.apply(new I(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof B));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(M.BOLD))||void 0===e?void 0:e.bold}))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return t instanceof A||(null===(e=t.getAnnotationByType(M.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(M.IMAGE)}))}}E.register({bold:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 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="M0 64C0 46.3 14.3 32 32 32H80 96 224c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128H96 80 32c-17.7 0-32-14.3-32-32s14.3-32 32-32H48V256 96H32C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64H112V224H224zM112 288V416H256c35.3 0 64-28.7 64-64s-28.7-64-64-64H224 112z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],$t.prototype,"selectionController",void 0);class Jt extends D{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new N(this.italic)}}class Xt extends H{constructor(){super({icon:"italic",tooltip:{text:"Italic"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof B));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(M.ITALIC))||void 0===e?void 0:e.italic}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((e=>e.apply(new Jt(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return t instanceof A||(null===(e=t.getAnnotationByType(M.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(M.IMAGE)}))}}E.register({italic:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 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="M128 64c0-17.7 14.3-32 32-32H352c17.7 0 32 14.3 32 32s-14.3 32-32 32H293.3L160 416h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H90.7L224 96H160c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],Xt.prototype,"selectionController",void 0);class Yt extends D{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new P(this.underline)}}class Zt extends H{constructor(){super({icon:"underline",tooltip:{text:"Underline"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof B));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(M.UNDERLINE))||void 0===e?void 0:e.underline}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((e=>e.apply(new Yt(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return t instanceof A||(null===(e=t.getAnnotationByType(M.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(M.IMAGE)}))}}E.register({underline:{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="M16 64c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H128V224c0 53 43 96 96 96s96-43 96-96V96H304c-17.7 0-32-14.3-32-32s14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H384V224c0 88.4-71.6 160-160 160s-160-71.6-160-160V96H48C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],Zt.prototype,"selectionController",void 0);var Qt=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class te extends H{constructor(){super({icon:"text-size",tooltip:{text:"Text Styles"}}),this.handleDropdownItemClick=t=>{const e=t.detail,i=te.items.find((t=>t.key===e)).bold,o=this.selectionController.getSelectedBlocks().filter((t=>t instanceof F));o.length>0?o.forEach((t=>{t.apply(new V(e,i))})):this.focusController.focusOnLastTextNode({newLine:!0}).then((()=>{this.selectionController.getSelectedBlocks().filter((t=>t instanceof F)).forEach((t=>{t.apply(new V(e,i))}))}))}}renderBtnWrapper(e){return t("vega-dropdown",{selectType:"single",trigger:"click",alignment:"center",selectedSourceKey:this.getSelectedSourceKey(),ref:t=>{this.addDropdownObserver(t)}},e({showArrowIcon:!0}),t("div",Object.assign({slot:"items"},super.preventLostFocus()),this.renderDropdownContent()))}renderDropdownContent(){return t(i,null,te.items.map((e=>{const i=new U(e.key),o=new K(e.bold);return t("vega-dropdown-item",{key:e.key,itemKey:e.key},t("vega-box",{padding:{right:"size-20"}},t("div",{style:Object.assign(Object.assign({},i.render()),o.render())},this.translationSlimmer.t(e.label))))})))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof A||t.getAnnotationByType(M.IMAGE)))}addDropdownObserver(t){ft.addUniqueObserverToNode(t,m,this.handleDropdownItemClick)}getSelectedSourceKey(){const t=this.selectionController.getSelectedBlocks().filter((t=>t instanceof F));return t.length>0&&t.every((e=>e.type===t[0].type))?t[0].getAnnotationByType(W.TEXT_STYLE).textStyle:""}}E.register({"text-size":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 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="M64 128V96h96l0 320H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H256c17.7 0 32-14.3 32-32s-14.3-32-32-32H224l0-320h96v32c0 17.7 14.3 32 32 32s32-14.3 32-32V80c0-26.5-21.5-48-48-48H192 48C21.5 32 0 53.5 0 80v48c0 17.7 14.3 32 32 32s32-14.3 32-32zM384 304V288h64l0 128H432c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H512l0-128h64v16c0 17.7 14.3 32 32 32s32-14.3 32-32V272c0-26.5-21.5-48-48-48H368c-26.5 0-48 21.5-48 48v32c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>'}}),te.items=[{key:"title",label:"Title",bold:!0},{key:"subtitle",label:"Subtitle"},{key:"heading-1",label:"Heading 1",bold:!0},{key:"heading-2",label:"Heading 2",bold:!0},{key:"heading-3",label:"Heading 3",bold:!0},{key:"paragraph",label:"Paragraph"}],Qt([r()],te.prototype,"selectionController",void 0),Qt([r()],te.prototype,"focusController",void 0);class ee extends H{constructor(){super({icon:"text-slash",tooltip:{text:"Clear Style"}})}isSelected(){return!1}onClick(){this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((t=>{t.apply(new _)}))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof A||t.getAnnotationByType(M.IMAGE)))}}E.register({"text-slash":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 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="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96H503L497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32H376.1h-.3H204.5c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96H333.7L301.3 210.8l-94.5-74.1zM243.3 416H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H309.8l17.6-62.1L272.9 311 243.3 416z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ee.prototype,"selectionController",void 0);class ie extends H{constructor(){super({icon:"code-simple",tooltip:{text:"Code"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((e=>e.apply(new G(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes();return t.length>0&&t.filter((t=>t instanceof B)).map((t=>t.getAnnotationByType(M.CODE))).every((t=>t&&t.code))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof A||t.getAnnotationByType(M.LINK)||t.getAnnotationByType(M.IMAGE)))}}E.register({"code-simple":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 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="M214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6zm146.7 0L498.7 256 361.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ie.prototype,"selectionController",void 0);class oe extends D{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new q(this.strikethrough)}}class se extends H{constructor(){super({icon:"strikethrough",tooltip:{text:"Strikethrough"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof B));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(M.STRIKETHROUGH))||void 0===e?void 0:e.strikethrough}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof B)).forEach((e=>e.apply(new oe(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return t instanceof A||(null===(e=t.getAnnotationByType(M.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(M.IMAGE)}))}}E.register({strikethrough:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path fill="currentColor" d="M332.2 319.9c17.22 12.17 22.33 26.51 18.61 48.21c-3.031 17.59-10.88 29.34-24.72 36.99c-35.44 19.75-108.5 11.96-186-19.68c-16.34-6.686-35.03 1.156-41.72 17.53s1.188 35.05 17.53 41.71c31.75 12.93 95.69 35.37 157.6 35.37c29.62 0 58.81-5.156 83.72-18.96c30.81-17.09 50.44-45.46 56.72-82.11c3.998-23.27 2.168-42.58-3.488-59.05H332.2zM488 239.9l-176.5-.0309c-15.85-5.613-31.83-10.34-46.7-14.62c-85.47-24.62-110.9-39.05-103.7-81.33c2.5-14.53 10.16-25.96 22.72-34.03c20.47-13.15 64.06-23.84 155.4 .3438c17.09 4.531 34.59-5.654 39.13-22.74c4.531-17.09-5.656-34.59-22.75-39.12c-91.31-24.18-160.7-21.62-206.3 7.654C121.8 73.72 103.6 101.1 98.09 133.1C89.26 184.5 107.9 217.3 137.2 239.9L24 239.9c-13.25 0-24 10.75-24 23.1c0 13.25 10.75 23.1 24 23.1h464c13.25 0 24-10.75 24-23.1C512 250.7 501.3 239.9 488 239.9z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],se.prototype,"selectionController",void 0);class ne extends H{constructor(){super({icon:"link",tooltip:{text:"Link"}}),this.handleLinkEditorChange=({detail:t})=>{switch(t.action){case"link":{const{url:e,text:i}=t.payload,o=i!==this.currentSelectedText,s=vt();return void this.currentSelectedNodes.forEach((t=>{t.apply(new $(this.currentRange)).apply(new J({link:{href:e,groupKey:s},newText:o?i:void 0,needMergeNode:o&&this.currentSelectedNodes.length>1}))}))}}}}renderBtnWrapper(e){return t("div",{class:"toolbar-btn-link-wrapper",ref:t=>this.linkBtnWrapperRef=t},e(),t("vega-rich-text-link-editor",{resetStatusAfterHide:!1,status:"linkEdit",ref:t=>{t&&(this.linkEditorRef=t),ft.addUniqueObserverToNode(t,b,this.handleLinkEditorChange)}}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getSelectedBlocks();return super.isDisabled()||e.length>1||t.some((t=>{var e;return!(t instanceof B)||t.getAnnotationByType(M.LINK)||(null===(e=t.getAnnotationByType(M.CODE))||void 0===e?void 0:e.code)}))}onClick(){this.currentRange=this.selectionController.getCurrentRange().toNativeRange(),this.currentSelectedNodes=this.selectionController.getSelectedNodes(),this.currentRange&&(this.currentSelectedText=this.currentRange.toString(),this.currentSelectedNodes.length>0&&(this.linkEditorRef.record={text:this.currentSelectedText,url:""})),this.linkEditorRef.target||(this.linkEditorRef.target=this.linkBtnWrapperRef,mt(this.linkEditorRef).then((()=>{this.linkEditorRef.show()})))}}E.register({link:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 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="M562.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L405.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C189.5 251.2 196 330 246 380c56.5 56.5 148 56.5 204.5 0L562.8 267.7zM43.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C57 372 57 321 88.5 289.5L200.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C416.5 260.8 410 182 360 132c-56.5-56.5-148-56.5-204.5 0L43.2 244.3z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ne.prototype,"selectionController",void 0);class re extends X{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new Y(this.indent)}}class ce extends H{constructor(){super({icon:"indent",tooltip:{text:"More Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>"list-item"===t.type||"code-block"===t.type))||e.some((t=>t instanceof Z))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const o=null!==(i=null===(e=t.getAnnotationByType(W.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new re(o+1))}))}}E.register({indent:{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="M0 64C0 46.3 14.3 32 32 32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32zm32 96H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3V176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ce.prototype,"selectionController",void 0);class le extends H{constructor(){super({icon:"outdent",tooltip:{text:"Less Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>"list-item"===t.type||"code-block"===t.type))||e.some((t=>t instanceof Z))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const o=null!==(i=null===(e=t.getAnnotationByType(W.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new re(o>1?o-1:0))}))}}E.register({outdent:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 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="M6 64C6 46.3 20.3 32 38 32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38C20.3 96 6 81.7 6 64zM198 192c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32zm32 96H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32s14.3-32 32-32zM6 448c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38c-17.7 0-32-14.3-32-32zm.2-179.4c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6V335.3c0 13.3-15.3 20.8-25.8 12.6L6.2 268.6z"/></svg>'}}),function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],le.prototype,"selectionController",void 0);class ae extends Q{constructor(t){super(),this.type=tt.UPDATE_IMAGE_NODE_URL,this.url=t}}var he=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class de extends H{constructor(){super({icon:"image",tooltip:{text:"Image"}}),this.onClick=()=>{this.inputElementRef.click()},this.fileInputChange=t=>{t.stopPropagation();const e=t.target;if(!e.files.length)return;const i=this.insertImageController.insertImageToCaretPosition(URL.createObjectURL(e.files[0]));this.updateNodeURLMap||(this.updateNodeURLMap=new Map),this.updateNodeURLMap.set(i,(t=>{i.apply(new ae(t))}));const o={file:e.files[0],sendBackUploadedURLCallback:this.updateNodeURLMap.get(i)};this.imageInsertedEventEmitter.emit(o),e.value=""}}renderBtnWrapper(e){return t("vega-box",null,e({showArrowIcon:!1}),t("input",{type:"file",style:{display:"none"},ref:t=>this.inputElementRef=t,accept:"image/*",onChange:this.fileInputChange}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t.getAnnotationByType(M.LINK)))}}E.register({image:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 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="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>'}}),he([r()],de.prototype,"insertImageController",void 0),he([r()],de.prototype,"imageInsertedEventEmitter",void 0),he([r()],de.prototype,"selectionController",void 0);class ue extends Q{constructor(t,e){super(),this.type=tt.TRANSFORM_LIST_BLOCK,this.isFlushable=!0,this.listType=t,this.selectedBlocks=e}}class pe extends Q{constructor(t){super(),this.type=tt.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}var fe=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ve extends H{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectBulletList():this.selectBulletList(),this.popoverRef.hide()}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof Z||t instanceof A))}isListType(t,e="bullet-list"){return t.length>0&&t.every((t=>t instanceof wt&&t.parent.type===e))}deselectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new pe(t))}selectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new ue("bullet-list",t))}}fe([r()],ve.prototype,"selectionController",void 0),fe([r()],ve.prototype,"popoverRef",void 0);var me=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class be extends H{constructor(){super({icon:"list-ol",tooltip:{text:"Numbers"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectNumberList():this.selectNumberList(),this.popoverRef.hide()}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof Z||t instanceof A))}isListType(t,e="number-list"){return t.length>0&&t.every((t=>t instanceof wt&&t.parent.type===e))}deselectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new pe(t))}selectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new ue("number-list",t))}}me([r()],be.prototype,"selectionController",void 0),me([r()],be.prototype,"popoverRef",void 0);var ge=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class xe extends H{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}}),this.bulletsToolbarButtonSlimmer=new ve,this.numbersToolbarButtonSlimmer=new be}componentWillRender(){this.numbersToolbarButtonSlimmer.isSelected()?super.setIcon("list-ol"):super.setIcon("list-ul")}renderBtnWrapper(e){return t("vega-popover",{showArrow:!1,trigger:"click",placement:"bottom",alignment:"center",ref:t=>this.popoverRef=t},t("div",{slot:"popover-content"},e({showArrowIcon:!0})),t("div",{slot:"popover"},this.renderContent()))}renderContent(){return t("vega-flex",{gap:"size-8","justify-content":"center"},t("div",null,this.bulletsToolbarButtonSlimmer.render()),t("div",null,this.numbersToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof Z||t instanceof A))}}E.register({"list-ul":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 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="M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"/></svg>'},"list-ol":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 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="M24 56c0-13.3 10.7-24 24-24H80c13.3 0 24 10.7 24 24V176h16c13.3 0 24 10.7 24 24s-10.7 24-24 24H40c-13.3 0-24-10.7-24-24s10.7-24 24-24H56V80H48C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432H120c13.3 0 24 10.7 24 24s-10.7 24-24 24H32c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>'}}),ge([r()],xe.prototype,"selectionController",void 0),ge([a()],xe.prototype,"bulletsToolbarButtonSlimmer",void 0),ge([a()],xe.prototype,"numbersToolbarButtonSlimmer",void 0),ge([c("componentWillRender")],xe.prototype,"componentWillRender",null);class we extends X{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new et(this.textAlign)}}var Ce=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ye extends H{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"left"===(null===(e=t.getAnnotationByType(W.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new we("left")))),this.popoverRef.hide()}}E.register({"align-left":{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="M288 64c0 17.7-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32H256c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H256c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),Ce([r()],ye.prototype,"selectionController",void 0),Ce([r()],ye.prototype,"popoverRef",void 0);var Re=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class je extends H{constructor(){super({icon:"align-center",tooltip:{text:"Center Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"center"===(null===(e=t.getAnnotationByType(W.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new we("center")))),this.popoverRef.hide()}}E.register({"align-center":{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="M352 64c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32z"/></svg>'}}),Re([r()],je.prototype,"selectionController",void 0),Re([r()],je.prototype,"popoverRef",void 0);var ke=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Oe extends H{constructor(){super({icon:"align-right",tooltip:{text:"Right Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"right"===(null===(e=t.getAnnotationByType(W.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new we("right")))),this.popoverRef.hide()}}E.register({"align-right":{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="M448 64c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),ke([r()],Oe.prototype,"selectionController",void 0),ke([r()],Oe.prototype,"popoverRef",void 0);var Se=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class He extends H{constructor(){super({icon:"align-justify",tooltip:{text:"Justified"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"justify"===(null===(e=t.getAnnotationByType(W.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new we("justify")))),this.popoverRef.hide()}}E.register({"align-justify":{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="M448 64c0-17.7-14.3-32-32-32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 192c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM448 448c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32z"/></svg>'}}),Se([r()],He.prototype,"selectionController",void 0),Se([r()],He.prototype,"popoverRef",void 0);var Te=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Le extends H{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}}),this.leftAlignToolbarButtonSlimmer=new ye,this.centerAlignToolbarButtonSlimmer=new je,this.rightAlignToolbarButtonSlimmer=new Oe,this.justifiedToolbarButtonSlimmer=new He}componentWillRender(){this.leftAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-left"):this.centerAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-center"):this.rightAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-right"):this.justifiedToolbarButtonSlimmer.isSelected()?super.setIcon("align-justify"):super.setIcon("align-left")}renderBtnWrapper(e){return t("vega-popover",{trigger:"click",showArrow:!1,alignment:"center",placement:"bottom",ref:t=>this.popoverRef=t},t("div",{slot:"popover-content"},e({showArrowIcon:!0})),t("div",{slot:"popover"},this.renderContent()))}renderContent(){return t("vega-flex",{gap:"size-8","justify-content":"center"},t("div",null,this.leftAlignToolbarButtonSlimmer.render()),t("div",null,this.centerAlignToolbarButtonSlimmer.render()),t("div",null,this.rightAlignToolbarButtonSlimmer.render()),t("div",null,this.justifiedToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){return super.isDisabled()||this.selectionController.getSelectedBlocks().some((t=>"code-block"===t.type))}}Te([r()],Le.prototype,"selectionController",void 0),Te([a()],Le.prototype,"leftAlignToolbarButtonSlimmer",void 0),Te([a()],Le.prototype,"centerAlignToolbarButtonSlimmer",void 0),Te([a()],Le.prototype,"rightAlignToolbarButtonSlimmer",void 0),Te([a()],Le.prototype,"justifiedToolbarButtonSlimmer",void 0),Te([c("componentWillRender")],Le.prototype,"componentWillRender",null);class ze{constructor(t,e){this.content=t.clone(!0),this.selection=e.clone(),this.refreshSelectionNodes()}clone(){return new ze(this.content,this.selection)}refreshSelectionNodes(){const{startNode:t,endNode:e,startOffset:i,endOffset:o}=this.selection.range;if(t&&e){const s=this.content.findNodeById(t.id),n=this.content.findNodeById(e.id);s&&n&&this.selection.range.updateRTERange({startNode:s,endNode:n,startOffset:i,endOffset:o})}}}var Ee=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Be extends l{connectedCallback(){const t=zt((()=>{this.valueController.flushChanges(this.value)}),Be.VALUE_CHANGE_DEBOUNCE_TIME,this);this.flushChangeObserver=new Lt(this.isAcceptableFlushChange.bind(this),t),f.register(v.getSubject(this.host,R),this.flushChangeObserver)}disconnectedCallback(){f.unregister(v.getSubject(this.host,R),this.flushChangeObserver)}componentWillLoad(){!this.value||this.value instanceof Ct||(this.value=Ct.fromJSON(this.value))}watchValueUpdate(){!this.value||this.value instanceof Ct?this.value&&0!==this.value.blocks.length?(this.changeEventEmitter.emit(this.value),f.notify(Ht,{host:this.host,detail:this.value})):this.value=Ct.createEmptyContent():this.value=Ct.fromJSON(this.value)}async flushChanges(t,e=!0){e&&this.historyController.registerHistory(new ze(t,new kt(this.selectionController.getCurrentRange()))),this.value=t.clone(),await mt(this.host)}isAcceptableFlushChange(){return!0}}Be.VALUE_CHANGE_DEBOUNCE_TIME=50,Ee([r()],Be.prototype,"host",void 0),Ee([r({writable:!0})],Be.prototype,"value",void 0),Ee([r()],Be.prototype,"changeEventEmitter",void 0),Ee([r()],Be.prototype,"valueController",void 0),Ee([r()],Be.prototype,"historyController",void 0),Ee([r()],Be.prototype,"selectionController",void 0),Ee([c("connectedCallback")],Be.prototype,"connectedCallback",null),Ee([c("disconnectedCallback")],Be.prototype,"disconnectedCallback",null),Ee([c("componentWillLoad")],Be.prototype,"componentWillLoad",null),Ee([c("watchValueUpdate")],Be.prototype,"watchValueUpdate",null);class Ie{constructor(t){this.editor=t}syncRichTextContentEditable(){this.editor.richTextContentEditable=!this.editor.disabled}}class Me{execute(t,e,i,o){this.initCurrentStateAndSelection(t,e),this.setCurrentRichTextEditor(i),this.handleEvent(o)}isRootContainer(t){return t&&t.nodeType===Node.ELEMENT_NODE&&t.classList.contains("rich-text-content")}isEmptyParagraph(t){return t&&t.childNodes&&0===t.childNodes.length}removeSelectionRange(t=!1){f.notify(v.getSubject(this.richTextEditorRef,j),{host:this.richTextEditorRef,detail:t});const e=this.selectionController.getCurrentRange(),i=this.selectionController.getSelectedNodes();return e.startNode||i[0]}createEmptyParagraph(){const t=new F(vt(),"paragraph"),e=new B(`${t.id}1`,"",t);return t.apply(new it([e])),t}initCurrentStateAndSelection(t,e){this.currentState=t,this.selectionController=e}setCurrentRichTextEditor(t){this.richTextEditorRef=t}}class Ae extends Q{constructor(t,...e){super(),this.type=tt.INSERT_NODES_BEFORE,this.referNode=t,this.nodesToBeInserted=e}}class De extends Q{constructor(t,e){super(),this.type=tt.REPLACE_SELECTED_TEXT,this.textToBeInsert="",this.textToBeInsert=t,this.currentRange=e}}class Ne extends Me{handleEvent(t){const e=t.data,i=this.selectionController.getCurrentRange(),{startContainer:o,startOffset:s}=i,n=this.selectionController.getSelectedNodes();if(n.length<2){if(!n.length&&this.isRootContainer(o)){const t=this.insertTextToRoot(e);this.selectionController.enqueueSelectionRangeFutureState(t,e.length)}else if(n[0]instanceof B){let t=s+e.length,r=!1,c=n[0];"\n"===c.text?(c=this.insertTextToLineBreakNode(c,e),r=!0):(o.nodeValue===ot&&s===ot.length&&c.isEmpty()&&(o.nodeValue="",t-=ot.length),c instanceof B&&(r=!0,c.apply(new De(e,i)))),r&&this.selectionController.enqueueSelectionRangeFutureState(c,Math.min(t,c.text.length))}}else{const t=this.removeSelectionRange(!0);t instanceof B&&(t.apply(new De(e,i)),this.selectionController.enqueueSelectionRangeFutureState(t,Math.min(s+e.length,t.text.length)))}}insertTextToRoot(t){if(this.currentState&&this.currentState.blocks[0]&&this.currentState.blocks[0]instanceof F){const e=this.currentState.blocks[0].nodes[0];return e.apply(new st(t)),e}}insertTextToLineBreakNode(t,e){const{startOffset:i,endOffset:o}=this.selectionController.getCurrentRange(),s=t.parentBlock,n=s.nodes.indexOf(t);if(0===i&&i===o&&s.nodes[n+1]){const i=t.cloneWithText(e);return s.apply(new Ae(t,i)),i}return t.apply(new st(e)),t}}class Pe extends Me{handleEvent(){const t=this.selectionController.getSelectedBlocks();t.length&&(t.length<2?this.breakSingleBlock():this.breakMultipleBlocks())}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getCurrentRange(),i=this.removeSelectionRange();if(t.length&&"list-item"===t[0].type||"list-item"===t[t.length-1].type){const o=i.parentBlock,s=t[t.length-1];if(o.type!==s.type&&e.startContainer.nodeType===e.endContainer.nodeType){o.apply(new nt(s));const t=new rt(i,i.text.length);return o.apply(t),void this.switchCaretPositionToNextElement(t.newBlock)}}this.selectionController.enqueueSelectionRangeFutureState(i,e.startOffset)}breakSingleBlock(){const t=this.removeSelectionRange(),e=t.parentBlock,{startOffset:i}=this.selectionController.getCurrentRange();if(e){const o=new yt(t,i);e.apply(o),this.switchCaretPositionToNextElement(o.newBlock)}}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}}class Fe extends Q{constructor(t,e){super(),this.type=tt.LINE_BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class Ve extends Q{constructor(t){super(),this.type=tt.LINE_BREAK_MULTIPLE_BLOCKS,this.selectedBlocks=t}}class Ue extends Me{handleEvent(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedBlocks();this.isRootContainer(t.startContainer)&&this.breakNewBlock(),e.length&&(e.length<2?this.breakSingleBlock():this.breakMultipleBlocks())}breakNewBlock(){if(this.currentState&&this.currentState.blocks[0]&&this.currentState.blocks[0]instanceof F){const t=new Fe(this.currentState.blocks[0].nodes[0],0);this.currentState.blocks[0].apply(t),this.switchCaretPositionToSpecifiedNode(t.lineBreakNode)}}breakSingleBlock(){const t=this.selectionController.getCurrentRange(),e=this.removeSelectionRange(),i=e.parentBlock;if(i){const o=new Fe(e,t.startOffset);i.apply(o),this.switchCaretPositionToSpecifiedNode(o.lineBreakNode)}}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.removeSelectionRange(),i=new Ve(t);e.parentBlock.apply(i),this.switchCaretPositionToSpecifiedNode(i.lineBreakNode)}switchCaretPositionToSpecifiedNode(t){this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(t),0)}getNextRTENode(t){const e=t.parentBlock.nodes.indexOf(t);return t.parentBlock.nodes[e+1]||t}}class Ke extends Q{constructor(t,e){super(),this.type=tt.DELETE_BLOCK_CONTENT,this.startContainerNode=t,this.startOffset=e}}class We extends Me{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.deleteContentWithSingleBlock():this.deleteContentWithMultipleNodes()}deleteContentWithSingleBlock(){const t=this.selectionController.getCurrentRange(),{startOffset:e,endOffset:i,startContainer:o,endContainer:s}=t,n=this.selectionController.getSelectedBlocks(),r=this.selectionController.getSelectedNodes();if(e!==i||o!==s)this.deleteContentWithMultipleNodes();else if(n[0]){const t=new Ke(r[0],e);if(n[0].apply(t),t.previousNode){const i=t.previousNode===r[0]?Math.max(0,e-1):this.getNodeEndOffset(t.previousNode);this.selectionController.enqueueSelectionRangeFutureState(t.previousNode,i)}else t.nextNode?this.selectionController.enqueueSelectionRangeFutureState(t.nextNode,0):0===this.currentState.blocks.length&&this.insertDefaultParagraph()}}deleteContentWithMultipleNodes(){const t=this.selectionController.getSelectedNodes(),e=this.removeSelectionRange(!0),i=t[t.length-1];t.length>1&&i instanceof B&&i.isEmpty()&&i.parentBlock.apply(new ct(i)),this.convertFirstBlockToParagraph(e.parentBlock)}convertFirstBlockToParagraph(t){if(this.currentState.blocks[0]===t&&t instanceof F&&1===t.nodes.length&&t.nodes[0].isEmpty()&&"paragraph"!==t.type){const e=this.createEmptyParagraph();e.apply(new lt(t.nodes)),t.parent.apply(new at(t,e)),t.parent.apply(new ct(t))}}insertDefaultParagraph(){const t=this.createEmptyParagraph();this.currentState.apply(new it([t])),this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],1)}getNodeEndOffset(t){return"IMAGE"===t.type?1:"TEXT"===t.type?"\n"===t.text?0:t.text.length:void 0}}class _e{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(){const t=this.currentStrategy.handle(this.currentElements);return this.childrenOutput.length>0&&t&&this.currentStrategy.appendChildBlocks(t,this.childrenOutput.map((t=>t.toDto())).filter(Bt)),t}}class Ge extends class{}{generateChildNodes(t,e={}){const i=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){if(this.isInvalidTextNode(t))return;i.push({id:vt(),type:"text",text:String(t.textContent),annotations:e})}else i.push(...this.generateChildNodes(Array.from(t.childNodes),Object.assign({},e,this.generateTextNodeAnnotations(t,e))))})),i}generateBlockAnnotations(t){const e={},i=this.getTextAlign(t),o=this.getIndent(t);return i&&(e.textAlign=i),o&&(e.indent=o),e}generateTextNodeAnnotations(t,e={}){if(this.isCode(t))return{code:!0};const i={bold:this.isBold(t),italic:this.isItalic(t),underline:this.isUnderline(t),strikethrough:this.isStrikethrough(t)};e.bold&&(i.bold=!0),e.underline&&(i.underline=!0),e.italic&&(i.italic=!0),e.strikethrough&&(i.strikethrough=!0);const o=this.getColor(t),s=this.getLink(t);return o&&(i.textColor=o),s&&(i.link=s),i}isInvalidTextNode(t){return!(!t.nodeValue||!t.nodeValue.includes("\t")||0!==t.nodeValue.replace(/\n|\t/gm,"").length)}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName||"monospace"===t.style.fontFamily}isBold(t){return"STRONG"===t.nodeName||"B"===t.nodeName||"bold"===t.style.fontWeight||"700"===t.style.fontWeight}isItalic(t){return"I"===t.nodeName||"italic"===t.style.fontStyle||"EM"===t.nodeName}isUnderline(t){return t.style.textDecoration.includes("underline")||"U"===t.nodeName||"INS"===t.nodeName||t.classList.contains("v-rte--underline")}isStrikethrough(t){return t.style.textDecoration.includes("line-through")||"S"===t.nodeName||"DEL"===t.nodeName||t.classList.contains("v-rte--strikethrough")}getColor(t){var e;const i=null===(e=It(t.style.color))||void 0===e?void 0:e.toUpperCase();if(i){const t=ht.find((t=>t.light===i||t.dark===i));return t?t.key:null}for(const e of ht)if(t.style.color.includes(e.key))return e.key;return null}getLink(t){return"A"===t.nodeName?{href:t.href,groupKey:vt()}:null}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}}getIndent(t){const e=t.style;let i;if(e.marginLeft)i=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:i=t[3];break;case 2:case 3:i=t[1];break;default:i=t[0]}}}const o=Number(i.replace("px",""));return o&&o>=0?Math.floor(o/16):null}}class qe extends Ge{canHandle(t,e){let i=0;for(let o=e;o<t.length;o++){const e=t[o];if(e.nodeType!==Node.TEXT_NODE&&(!qe.canHandleTags.includes(e.nodeName)||""===e.textContent&&e.querySelector("IMG")))break;i++}return i}handle(t){const e=t[0].parentElement,i=this.generateChildNodes(t,this.generateTextNodeAnnotations(e));return 0===i.length?null:F.from({id:vt(),type:"paragraph",nodes:i,annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}qe.canHandleTags=["SPAN","STRONG","CODE","I","EM","S","U","A","VEGA-RICH-TEXT-LINK-EDITOR","B","INS","DEL"];class $e extends Ge{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:Rt.from({id:vt(),type:"bullet-list",blocks:[],annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.blocks=e,e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}class Je extends Ge{canHandle(t,e){return"LI"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:wt.from({id:vt(),type:"list-item",nodes:this.generateChildNodes(Array.from(t[0].childNodes).filter((t=>!["UL","OL"].includes(t.nodeName))),this.generateTextNodeAnnotations(t[0])),annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.children=e.filter((t=>["bullet-list","number-list"].includes(t.type)))}shouldProceedToElementChildren(){return!0}}class Xe extends Ge{canHandle(t,e){return["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title","subtitle"].includes(this.getElementType(t[e]))?1:0}handle(t){const e=this.generateChildNodes(t);return 0===e.length?null:F.from({id:vt(),type:this.getElementType(t[0]),nodes:e,annotations:Object.assign(Object.assign({},this.generateBlockAnnotations(t[0])),{textStyle:this.getElementType(t[0])})})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}getElementType(t){var e;if(t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type"))return t.getAttribute("data-type");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"}switch(t.nodeName){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""}}}class Ye extends Ge{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t){const e=t[0];return jt.from({id:vt(),type:"image",nodes:[{id:vt(),type:"image",url:e.src,annotations:{size:"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class Ze extends Ge{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t){const e=t[0],i=e.querySelector("img");if(Bt(i))return jt.from({id:vt(),type:"image",nodes:[{id:vt(),type:"image",url:i.src,annotations:{size:e.size||"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class Qe extends Ge{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:Rt.from({id:vt(),type:"number-list",blocks:[],annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.blocks=e,e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}class ti extends Ge{canHandle(t,e){const i=t[e];return i.nodeType===Node.ELEMENT_NODE&&""===i.textContent&&i.querySelector("img")?1:0}handle(t){const e=t[0].querySelector("img");return jt.from({id:vt(),type:"image",nodes:[{id:vt(),type:"image",url:e.src,annotations:{size:"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class ei extends Ge{canHandle(t,e){const i=t[e],o=i.parentElement;return"LI"!==i.nodeName&&o&&["UL","OL"].includes(o.nodeName)?1:0}handle(t){const e=this.generateChildNodes(t);return 0===e.length?null:wt.from({id:vt(),type:"list-item",nodes:e,annotations:{}})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class ii extends Ge{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,i=e.dataset.language;return dt.from({id:vt(),type:"code-block",content:t,language:i})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class oi extends ii{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],i=e.querySelector("code");if(i)return super.handle([i]);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}}class si{constructor(){this.elementStrategies=[new $e,new Qe,new ei,new Je,new oi,new ii,new Xe,new Ye,new Ze,new ti,new qe]}process(t){const e=[];for(let i=0;i<t.length;i++){if(this.isInvalidElement(t[i]))continue;let o=0;for(const s of this.elementStrategies)if(o=s.canHandle(t,i),o>0){const n=t.slice(i,i+o),r=new _e(s,n);1===o&&s.shouldProceedToElementChildren()&&r.setChildrenOutput(this.process(Array.from(n[0].childNodes))),e.push(r),i+=o-1;break}if(0===o&&i<t.length){const o=Array.from(t[i].childNodes),s=this.process(Array.from(o));s.length>0&&e.push(...s)}}return e}isInvalidElement(t){return t.nodeType===Node.COMMENT_NODE||["META","BUTTON","STYLE"].includes(t.nodeName)}}class ni extends Me{constructor(){super(...arguments),this.elementToDTOProcessor=new si}handleEvent(t){const e=this.parsePastedElements(t),{startContainer:i}=this.selectionController.getCurrentRange();this.isRootContainer(i)?this.insertBlocksToRoot(e):this.isEmptyParagraph(i)?this.insertBlocksBeforeEmptyBlock(e):this.insertBlocksToContent(e)}insertBlocksToRoot(t){this.currentState.apply(new it(t))}insertBlocksToContent(t){const e=this.removeSelectionRange();if(e&&e.parentBlock){const i=e.parentBlock,{startOffset:o}=this.selectionController.getCurrentRange(),s=new rt(e,o);i.apply(s),i.parent.apply(new ut(i,...t)),this.switchCaretPositionToNextElement(s.newBlock)}}insertBlocksBeforeEmptyBlock(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parentBlock;i&&(i.parent.apply(new at(i,...t)),this.switchCaretPositionToNextElement(i))}parsePastedElements(t){let e=t.dataTransfer.getData("text/html");if(!e){const i=t.dataTransfer.getData("text/plain");e=this.parsePlainText(i)}const i=document.createElement("div");return i.innerHTML=e,this.elementToDTOProcessor.process(Array.from(i.childNodes)).filter(Boolean).map((t=>t.toDto())).filter(Boolean)}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}parsePlainText(t){return t.split("\n").map((t=>`<span>${t}</span>`)).join("<span>\n</span>")}}var ri=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ci extends l{constructor(){super(...arguments),this.insertTextHandler=new Ne,this.insertParagraphHandler=new Pe,this.insertLineBreakHandler=new Ue,this.deleteContentHandler=new We,this.insertPasteHandler=new ni,this.handleUserInputAction=t=>{const e=t.inputType;if(t.preventDefault(),this.initValueIfEmpty(),"insertCompositionText"===e||this.isFocusNodeNonEditable())return;this.insertCompositionTextController.removeObserver();let i=!1;switch(e){case"insertParagraph":i=!0,this.insertParagraphHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertText":i=!0,this.insertTextHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertLineBreak":i=!0,this.insertLineBreakHandler.execute(this.value,this.selectionController,this.host,t);break;case"deleteContentBackward":i=!0,this.deleteContentHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertFromPaste":i=!0,this.insertPasteHandler.execute(this.value,this.selectionController,this.host,t)}i&&this.valueController.flushChanges(this.value)}}addActionListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("beforeinput",this.handleUserInputAction),t.addEventListener("drop",this.preventDropEvent))}removeActionListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("beforeinput",this.handleUserInputAction),t.removeEventListener("drop",this.preventDropEvent))}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}preventDropEvent(t){t.preventDefault()}initValueIfEmpty(){if(!this.value){const t=vt();this.valueController.flushChanges(Ct.fromJSON([{id:t,type:"paragraph",nodes:[{id:`${t}1`,type:"text",text:""}]}]))}}isFocusNodeNonEditable(){const{startContainer:t,endContainer:e}=this.selectionController.getCurrentRange(),i=this.selectionController.getSelectedNodes();if(t&&t===e&&0===i.length){const e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return e&&e.classList.contains(dt.CODE_BLOCK_PLACEHOLDER_CLASS_NAME)}return!1}}ri([r()],ci.prototype,"host",void 0),ri([r()],ci.prototype,"value",void 0),ri([r()],ci.prototype,"valueController",void 0),ri([r()],ci.prototype,"vegaRichTextEditorRenderer",void 0),ri([r()],ci.prototype,"selectionController",void 0),ri([r()],ci.prototype,"insertCompositionTextController",void 0),ri([c("componentDidLoad")],ci.prototype,"addActionListener",null),ri([c("disconnectedCallback")],ci.prototype,"removeActionListener",null);class li extends Q{constructor(t,e,i){super(),this.isFlushable=!0,this.type=tt.INSERT_IMAGE_TO_BLOCK,this.splitPointNode=t,this.startOffsetOfNode=e,this.imageBlockToBeInserted=i}}var ai=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class hi extends l{insertImageToCaretPosition(t){const e=this.selectionController.getSelectedBlocks(),i=new jt(vt()),o=new Z(vt(),t,i);if(o.apply(new T("md","")),i.apply(new it([o])),e.length<1||this.value.blocks.length<1)this.value.apply(new it([i])),this.valueController.flushChanges(this.value);else{const{startOffset:t}=this.selectionController.getCurrentRange(),o=this.selectionController.getSelectedNodes();e[0].apply(new li(o[0],t,i))}return this.updateCaretPosition(o),o}registerObserver(){this.registerImageSelectedObserver()}unRegisterObserver(){this.removeImageSelectedObserver()}updateCaretPosition(t){this.selectionController.enqueueSelectionRangeFutureState(t,1)}registerImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(ft.addUniqueObserverToNode(t,k,(t=>{const e=this.selectionController.getCurrentRange();if(!e||e.startContainer!==t.host||0!==e.startOffset){const e=pt.getEntityByDOM(t.host.querySelector("img"));this.selectionController.enqueueSelectionRangeFutureState(e,0,e,0,!0)}})),ft.addUniqueObserverToNode(t,O,(t=>{const e=this.selectionController.getCurrentRange();e&&e.startContainer===t.host&&1===e.startOffset||this.selectionController.enqueueSelectionRangeFutureState(t.host,1,t.host,1,!0)})))}removeImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(ft.removeUniqueObserverFromNode(t,k),ft.removeUniqueObserverFromNode(t,O))}}ai([r()],hi.prototype,"selectionController",void 0),ai([r()],hi.prototype,"value",void 0),ai([r()],hi.prototype,"valueController",void 0),ai([r()],hi.prototype,"vegaRichTextEditorRenderer",void 0),ai([c("componentDidLoad")],hi.prototype,"registerObserver",null),ai([c("disconnectedCallback")],hi.prototype,"unRegisterObserver",null);var di=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ui extends l{constructor(){super(...arguments),this.doFocusOnLastTextNode=async t=>{this.setCaretRangeToNodeEnd(pt.getDOMByEntity(t.getLastNode()).firstChild),await this.vegaRichTextEditorRenderer.getRichTextContentRef().vegaFocus()}}async focusOnLastTextNode(t){const e=this.value.blocks[this.value.blocks.length-1];if(e instanceof F&&!(null==t?void 0:t.newLine))await this.doFocusOnLastTextNode(e);else{const t=F.from({id:vt(),type:"paragraph",nodes:[{id:vt(),type:"text",text:""}]});e.parent.apply(new ut(e,t)),await this.valueController.flushChanges(this.value),await this.doFocusOnLastTextNode(t)}}setCaretRangeToNodeEnd(t){const e=new Range;e.setStart(t,t.nodeValue.length),this.selectionController.setSelectionRange(e)}}di([r()],ui.prototype,"vegaRichTextEditorRenderer",void 0),di([r()],ui.prototype,"selectionController",void 0),di([r()],ui.prototype,"valueController",void 0),di([r()],ui.prototype,"value",void 0);var pi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class fi extends l{connectedCallback(){this.observer=new Lt(this.isAcceptObserver.bind(this),(t=>{L.getTextNodeElements().forEach(((e,i)=>{i.style.color=t?e.textColor.dark:e.textColor.light}))})),f.register(Tt,this.observer)}disconnectResizeObserver(){f.unregister(Tt,this.observer)}isAcceptObserver(){return!0}}pi([c("connectedCallback")],fi.prototype,"connectedCallback",null),pi([c("disconnectedCallback")],fi.prototype,"disconnectResizeObserver",null);var vi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class mi extends l{constructor(){super(...arguments),this.insertCompositionTextEndFlag=!0,this.observerOptions={characterData:!0,characterDataOldValue:!0,subtree:!0,childList:!0},this.updateTextFromDom=t=>{let e=!1;!1!==this.insertCompositionTextEndFlag&&t.forEach((t=>{const{target:i,oldValue:o}=t;if(i.nodeType===Node.TEXT_NODE&&i.parentElement){const t=pt.getEntityByDOM(i.parentElement),s=i.textContent;t instanceof B?e=this.updateCurrentNodeText(t,s,o):s&&(i.parentElement.removeChild(i),e=!0)}})),e&&this.valueController.flushChanges(this.value)},this.handleObserver=t=>{t.every((t=>"characterData"===t.type))&&this.updateTextFromDom(t)},this.handleCompositionStart=()=>{this.insertCompositionTextEndFlag=!1,f.notify(v.getSubject(this.host,j),{host:this.host,detail:!0})},this.handleCompositionEnd=t=>{this.insertCompositionTextEndFlag=!0;const e=t.data;e&&this.dispatchInsertTextEvent(e)}}initMutationObserver(){if(this.mutationObserver){const t=this.getEditableElementRef();t&&(this.mutationObserver.disconnect(),this.mutationObserver.observe(t,this.observerOptions))}}removeObserver(){this.mutationObserver&&this.mutationObserver.disconnect()}isComposing(){return!this.insertCompositionTextEndFlag}addCompositionTextEventListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd)),this.mutationObserver=new MutationObserver(this.handleObserver),this.initMutationObserver()}removeCompositionTextEventListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("compositionstart",this.handleCompositionStart),t.removeEventListener("compositionend",this.handleCompositionEnd)),this.removeObserver()}reConnectObserver(){this.initMutationObserver()}appendLineBreakNode(t){const e=t.parentBlock,i=e.nodes.indexOf(t);if(e.nodes[i+1]){const o=t.cloneWithText("\n");e.apply(new Ae(e.nodes[i+1],o))}}updateCurrentNodeText(t,e,i){const o=this.removeZeroWidthSpace(e.replace(/(\n)$/,""));if(t.text!==o){const{startOffset:s}=this.selectionController.getCurrentRange(),n="\n"===t.text;t.apply(new st(o)),n&&this.appendLineBreakNode(t);const r=Math.min(o.length,s-(i?i.length-e.length:0));return this.selectionController.enqueueSelectionRangeFutureState(t,Math.max(0,r)),!0}}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}removeZeroWidthSpace(t){return t.startsWith(ot)?t.slice(ot.length):t.endsWith(ot)?t.slice(0,t.length-ot.length):t}dispatchInsertTextEvent(t){const e=new CustomEvent("beforeinput");e.data=t,e.inputType="insertText",this.editableElementRef.dispatchEvent(e)}}vi([r()],mi.prototype,"selectionController",void 0),vi([r()],mi.prototype,"host",void 0),vi([r()],mi.prototype,"value",void 0),vi([r()],mi.prototype,"valueController",void 0),vi([r()],mi.prototype,"userInputController",void 0),vi([r()],mi.prototype,"vegaRichTextEditorRenderer",void 0),vi([c("componentDidLoad")],mi.prototype,"addCompositionTextEventListener",null),vi([c("disconnectedCallback")],mi.prototype,"removeCompositionTextEventListener",null),vi([c("componentDidRender")],mi.prototype,"reConnectObserver",null);var bi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class gi extends l{constructor(){super(...arguments),this.deleteActionProcess=t=>{const e=this.selectionController.getCurrentRange(),{startContainer:i,endContainer:o,startOffset:s,endOffset:n}=e;if(i!==o||s!==n){const s=this.removeSelectionRange();!(!t||!t.detail)&&t.detail&&this.mergeRangeStartAndEnd(i,o),this.selectionController.enqueueSelectionRangeFutureState(s,e.startOffset)}}}addDeleteObserver(){ft.addUniqueObserverToNode(this.host,j,this.deleteActionProcess)}removeDeleteObserver(){ft.removeUniqueObserverFromNode(this.host,j)}removeSelectionRange(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),{endOffset:i,startOffset:o}=t,s=e[0],n=e[e.length-1];if(e.length>1&&e.filter((t=>t instanceof A?t!==s:"IMAGE"!==t.type?t!==s&&t!==n:t!==s&&(t!==n||t===n&&0!==i))).forEach((t=>{t.parentBlock.apply(new ct(t))})),this.removeRangeStartAndEndSelectedText(),s instanceof Z&&1!==o&&(n!==s||0!==i)){if(1===s.parentBlock.nodes.length){const t=this.createEmptyParagraph();return s.parentBlock.parent.apply(new at(s.parentBlock,t)),s.parentBlock.apply(new ct(s)),t.nodes[0]}if(s===s.parentBlock.nodes[0])return s.parentBlock.apply(new ct(s)),s.parentBlock.nodes[0]}else if(s instanceof A){const t=this.createEmptyParagraph();return s.parentBlock.parent.apply(new at(s.parentBlock,t)),s.parentBlock.apply(new ct(s)),t.nodes[0]}return s}removeRangeStartAndEndSelectedText(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getCurrentRange();t[0]instanceof B&&t[0].apply(new De("",e)),t.length>1&&t[t.length-1]instanceof B&&t[t.length-1].apply(new De("",e))}createEmptyParagraph(){const t=new F(vt(),"paragraph"),e=new B(`${t.id}1`,"",t);return t.apply(new it([e])),t}mergeRangeStartAndEnd(t,e){if(t!==e&&t.nodeType===Node.TEXT_NODE&&e.nodeType===Node.TEXT_NODE){const t=this.selectionController.getSelectedNodes(),e=t[0],i=t[t.length-1];if(e&&e.parentBlock&&i&&i.parentBlock){const t=i.parentBlock;this.shouldMergeTextNode(e,i)&&(e.apply(new st(e.text+i.text)),e.parentBlock===i.parentBlock?e.parentBlock.apply(new ct(i)):i.parentBlock.apply(new ct(i.parentBlock.nodes[0]))),e instanceof B&&i instanceof B&&e.parentBlock!==i.parentBlock&&(e.parentBlock.apply(new it(t.nodes)),t.nodes=[]),t.nodes.length<1&&t.parent.apply(new ct(t))}}}shouldMergeTextNode(t,e){const{annotations:i}=t.toJSON(),{annotations:o}=e.toJSON();return t instanceof B&&e instanceof B&&JSON.stringify(i)===JSON.stringify(o)}}bi([r()],gi.prototype,"host",void 0),bi([r()],gi.prototype,"selectionController",void 0),bi([r()],gi.prototype,"value",void 0),bi([c("connectedCallback")],gi.prototype,"addDeleteObserver",null),bi([c("disconnectedCallback")],gi.prototype,"removeDeleteObserver",null);var xi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class wi extends Ft{constructor(){super((()=>this.getKeyboardShortcutOptions.call(this))),this.redoStack=[],this.undoStack=[],this.registerHistoryDelay=300,this.registerHistoryDebounced=zt((()=>{this.internalRegisterHistory(new ze(this.value,new kt(this.selectionController.getCurrentRange())))}),this.registerHistoryDelay,this)}registerInitState(){this.value&&this.internalRegisterHistory(new ze(this.value,new kt(this.selectionController.getCurrentRange())))}async undo(){if(this.undoStack.length>0){const t=this.undoStack.pop().clone();this.redoStack.push(t);const e=this.undoStack[this.undoStack.length-1];e&&await this.restoreState(e.clone())}}async redo(){if(this.redoStack.length>0){const t=this.redoStack.pop().clone();this.undoStack.push(t),await this.restoreState(t)}}registerHistory(t){this.registerHistoryDebounced(t)}internalRegisterHistory(t){this.redoStack=[],this.undoStack.push(t)}async restoreState(t){const{content:e,selection:i}=t;this.selectionController.setSelectionState(i),await this.valueController.flushChanges(e,!1)}getKeyboardShortcutOptions(){const t={keyCode:"KeyZ",activeElementInScope:[this.vegaRichTextEditorRenderer.getRTEEditableElementRef()],eventName:"keydown",modifierPressed:!0};return[Object.assign(Object.assign({},t),{shiftKey:!1,callback:t=>{t.preventDefault(),this.undo()}}),Object.assign(Object.assign({},t),{shiftKey:!0,callback:t=>{t.preventDefault(),this.redo()}})]}}xi([r()],wi.prototype,"host",void 0),xi([r()],wi.prototype,"vegaRichTextEditorRenderer",void 0),xi([r()],wi.prototype,"valueController",void 0),xi([r()],wi.prototype,"value",void 0),xi([r()],wi.prototype,"selectionController",void 0),xi([c("componentDidLoad")],wi.prototype,"registerInitState",null);class Ci extends Q{constructor(t){super(),this.type=tt.TRANSFORM_TO_CODE_BLOCK,this.selectedBlocks=t}}var yi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ri extends H{constructor(){super({icon:"rectangle-code",tooltip:{text:"Code Block"}})}onClick(){if(!this.isSelected()){const t=this.selectionController.getSelectedBlocks(),e=t[0].parent,i=new Ci(t);e.apply(i),this.valueController.flushChanges(this.value),this.selectionController.enqueueSelectionRangeFutureState(i.newCodeBlock.nodes[0],0)}}isSelected(){const t=this.selectionController.getSelectedBlocks();return!(!t.length||!t.every((t=>"code-block"===t.type)))}isDisabled(){const t=this.selectionController.getSelectedBlocks();return super.isDisabled()||t.some((t=>"image"===t.type||"list-item"===t.type))}}E.register({"rectangle-code":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 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="M320.1 175L384.1 239C394.3 248.4 394.3 263.6 384.1 272.1L320.1 336.1C311.6 346.3 296.4 346.3 287 336.1C277.7 327.6 277.7 312.4 287 303L334.1 256L287 208.1C277.7 199.6 277.7 184.4 287 175C296.4 165.7 311.6 165.7 320.1 175V175zM177.9 256L224.1 303C234.3 312.4 234.3 327.6 224.1 336.1C215.6 346.3 200.4 346.3 191 336.1L127 272.1C117.7 263.6 117.7 248.4 127 239L191 175C200.4 165.7 215.6 165.7 224.1 175C234.3 184.4 234.3 199.6 224.1 208.1L177.9 256zM448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM448 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H448C456.8 432 464 424.8 464 416V96C464 87.16 456.8 80 448 80z"/></svg>'}}),yi([r()],Ri.prototype,"selectionController",void 0),yi([r()],Ri.prototype,"valueController",void 0),yi([r()],Ri.prototype,"value",void 0);class ji extends Ot{constructor(){super(1),this.focusNodeOffset=0,this.doTask=async()=>{await this.focusTheCodeBlock(this.shouldFocusNode)}}enqueueSelectionRangeFutureState(t,e,i){this.shouldFocusNode=t,this.focusNodeOffset=e,super.enqueueTheTaskIntoQueue(i)}isCodeBlockSelected(t,e){const i=pt.getDOMByEntity(t.nodes[0]);return t.isSelected()||i&&e.intersectsNode(i.nextSibling)&&e.intersectsNode(i.previousSibling)}async focusTheCodeBlock(t){await Promise.resolve();const e=pt.getDOMByEntity(t);e&&e.doFocus()}}var ki=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const Oi=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.vegaImageInserted=s(this,"vegaImageInserted",7),this.imageInserted=s(this,"imageInserted",7),this.globalSlimmers={},this.translationSlimmer=new Nt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.formFieldController=new bt({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new At:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:t=>this[t],inputContainerGetter:()=>this.vegaRichTextEditorRenderer.getRichTextContainerRef(),touchableAreaGetter:()=>[this.vegaRichTextEditorRenderer.getRichTextContentRef()]}),this.changeEventEmitter=gt(Oi,b),this.vegaRichTextEditorRenderer=new _t,this.valueController=new Be,this.selectionController=new St,this.focusController=new ui,this.darkModeStateControllerSlimmer=new Et,this.toolbarRenderer=new qt,this.clearStyleToolbarButtonSlimmer=new ee,this.boldToolbarButtonSlimmer=new $t,this.italicToolbarButtonSlimmer=new Xt,this.underlineToolbarButtonSlimmer=new Zt,this.textColorToolbarButtonSlimmer=new z,this.textStylesToolbarButtonSlimmer=new te,this.codeToolbarButtonSlimmer=new ie,this.strikethroughToolbarButtonSlimmer=new se,this.imageToolbarButtonSlimmer=new de,this.linkToolbarButtonSlimmer=new ne,this.moreIndentToolbarButtonSlimmer=new ce,this.lessIndentToolbarButtonSlimmer=new le,this.bulletsNumbersToolbarButtonSlimmer=new xe,this.horizontalAlignmentToolbarButtonSlimmer=new Le,this.codeBlockToolbarButtonSlimmer=new Ri,this.placeholderNotifySlimmer=xt(Oi,"placeholder","watchPlaceholder"),this.disabledNotifySlimmer=xt(Oi,"richTextContentEditable","watchRichTextContentEditable"),this.richTextContentController=new Ie(this),this.userInputController=new ci,this.insertImageController=new hi,this.insertCompositionTextController=new mi,this.imageInsertedEventEmitter=gt(Oi,g),this.changeEventPreventSlimmer=new Dt([b],(()=>this.vegaRichTextEditorRenderer.getRichTextWrapperRef())),this.textNodeColorController=new fi,this.deleteSelectedNodesController=new gi,this.historyController=new wi,this.internalCodeBlockSelectionController=new ji,this.richTextContentEditable=!0,this.selectionMap=new Map,this.isInDarkMode=Pt.isDarkMode(),this.label="",this.required=!1,this.placeholder="",this.disabled=!1,this.hint="",this.rows=4,this.value=Ct.createEmptyContent(),this.toolbarItems=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],this.isValid=null,this.autoValidation=!0,this.validationRules=[]}watchRichTextContentEditable(){}watchPlaceholder(){}watchDisabled(){this.richTextContentController.syncRichTextContentEditable()}watchValueUpdate(){}watchValidationRules(){}componentWillLoad(){this.richTextContentController.syncRichTextContentEditable()}render(){return u(this.vegaRichTextEditorRenderer.render(),this.host)}get host(){return n(this)}static get watchers(){return{richTextContentEditable:["watchRichTextContentEditable"],placeholder:["watchPlaceholder"],disabled:["watchDisabled"],value:["watchValueUpdate"],validationRules:["watchValidationRules"]}}};ki([d()],Oi.prototype,"globalSlimmers",void 0),ki([a()],Oi.prototype,"translationSlimmer",void 0),ki([a()],Oi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),ki([a()],Oi.prototype,"formFieldController",void 0),ki([a()],Oi.prototype,"changeEventEmitter",void 0),ki([a()],Oi.prototype,"vegaRichTextEditorRenderer",void 0),ki([a()],Oi.prototype,"valueController",void 0),ki([a()],Oi.prototype,"selectionController",void 0),ki([a()],Oi.prototype,"focusController",void 0),ki([a()],Oi.prototype,"darkModeStateControllerSlimmer",void 0),ki([a()],Oi.prototype,"toolbarRenderer",void 0),ki([a()],Oi.prototype,"clearStyleToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"boldToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"italicToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"underlineToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"textColorToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"textStylesToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"codeToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"strikethroughToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"imageToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"linkToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"moreIndentToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"lessIndentToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"codeBlockToolbarButtonSlimmer",void 0),ki([a()],Oi.prototype,"placeholderNotifySlimmer",void 0),ki([a()],Oi.prototype,"disabledNotifySlimmer",void 0),ki([a()],Oi.prototype,"richTextContentController",void 0),ki([a()],Oi.prototype,"userInputController",void 0),ki([a()],Oi.prototype,"insertImageController",void 0),ki([a()],Oi.prototype,"insertCompositionTextController",void 0),ki([a()],Oi.prototype,"imageInsertedEventEmitter",void 0),ki([a()],Oi.prototype,"changeEventPreventSlimmer",void 0),ki([a()],Oi.prototype,"textNodeColorController",void 0),ki([a()],Oi.prototype,"deleteSelectedNodesController",void 0),ki([a()],Oi.prototype,"historyController",void 0),ki([a()],Oi.prototype,"internalCodeBlockSelectionController",void 0),Oi.style=':host{display:block}:host vega-field-label{margin-bottom:8px}:host vega-text{margin-bottom:16px;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-text{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-text{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-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container{display:flex;box-sizing:content-box;position:relative;box-sizing:content-box;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));margin-top:12px;overflow:auto;resize:vertical;padding-top:12px;padding-right:16px;padding-bottom:32px;padding-left:16px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .rich-text-editor-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host .rich-text-editor-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));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))}:host .rich-text-editor-container.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));cursor:not-allowed}:host .rich-text-editor-container.disabled:hover,:host .rich-text-editor-container.disabled:focus-within{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:focus-within{outline:none}:host .rich-text-editor-container.disabled vega-rich-text-content{pointer-events:none;opacity:0.35}:host .rich-text-editor-container.error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host .rich-text-editor-container.error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host .rich-text-editor-container.error: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))}:host .rich-text-editor-container .text-editor-counter{position:absolute;bottom:8px;right:8px;display:flex;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;border-radius:4px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1));background-color:rgba(var(--v-bg-textarea-count, 4, 4, 28, 0.6))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container .text-editor-counter{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 .rich-text-editor-container .text-editor-counter{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 .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container .text-editor-counter.counter-exceed-max-length{background-color:rgba(var(--v-bg-textarea-counter-exceed-max-length, 214, 46, 81))}.toolbar-btn-group{display:flex;justify-content:center;align-items:center}.toolbar-btn-group>*:not(:first-child):not(:last-child) ::part(rich-text-editor-toolbar-button){border-radius:0px}.toolbar-btn-group>*:first-child:not(:last-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0px;border-bottom-right-radius:0px}.toolbar-btn-group>*:last-child:not(:first-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:0px;border-bottom-left-radius:0px;border-top-right-radius:4px;border-bottom-right-radius:4px}.toolbar-btn-group>*:not(:first-child) ::part(rich-text-editor-toolbar-button){margin-left:-1px}.toolbar-btn-group .toolbar-btn-color-preview-box{display:flex;border:1px solid rgba(var(--v-border-chip, 205, 209, 211, 1));box-sizing:border-box;border-radius:4px;width:16px;height:16px;justify-content:center;align-items:center;margin-left:6px}.toolbar-btn-group .toolbar-btn-color-preview-box.disabled{opacity:0.35}.toolbar-btn-group .toolbar-btn-link-wrapper{position:relative}.toolbar-btn-group .toolbar-btn-link-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}.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;margin-top:12px}@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}';var Si=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Hi extends l{constructor(){super(...arguments),this.handleClick=t=>{this.disabled?t.preventDefault():this.clickEventEmitter.emit(void 0,t)}}render(){return t("button",{part:"rich-text-editor-toolbar-button",class:{"rich-text-editor-toolbar-btn":!0,"rich-text-editor-toolbar-button-disabled":this.disabled,"rich-text-editor-toolbar-button-selected":this.selected},onClick:this.handleClick,disabled:this.disabled},t("vega-flex",{gap:"size-8",justifyContent:"center",alignItems:"center"},t("vega-icon",{size:"size-16",color:this.iconColor,icon:E.getIconKey(this.icon)}),this.showArrowIcon&&t("vega-icon",{size:"size-8",color:"text-secondary",icon:E.getIconKey("chevron-down")})),t("slot",null))}}E.register({"chevron-down":Vt}),Si([r()],Hi.prototype,"disabled",void 0),Si([r()],Hi.prototype,"selected",void 0),Si([r()],Hi.prototype,"showArrowIcon",void 0),Si([r()],Hi.prototype,"icon",void 0),Si([r()],Hi.prototype,"iconColor",void 0),Si([r()],Hi.prototype,"clickEventEmitter",void 0);var Ti=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const Li=class{constructor(t){o(this,t),this.vegaClick=s(this,"vegaClick",7),this.click=s(this,"click",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.clickEventEmitter=gt(Li,x),this.eventPrevent=new Dt([x],(()=>this.host),{useCapture:!0,customPreventHandle:t=>{this.disabled&&t.stopImmediatePropagation()}}),this.renderer=new Hi,this.disabled=!1,this.selected=!1,this.showArrowIcon=!1,this.icon="",this.iconColor="text-primary"}render(){return u(t(e,null,this.renderer.render()),this.host)}get host(){return n(this)}};Ti([d()],Li.prototype,"globalSlimmers",void 0),Ti([a()],Li.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Ti([a()],Li.prototype,"clickEventEmitter",void 0),Ti([a()],Li.prototype,"eventPrevent",void 0),Ti([a()],Li.prototype,"renderer",void 0),Li.style=":host{display:inline-block}.rich-text-editor-toolbar-btn{display:flex;justify-content:center;align-items:center;border-radius:4px;border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));padding-top:8px;padding-bottom:8px;padding-left:12px;padding-right:12px;cursor:pointer;position:relative;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1))}.rich-text-editor-toolbar-btn:hover{background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1));z-index:1}.rich-text-editor-toolbar-btn:active{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:-1px;z-index:2}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-selected{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));cursor:not-allowed}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}";var zi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ei extends l{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&(this.formRef.getValue().then((({alt:t})=>{this.changeEventEmitter.emit({action:"edit",payload:{size:this.size,alt:t}})})),this.popoverRef.hide())}}render(){return t("vega-popover",{style:{width:"100%"},trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,ft.addUniqueObserverToNode(t,w,(()=>{this.selected=!0,this.notifyImageSelected(),this.formRef.setValue({alt:this.alt})})),ft.addUniqueObserverToNode(t,C,(()=>{this.currentPage=1,this.selected=!1,this.formRef.reset()}))}},t("div",{slot:"popover-content"},t("slot",null)),t("div",{slot:"popover"},this.renderImageEditor(),this.renderAltTextEditor()))}findParentContainerRef(){this.parentContainerRef=Mt(this.host,"vega-rich-text-content")}renderImageEditor(){return t("vega-box",{display:1===this.currentPage?"block":"none"},t("vega-flex",{gap:"size-12",alignItems:"center"},t("vega-font",{variant:"font-field-label-sm",color:"text-primary"},this.translationSlimmer.t("Size"),":"),t("vega-segment-control",{size:"small",segments:[{key:"sm",text:this.translationSlimmer.t("Sm")},{key:"md",text:this.translationSlimmer.t("Md")},{key:"lg",text:this.translationSlimmer.t("Lg")}],selected:this.size,ref:t=>{ft.addUniqueObserverToNode(t,b,(t=>{if(!this.selected)return;const e=t.detail;this.size=e,this.changeEventEmitter.emit({action:"edit",payload:{size:e,alt:this.alt}})}))}}),t("vega-button-group",{variant:"tertiary",size:"small",ref:t=>{ft.addUniqueObserverToNode(t,x,(t=>{"Alt Text"===t.detail?this.currentPage=2:(this.notifyImageDeleteButtonClicked(),this.changeEventEmitter.emit({action:"delete"}),this.popoverRef.hide())}))}},t("vega-button-group-item",{label:this.translationSlimmer.t("Alt Text"),itemKey:"Alt Text"}),t("vega-button-group-item",{label:this.translationSlimmer.t("Delete Image"),icon:E.getIconKey("trash-can"),iconOnly:!0,itemKey:"trash-can"}))))}renderAltTextEditor(){return t("vega-box",{display:2===this.currentPage?"block":"none"},t("vega-form",{ref:t=>this.formRef=t},t("vega-input",{"data-vega-form":"alt",style:{width:"315px"},label:this.translationSlimmer.t("Alt Text"),ref:t=>{t.doFocus()},onKeyDown:this.handleKeyDown})))}notifyImageSelected(){this.parentContainerRef&&f.notify(v.getSubject(this.parentContainerRef,k),{host:this.host})}notifyImageDeleteButtonClicked(){this.parentContainerRef&&f.notify(v.getSubject(this.parentContainerRef,O),{host:this.host})}}E.register({"trash-can":Ut}),zi([r({writable:!0})],Ei.prototype,"currentPage",void 0),zi([r({writable:!0})],Ei.prototype,"selected",void 0),zi([r()],Ei.prototype,"host",void 0),zi([r()],Ei.prototype,"alt",void 0),zi([r({writable:!0})],Ei.prototype,"size",void 0),zi([r()],Ei.prototype,"changeEventEmitter",void 0),zi([r()],Ei.prototype,"translationSlimmer",void 0),zi([c("componentDidLoad")],Ei.prototype,"findParentContainerRef",null);var Bi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const Ii=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.globalSlimmers={},this.translationSlimmer=new Nt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.renderer=new Ei,this.changeEventEmitter=gt(Ii,b),this.currentPage=1,this.selected=!1,this.alt="",this.size="md"}render(){return u(t(e,{class:{"rte-image-selected":this.selected}},this.renderer.render()),this.host)}get host(){return n(this)}};Bi([d()],Ii.prototype,"globalSlimmers",void 0),Bi([a()],Ii.prototype,"translationSlimmer",void 0),Bi([a()],Ii.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Bi([a()],Ii.prototype,"renderer",void 0),Bi([a()],Ii.prototype,"changeEventEmitter",void 0),Ii.style=":host{display:inline-block}:host(.rte-image-selected){outline:2px solid rgba(var(--v-border-color-tile-selected, 19, 98, 226, 1));outline-offset:-2px}";var Mi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ai extends l{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&this.formRef.getValue().then((({text:t,url:e})=>{e.length>0&&(this.changeEventEmitter.emit({action:"link",payload:{text:t||e,url:e}}),this.popoverRef.hide())}))}}componentDidLoad(){this.updatePopoverTarget()}componentDidRender(){f.notify(v.getSubject(this.host,y),{})}watchStatusChange(){"linkEdit"===this.status&&setTimeout((()=>{this.urlInputRef.doFocus()}))}watchTargetChange(){this.updatePopoverTarget()}getPopoverRef(){return this.popoverRef}render(){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,ft.addUniqueObserverToNode(t,w,(()=>{var t,e;"linkEdit"===this.status&&this.urlInputRef.doFocus(),this.formRef.setValue({text:null===(t=this.record)||void 0===t?void 0:t.text,url:null===(e=this.record)||void 0===e?void 0:e.url})})),ft.addUniqueObserverToNode(t,C,(()=>{this.formRef.reset(),this.resetStatusAfterHide&&(this.status="editOrUnlinkSelection")}))}},t("span",{slot:"popover-content"},t("slot",null)),t("div",{slot:"popover"},this.renderLinkUnlinkContent(),this.renderLinkEditContent()))}renderLinkUnlinkContent(){return t("vega-box",{display:"editOrUnlinkSelection"===this.status?"block":"none"},t("vega-button-group",{size:"small",variant:"tertiary",ref:t=>{ft.addUniqueObserverToNode(t,x,(({detail:t})=>{switch(t){case"edit":return void(this.status="linkEdit");case"unlink":this.changeEventEmitter.emit({action:"unlink"}),this.popoverRef.hide()}}))}},t("vega-button-group-item",{label:this.translationSlimmer.t("Edit"),itemKey:"edit"}),t("vega-button-group-item",{label:this.translationSlimmer.t("Unlink"),itemKey:"unlink"})))}renderLinkEditContent(){return t("vega-box",{display:"linkEdit"===this.status?"block":"none"},t("vega-form",{ref:t=>this.formRef=t},t("vega-flex",{style:{width:"419px"},direction:"col",gap:"size-16"},t("vega-input",{"data-vega-form":"url",ref:t=>{this.urlInputRef=t},size:"small",label:this.translationSlimmer.t("URL"),onKeyDown:this.handleKeyDown}),t("vega-input",{size:"small",label:this.translationSlimmer.t("Text"),"data-vega-form":"text",onKeyDown:this.handleKeyDown}))))}updatePopoverTarget(){Kt.call(v.getSubject(this.popoverRef,S),this.target)}}Mi([r()],Ai.prototype,"host",void 0),Mi([r({writable:!0})],Ai.prototype,"status",void 0),Mi([r({writable:!0})],Ai.prototype,"record",void 0),Mi([r()],Ai.prototype,"changeEventEmitter",void 0),Mi([r()],Ai.prototype,"resetStatusAfterHide",void 0),Mi([r()],Ai.prototype,"translationSlimmer",void 0),Mi([r()],Ai.prototype,"target",void 0),Mi([c("componentDidLoad")],Ai.prototype,"componentDidLoad",null),Mi([c("componentDidRender")],Ai.prototype,"componentDidRender",null),Mi([c("watchStatusChange")],Ai.prototype,"watchStatusChange",null),Mi([c("watchTargetChange")],Ai.prototype,"watchTargetChange",null);var Di=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const Ni=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.globalSlimmers={},this.translationSlimmer=new Nt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.renderer=new Ai,this.changeEventEmitter=gt(Ni,b),this.status="editOrUnlinkSelection",this.resetStatusAfterHide=!0}watchStatusChange(){}watchTargetChange(){}async show(){await this.renderer.getPopoverRef().show()}render(){return u(t(e,null,this.renderer.render()),this.host)}get host(){return n(this)}static get watchers(){return{status:["watchStatusChange"],target:["watchTargetChange"]}}};Di([d()],Ni.prototype,"globalSlimmers",void 0),Di([a()],Ni.prototype,"translationSlimmer",void 0),Di([a()],Ni.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Di([a()],Ni.prototype,"renderer",void 0),Di([a()],Ni.prototype,"changeEventEmitter",void 0),Ni.style=":host{display:contents}:host vega-popover{display:inline}";export{Oi as vega_rich_text_editor,Li as vega_rich_text_editor_toolbar_button,Ii as vega_rich_text_image_editor,Ni as vega_rich_text_link_editor}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as t,V as e,L as s,c as i}from"./p-6e1ab235.js";import{d as n}from"./p-1bc5b3bc.js";import{v as o,w as h,a as r,G as a,g as c,Z as f,D as d,z as l,u}from"./p-05373557.js";import{g as p}from"./p-9b797118.js";import{C as g}from"./p-2d0d575f.js";import{d as m}from"./p-e1a2a701.js";import{b as w}from"./p-425ba7d6.js";import{O}from"./p-331a62d5.js";import{f as R}from"./p-bf953152.js";import{S as b}from"./p-1fb56e14.js";let v=!1;class C{constructor(){this.rangeCount=0,this.ranges=[]}getRangeAt(t){return this.ranges[t]}addRange(t){if(this.ranges.push(t),this.rangeCount=this.ranges.length,!v){const e=window.getSelection();e.removeAllRanges(),e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}}removeAllRanges(){this.ranges=[],this.rangeCount=0}}const N=new class{constructor(){this.supportShadowSelection="function"==typeof window.ShadowRoot.prototype.getSelection,this.supportBeforeInput="function"==typeof window.InputEvent.prototype.getTargetRanges,this.isFirefox=window.navigator.userAgent.toLowerCase().indexOf("firefox")>0,this.listen()}getSelection(t){return this.supportShadowSelection?t.getSelection():this.isFirefox?this.getFirefoxSelection():this.polyfilledShadowSelection}getFirefoxSelection(){const t=document.getSelection(),e=t.getRangeAt(0),s=e.startContainer,i=e.endContainer;if(s!==i&&s.textContent.length===e.startOffset){const t=s.nodeType===Node.TEXT_NODE?s.parentNode.nextSibling:s.nextSibling;e.setStart(t.firstChild,0)}if(i!==s&&0===e.endOffset){const t=i.nodeType===Node.TEXT_NODE?i.parentNode.previousSibling:i.previousSibling;e.setEnd(t.lastChild,t.lastChild.textContent.length)}return t}listen(){this.isFirefox||this.supportShadowSelection||!this.supportBeforeInput||(this.polyfilledShadowSelection=new C,window.addEventListener("selectionchange",(()=>{if(!v){v=!0;const t=p();t&&t.hasAttribute("contenteditable")?document.execCommand("indent"):this.polyfilledShadowSelection.removeAllRanges(),v=!1}}),!0),window.addEventListener("beforeinput",(t=>{if(v){const e=t.getTargetRanges()[0],s=new Range;s.setStart(e.startContainer,e.startOffset),s.setEnd(e.endContainer,e.endOffset),this.polyfilledShadowSelection.removeAllRanges(),this.polyfilledShadowSelection.addRange(s),t.preventDefault(),t.stopImmediatePropagation()}}),!0))}};class S extends e{constructor(t){super(),this.autoRunTaskQueue=new b(t)}async executeTaskHook(){this.autoRunTaskQueue.queue.length&&await this.autoRunTaskQueue.runTask()}enqueueTheTaskIntoQueue(t=!1){this.autoRunTaskQueue.enqueue({run:async()=>{try{await this.doTask()}catch(t){s.error("The auto task run failed.",t)}}},t)}}!function(t,e,s,i){var n,o=arguments.length,h=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,s,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(h=(o<3?n(h):o>3?n(e,s,h):n(e,s))||h);o>3&&h&&Object.defineProperty(e,s,h)}([t("componentDidUpdate")],S.prototype,"executeTaskHook",null);class j{constructor(t,e,s=0,i=0,n,o,h){this._startOffset=0,this._endOffset=0,this._startContainer=t,this._endContainer=e,this._startOffset=s,this._endOffset=i,this._startNode=n,this._endNode=o,h&&(this._oldNativeRange=h)}get startContainer(){return this._startContainer}get endContainer(){return this._endContainer}get startNode(){return this._startNode}get endNode(){return this._endNode}get startOffset(){return this._startOffset}get endOffset(){return this._endOffset}updateRTERange(t,e){const{startOffset:s,endOffset:i}=t;this._startOffset=s,this._endOffset=i;const n=t.startNode,h=t.endNode;if(n instanceof o){this._startNode=n,this._endNode=h;const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode);t&&(this._startContainer=t,this._endContainer=e)}else this._startContainer=n,this._endContainer=h,this._startNode=this.getRTENodeByElement(this._startContainer),this._endNode=this._startContainer===this._endContainer?this._startNode:this.getRTENodeByElement(this._endContainer),e&&(this._oldNativeRange=e);return new j(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}clone(){return new j(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}toNativeRange(){const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode),s=new Range;return t&&e?(s.setStart(t,this._startOffset),s.setEnd(e,this._endOffset),this._startContainer=t,this._endContainer=e,this._oldNativeRange=s,s):this._oldNativeRange?this._oldNativeRange:void 0}getElementByRTENode(t){if(t){const e=h.getDOMByEntity(t);if(e)return t instanceof r?R(e,"vega-rich-text-image-editor"):e.firstChild}}getRTENodeByElement(t){if(t){const e=t.nodeType===Node.TEXT_NODE?t.parentElement:"VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t;return h.getEntityByDOM(e)}}}class E{constructor(t){this.range=t}clone(){const t=this.range.clone();return new E(t)}}var T=function(t,e,s,i){var n,o=arguments.length,h=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,s,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(h=(o<3?n(h):o>3?n(e,s,h):n(e,s))||h);return o>3&&h&&Object.defineProperty(e,s,h),h};class y extends S{constructor(){super(1),this.currentRange=new j,this.handleSelectionWithDebounce=n(this.handleSelectionChange,y.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.pendingRestoreSelectionNodes=[],this.doTask=async()=>{await Promise.resolve();const t=this.currentRange.toNativeRange();t&&this.setSelectionRange(t)}}connectedCallback(){this.registerSelectionRangeChangeObserver()}disconnectedCallback(){g.unregister(m.getSubject(this.host,w),this.selectionRangeChangeObserver)}componentDidLoad(){document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}watchValueUpdate(){this.prepareRestoreSelectionState(),this.restoreSelection()}getCurrentRange(){return this.currentRange}getSelectedNodes(){return Array.from(this.selectionMap.values()).flat()}getSelectedBlocks(){return Array.from(this.selectionMap.keys())}setSelectionState(t){this.selectionState=t}enqueueSelectionRangeFutureState(t,e,s,i,n=!1){t instanceof a?this.internalCodeBlockSelectionController.enqueueSelectionRangeFutureState(t,e,n):(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:s=s||t,startOffset:e,endOffset:i=i||0===i?i:e}),super.enqueueTheTaskIntoQueue(n))}setSelectionRange(t){const e=this.getSelection();e&&(e.removeAllRanges(),e.addRange(t),this.saveSelection())}getSelection(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();return N.getSelection(t.shadowRoot)}saveSelection(){const t=this.getSelection();if(t&&t.rangeCount>0&&0===this.autoRunTaskQueue.queue.length&&!this.insertCompositionTextController.isComposing()){const e=t.getRangeAt(0),{startContainer:s,endContainer:i,startOffset:n,endOffset:o}=e;this.currentRange=this.currentRange.updateRTERange({startNode:s,endNode:i,startOffset:n,endOffset:o},e)}}restoreSelection(){if(this.selectionState){const{startNode:t,endNode:e,startOffset:s,endOffset:i}=this.selectionState.range;t instanceof c&&t===e&&0===t.text.length?this.enqueueSelectionRangeFutureState(t,f.length):this.enqueueSelectionRangeFutureState(t,s,e,i),this.selectionState=null}}handleSelectionChange(){if(this.disabled)return;const t=this.getSelection();if(!t||0===t.rangeCount)return;this.clearSelectionMap(),this.saveSelection();const e=t.getRangeAt(0),s=[],i=t=>{if(e.intersectsNode(t)){if(t.nodeType===Node.TEXT_NODE){const e=h.getEntityByDOM(t.parentElement);if(e instanceof o)return void s.push(e)}if(t.nodeType===Node.ELEMENT_NODE){const i="VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t,n=h.getEntityByDOM(i);if(n instanceof u)return void(this.internalCodeBlockSelectionController.isCodeBlockSelected(n,e)&&s.push(n.nodes[0]));if(n instanceof o)return void s.push(n)}t.childNodes.forEach(i)}};i(e.commonAncestorContainer),s.forEach((t=>{this.selectionMap.has(t.parentBlock)?this.selectionMap.get(t.parentBlock).push(t):this.selectionMap.set(t.parentBlock,[t])})),this.getSelectedNodes().forEach((t=>t.apply(new d(e))))}clearSelectionMap(){this.getSelectedNodes().filter((t=>"CODE_BLOCK_NODE"!==t.type)).forEach((t=>{t.annotationMap.delete(l.SELECTION_RANGE)})),this.selectionMap=new Map}isAcceptableSelectionRangeChange(){return!0}registerSelectionRangeChangeObserver(){this.selectionRangeChangeObserver=new O(this.isAcceptableSelectionRangeChange.bind(this),(t=>{t.updateDirectly?this.enqueueSelectionRangeFutureState(t.node,t.offset):this.pendingRestoreSelectionNodes.push(t.node)})),g.register(m.getSubject(this.host,w),this.selectionRangeChangeObserver)}prepareRestoreSelectionState(){if(this.pendingRestoreSelectionNodes.length>0){const t=this.pendingRestoreSelectionNodes[0],e=this.pendingRestoreSelectionNodes.length>1?this.pendingRestoreSelectionNodes[this.pendingRestoreSelectionNodes.length-1]:t,{startOffset:s,endOffset:i,endContainer:n,startContainer:o}=this.currentRange;o&&h.getDOMByEntity(t)===o.parentElement&&n&&h.getDOMByEntity(e)===n.parentElement?(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:e,startOffset:s,endOffset:i}),this.selectionState=new E(this.currentRange)):(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:e,startOffset:0,endOffset:e.text.length}),this.selectionState=new E(this.currentRange)),this.pendingRestoreSelectionNodes=[]}}}y.SELECTION_CHANGE_DEBOUNCE_TIME=50,T([i()],y.prototype,"vegaRichTextEditorRenderer",void 0),T([i({writable:!0})],y.prototype,"selectionMap",void 0),T([i()],y.prototype,"host",void 0),T([i()],y.prototype,"value",void 0),T([i()],y.prototype,"disabled",void 0),T([i()],y.prototype,"valueController",void 0),T([i()],y.prototype,"insertCompositionTextController",void 0),T([i()],y.prototype,"historyController",void 0),T([i()],y.prototype,"internalCodeBlockSelectionController",void 0),T([t("connectedCallback")],y.prototype,"connectedCallback",null),T([t("disconnectedCallback")],y.prototype,"disconnectedCallback",null),T([t("componentDidLoad")],y.prototype,"componentDidLoad",null),T([t("watchValueUpdate")],y.prototype,"watchValueUpdate",null);export{S as A,E as R,N as S,y as a}
|
|
1
|
+
import{M as t,V as e,L as s,c as i}from"./p-6e1ab235.js";import{d as n}from"./p-1bc5b3bc.js";import{v as o,w as h,a as r,G as a,g as c,Z as d,D as f,z as l,u}from"./p-3eb2d433.js";import{g as p}from"./p-519a7d55.js";import{C as g}from"./p-2d0d575f.js";import{d as m}from"./p-6e01f0a2.js";import{b as w}from"./p-425ba7d6.js";import{O}from"./p-331a62d5.js";import{f as R}from"./p-d5776087.js";import{S as v}from"./p-1fb56e14.js";let C=!1;class b{constructor(){this.rangeCount=0,this.ranges=[]}getRangeAt(t){return this.ranges[t]}addRange(t){if(this.ranges.push(t),this.rangeCount=this.ranges.length,!C){const e=window.getSelection();e.removeAllRanges(),e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}}removeAllRanges(){this.ranges=[],this.rangeCount=0}}const N=new class{constructor(){this.supportShadowSelection="function"==typeof window.ShadowRoot.prototype.getSelection,this.supportBeforeInput="function"==typeof window.InputEvent.prototype.getTargetRanges,this.isFirefox=window.navigator.userAgent.toLowerCase().indexOf("firefox")>0,this.listen()}getSelection(t){return this.supportShadowSelection?t.getSelection():this.isFirefox?this.getFirefoxSelection():this.polyfilledShadowSelection}getFirefoxSelection(){const t=document.getSelection(),e=t.getRangeAt(0),s=e.startContainer,i=e.endContainer;if(s!==i&&s.textContent.length===e.startOffset){const t=s.nodeType===Node.TEXT_NODE?s.parentNode.nextSibling:s.nextSibling;e.setStart(t.firstChild,0)}if(i!==s&&0===e.endOffset){const t=i.nodeType===Node.TEXT_NODE?i.parentNode.previousSibling:i.previousSibling;e.setEnd(t.lastChild,t.lastChild.textContent.length)}return t}listen(){this.isFirefox||this.supportShadowSelection||!this.supportBeforeInput||(this.polyfilledShadowSelection=new b,window.addEventListener("selectionchange",(()=>{if(!C){C=!0;const t=p();t&&t.hasAttribute("contenteditable")?document.execCommand("indent"):this.polyfilledShadowSelection.removeAllRanges(),C=!1}}),!0),window.addEventListener("beforeinput",(t=>{if(C){const e=t.getTargetRanges()[0],s=new Range;s.setStart(e.startContainer,e.startOffset),s.setEnd(e.endContainer,e.endOffset),this.polyfilledShadowSelection.removeAllRanges(),this.polyfilledShadowSelection.addRange(s),t.preventDefault(),t.stopImmediatePropagation()}}),!0))}};class S extends e{constructor(t){super(),this.autoRunTaskQueue=new v(t)}async executeTaskHook(){this.autoRunTaskQueue.queue.length&&await this.autoRunTaskQueue.runTask()}enqueueTheTaskIntoQueue(t=!1){this.autoRunTaskQueue.enqueue({run:async()=>{try{await this.doTask()}catch(t){s.error("The auto task run failed.",t)}}},t)}}!function(t,e,s,i){var n,o=arguments.length,h=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,s,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(h=(o<3?n(h):o>3?n(e,s,h):n(e,s))||h);o>3&&h&&Object.defineProperty(e,s,h)}([t("componentDidUpdate")],S.prototype,"executeTaskHook",null);class j{constructor(t,e,s=0,i=0,n,o,h){this._startOffset=0,this._endOffset=0,this._startContainer=t,this._endContainer=e,this._startOffset=s,this._endOffset=i,this._startNode=n,this._endNode=o,h&&(this._oldNativeRange=h)}get startContainer(){return this._startContainer}get endContainer(){return this._endContainer}get startNode(){return this._startNode}get endNode(){return this._endNode}get startOffset(){return this._startOffset}get endOffset(){return this._endOffset}updateRTERange(t,e){const{startOffset:s,endOffset:i}=t;this._startOffset=s,this._endOffset=i;const n=t.startNode,h=t.endNode;if(n instanceof o){this._startNode=n,this._endNode=h;const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode);t&&(this._startContainer=t,this._endContainer=e)}else this._startContainer=n,this._endContainer=h,this._startNode=this.getRTENodeByElement(this._startContainer),this._endNode=this._startContainer===this._endContainer?this._startNode:this.getRTENodeByElement(this._endContainer),e&&(this._oldNativeRange=e);return new j(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}clone(){return new j(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}toNativeRange(){const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode),s=new Range;return t&&e?(s.setStart(t,this._startOffset),s.setEnd(e,this._endOffset),this._startContainer=t,this._endContainer=e,this._oldNativeRange=s,s):this._oldNativeRange?this._oldNativeRange:void 0}getElementByRTENode(t){if(t){const e=h.getDOMByEntity(t);if(e)return t instanceof r?R(e,"vega-rich-text-image-editor"):e.firstChild}}getRTENodeByElement(t){if(t){const e=t.nodeType===Node.TEXT_NODE?t.parentElement:"VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t;return h.getEntityByDOM(e)}}}class E{constructor(t){this.range=t}clone(){const t=this.range.clone();return new E(t)}}var T=function(t,e,s,i){var n,o=arguments.length,h=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,s,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(h=(o<3?n(h):o>3?n(e,s,h):n(e,s))||h);return o>3&&h&&Object.defineProperty(e,s,h),h};class y extends S{constructor(){super(1),this.currentRange=new j,this.handleSelectionWithDebounce=n(this.handleSelectionChange,y.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.pendingRestoreSelectionNodes=[],this.doTask=async()=>{await Promise.resolve();const t=this.currentRange.toNativeRange();t&&this.setSelectionRange(t)}}connectedCallback(){this.registerSelectionRangeChangeObserver()}disconnectedCallback(){g.unregister(m.getSubject(this.host,w),this.selectionRangeChangeObserver)}componentDidLoad(){document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}watchValueUpdate(){this.prepareRestoreSelectionState(),this.restoreSelection()}getCurrentRange(){return this.currentRange}getSelectedNodes(){return Array.from(this.selectionMap.values()).flat()}getSelectedBlocks(){return Array.from(this.selectionMap.keys())}setSelectionState(t){this.selectionState=t}enqueueSelectionRangeFutureState(t,e,s,i,n=!1){t instanceof a?this.internalCodeBlockSelectionController.enqueueSelectionRangeFutureState(t,e,n):(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:s=s||t,startOffset:e,endOffset:i=i||0===i?i:e}),super.enqueueTheTaskIntoQueue(n))}setSelectionRange(t){const e=this.getSelection();e&&(e.removeAllRanges(),e.addRange(t),this.saveSelection())}getSelection(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();return N.getSelection(t.shadowRoot)}saveSelection(){const t=this.getSelection();if(t&&t.rangeCount>0&&0===this.autoRunTaskQueue.queue.length&&!this.insertCompositionTextController.isComposing()){const e=t.getRangeAt(0),{startContainer:s,endContainer:i,startOffset:n,endOffset:o}=e;this.currentRange=this.currentRange.updateRTERange({startNode:s,endNode:i,startOffset:n,endOffset:o},e)}}restoreSelection(){if(this.selectionState){const{startNode:t,endNode:e,startOffset:s,endOffset:i}=this.selectionState.range;t instanceof c&&t===e&&0===t.text.length?this.enqueueSelectionRangeFutureState(t,d.length):this.enqueueSelectionRangeFutureState(t,s,e,i),this.selectionState=null}}handleSelectionChange(){if(this.disabled)return;const t=this.getSelection();if(!t||0===t.rangeCount)return;this.clearSelectionMap(),this.saveSelection();const e=t.getRangeAt(0),s=[],i=t=>{if(e.intersectsNode(t)){if(t.nodeType===Node.TEXT_NODE){const e=h.getEntityByDOM(t.parentElement);if(e instanceof o)return void s.push(e)}if(t.nodeType===Node.ELEMENT_NODE){const i="VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t,n=h.getEntityByDOM(i);if(n instanceof u)return void(this.internalCodeBlockSelectionController.isCodeBlockSelected(n,e)&&s.push(n.nodes[0]));if(n instanceof o)return void s.push(n)}t.childNodes.forEach(i)}};i(e.commonAncestorContainer),s.forEach((t=>{this.selectionMap.has(t.parentBlock)?this.selectionMap.get(t.parentBlock).push(t):this.selectionMap.set(t.parentBlock,[t])})),this.getSelectedNodes().forEach((t=>t.apply(new f(e))))}clearSelectionMap(){this.getSelectedNodes().filter((t=>"CODE_BLOCK_NODE"!==t.type)).forEach((t=>{t.annotationMap.delete(l.SELECTION_RANGE)})),this.selectionMap=new Map}isAcceptableSelectionRangeChange(){return!0}registerSelectionRangeChangeObserver(){this.selectionRangeChangeObserver=new O(this.isAcceptableSelectionRangeChange.bind(this),(t=>{t.updateDirectly?this.enqueueSelectionRangeFutureState(t.node,t.offset):this.pendingRestoreSelectionNodes.push(t.node)})),g.register(m.getSubject(this.host,w),this.selectionRangeChangeObserver)}prepareRestoreSelectionState(){if(this.pendingRestoreSelectionNodes.length>0){const t=this.pendingRestoreSelectionNodes[0],e=this.pendingRestoreSelectionNodes.length>1?this.pendingRestoreSelectionNodes[this.pendingRestoreSelectionNodes.length-1]:t,{startOffset:s,endOffset:i,endContainer:n,startContainer:o}=this.currentRange;o&&h.getDOMByEntity(t)===o.parentElement&&n&&h.getDOMByEntity(e)===n.parentElement?(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:e,startOffset:s,endOffset:i}),this.selectionState=new E(this.currentRange)):(this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:e,startOffset:0,endOffset:e.text.length}),this.selectionState=new E(this.currentRange)),this.pendingRestoreSelectionNodes=[]}}}y.SELECTION_CHANGE_DEBOUNCE_TIME=50,T([i()],y.prototype,"vegaRichTextEditorRenderer",void 0),T([i({writable:!0})],y.prototype,"selectionMap",void 0),T([i()],y.prototype,"host",void 0),T([i()],y.prototype,"value",void 0),T([i()],y.prototype,"disabled",void 0),T([i()],y.prototype,"valueController",void 0),T([i()],y.prototype,"insertCompositionTextController",void 0),T([i()],y.prototype,"historyController",void 0),T([i()],y.prototype,"internalCodeBlockSelectionController",void 0),T([t("connectedCallback")],y.prototype,"connectedCallback",null),T([t("disconnectedCallback")],y.prototype,"disconnectedCallback",null),T([t("componentDidLoad")],y.prototype,"componentDidLoad",null),T([t("watchValueUpdate")],y.prototype,"watchValueUpdate",null);export{S as A,E as R,N as S,y as a}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as a}from"./p-21d26bb4.js";import{F as r}from"./p-72e64237.js";import{C as o}from"./p-2d0d575f.js";import{O as n}from"./p-331a62d5.js";import{g as h,b as l,d,c as m,e as c,F as p,a as f}from"./p-5773a9a3.js";import{d as u}from"./p-d27ae9ff.js";import{s as b}from"./p-519a7d55.js";import{f as v,c as j,i as w}from"./p-d5776087.js";import{I as g}from"./p-b28d4f7d.js";import{c as V,I as F}from"./p-6e1ab235.js";import{V as y,I as E}from"./p-4387d550.js";import{c as R}from"./p-012cbd8f.js";import{C as S}from"./p-6b7dca3e.js";import{w as C,x as O,y as I,d as P}from"./p-6e01f0a2.js";import{C as B}from"./p-864de9a1.js";import{d as M}from"./p-425ba7d6.js";import{c as A}from"./p-8e31e7ea.js";import{S as D}from"./p-138fcf6e.js";import"./p-0bb29d98.js";import"./p-37b05e0b.js";import"./p-6a334573.js";import"./p-4ab3df00.js";import"./p-834434d5.js";import"./p-74168615.js";import"./p-ed45b3b6.js";import"./p-abd7aeaa.js";import"./p-e7b00bf0.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-262ec334.js";import"./p-613ee009.js";import"./p-b75ee3ba.js";import"./p-5f377954.js";import"./p-4d793cb0.js";import"./p-7a40e033.js";import"./p-112455b1.js";var N=function(t,i,s,e){var a,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,s,e);else for(var n=t.length-1;n>=0;n--)(a=t[n])&&(o=(r<3?a(o):r>3?a(i,s,o):a(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class x extends D{constructor(){super({parent:"vega-form",subStates:[{subStateName:"disableBlurValidation",parentStateName:"disableBlurValidation"}]})}}N([V()],x.prototype,"host",void 0),N([V({writable:!0})],x.prototype,"disableBlurValidation",void 0);var H=function(t,i,s,e){var a,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,s,e);else for(var n=t.length-1;n>=0;n--)(a=t[n])&&(o=(r<3?a(o):r>3?a(i,s,o):a(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};const k=class{constructor(s){t(this,s),this.vegaValidate=i(this,"vegaValidate",7),this.validate=i(this,"validate",7),this.vegaFormSubmit=i(this,"vegaFormSubmit",7),this.formSubmit=i(this,"formSubmit",7),this.vegaFormReset=i(this,"vegaFormReset",7),this.formReset=i(this,"formReset",7),this.globalSlimmers={},this.submitEventEmitter=R(k,C),this.resetEventEmitter=R(k,O),this.validateEventEmitter=R(k,I),this.disableBlurValidationNotifySlimmer=A(k,"disableBlurValidation","watchDisableBlurValidation"),this.stateController=new x,this.childEventPrevent=new S([C,O],(()=>this.host.querySelector("vega-form")),{customPreventHandle:t=>{t.stopPropagation()}}),this.childFormValidateEventPrevent=new S([I],(()=>this.host),{customPreventHandle:t=>{t.stopPropagation()}}),this.childNotifyObserver=new B(h,(t=>this.updateInternalValidStatus(t))),this.childNodeValueChangeObserver=new B(l,(()=>this.updateInternalTouchedStatus())),this.vegaComponentUsageRuntimeMetricsSlimmer=new y,this.invalidFieldPathMap=new g(new Map,(t=>{this.invalidFieldPathMap=t,this.updateIsValidFlag()})),this.pendingValidFieldPathMap=new g(new Map,(t=>{this.pendingValidFieldPathMap=t,this.updateIsValidFlag()})),this.controlledFieldPathSet=new Set,this.isValid=null,this.isTouched=!1,this.disableBlurValidation=!1,this.updateInternalValidStatus=t=>{if(t.host!==this.host){const i=t.host,s=t.detail;r.isValidFormField(i)&&this.shouldVisitElement(i,!1,!1)&&(s?this.invalidFieldPathMap.delete(i):this.invalidFieldPathMap.set(i,i.dataset.vegaForm))}}}watchIsValid(){this.validateEventEmitter.emit(this.isValid),o.notify(h,{host:this.host,detail:this.isValid})}watchDisableBlurValidation(){}async disconnectedCallback(){o.notify(d,{host:this.host}),o.unregister(d,this.formFieldDisconnectedObserver),o.unregister(m,this.formFieldPendingValidObserver)}async componentDidLoad(){await this.navigateVegaFormChildren((async(t,i)=>{i||this.controlledFieldPathSet.add(this.getFormFieldName(t,!0))})),this.initFormFieldDisconnectedObserver(),this.registerFormSubmitChangeManager(),this.registerFormResetChangeManager(),this.registerFormFieldPendingValidChangeManager()}async valid(t=!0){const i={isValid:!0,invalidFields:[]};return await this.navigateVegaFormChildren((async(s,e)=>{if("function"==typeof s.valid&&e){const e=await s.valid(t);e.isValid||(i.isValid=!1,i.invalidFields.push(...e.invalidFields),i.invalidFieldsErrorMessages=Object.assign(Object.assign({},i.invalidFieldsErrorMessages),e.invalidFieldsErrorMessages))}else{const{isValid:e,message:a}=await this.handleChildFormFieldElementValid(s,t);e||(i.isValid=!1,i.invalidFields.push(this.getFormFieldName(s)),i.invalidFieldsErrorMessages||(i.invalidFieldsErrorMessages={}),i.invalidFieldsErrorMessages[this.getFormFieldName(s)]=a)}})),i}async getValue(t){const i={};return await this.navigateVegaFormChildren((async(s,e)=>{const a=this.getFormFieldName(s);i[a]=e?await s.getValue(t):k.getFormFieldValue(s)}),t),u(i)?Object.values(i):i}async setValue(t,i){t&&(await this.navigateVegaFormChildren((async(s,e)=>{const a=this.getFormFieldName(s);e?await s.setValue(t[a],i):(await s.componentOnReady(),void 0!==t[a]&&("function"==typeof s.setValue?await s.setValue(t[a]):s.value=t[a]))}),i),this.isTouched=!1)}async reset(t={},i){await this.navigateVegaFormChildren((async(s,e)=>{const a=this.getFormFieldName(s);e&&await s.reset(t[a]||{},i)}),i),o.notify(c,{host:this.host,defaultValueMap:t,option:i}),this.isTouched=!1}static getFormFieldValue(t){return void 0===t.value?t.getAttribute("value"):t.value}render(){return b(s(e,null,s("slot",null)),this.host)}updateInternalTouchedStatus(){this.isTouched=!0}async navigateVegaFormChildren(t,i,s=this.host){const e=[];Array.from(s.children).forEach((s=>{r.isValidFormField(s)?this.shouldVisitElement(s,null==i?void 0:i.skipDisabled,null==i?void 0:i.skipInvisible)&&e.push(t(s,"VEGA-FORM"===s.tagName)):e.push(this.navigateVegaFormChildren(t,i,s))})),await Promise.all(e)}updateIsValidFlag(){this.isValid=this.pendingValidFieldPathMap.size>0?null:0===this.invalidFieldPathMap.size}getFormFieldName(t,i){let s=t.dataset.vegaForm;if(i){let i=v(t,"vega-form");for(;i&&i!==this.host;)s=i.dataset.vegaForm+" -> "+s,i=v(i,"vega-form")}return s}shouldVisitElement(t,i,s){return this.getFormFieldName(t)&&(!i||!t.disabled)&&(!s||j(t))}initFormFieldDisconnectedObserver(){this.formFieldDisconnectedObserver=new n(this.canAcceptFormFieldDisconnectedOperation.bind(this),this.updateInvalidFieldPath.bind(this)),o.register(d,this.formFieldDisconnectedObserver)}canAcceptFormFieldDisconnectedOperation(t){return this.invalidFieldPathMap.has(t.host)}async updateInvalidFieldPath(t){this.invalidFieldPathMap.delete(t.host),this.pendingValidFieldPathMap.delete(t.host)}registerFormSubmitChangeManager(){this.formEventsObserver=new n(this.canAcceptFormSubmitEvent.bind(this),this.handleSubmitEvents.bind(this)),o.register(p,this.formEventsObserver)}canAcceptFormSubmitEvent(t){return this.isElementInCurrentForm(t.host)}async handleSubmitEvents(){if((await this.valid()).isValid){const t=await this.getValue();this.submitEventEmitter.emit(t)}}registerFormResetChangeManager(){this.formEventsObserver=new n(this.canAcceptFormResetEvent.bind(this),this.handleResetEvents.bind(this)),o.register(f,this.formEventsObserver)}canAcceptFormResetEvent(t){return this.isElementInCurrentForm(t.host)}async handleResetEvents(){await this.reset(),this.resetEventEmitter.emit()}registerFormFieldPendingValidChangeManager(){this.formFieldPendingValidObserver=new n(this.canAcceptFormFieldPendingValid.bind(this),this.handleFieldPendingValid.bind(this)),o.register(m,this.formFieldPendingValidObserver)}canAcceptFormFieldPendingValid(t){return this.isElementInCurrentForm(t.host)}handleFieldPendingValid(t){"boolean"==typeof t.detail?this.pendingValidFieldPathMap.delete(t.host):this.pendingValidFieldPathMap.set(t.host,t.host.dataset.vegaForm)}isElementInCurrentForm(t){return this.invalidFieldPathMap.has(t)||w(t,this.host)}async handleChildFormFieldElementValid(t,i){const s=P.getSubject(t,M),{isValid:e,message:a}=await new Promise((e=>{const a=setTimeout((()=>{e({isValid:!0,message:""})}),2e3);o.notify(s,{host:t,message:i,promiseResolve:e,timerId:a})}));return{isValid:e,message:a}}get host(){return a(this)}static get watchers(){return{isValid:["watchIsValid"],disableBlurValidation:["watchDisableBlurValidation"]}}};H([E()],k.prototype,"globalSlimmers",void 0),H([F()],k.prototype,"submitEventEmitter",void 0),H([F()],k.prototype,"resetEventEmitter",void 0),H([F()],k.prototype,"validateEventEmitter",void 0),H([F()],k.prototype,"disableBlurValidationNotifySlimmer",void 0),H([F()],k.prototype,"stateController",void 0),H([F()],k.prototype,"childEventPrevent",void 0),H([F()],k.prototype,"childFormValidateEventPrevent",void 0),H([F()],k.prototype,"childNotifyObserver",void 0),H([F()],k.prototype,"childNodeValueChangeObserver",void 0),H([F()],k.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),k.style=":host{display:block}";export{k as vega_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as t}from"./p-b1f65b13.js";import{C as e}from"./p-2d0d575f.js";import{d as s}from"./p-e1a2a701.js";import{a as n,b as i}from"./p-425ba7d6.js";import{L as r}from"./p-6e1ab235.js";import{g as o}from"./p-37b05e0b.js";import{V as c}from"./p-50677c8e.js";var a,h;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(a||(a={}));class l{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT"}(h||(h={}));class u extends l{}const d=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap}register(t,e){this.domToEntity.set(t,e),this.entityToDOM.set(e,t)}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}};var p,f,w;!function(t){t.DELETE_CHILD="DELETE_CHILD",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILD_NODES="APPEND_CHILD_NODES",t.INSERT_BLOCKS_AFTER="INSERT_BLOCKS_AFTER",t.INSERT_BLOCKS_BEFORE="INSERT_BLOCKS_BEFORE",t.INSERT_NODES_AFTER="INSERT_NODES_AFTER",t.INSERT_NODES_BEFORE="INSERT_NODES_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.BREAK_SINGLE_BLOCK="BREAK_SINGLE_BLOCK",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK"}(p||(p={}));class x{constructor(){this.isFlushable=!1}}class A extends u{constructor(t){super(),this.type=h.ALIGNMENT,this.textAlign=t}static from(t){return[h.ALIGNMENT,new A(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}clone(){return new A(this.textAlign)}render(){return null}}class E extends u{constructor(t){super(),this.type=h.INDENT,this.indent=Math.max(0,t)}static from(t){return[h.INDENT,new E(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new E(this.indent)}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class g{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=t instanceof x?t.type:t.constructor.name,n=g.get(s,e.constructor.name);if(n)return n.execute(t,e);r.error(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)}}g.registry=new Map;class O{constructor(t){this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,e){switch(t){case"textAlign":return A.from(e);case"indent":return E.from(e)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof u)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}}doApply(t){t instanceof x?g.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(f||(f={}));class N{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}doApply(t){t instanceof x?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}!function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK"}(w||(w={}));class y extends l{}class S extends y{constructor(t="md",e){super(),this.type=w.IMAGE,this.size=t,this.alt=e}static from(t,e){return[w.IMAGE,new S(t,e)]}toJSON(){return t(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new S(this.size,this.alt)}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class T{execute(t,e){return r.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.nodes[t.nodes.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtTextBlockStart(t,e,s){return e===t.nodes[0]&&0===s}isCaretPositionAtImageBlockStart(t,e,s){return e===t.nodes[0]&&0===s}isCaretPositionAtImageBlockEnd(t,e,s){return e===t.nodes[t.nodes.length-1]&&1===s}}class m{}class _ extends N{constructor(t,e,s,n){super(t,n),this.type=f.IMAGE,this.url=e,this.parentBlock=s}static from(e,s){const n=new _(e.id,e.url,s);let i;return i=e.annotations&&0!==Object.keys(e.annotations).length?e.annotations:{size:"md"},n.annotationMap=new Map(Object.keys(i).map((()=>S.from(i.size,i.alt))).filter(t)),n}toJSON(){const t=this.annotationMap.get(w.IMAGE),e={};return(null==t?void 0:t.size)&&(e.size=t.size),(null==t?void 0:t.alt)&&(e.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(e).length>0?{annotations:e}:{}),{type:"image",url:this.url})}clone(){return new _(this.id,this.url,this.parentBlock,super.cloneAnnotations())}doAnnotationActionApply(t){const e=g.get(m.name,_.name);e&&e.execute(t,this)}doModifyActionApply(t){g.executeTheStrategy(t,this)}}g.register(p.UPDATE_IMAGE_NODE_URL,_.name,new class extends T{handleAction(t,e){e.url=t.url}}),g.register(m.name,_.name,new class extends T{handleAction(t,e){const s=t.toAnnotation();e.annotationMap.set(s.type,s)}});class C extends x{constructor(t){super(),this.type=p.DELETE_CHILD,this.entityToBeRemoved=t}}class L extends T{getPreviousNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t);if(s>0)return e.nodes[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t);if(e.nodes[s+1])return e.nodes[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t),n=e.parent;if("list-item"===e.type){const t=n.parent;return 0===s&&Array.isArray(n.blocks)&&n.blocks[0]===e&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===n}return 0===s&&Array.isArray(n.blocks)&&n.blocks[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const e=t.parent.blocks.indexOf(t);if(e>0)return t.parent.blocks[e-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){const e=t.blocks;if(e)return this.getBlockLastNode(e[e.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const e=t.parent.blocks.indexOf(t);if(t.parent.blocks[e+1])return t.parent.blocks[e+1];if("list-item"===t.type&&t.parent.blocks.length===e+1)return this.getNextBlock(t.parent)}}}class B extends x{constructor(t){super(),this.type=p.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class I extends T{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.nodes;"image"!==s.type&&(t=s.nodes.filter((t=>t.text))),e.apply(new B(t)),s.parent.apply(new C(s))}}}class k extends T{handleAction(t,e){e.nodes=e.nodes.filter((e=>e!==t.entityToBeRemoved)),0===e.nodes.length&&e.parent&&e.parent.apply(new C(e))}}class b extends T{handleAction(t,e){const s=t.entityToBeAppended;s.forEach((t=>{t.parentBlock=e})),e.nodes=e.nodes.concat(s)}}class D extends T{handleAction(t,e){e.nodes=[],e.apply(new B(t.newChildNodes))}}class R extends x{constructor(t,...e){super(),this.type=p.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=e}}class M extends x{constructor(t){super(),this.type=p.REPLACE_CHILD_NODES,this.newChildNodes=t}}class F extends x{constructor(t,...e){super(),this.type=p.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=e}}class K extends x{constructor(t,e){super(),this.type=p.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class j extends m{constructor(){super(...arguments),this.doSplit=!0}}class P extends l{constructor(t){super(),this.type=a.SELECTION_RANGE,this.range=t}clone(){return new P(this.range)}}class v extends y{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new v(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new v(this.strikethrough)}renderClass(){return this.strikethrough?"v-rte--strikethrough":null}render(){return null}}class H extends y{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new H(t)]}toJSON(){return{underline:this.underline}}clone(){return new H(this.underline)}renderClass(){return this.underline?"v-rte--underline":null}render(){return null}}class J extends y{constructor(t){super(),this.type=w.ITALIC,this.italic=t}static from(t){return[w.ITALIC,new J(t)]}toJSON(){return{italic:this.italic}}clone(){return new J(this.italic)}render(){return this.italic?{"font-style":"italic"}:null}}class W extends y{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new W(t)]}toJSON(){return{bold:this.bold}}clone(){return new W(this.bold)}render(){return this.bold?{"font-weight":"700"}:null}}class G extends y{constructor(t){super(),this.type=w.CODE,this.code=t}static from(t){return[w.CODE,new G(t)]}toJSON(){return{code:this.code}}clone(){return new G(this.code)}renderClass(){return this.code?"v-rte--code":null}render(){return null}}const z=[{key:"black",light:"#111128",dark:"#E3E3E8"},{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],U="";class $ extends y{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new $(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new $(this.textColor.key)}renderClass(){return null}render(){return{color:c.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return z.find((e=>e.key===t))||z[0]}}class X extends y{constructor(t){super(),this.type=w.LINK,this.link=t}static from(t){return[w.LINK,new X({href:t.href,groupKey:t.groupKey})]}toJSON(){return{link:{href:this.link.href,groupKey:this.link.groupKey}}}clone(){return new X(this.link)}toEqual(t){return this.link.groupKey===t.link.groupKey}render(){return null}}class q extends l{constructor(t){super(),this.type=a.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new q("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone())))})),t}}class V extends m{constructor(t,e){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e}toAnnotation(){return new q(this.groupKey)}}class Y extends m{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class Q extends x{constructor(t){super(),this.type=p.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class Z extends l{constructor(){super(...arguments),this.type=a.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE]}}class tt extends j{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Z}}class et extends j{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new G(this.code)}}class st extends m{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class nt extends j{constructor({link:e,newText:s,needMergeNode:n,doSplit:i}){super(),this.isFlushable=!0,this.link=e,this.needMergeNode=n,this.newText=s,t(i)&&(this.doSplit=i)}toAnnotation(){return new X(this.link)}}class it extends N{constructor(t,e,s,n){super(t,n),this.type=f.TEXT,this.parentBlock=s,this.text=e}static from(e,s){const n=new it(e.id,e.text,s),{annotations:i}=e;return i&&(n.annotationMap=new Map(Object.keys(i).map((t=>(i.link&&s.apply(new V(i.link.groupKey,[n])),this.createAnnotationEntity(t,i[t])))).filter(t))),n}static createAnnotationEntity(t,e){switch(t){case"bold":return W.from(e);case"italic":return J.from(e);case"underline":return H.from(e);case"strikethrough":return v.from(e);case"code":return G.from(e);case"textColor":return $.from(e);case"link":return X.from(e)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof y)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}cloneWithText(t){return new it(o(),t,this.parentBlock,super.cloneAnnotations())}clone(){return new it(this.id,this.text,this.parentBlock,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}doAnnotationActionApply(t){const e=this.getAnnotationByType(a.SELECTION_RANGE);if(t instanceof j&&t.doSplit&&e){const e=g.get(j.name,it.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);this.parentBlock.mergeNodes(t)}doModifyActionApply(t){g.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof Y)return void this.syncUpSelectedNodes(t);s instanceof P||this.syncUpSelectedNodes(t);const n=g.get(m.name,it.name);n&&n.execute(e,t)}syncUpSelectedNodes(t){const n=d.getDOMByEntity(this);if(n){const r=s.getSubjectFromParentNodeByEventId(n,i);r&&e.notify(r,{node:t})}}}g.register(p.UPDATE_TEXT,it.name,new class extends T{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.annotationMap.delete(w.LINK)}}),g.register(p.REPLACE_SELECTED_TEXT,it.name,new class extends T{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:i,startOffset:r,endOffset:o}=e;let c=s.text;if(n===i&&r===o&&t)c=s.text.slice(0,r)+t+s.text.slice(r);else{const e=n.parentElement,a=i.parentElement,h=e&&d.getEntityByDOM(e),l=a&&d.getEntityByDOM(a);let u=0,p=s.text.length;h&&h===s?(u=r,p=n===i?o:p):l&&l===s&&(p=o),c=s.text.slice(0,u)+t+s.text.slice(p)}s.apply(new Q(c))}}}),g.register(j.name,it.name,new class extends T{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(a.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof j&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:i,endOffset:r}=s.range,o=t===n&&i===r;e.parentBlock.nodes=e.parentBlock.nodes.flatMap((t=>t.id===e.id?o?this.insertNewNode(i,e):this.shouldSplitSelection(s.range)?this.splitTextNode(s.range,e):(this.setApplyTargetNode(e),e):t))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");return this.setApplyTargetNode(s),0===t?[s,e]:t===e.text.length?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:i}=t;return e!==s||n>0||i<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:i}=t,r=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const i=t.substring(0,s),r=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(i),e.cloneWithText(r),e.cloneWithText(o)]},a=r&&d.getEntityByDOM(r),h=o&&d.getEntityByDOM(o);if(a&&a.id===e.id){const r=s===n?t.endOffset:e.text.length,[o,a,h]=c(e.text,i,r);return this.setApplyTargetNode(a),[o,a,h].filter((t=>!!t.text))}if(h&&h.id===e.id){const[s,n,i]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,i].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}),g.register(m.name,it.name,new class extends T{handleAction(e,s){const n=e.toAnnotation();if(e instanceof st)s.annotationMap.delete(e.annotationType);else{if(!(n instanceof Z))return n instanceof y||n instanceof P?(e instanceof nt&&(t(e.newText)&&(s.text=e.newText),s.parentBlock.apply(new V(e.link.groupKey,[s]))),e instanceof et&&this.handleAction(new tt,s),void s.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{s.deleteAnnotationByType(t)}))}}});class rt extends u{constructor(t){super(),this.type=h.TEXT_STYLE,this.textStyle=t}static from(t){return[h.TEXT_STYLE,new rt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new rt(this.textStyle)}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500"}}}}class ot extends m{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new rt(this.textStyle)}}class ct extends j{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new W(this.bold)}}class at extends T{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),i=t.text.slice(e),r=s.nodes.indexOf(t);if(r>-1){const e=s.nodes.slice(0,r),o=s.nodes.slice(r+1);n&&e.push(t.cloneWithText(n)),i&&o.unshift(t.cloneWithText(i)),s.apply(new M(e));const c=s.cloneWithNodes(o);return s.parent.apply(new R(s,c)),c}}}}class ht extends T{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new it(o(),"\n",s),i=t.text.slice(0,e),r=t.text.slice(e),c=s.nodes.indexOf(t);if(c>-1){const e=s.nodes.slice(0,c),o=s.nodes.slice(c+1);i&&e.push(t.cloneWithText(i)),r&&o.unshift(t.cloneWithText(r)),this.mergeLineBreakNodes(e,n,o,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new it(o(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new M([...t,e,...s]))}}class lt extends T{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.nodes,n=new it(o(),"\n",e),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,i,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.nodes),t.parent.apply(new C(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new it(o(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new M([...t,e,...s]))}}class ut extends x{constructor(t){super(),this.type=p.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class dt extends L{handleAction(t,e){this.deleteNodeContent(t,e)}deleteNodeContent(t,e){const s=t.startContainerNode,n=t.startOffset;if(0!==n&&!s.isEmpty()){const i=s.text.slice(0,n-1)+s.text.slice(n);if(s.apply(new Q(i)),i)return void(t.previousNode=s);{const n=this.getPreviousNode(s);return n&&n.parentBlock===e&&"\n"===n.text||1===e.nodes.length?void(t.previousNode=s):(e.apply(new C(s)),void(t.previousNode=n))}}{let n=this.getPreviousNode(s),i=null;if(e.nodes.length&&n&&n.parentBlock!==e)s.isEmpty()&&e.apply(new C(s)),e.type===n.parentBlock.type&&n.parentBlock.apply(new ut(e));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&e.apply(new C(s)),n instanceof it&&n.isEmpty()){const t=n;n=this.getPreviousNode(n),t.parentBlock.apply(new C(t)),n||(i=s)}0===e.nodes.length&&e.parent.apply(new C(e)),n?t.previousNode=n:i&&(t.nextNode=i)}}}class pt extends T{replaceNodeWithNodes(t,e,s){t.nodes&&(s.forEach((e=>{e.parentBlock=t})),t.nodes=t.nodes.flatMap((t=>t===e?s:t)))}}class ft extends pt{handleAction(t,e){const s=t.referNode,n=[...t.nodesToBeInserted,s];this.replaceNodeWithNodes(e,s,n)}}class wt extends O{constructor(t,e){super(t),this.nodes=[],this.type=e,this.annotationMap=wt.isAcceptableTextStyle(e)?new Map([rt.from(e)]):new Map([rt.from("paragraph")])}static from(e){const s=new wt(e.id,e.type),{annotations:n}=e;return s.nodes=e.nodes.map((t=>it.from(t,s))),n&&Object.entries(n).forEach((([e,n])=>{const i=this.createAnnotationEntity(e,n);t(i)&&s.annotationMap.set(...i)})),s}static createAnnotationEntity(t,e){return"textStyle"===t?rt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof nt&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(w.LINK),i=s.getAnnotationByType(w.LINK);if(t&&i&&t.toEqual(i))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const e=new wt(o(),this.type);return e.nodes=[],e.apply(new B(t)),e}clone(){const t=new wt(this.id,this.type);return t.nodes=this.nodes.map((e=>{const s=e.clone();return s.parentBlock=t,s})),t.annotationMap=super.cloneAnnotations(),t.parent=this.parent,t}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}createNewParagraph(){return new wt(o(),"paragraph")}doAnnotationActionApply(t){const e=g.get(t.constructor.name,wt.name);e&&e.execute(t,this)}}g.register(ot.name,wt.name,new class extends T{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.nodes.forEach(t.bold?t=>{const e=new ct(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new st(w.BOLD))})}}),g.register(V.name,wt.name,new class extends T{handleAction(t,e){const s=e.getAnnotationByType(a.LINK_GROUP);if(s){const n=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...n,...t.nodes]),e.annotationMap.set(a.LINK_GROUP,s)}}}),g.register(p.DELETE_CHILD,wt.name,new k),g.register(p.APPEND_CHILD_NODES,wt.name,new b),g.register(p.SPLIT_BLOCK_WITH_NODE,wt.name,new at),g.register(p.REPLACE_CHILD_NODES,wt.name,new D),g.register(p.MERGE_TWO_BLOCKS_NODES,wt.name,new I),g.register(p.BREAK_SINGLE_BLOCK,wt.name,new class extends T{handleAction(t,e){t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset,e)}breakSingleTextBlock(t,e,s){const n=this.copyInlineStyleToNewParagraph(t,s);if(this.isCaretPositionAtTextBlockEnd(s,t,e))s.parent.apply(new R(s,n));else{if(!this.isCaretPositionAtTextBlockStart(s,t,e)){const n=new K(t,e);return s.apply(n),n.newBlock}s.parent.apply(new F(s,n))}return n}copyInlineStyleToNewParagraph(t,e){const s=t.cloneWithText("");s.annotationMap.delete(w.LINK);const n=e.createNewParagraph();return n.apply(new B([s])),n}}),g.register(p.LINE_BREAK_SINGLE_BLOCK,wt.name,new ht),g.register(p.LINE_BREAK_MULTIPLE_BLOCKS,wt.name,new lt),g.register(p.DELETE_BLOCK_CONTENT,wt.name,new dt),g.register(p.INSERT_IMAGE_TO_BLOCK,wt.name,new class extends T{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtTextBlockEnd(e,s,n))e.parent.apply(new R(e,i));else if(this.isCaretPositionAtTextBlockStart(e,s,n))e.parent.apply(new F(e,i));else{const t=new K(s,n);e.apply(t),e.parent.apply(new R(e,i))}}}),g.register(p.INSERT_NODES_BEFORE,wt.name,new ft),g.register(p.TRANSFORM_LIST_BLOCK,wt.name,new class extends T{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),i=t.selectedBlocks,r=i.map((t=>s.toListItem(t)));n.apply(new B(r)),s.apply(new R(t.selectedBlocks[0],n)),i.forEach((t=>{t.parent.apply(new C(t))}))}});class xt extends x{constructor(t,e){super(),this.isFlushable=!0,this.type=p.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class At extends m{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new P(this.range)}}class Et extends N{constructor(t,e,s,n){super(t),this.type=f.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parentBlock=n,this.language=s}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}clone(){return new Et(this.id,this.text,this.language,this.parentBlock)}doAnnotationActionApply(t){g.executeTheStrategy(t,this)}doModifyActionApply(t){g.executeTheStrategy(t,this)}}g.register(p.UPDATE_CODE_BLOCK,Et.name,new class extends T{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),g.register(At.name,Et.name,new class extends T{handleAction(t,e){e.annotationMap.set(a.SELECTION_RANGE,t.toAnnotation())}});class gt extends O{constructor(t,e,s){super(t),this.type="code-block",this.nodes=[new Et(`${t}-1`,e,s,this)]}static from(t){return new gt(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.nodes[0];return{id:this.id,type:"code-block",content:e,language:t}}clone(){const t=gt.from(this.toJSON());return t.parent=this.parent,t}apply(t){if(t instanceof x&&g.executeTheStrategy(t,this),t.isFlushable){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}}isNotEmpty(){return!!this.nodes.length}getLastNode(){return this.nodes[0]}isSelected(){return this.nodes[0].annotationMap.has(a.SELECTION_RANGE)}}g.register(p.DELETE_CODE_BLOCK,gt.name,new class extends L{handleAction(t,e){const s=e.nodes[0],n=e.parent;if(n){let t=this.getPreviousNode(s),i=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),i=0),n.apply(new C(e));const r=t?d.getDOMByEntity(t):null;if(0===n.blocks.length){const s=wt.from({id:o(),type:"paragraph",nodes:[{id:o(),type:"text",text:""}]});e.parent.apply(new B([s])),t=s.nodes[0],i=0}this.notifyUpdateSelection(t,r,i,e)}}notifyUpdateSelection(t,n,r,o){const c=d.getDOMByEntity(o);if(c){const o=s.getSubjectFromParentNodeByEventId(c,i);o&&e.notify(o,{node:t,updateDirectly:!!n,offset:r})}}getRTENodeEndOffset(t){return t&&"CODE_BLOCK_NODE"!==t.type?"IMAGE"!==t.type?t.text.length:1:0}}),g.register(p.DELETE_CHILD,gt.name,new k),g.register(p.SWITCH_OUT_FROM_CODE_BLOCK,gt.name,new class extends T{handleAction(t,n){const{content:r,language:c}=t,a=r.split("\n"),h=new xt(a.slice(0,a.length-2).join("\n"),c);h.isFlushable=!1,n.nodes[0].apply(h);const l=wt.from({id:o(),type:"paragraph",nodes:[{id:o(),text:"",type:"text"}]});n.parent.apply(new R(n,l));const u=d.getDOMByEntity(n);if(u){const t=s.getSubjectFromParentNodeByEventId(u,i);t&&e.notify(t,{node:l.nodes[0]})}}}),g.register(p.INSERT_IMAGE_TO_BLOCK,gt.name,new class extends T{handleAction(t,e){e.parent.apply(new R(e,t.imageBlockToBeInserted))}}),gt.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{E as $,T as A,L as B,S as C,At as D,$ as E,z as F,Et as G,m as H,R as I,ct as J,J as K,nt as L,x as M,w as N,H as O,ot as P,rt as Q,C as R,K as S,j as T,xt as U,W as V,h as W,tt as X,et as Y,U as Z,v as _,_ as a,A as a0,Q as a1,ut as a2,M as b,B as c,wt as d,F as e,p as f,it as g,pt as h,O as i,g as j,I as k,k as l,b as m,D as n,ft as o,dt as p,ht as q,lt as r,at as s,Y as t,gt as u,N as v,d as w,u as x,y,a as z}
|
|
1
|
+
import{i as t}from"./p-b1f65b13.js";import{C as e}from"./p-2d0d575f.js";import{d as s}from"./p-6e01f0a2.js";import{a as n,b as i}from"./p-425ba7d6.js";import{L as r}from"./p-6e1ab235.js";import{g as o}from"./p-37b05e0b.js";import{V as c}from"./p-0c8bd757.js";var a,h;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(a||(a={}));class l{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT"}(h||(h={}));class u extends l{}const d=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap}register(t,e){this.domToEntity.set(t,e),this.entityToDOM.set(e,t)}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}};var p,f,w;!function(t){t.DELETE_CHILD="DELETE_CHILD",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILD_NODES="APPEND_CHILD_NODES",t.INSERT_BLOCKS_AFTER="INSERT_BLOCKS_AFTER",t.INSERT_BLOCKS_BEFORE="INSERT_BLOCKS_BEFORE",t.INSERT_NODES_AFTER="INSERT_NODES_AFTER",t.INSERT_NODES_BEFORE="INSERT_NODES_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.BREAK_SINGLE_BLOCK="BREAK_SINGLE_BLOCK",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK"}(p||(p={}));class x{constructor(){this.isFlushable=!1}}class A extends u{constructor(t){super(),this.type=h.ALIGNMENT,this.textAlign=t}static from(t){return[h.ALIGNMENT,new A(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}clone(){return new A(this.textAlign)}render(){return null}}class E extends u{constructor(t){super(),this.type=h.INDENT,this.indent=Math.max(0,t)}static from(t){return[h.INDENT,new E(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new E(this.indent)}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class g{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=t instanceof x?t.type:t.constructor.name,n=g.get(s,e.constructor.name);if(n)return n.execute(t,e);r.error(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)}}g.registry=new Map;class O{constructor(t){this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,e){switch(t){case"textAlign":return A.from(e);case"indent":return E.from(e)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof u)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}}doApply(t){t instanceof x?g.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(f||(f={}));class N{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}doApply(t){t instanceof x?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}!function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK"}(w||(w={}));class y extends l{}class S extends y{constructor(t="md",e){super(),this.type=w.IMAGE,this.size=t,this.alt=e}static from(t,e){return[w.IMAGE,new S(t,e)]}toJSON(){return t(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new S(this.size,this.alt)}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class T{execute(t,e){return r.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.nodes[t.nodes.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtTextBlockStart(t,e,s){return e===t.nodes[0]&&0===s}isCaretPositionAtImageBlockStart(t,e,s){return e===t.nodes[0]&&0===s}isCaretPositionAtImageBlockEnd(t,e,s){return e===t.nodes[t.nodes.length-1]&&1===s}}class m{}class _ extends N{constructor(t,e,s,n){super(t,n),this.type=f.IMAGE,this.url=e,this.parentBlock=s}static from(e,s){const n=new _(e.id,e.url,s);let i;return i=e.annotations&&0!==Object.keys(e.annotations).length?e.annotations:{size:"md"},n.annotationMap=new Map(Object.keys(i).map((()=>S.from(i.size,i.alt))).filter(t)),n}toJSON(){const t=this.annotationMap.get(w.IMAGE),e={};return(null==t?void 0:t.size)&&(e.size=t.size),(null==t?void 0:t.alt)&&(e.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(e).length>0?{annotations:e}:{}),{type:"image",url:this.url})}clone(){return new _(this.id,this.url,this.parentBlock,super.cloneAnnotations())}doAnnotationActionApply(t){const e=g.get(m.name,_.name);e&&e.execute(t,this)}doModifyActionApply(t){g.executeTheStrategy(t,this)}}g.register(p.UPDATE_IMAGE_NODE_URL,_.name,new class extends T{handleAction(t,e){e.url=t.url}}),g.register(m.name,_.name,new class extends T{handleAction(t,e){const s=t.toAnnotation();e.annotationMap.set(s.type,s)}});class C extends x{constructor(t){super(),this.type=p.DELETE_CHILD,this.entityToBeRemoved=t}}class L extends T{getPreviousNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t);if(s>0)return e.nodes[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t);if(e.nodes[s+1])return e.nodes[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parentBlock,s=e.nodes.indexOf(t),n=e.parent;if("list-item"===e.type){const t=n.parent;return 0===s&&Array.isArray(n.blocks)&&n.blocks[0]===e&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===n}return 0===s&&Array.isArray(n.blocks)&&n.blocks[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const e=t.parent.blocks.indexOf(t);if(e>0)return t.parent.blocks[e-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){const e=t.blocks;if(e)return this.getBlockLastNode(e[e.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const e=t.parent.blocks.indexOf(t);if(t.parent.blocks[e+1])return t.parent.blocks[e+1];if("list-item"===t.type&&t.parent.blocks.length===e+1)return this.getNextBlock(t.parent)}}}class B extends x{constructor(t){super(),this.type=p.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class I extends T{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.nodes;"image"!==s.type&&(t=s.nodes.filter((t=>t.text))),e.apply(new B(t)),s.parent.apply(new C(s))}}}class b extends T{handleAction(t,e){e.nodes=e.nodes.filter((e=>e!==t.entityToBeRemoved)),0===e.nodes.length&&e.parent&&e.parent.apply(new C(e))}}class k extends T{handleAction(t,e){const s=t.entityToBeAppended;s.forEach((t=>{t.parentBlock=e})),e.nodes=e.nodes.concat(s)}}class D extends T{handleAction(t,e){e.nodes=[],e.apply(new B(t.newChildNodes))}}class R extends x{constructor(t,...e){super(),this.type=p.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=e}}class M extends x{constructor(t){super(),this.type=p.REPLACE_CHILD_NODES,this.newChildNodes=t}}class F extends x{constructor(t,...e){super(),this.type=p.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=e}}class K extends x{constructor(t,e){super(),this.type=p.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class j extends m{constructor(){super(...arguments),this.doSplit=!0}}class P extends l{constructor(t){super(),this.type=a.SELECTION_RANGE,this.range=t}clone(){return new P(this.range)}}class v extends y{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new v(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new v(this.strikethrough)}renderClass(){return this.strikethrough?"v-rte--strikethrough":null}render(){return null}}class H extends y{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new H(t)]}toJSON(){return{underline:this.underline}}clone(){return new H(this.underline)}renderClass(){return this.underline?"v-rte--underline":null}render(){return null}}class J extends y{constructor(t){super(),this.type=w.ITALIC,this.italic=t}static from(t){return[w.ITALIC,new J(t)]}toJSON(){return{italic:this.italic}}clone(){return new J(this.italic)}render(){return this.italic?{"font-style":"italic"}:null}}class W extends y{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new W(t)]}toJSON(){return{bold:this.bold}}clone(){return new W(this.bold)}render(){return this.bold?{"font-weight":"700"}:null}}class G extends y{constructor(t){super(),this.type=w.CODE,this.code=t}static from(t){return[w.CODE,new G(t)]}toJSON(){return{code:this.code}}clone(){return new G(this.code)}renderClass(){return this.code?"v-rte--code":null}render(){return null}}const z=[{key:"black",light:"#111128",dark:"#E3E3E8"},{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],U="";class $ extends y{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new $(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new $(this.textColor.key)}renderClass(){return null}render(){return{color:c.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return z.find((e=>e.key===t))||z[0]}}class X extends y{constructor(t){super(),this.type=w.LINK,this.link=t}static from(t){return[w.LINK,new X({href:t.href,groupKey:t.groupKey})]}toJSON(){return{link:{href:this.link.href,groupKey:this.link.groupKey}}}clone(){return new X(this.link)}toEqual(t){return this.link.groupKey===t.link.groupKey}render(){return null}}class q extends l{constructor(t){super(),this.type=a.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new q("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone())))})),t}}class V extends m{constructor(t,e){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e}toAnnotation(){return new q(this.groupKey)}}class Y extends m{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class Q extends x{constructor(t){super(),this.type=p.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class Z extends l{constructor(){super(...arguments),this.type=a.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE]}}class tt extends j{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Z}}class et extends j{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new G(this.code)}}class st extends m{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class nt extends j{constructor({link:e,newText:s,needMergeNode:n,doSplit:i}){super(),this.isFlushable=!0,this.link=e,this.needMergeNode=n,this.newText=s,t(i)&&(this.doSplit=i)}toAnnotation(){return new X(this.link)}}class it extends N{constructor(t,e,s,n){super(t,n),this.type=f.TEXT,this.parentBlock=s,this.text=e}static from(e,s){const n=new it(e.id,e.text,s),{annotations:i}=e;return i&&(n.annotationMap=new Map(Object.keys(i).map((t=>(i.link&&s.apply(new V(i.link.groupKey,[n])),this.createAnnotationEntity(t,i[t])))).filter(t))),n}static createAnnotationEntity(t,e){switch(t){case"bold":return W.from(e);case"italic":return J.from(e);case"underline":return H.from(e);case"strikethrough":return v.from(e);case"code":return G.from(e);case"textColor":return $.from(e);case"link":return X.from(e)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof y)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}cloneWithText(t){return new it(o(),t,this.parentBlock,super.cloneAnnotations())}clone(){return new it(this.id,this.text,this.parentBlock,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}doAnnotationActionApply(t){const e=this.getAnnotationByType(a.SELECTION_RANGE);if(t instanceof j&&t.doSplit&&e){const e=g.get(j.name,it.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);this.parentBlock.mergeNodes(t)}doModifyActionApply(t){g.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof Y)return void this.syncUpSelectedNodes(t);s instanceof P||this.syncUpSelectedNodes(t);const n=g.get(m.name,it.name);n&&n.execute(e,t)}syncUpSelectedNodes(t){const n=d.getDOMByEntity(this);if(n){const r=s.getSubjectFromParentNodeByEventId(n,i);r&&e.notify(r,{node:t})}}}g.register(p.UPDATE_TEXT,it.name,new class extends T{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.annotationMap.delete(w.LINK)}}),g.register(p.REPLACE_SELECTED_TEXT,it.name,new class extends T{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:i,startOffset:r,endOffset:o}=e;let c=s.text;if(n===i&&r===o&&t)c=s.text.slice(0,r)+t+s.text.slice(r);else{const e=n.parentElement,a=i.parentElement,h=e&&d.getEntityByDOM(e),l=a&&d.getEntityByDOM(a);let u=0,p=s.text.length;h&&h===s?(u=r,p=n===i?o:p):l&&l===s&&(p=o),c=s.text.slice(0,u)+t+s.text.slice(p)}s.apply(new Q(c))}}}),g.register(j.name,it.name,new class extends T{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(a.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof j&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:i,endOffset:r}=s.range,o=t===n&&i===r;e.parentBlock.nodes=e.parentBlock.nodes.flatMap((t=>t.id===e.id?o?this.insertNewNode(i,e):this.shouldSplitSelection(s.range)?this.splitTextNode(s.range,e):(this.setApplyTargetNode(e),e):t))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");return this.setApplyTargetNode(s),0===t?[s,e]:t===e.text.length?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:i}=t;return e!==s||n>0||i<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:i}=t,r=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const i=t.substring(0,s),r=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(i),e.cloneWithText(r),e.cloneWithText(o)]},a=r&&d.getEntityByDOM(r),h=o&&d.getEntityByDOM(o);if(a&&a.id===e.id){const r=s===n?t.endOffset:e.text.length,[o,a,h]=c(e.text,i,r);return this.setApplyTargetNode(a),[o,a,h].filter((t=>!!t.text))}if(h&&h.id===e.id){const[s,n,i]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,i].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}),g.register(m.name,it.name,new class extends T{handleAction(e,s){const n=e.toAnnotation();if(e instanceof st)s.annotationMap.delete(e.annotationType);else{if(!(n instanceof Z))return n instanceof y||n instanceof P?(e instanceof nt&&(t(e.newText)&&(s.text=e.newText),s.parentBlock.apply(new V(e.link.groupKey,[s]))),e instanceof et&&this.handleAction(new tt,s),void s.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{s.deleteAnnotationByType(t)}))}}});class rt extends u{constructor(t){super(),this.type=h.TEXT_STYLE,this.textStyle=t}static from(t){return[h.TEXT_STYLE,new rt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new rt(this.textStyle)}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500"}}}}class ot extends m{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new rt(this.textStyle)}}class ct extends j{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new W(this.bold)}}class at extends T{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),i=t.text.slice(e),r=s.nodes.indexOf(t);if(r>-1){const e=s.nodes.slice(0,r),o=s.nodes.slice(r+1);n&&e.push(t.cloneWithText(n)),i&&o.unshift(t.cloneWithText(i)),s.apply(new M(e));const c=s.cloneWithNodes(o);return s.parent.apply(new R(s,c)),c}}}}class ht extends T{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new it(o(),"\n",s),i=t.text.slice(0,e),r=t.text.slice(e),c=s.nodes.indexOf(t);if(c>-1){const e=s.nodes.slice(0,c),o=s.nodes.slice(c+1);i&&e.push(t.cloneWithText(i)),r&&o.unshift(t.cloneWithText(r)),this.mergeLineBreakNodes(e,n,o,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new it(o(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new M([...t,e,...s]))}}class lt extends T{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.nodes,n=new it(o(),"\n",e),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,i,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.nodes),t.parent.apply(new C(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new it(o(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new M([...t,e,...s]))}}class ut extends x{constructor(t){super(),this.type=p.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class dt extends L{handleAction(t,e){this.deleteNodeContent(t,e)}deleteNodeContent(t,e){const s=t.startContainerNode,n=t.startOffset;if(0!==n&&!s.isEmpty()){const i=s.text.slice(0,n-1)+s.text.slice(n);if(s.apply(new Q(i)),i)return void(t.previousNode=s);{const n=this.getPreviousNode(s);return n&&n.parentBlock===e&&"\n"===n.text||1===e.nodes.length?void(t.previousNode=s):(e.apply(new C(s)),void(t.previousNode=n))}}{let n=this.getPreviousNode(s),i=null;if(e.nodes.length&&n&&n.parentBlock!==e)s.isEmpty()&&e.apply(new C(s)),e.type===n.parentBlock.type&&n.parentBlock.apply(new ut(e));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&e.apply(new C(s)),n instanceof it&&n.isEmpty()){const t=n;n=this.getPreviousNode(n),t.parentBlock.apply(new C(t)),n||(i=s)}0===e.nodes.length&&e.parent.apply(new C(e)),n?t.previousNode=n:i&&(t.nextNode=i)}}}class pt extends T{replaceNodeWithNodes(t,e,s){t.nodes&&(s.forEach((e=>{e.parentBlock=t})),t.nodes=t.nodes.flatMap((t=>t===e?s:t)))}}class ft extends pt{handleAction(t,e){const s=t.referNode,n=[...t.nodesToBeInserted,s];this.replaceNodeWithNodes(e,s,n)}}class wt extends O{constructor(t,e){super(t),this.nodes=[],this.type=e,this.annotationMap=wt.isAcceptableTextStyle(e)?new Map([rt.from(e)]):new Map([rt.from("paragraph")])}static from(e){const s=new wt(e.id,e.type),{annotations:n}=e;return s.nodes=e.nodes.map((t=>it.from(t,s))),n&&Object.entries(n).forEach((([e,n])=>{const i=this.createAnnotationEntity(e,n);t(i)&&s.annotationMap.set(...i)})),s}static createAnnotationEntity(t,e){return"textStyle"===t?rt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof nt&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(w.LINK),i=s.getAnnotationByType(w.LINK);if(t&&i&&t.toEqual(i))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const e=new wt(o(),this.type);return e.nodes=[],e.apply(new B(t)),e}clone(){const t=new wt(this.id,this.type);return t.nodes=this.nodes.map((e=>{const s=e.clone();return s.parentBlock=t,s})),t.annotationMap=super.cloneAnnotations(),t.parent=this.parent,t}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}createNewParagraph(){return new wt(o(),"paragraph")}doAnnotationActionApply(t){const e=g.get(t.constructor.name,wt.name);e&&e.execute(t,this)}}g.register(ot.name,wt.name,new class extends T{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.nodes.forEach(t.bold?t=>{const e=new ct(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new st(w.BOLD))})}}),g.register(V.name,wt.name,new class extends T{handleAction(t,e){const s=e.getAnnotationByType(a.LINK_GROUP);if(s){const n=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...n,...t.nodes]),e.annotationMap.set(a.LINK_GROUP,s)}}}),g.register(p.DELETE_CHILD,wt.name,new b),g.register(p.APPEND_CHILD_NODES,wt.name,new k),g.register(p.SPLIT_BLOCK_WITH_NODE,wt.name,new at),g.register(p.REPLACE_CHILD_NODES,wt.name,new D),g.register(p.MERGE_TWO_BLOCKS_NODES,wt.name,new I),g.register(p.BREAK_SINGLE_BLOCK,wt.name,new class extends T{handleAction(t,e){t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset,e)}breakSingleTextBlock(t,e,s){const n=this.copyInlineStyleToNewParagraph(t,s);if(this.isCaretPositionAtTextBlockEnd(s,t,e))s.parent.apply(new R(s,n));else{if(!this.isCaretPositionAtTextBlockStart(s,t,e)){const n=new K(t,e);return s.apply(n),n.newBlock}s.parent.apply(new F(s,n))}return n}copyInlineStyleToNewParagraph(t,e){const s=t.cloneWithText("");s.annotationMap.delete(w.LINK);const n=e.createNewParagraph();return n.apply(new B([s])),n}}),g.register(p.LINE_BREAK_SINGLE_BLOCK,wt.name,new ht),g.register(p.LINE_BREAK_MULTIPLE_BLOCKS,wt.name,new lt),g.register(p.DELETE_BLOCK_CONTENT,wt.name,new dt),g.register(p.INSERT_IMAGE_TO_BLOCK,wt.name,new class extends T{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtTextBlockEnd(e,s,n))e.parent.apply(new R(e,i));else if(this.isCaretPositionAtTextBlockStart(e,s,n))e.parent.apply(new F(e,i));else{const t=new K(s,n);e.apply(t),e.parent.apply(new R(e,i))}}}),g.register(p.INSERT_NODES_BEFORE,wt.name,new ft),g.register(p.TRANSFORM_LIST_BLOCK,wt.name,new class extends T{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),i=t.selectedBlocks,r=i.map((t=>s.toListItem(t)));n.apply(new B(r)),s.apply(new R(t.selectedBlocks[0],n)),i.forEach((t=>{t.parent.apply(new C(t))}))}});class xt extends x{constructor(t,e){super(),this.isFlushable=!0,this.type=p.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class At extends m{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new P(this.range)}}class Et extends N{constructor(t,e,s,n){super(t),this.type=f.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parentBlock=n,this.language=s}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}clone(){return new Et(this.id,this.text,this.language,this.parentBlock)}doAnnotationActionApply(t){g.executeTheStrategy(t,this)}doModifyActionApply(t){g.executeTheStrategy(t,this)}}g.register(p.UPDATE_CODE_BLOCK,Et.name,new class extends T{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),g.register(At.name,Et.name,new class extends T{handleAction(t,e){e.annotationMap.set(a.SELECTION_RANGE,t.toAnnotation())}});class gt extends O{constructor(t,e,s){super(t),this.type="code-block",this.nodes=[new Et(`${t}-1`,e,s,this)]}static from(t){return new gt(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.nodes[0];return{id:this.id,type:"code-block",content:e,language:t}}clone(){const t=gt.from(this.toJSON());return t.parent=this.parent,t}apply(t){if(t instanceof x&&g.executeTheStrategy(t,this),t.isFlushable){const t=d.getDOMByEntity(this);if(t){const i=s.getSubjectFromParentNodeByEventId(t,n);i&&e.notify(i,{})}}}isNotEmpty(){return!!this.nodes.length}getLastNode(){return this.nodes[0]}isSelected(){return this.nodes[0].annotationMap.has(a.SELECTION_RANGE)}}g.register(p.DELETE_CODE_BLOCK,gt.name,new class extends L{handleAction(t,e){const s=e.nodes[0],n=e.parent;if(n){let t=this.getPreviousNode(s),i=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),i=0),n.apply(new C(e));const r=t?d.getDOMByEntity(t):null;if(0===n.blocks.length){const s=wt.from({id:o(),type:"paragraph",nodes:[{id:o(),type:"text",text:""}]});e.parent.apply(new B([s])),t=s.nodes[0],i=0}this.notifyUpdateSelection(t,r,i,e)}}notifyUpdateSelection(t,n,r,o){const c=d.getDOMByEntity(o);if(c){const o=s.getSubjectFromParentNodeByEventId(c,i);o&&e.notify(o,{node:t,updateDirectly:!!n,offset:r})}}getRTENodeEndOffset(t){return t&&"CODE_BLOCK_NODE"!==t.type?"IMAGE"!==t.type?t.text.length:1:0}}),g.register(p.DELETE_CHILD,gt.name,new b),g.register(p.SWITCH_OUT_FROM_CODE_BLOCK,gt.name,new class extends T{handleAction(t,n){const{content:r,language:c}=t,a=r.split("\n"),h=new xt(a.slice(0,a.length-2).join("\n"),c);h.isFlushable=!1,n.nodes[0].apply(h);const l=wt.from({id:o(),type:"paragraph",nodes:[{id:o(),text:"",type:"text"}]});n.parent.apply(new R(n,l));const u=d.getDOMByEntity(n);if(u){const t=s.getSubjectFromParentNodeByEventId(u,i);t&&e.notify(t,{node:l.nodes[0]})}}}),g.register(p.INSERT_IMAGE_TO_BLOCK,gt.name,new class extends T{handleAction(t,e){e.parent.apply(new R(e,t.imageBlockToBeInserted))}}),gt.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{E as $,T as A,L as B,S as C,At as D,$ as E,z as F,Et as G,m as H,R as I,ct as J,J as K,nt as L,x as M,w as N,H as O,ot as P,rt as Q,C as R,K as S,j as T,xt as U,W as V,h as W,tt as X,et as Y,U as Z,v as _,_ as a,A as a0,Q as a1,ut as a2,M as b,B as c,wt as d,F as e,p as f,it as g,pt as h,O as i,g as j,I as k,b as l,k as m,D as n,ft as o,dt as p,ht as q,lt as r,at as s,Y as t,gt as u,N as v,d as w,u as x,y,a as z}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as r}from"./p-
|
|
1
|
+
import{V as r}from"./p-fecb4044.js";import{I as e}from"./p-abd7aeaa.js";class i extends e{evaluate(r){var e,i;if(!this.isAcceptedInputType(r))throw new Error(`Invalid value ${r} for rich text editor`);const t=(null===(e=null==r?void 0:r.blocks)||void 0===e?void 0:e.length)>1||1===(null===(i=null==r?void 0:r.blocks)||void 0===i?void 0:i.length)&&r.blocks.some((r=>r.isNotEmpty()));return{isValid:t,message:t?"":"This field is required"}}canEvaluate(r,e){return e?this.isAcceptedInputType(r)&&!e.disabled&&e.visible:this.isAcceptedInputType(r)}shouldShowError(r){return!r.disabled&&r.visible&&(r.touched||r.modified)}isAcceptedInputType(e){return null==e||e instanceof r}}export{i as R}
|