@globalpayments/vega 2.59.1 → 2.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-64aff1a9.js → app-globals-8a3536ba.js} +3 -3
- package/dist/cjs/{code-block-4bfae76d.js → code-block-7d901dfc.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-34f4577a.js → component-value-history-controller-slimmer.abstract-d61e5129.js} +2 -2
- package/dist/cjs/{content-state-b82b74de.js → content-state-2096aa5a.js} +2 -2
- package/dist/cjs/{design-token-0b1315f2.js → design-token-52f9da81.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-f14737af.js → element-appender-slimmer-2a3e1e51.js} +2 -2
- package/dist/cjs/{image-annotation-action-a3146135.js → image-annotation-action-8c1ecc99.js} +2 -2
- package/dist/cjs/index.cjs.js +8 -9
- package/dist/cjs/{inject-keyboard-manager-70382bae.js → inject-keyboard-manager-ad865c95.js} +1 -1
- package/dist/cjs/{keyboard-manager-6858915b.js → keyboard-manager-7f4e1f43.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-faca2038.js → keyboard-manager-slimmer-138a90e5.js} +1 -1
- package/dist/cjs/loader.cjs.js +6 -7
- package/dist/cjs/{public-rules-26467413.js → public-rules-c711fae3.js} +4 -5
- package/dist/cjs/{responsive-format-facade-d2e03695.js → responsive-format-facade-3ab3b18c.js} +2 -2
- package/dist/cjs/{rich-text-editor-required-rule-026c8c3f.js → rich-text-editor-required-rule-4d92437f.js} +1 -1
- package/dist/cjs/{state-background-color-formatter-c57409ea.js → state-background-color-formatter-aa5570f6.js} +1 -1
- package/dist/cjs/string-format-strategy.abstract-07a95352.js +60 -0
- package/dist/cjs/{string-input-formatter-slimmer-1b757bad.js → string-input-formatter-slimmer-941eaec2.js} +1 -224
- package/dist/cjs/string-mask-strategy-6bdad95e.js +172 -0
- package/dist/cjs/{style-formatter-effb0730.js → style-formatter-dcb443fb.js} +2 -2
- package/dist/cjs/{type-guard-aa8fdeaf.js → type-guard-f12b5bae.js} +13 -3
- package/dist/cjs/{valid-credit-card-number-rule-4a1b00b8.js → valid-credit-card-number-rule-ce5c9147.js} +9 -9
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +6 -7
- package/dist/cjs/vega-box.cjs.entry.js +7 -8
- package/dist/cjs/vega-button-circle.cjs.entry.js +6 -7
- package/dist/cjs/vega-button.cjs.entry.js +4 -5
- package/dist/cjs/vega-calendar_4.cjs.entry.js +14 -4
- package/dist/cjs/vega-card.cjs.entry.js +6 -7
- package/dist/cjs/vega-carousel.cjs.entry.js +4 -5
- package/dist/cjs/vega-chip.cjs.entry.js +6 -7
- package/dist/cjs/vega-code-block.cjs.entry.js +5 -6
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -4
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +36 -11
- package/dist/cjs/vega-dialog_2.cjs.entry.js +6 -7
- package/dist/cjs/vega-divider.cjs.entry.js +6 -7
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -8
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -7
- package/dist/cjs/vega-flex.cjs.entry.js +7 -8
- package/dist/cjs/vega-font.cjs.entry.js +6 -7
- package/dist/cjs/vega-grid.cjs.entry.js +6 -7
- package/dist/cjs/vega-icon.cjs.entry.js +6 -7
- package/dist/cjs/vega-image-uploader.cjs.entry.js +4 -5
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +241 -12
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -4
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +110 -21
- package/dist/cjs/vega-input-select.cjs.entry.js +4 -5
- package/dist/cjs/vega-input.cjs.entry.js +16 -191
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +6 -7
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -5
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -5
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -10
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -4
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +4 -5
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +8 -9
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -5
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -5
- package/dist/cjs/vega-signature-capture.cjs.entry.js +6 -7
- package/dist/cjs/vega-table_8.cjs.entry.js +4 -5
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +7 -8
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -8
- package/dist/cjs/vega.cjs.js +6 -7
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.js +12 -1
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +11 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +4 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker.js +43 -0
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.js +4 -11
- package/dist/collection/components/vega-input/vega-input.js +1 -1
- package/dist/collection/components/vega-input-credit-card/vega-input-credit-card.js +6 -3
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/phone-number-input-renderer.js +3 -16
- package/dist/collection/constants/card-config.js +4 -4
- package/dist/collection/helpers/formatter/string-formatter/credit-card-blur-mask-strategy.js +1 -1
- package/dist/collection/helpers/formatter/string-formatter/vega-phone-number-input-strategy.js +104 -0
- package/dist/collection/helpers/formatter/test/string-formatter/vega-phone-number-input-strategy.test.js +43 -0
- package/dist/esm/{app-globals-05dbca3e.js → app-globals-c7699395.js} +3 -3
- package/dist/esm/{code-block-3d519665.js → code-block-055cae13.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-8b5be007.js → component-value-history-controller-slimmer.abstract-7a64c05a.js} +2 -2
- package/dist/esm/{content-state-73900a67.js → content-state-460f6254.js} +2 -2
- package/dist/esm/{design-token-dbc8c235.js → design-token-e1821e4a.js} +3 -3
- package/dist/esm/{element-appender-slimmer-6ad38a9b.js → element-appender-slimmer-4260c020.js} +2 -2
- package/dist/esm/{image-annotation-action-4ebed11f.js → image-annotation-action-95cc9118.js} +2 -2
- package/dist/esm/index.js +8 -9
- package/dist/esm/{inject-keyboard-manager-a28dfee4.js → inject-keyboard-manager-109817bf.js} +1 -1
- package/dist/esm/{keyboard-manager-fa6355cb.js → keyboard-manager-ab521d22.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-818050ee.js → keyboard-manager-slimmer-cae3a002.js} +1 -1
- package/dist/esm/loader.js +6 -7
- package/dist/esm/{public-rules-f28aca10.js → public-rules-71e1883d.js} +4 -5
- package/dist/esm/{responsive-format-facade-81b72f39.js → responsive-format-facade-dbeffcd6.js} +2 -2
- package/dist/esm/{rich-text-editor-required-rule-c4ba68b8.js → rich-text-editor-required-rule-6cfdcaaf.js} +1 -1
- package/dist/esm/{state-background-color-formatter-da5e76e8.js → state-background-color-formatter-0f01d27a.js} +1 -1
- package/dist/esm/string-format-strategy.abstract-452f4398.js +58 -0
- package/dist/esm/{string-input-formatter-slimmer-b144e8d7.js → string-input-formatter-slimmer-6d99bb4f.js} +2 -223
- package/dist/esm/string-mask-strategy-6232a1c1.js +170 -0
- package/dist/esm/{style-formatter-7d817448.js → style-formatter-41ca4df2.js} +2 -2
- package/dist/esm/{type-guard-84b1f192.js → type-guard-12f7654b.js} +8 -2
- package/dist/esm/{valid-credit-card-number-rule-cc497bec.js → valid-credit-card-number-rule-81443274.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -7
- package/dist/esm/vega-app-header-button.entry.js +6 -7
- package/dist/esm/vega-box.entry.js +7 -8
- package/dist/esm/vega-button-circle.entry.js +6 -7
- package/dist/esm/vega-button.entry.js +4 -5
- package/dist/esm/vega-calendar_4.entry.js +14 -4
- package/dist/esm/vega-card.entry.js +6 -7
- package/dist/esm/vega-carousel.entry.js +4 -5
- package/dist/esm/vega-chip.entry.js +6 -7
- package/dist/esm/vega-code-block.entry.js +5 -6
- package/dist/esm/vega-combo-box.entry.js +3 -4
- package/dist/esm/vega-date-picker_2.entry.js +35 -10
- package/dist/esm/vega-dialog_2.entry.js +6 -7
- package/dist/esm/vega-divider.entry.js +6 -7
- package/dist/esm/vega-dropdown_5.entry.js +7 -8
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +6 -7
- package/dist/esm/vega-flex.entry.js +7 -8
- package/dist/esm/vega-font.entry.js +6 -7
- package/dist/esm/vega-grid.entry.js +6 -7
- package/dist/esm/vega-icon.entry.js +6 -7
- package/dist/esm/vega-image-uploader.entry.js +4 -5
- package/dist/esm/vega-input-credit-card.entry.js +240 -11
- package/dist/esm/vega-input-numeric.entry.js +3 -4
- package/dist/esm/vega-input-phone-number.entry.js +110 -21
- package/dist/esm/vega-input-select.entry.js +4 -5
- package/dist/esm/vega-input.entry.js +10 -185
- package/dist/esm/vega-left-nav_5.entry.js +6 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -5
- package/dist/esm/vega-pagination.entry.js +4 -5
- package/dist/esm/vega-popover_2.entry.js +9 -10
- package/dist/esm/vega-radio_2.entry.js +3 -4
- package/dist/esm/vega-rich-text-content.entry.js +4 -5
- package/dist/esm/vega-rich-text-editor_4.entry.js +8 -9
- package/dist/esm/vega-selection-chip_2.entry.js +4 -5
- package/dist/esm/vega-sidenav_3.entry.js +4 -5
- package/dist/esm/vega-signature-capture.entry.js +6 -7
- package/dist/esm/vega-table_8.entry.js +4 -5
- package/dist/esm/vega-time-picker_2.entry.js +7 -8
- package/dist/esm/vega-tooltip_2.entry.js +7 -8
- package/dist/esm/vega.js +6 -7
- package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.d.ts +1 -0
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +1 -0
- package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +14 -0
- package/dist/types/components/vega-input/types.d.ts +3 -10
- package/dist/types/components.d.ts +14 -0
- package/dist/types/helpers/formatter/string-formatter/vega-phone-number-input-strategy.d.ts +49 -0
- package/dist/types/helpers/formatter/test/string-formatter/vega-phone-number-input-strategy.test.d.ts +1 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-0dcec258.js +1 -0
- package/dist/vega/p-10063072.entry.js +1 -0
- package/dist/vega/p-1152850b.entry.js +1 -0
- package/dist/vega/p-165054fb.entry.js +1 -0
- package/dist/vega/p-1652cfc6.entry.js +1 -0
- package/dist/vega/p-16c6c22f.entry.js +1 -0
- package/dist/vega/p-1852ca80.entry.js +1 -0
- package/dist/vega/p-1b222c94.entry.js +1 -0
- package/dist/vega/{p-ca30b996.js → p-1b91a882.js} +1 -1
- package/dist/vega/{p-86f17433.js → p-1cabeb33.js} +1 -1
- package/dist/vega/p-1f8c46c4.entry.js +1 -0
- package/dist/vega/p-1fdf0f74.entry.js +1 -0
- package/dist/vega/{p-63c9eb58.js → p-200ba358.js} +1 -1
- package/dist/vega/p-20b8b626.entry.js +1 -0
- package/dist/vega/{p-8baacfc5.js → p-21873037.js} +1 -1
- package/dist/vega/{p-b40adb9e.js → p-2608b9fe.js} +1 -1
- package/dist/vega/{p-0f0baac3.js → p-27dfa896.js} +1 -1
- package/dist/vega/p-2e4bc8aa.entry.js +1 -0
- package/dist/vega/p-334e31a3.entry.js +1 -0
- package/dist/vega/p-394dfa02.entry.js +1 -0
- package/dist/vega/p-433ea113.entry.js +1 -0
- package/dist/vega/p-460bbd22.entry.js +1 -0
- package/dist/vega/p-46973cf9.entry.js +1 -0
- package/dist/vega/p-52c1dde9.entry.js +1 -0
- package/dist/vega/p-594ecdab.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-62898294.entry.js +1 -0
- package/dist/vega/p-636f7b17.entry.js +1 -0
- package/dist/vega/p-68eae19d.entry.js +1 -0
- package/dist/vega/p-69119f58.entry.js +1 -0
- package/dist/vega/p-6b71d5d1.entry.js +1 -0
- package/dist/vega/p-71f9c4d4.js +1 -0
- package/dist/vega/{p-59e990c7.entry.js → p-741a8b61.entry.js} +1 -1
- package/dist/vega/{p-436f7e27.js → p-743c5baf.js} +1 -1
- package/dist/vega/{p-1a195e28.js → p-7e4fdccb.js} +1 -1
- package/dist/vega/p-824a06ba.js +1 -0
- package/dist/vega/{p-42033e59.js → p-8539e05e.js} +1 -1
- package/dist/vega/p-867a4970.js +1 -0
- package/dist/vega/{p-bdce4143.js → p-95ac7c7e.js} +1 -1
- package/dist/vega/p-95c30aed.entry.js +1 -0
- package/dist/vega/{p-6f90d444.js → p-9ce249a9.js} +1 -1
- package/dist/vega/{p-f6d25220.js → p-a433fef4.js} +1 -1
- package/dist/vega/p-af2de012.entry.js +1 -0
- package/dist/vega/p-b1faebe0.js +1 -0
- package/dist/vega/p-b56e2c89.entry.js +1 -0
- package/dist/vega/p-b8f50c69.entry.js +1 -0
- package/dist/vega/p-b9821a7f.entry.js +1 -0
- package/dist/vega/p-c883bce1.entry.js +1 -0
- package/dist/vega/p-cc2ceaa8.entry.js +1 -0
- package/dist/vega/{p-7f087c8b.js → p-d1ebec08.js} +1 -1
- package/dist/vega/{p-fc8badd3.entry.js → p-d35243c8.entry.js} +1 -1
- package/dist/vega/p-dbe5daa7.js +1 -0
- package/dist/vega/p-dd6a4ea6.entry.js +1 -0
- package/dist/vega/p-e3bb1cce.entry.js +13 -0
- package/dist/vega/p-e45f8a67.entry.js +1 -0
- package/dist/vega/p-e4fbd2b7.entry.js +1 -0
- package/dist/vega/p-eaa43f31.entry.js +1 -0
- package/dist/vega/p-ed50233f.entry.js +1 -0
- package/dist/vega/p-f1a2658b.entry.js +1 -0
- package/dist/vega/p-fc4c5265.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +4 -3
- package/dist/cjs/card-config-2ee5505e.js +0 -65
- package/dist/cjs/regex-c1f70fd4.js +0 -15
- package/dist/esm/card-config-d2ad484e.js +0 -63
- package/dist/esm/regex-dfe11abf.js +0 -8
- package/dist/vega/p-12ed3141.entry.js +0 -1
- package/dist/vega/p-13eca7f3.entry.js +0 -1
- package/dist/vega/p-1ff1deaf.entry.js +0 -1
- package/dist/vega/p-2004317b.entry.js +0 -1
- package/dist/vega/p-29e0d4c8.entry.js +0 -1
- package/dist/vega/p-369f38ed.entry.js +0 -1
- package/dist/vega/p-36ed226a.js +0 -1
- package/dist/vega/p-3a0a4d15.js +0 -1
- package/dist/vega/p-4452e085.js +0 -1
- package/dist/vega/p-490f5e3f.entry.js +0 -1
- package/dist/vega/p-4996b853.entry.js +0 -1
- package/dist/vega/p-49fd1009.js +0 -1
- package/dist/vega/p-4fb159d5.js +0 -1
- package/dist/vega/p-51cce3f9.entry.js +0 -1
- package/dist/vega/p-53d67971.entry.js +0 -1
- package/dist/vega/p-555804a0.entry.js +0 -1
- package/dist/vega/p-5e2c9e69.js +0 -1
- package/dist/vega/p-675b9501.entry.js +0 -1
- package/dist/vega/p-707bb905.entry.js +0 -1
- package/dist/vega/p-7183bd72.entry.js +0 -1
- package/dist/vega/p-73b487b0.entry.js +0 -1
- package/dist/vega/p-76de6b00.entry.js +0 -1
- package/dist/vega/p-7b1bb372.entry.js +0 -1
- package/dist/vega/p-8a317208.entry.js +0 -1
- package/dist/vega/p-9479866e.entry.js +0 -1
- package/dist/vega/p-9f453b90.entry.js +0 -1
- package/dist/vega/p-a204a2b2.js +0 -1
- package/dist/vega/p-a328d448.entry.js +0 -1
- package/dist/vega/p-ad1b22b4.entry.js +0 -1
- package/dist/vega/p-ae415e7e.entry.js +0 -1
- package/dist/vega/p-be8bbaa5.entry.js +0 -1
- package/dist/vega/p-bf6187f7.entry.js +0 -1
- package/dist/vega/p-c5c5509c.entry.js +0 -13
- package/dist/vega/p-c9c2c8c6.entry.js +0 -1
- package/dist/vega/p-cc20f01f.entry.js +0 -1
- package/dist/vega/p-d3bcaa82.entry.js +0 -1
- package/dist/vega/p-dbb06804.entry.js +0 -1
- package/dist/vega/p-df647e48.entry.js +0 -1
- package/dist/vega/p-e989ce94.entry.js +0 -1
- package/dist/vega/p-e9d2e0dc.entry.js +0 -1
- package/dist/vega/p-f6b11a21.entry.js +0 -1
- package/dist/vega/p-f8e62e5e.entry.js +0 -1
- package/dist/vega/p-fd6f90fd.entry.js +0 -1
- package/dist/vega/p-ffaee583.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-b5822a21.js";import{b as n,c as s}from"./p-b5bef48a.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-5e2c9e69.js";import{g as a}from"./p-a4670e23.js";import{V as c}from"./p-7e8f055d.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-575235c8.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const g=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const n=this.rootDomToContentEntity.get(t);n&&n!==e&&this.contentEntityToRootDom.delete(n),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var x,m,w,A;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_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.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",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",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE"}(x||(x={}));class y{constructor(){this.isFlushable=!1}}class E extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new E("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone())))})),t}toString(t,e){const n=this.toJsx(t,e);return Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${r(t)}="${n}"`})).join(" ")}toJsx(t,e){const n=this.getStyle(t,e),s=this.getClass(t,e),r=this.getAttribute(t,e);return s.length>0&&(r.class=s.join(" ")),n&&Object.keys(n).length>0&&(r.style=n),r}getClass(t,e){const n=[];return t.link.customClass&&n.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&n.push("v-rte--link"),n}getStyle(t,e){const n={};return t.link.customStyle&&Object.assign(n,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&(n.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),n}getAttribute(t,e){var n;const{href:s,customAttribute:r={}}=t.link,i=null===(n=null==e?void 0:e.autoMatchFormat)||void 0===n||n,o=r.target||(i?"_blank":"");return Object.assign(Object.assign(Object.assign({},r),s||i?{href:s}:{}),o?{target:o}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${r(t)}: ${e};`)).join(" ")}}class O extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new O(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new O(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class S extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new S(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new S(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class T{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n)}static get(t,e){const n=this.registry.get(e);if(n)return n.get(t)}static executeTheStrategy(t,e){const n=t instanceof y?t.type:t.constructor.name,s=T.get(n,e.constructor.name);if(s)return s.execute(t,e);i.error(`Type ${n} action handle strategy is not registered in class ${e.constructor.name}`)}}T.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(m||(m={}));class N extends p{}class C extends N{constructor(t){super(),this.type=m.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[m.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(o)}render(t={}){var e;const n=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete n[t])),Object.keys(n).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===n[t]&&(n[t]="true")})),n}}class v extends N{constructor(t){super(),this.type=m.CUSTOM_CLASS,this.customClass=t}static from(t){return[m.CUSTOM_CLASS,new v(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new v(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class b extends N{constructor(t){super(),this.type=m.CUSTOM_STYLE,this.customStyle=t}static from(t){return[m.CUSTOM_STYLE,new b(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new b(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class _ extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new _(t)]}clone(){return new _(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class L{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return O.from(e);case"indent":return S.from(e);case"customAttribute":return C.from(e);case"customClass":return v.from(e);case"customStyle":return b.from(e);case"internalWrapper":return _.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);o(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof E||t instanceof _))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof N)).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(s){if(this.doApply(s),s.isFlushable){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){return Object.assign(Object.assign({},Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof b)).map((e=>e.renderStyle(t))).filter(o).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof v)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(m.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const n=Object.entries(Object.assign({},this.getStyles({standalone:!0}))).map((([t,e])=>`${r(t)}: ${e};`)).join(""),s=this.annotationMap.get(m.CUSTOM_CLASS),i=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return i.length?` ${i.join(" ")}`:""}doApply(t){t instanceof y?T.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof E||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.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",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(w||(w={}));class R extends p{}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(A||(A={}));class I{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${n}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return C.from(e);case"customClass":return v.from(e);case"customStyle":return b.from(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}getStyles(t={standalone:!1}){const e=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof b)).map((e=>e.renderStyle(t))).filter(Boolean);return this.mergeAnnotationStyles(e,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof v)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(m.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}generateAttributeString(...t){var e;const n=Object.entries(Object.assign({},this.getStyles({standalone:!0}))).map((([t,e])=>`${r(t)}: ${e};`)).join(""),s=this.annotationMap.get(m.CUSTOM_CLASS),i=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return i.length?` ${i.join(" ")}`:""}doApply(t){t instanceof y?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}mergeAnnotationStyles(t,e){const n={};for(const s of t)for(const t in s){const r=s[t],i=n[t];n[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return n}}class B{}class $ extends B{constructor(){super(...arguments),this.doSplit=!0}}class D extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new D(this.range)}}class k extends R{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new k(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new k(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class M extends R{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new M(t)]}toJSON(){return{underline:this.underline}}clone(){return new M(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class j extends R{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)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class P extends R{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new P(t)]}toJSON(){return{bold:this.bold}}clone(){return new P(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class F extends R{constructor(t,e=!0){super(),this.type=w.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[w.CODE,new F(t,e)]}toJSON(){return{code:this.code}}clone(){return new F(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const H={key:"black",light:"#111128",dark:"#E3E3E8"},W=[H,{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"}],K="";class J extends R{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new J(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new J(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:c.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return W.find((e=>e.key===t))||W[0]}}class U extends R{constructor(t,e=!0){super(),this.type=w.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[w.LINK,new U(t,e)]}toJSON(){return{link:this.link}}clone(){return new U(this.link)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class G extends B{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new E(this.groupKey)}}class z extends B{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}const X=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof L)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof I))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class V{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(m.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new b(n.removeStyles(e)))}createNewParagraph(t){const e=X.getRTEBlockClass("paragraph");if(e)return e.from({id:a(),type:"paragraph",nodes:[{id:a(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,n){return e===t.children[0]&&0===n}isCaretPositionAtBlockEnd(t,e,n){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,n):this.isCaretPositionAtDecoratorBlockEnd(t,e,n)}isCaretPositionAtTextBlockEnd(t,e,n){const s=t.children[t.children.length-1];return e===s&&(e.isEmpty()||n===s.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,n){return e===t.children[t.children.length-1]&&0!==n}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class q extends y{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Y extends V{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof $&&t.doSplit&&n){const{startContainer:t,endContainer:s,startOffset:r,endOffset:i}=n.range,o=t===s&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(n.range)){const s=this.splitTextNode(n.range,e);return t.annotationMap.has("LINK")&&t.apply(new q(s)),s}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const n=e.cloneWithText("");return this.setApplyTargetNode(n),0===t?[n,e]:t===e.text.length?[e,n]:[e.cloneWithText(e.text.substring(0,t)),n,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:n,startOffset:s,endOffset:r}=t;return e!==n||s>0||r<(n.textContent?n.textContent.length:0)}splitTextNode(t,e){const{startContainer:n,endContainer:s,startOffset:r}=t,i=n.parentElement,o=s.parentElement,a=(t,n,s)=>{const r=t.substring(0,n),i=t.substring(n,s),o=t.substring(s);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},c=i&&g.getEntityByDOM(i),l=o&&g.getEntityByDOM(o);if(c&&c.id===e.id){const i=n===s?t.endOffset:e.text.length,[o,c,l]=a(e.text,r,i);return this.setApplyTargetNode(c),[o,c,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[n,s,r]=a(e.text,0,t.endOffset);return this.setApplyTargetNode(s),[n,s,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Q extends ${constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new P(this.bold)}}class Z extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE,m.CUSTOM_STYLE]}}class tt extends ${constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Z}}class et extends ${constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new F(this.code)}}class nt extends B{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class st extends ${constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new j(this.italic)}}class rt extends ${constructor({link:t,newText:e,needMergeNode:n,doSplit:s,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=n,this.newText=e,this.type=r,o(s)&&(this.doSplit=s)}toAnnotation(){return new U(this.link)}}class it extends ${constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new k(this.strikethrough)}}class ot extends ${constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new M(this.underline)}}class at extends V{handleAction(t,e){const n=t.toAnnotation();if(t instanceof nt)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof Z))return n instanceof R||n instanceof D?(t instanceof rt&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new G(t.link.groupKey,[e],t.type))),t instanceof et&&this.handleAction(new tt,e),t instanceof Q&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof st&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ot||t instanceof it)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class ct extends y{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class lt extends V{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new ct)}}class ht extends y{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class ut extends V{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,n){if(e&&e.startContainer&&e.endContainer){const{startContainer:s,endContainer:r,startOffset:i,endOffset:o}=e;let a=n.text;if(s===r&&i===o&&t)a=n.text.slice(0,i)+t+n.text.slice(i);else{const e=s.parentElement,c=r.parentElement,l=e&&g.getEntityByDOM(e),h=c&&g.getEntityByDOM(c);let u=0,d=n.text.length;l&&l===n?(u=i,d=s===r?o:d):h&&h===n&&(d=o),a=n.text.slice(0,u)+t+n.text.slice(d)}n.apply(new ht(a))}}}class dt extends p{constructor(t){super(),this.type=w.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new dt(e);return o.child=n?dt.from(n)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?v.from(r)[1]:void 0,o.customStyle=s?b.from(s)[1]:void 0,[w.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new dt(this.htmlTag);return r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(n=this.customClass)||void 0===n?void 0:n.clone(),r.customStyle=null===(s=this.customStyle)||void 0===s?void 0:s.clone(),r}toJSON(){var t,e,n,s;return{inlineHtml:l({htmlTag:this.htmlTag,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(n=this.customClass)||void 0===n?void 0:n.toJSON().customClass,customStyle:null===(s=this.customStyle)||void 0===s?void 0:s.toJSON().customStyle})}}}class pt extends V{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const s=e.annotationMap.get("LINK").link.groupKey,r=n.linkGroups.get(s);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),n.linkGroups.set(s,r))}}}}class ft extends V{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const t=e.annotationMap.get(w.LINK).link.groupKey,s=n.linkGroups.get(t);if(s){const r=s.indexOf(e);-1!==r&&s.splice(r,1),0===s.length&&n.linkGroups.delete(t),0===n.linkGroups.size&&e.parent.annotationMap.delete(u.LINK_GROUP)}}e.annotationMap.delete(w.LINK)}}class gt extends R{constructor(t){super(),this.type=w.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[w.PLAIN_TEXT,new gt(t)]}clone(){return new gt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return{plainText:this.plainText}}}class xt extends I{constructor(t,e,n,s){super(t,s),this.type=A.TEXT,this.parent=n,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,n={autoMatchFormat:!0}){const s=new xt(t.id,t.text,e),{annotations:r}=t;return r&&(s.annotationMap=new Map(Object.keys(r).map((t=>("link"===t&&r.link&&e&&e.apply(new G(r.link.groupKey,[s],"link")),this.createAnnotationEntity(t,r[t],n)))).filter(o))),s}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return P.from(e);case"italic":return j.from(e);case"underline":return M.from(e);case"strikethrough":return k.from(e);case"code":return F.from(e,s);case"textColor":return J.from(e);case"link":return U.from(e,s);case"inlineHtml":return dt.from(e);case"plainText":return gt.from(e)}return I.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof N||t instanceof dt)).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})}toHtml(){const t=this.getAnnotationByType(w.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new xt(a(),t,this.parent,super.cloneAnnotations())}clone(){return new xt(this.id,this.text,this.parent,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=g.getDOMByEntity(this);if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}registerModifyStrategy(){const t=this.constructor.name;xt.registerActionStrategyStatus[t]||(this.isContentEditable()&&(T.register(x.UPDATE_TEXT,t,new lt),T.register(x.REPLACE_SELECTED_TEXT,t,new ut),T.register($.name,t,new Y)),T.register(x.LINK_GROUP_NODE_SPLIT,t,new pt),T.register(x.DELETE_LINK_GROUP,t,new ft),T.register(B.name,t,new at),xt.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof $&&t.doSplit&&e){const e=T.get($.name,this.constructor.name);if(e){const n=e.execute(t,this);n&&this.applyActionToNode(n,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){T.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof z)return void this.syncUpSelectedNodes(t);n instanceof D||this.syncUpSelectedNodes(t);const s=T.get(B.name,xt.name);s&&s.execute(e,t)}syncUpSelectedNodes(n){const r=g.getDOMByEntity(this);if(r){const i=e.getSubjectFromParentNodeByEventId(r,s);i&&t.notify(i,{node:n})}}renderWithWrapperStr(t){const{htmlTag:e,customAttribute:n,customClass:s,customStyle:r,child:i}=t,a=[...(null==n?void 0:n.toString())||[],null==s?void 0:s.toString(),null==r?void 0:r.toString()].filter(o),c=a.length>0?` ${a.join(" ")}`:"";return i?`<${e}${c}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${c}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(w.CODE))||void 0===t?void 0:t.code)?"code":"span",n=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${n}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(w.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof R&&!(t instanceof U)&&!(t instanceof gt)||t instanceof N)).length}}xt.registerActionStrategyStatus={},xt.htmlTag="span";class mt extends y{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};switch(this.textStyle){case"paragraph":return e;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",marginTop:"0px",marginBottom:"0px"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"}}}}class At extends B{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class yt extends y{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Et extends y{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Ot extends V{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,n){if(t){const s=t.text.slice(0,e),r=t.text.slice(e),i=n.children.indexOf(t);if(i>-1){const e=n.children.slice(0,i),o=n.children.slice(i+1);s&&e.push(t.cloneWithText(s)),r&&o.unshift(t.cloneWithText(r)),n.apply(new Et(e));const a=n.cloneWithNodes(o);return n.parent.apply(new yt(n,a)),a}}}}class St extends V{handleAction(t,e){e.children=[],e.apply(new mt(t.newChildNodes))}}class Tt extends y{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Nt extends V{handleAction(t,e){const n=t.blockNeedToBeMerged;if(e.type===n.type||"image"!==e.type&&"image"!==n.type){let t=n.children;"image"!==n.type&&(t=n.children.filter((t=>t.text))),e.apply(new mt(t)),n.parent.apply(new Tt(n))}}}class Ct extends V{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new xt(a(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const e=n.children.slice(0,o),a=n.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&a.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,s,a,n)}return s}}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new xt(a(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new Et([...t,e,...n]))}}class vt extends V{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new xt(a(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(n,s,r,e),s}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Tt(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new xt(a(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new Et([...t,e,...n]))}}class bt extends y{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class _t extends y{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class Lt extends B{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new O(this.textAlign)}}class Rt extends V{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class It extends B{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new S(this.indent)}}class Bt extends L{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=Bt.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new Bt(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(s=null===(n=t.annotations)||void 0===n?void 0:n.textStyle)&&void 0!==s?s:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const n=X.getRTENodeClass(t.type);if(n)return n.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.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.children=this.children.reduce(((e,n)=>{const s=e.at(-1);if(t instanceof rt&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(w.LINK),r=n.getAnnotationByType(w.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,n]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),n=super.generateAttributeString(),s=this.getAnnotationByType(u.LINK_GROUP);let r=this.children.map((t=>t.toHtml())).join("");return s&&this.children.length>0&&(r=this.generateLinkHtml(s,r,t)),super.shouldRenderAsInternalWrapper()?r:[`<${e}${n}>`,r,`</${e}>`].join("")}cloneWithNodes(t){const e=new Bt(a(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new mt(t)),e}clone(){const t=new Bt(this.id,this.type);return t.children=this.children.map((e=>{const n=e.clone();return n.parent=t,n})),t.annotationMap=super.cloneAnnotations(),t.parent=this.parent,t}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}doAnnotationActionApply(t){const e=T.get(t.constructor.name,Bt.name);e&&e.execute(t,this)}generateLinkHtml(t,e,n){e="";let s=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(w.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(w.LINK):null;if(i){if(s.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,autoMatchFormat:null==n?void 0:n.autoMatchFormat});e+=[`<a${r?` ${r}`:""}>`,s.map((t=>t.toHtml())).join(""),"</a>"].join(""),s=[]}}else e+=this.children[r].toHtml()}return e}}T.register(At.name,Bt.name,new class extends V{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Q(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new nt(w.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}),T.register(Lt.name,Bt.name,new Rt),T.register(It.name,Bt.name,new class extends V{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),T.register(G.name,Bt.name,new class extends V{handleAction(t,e){let n=e.getAnnotationByType(u.LINK_GROUP);if("update_link"===t.type){if(n){const e=n.linkGroups.get(t.groupKey);e&&n.linkGroups.set(t.groupKey,[e[0]])}}else{if(n){const e=n.linkGroups.get(t.groupKey)||[];n.linkGroups.set(t.groupKey,[...e,...t.nodes])}else n=t.toAnnotation(),n.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(u.LINK_GROUP,n)}}}),T.register(x.UNLINK_LINK_GROUP,Bt.name,new class extends V{handleAction(t,e){const n=e.getAnnotationByType(u.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),T.register(x.SPLIT_BLOCK_WITH_NODE,Bt.name,new Ot),T.register(x.REPLACE_CHILD_NODES,Bt.name,new St),T.register(x.MERGE_TWO_BLOCKS_NODES,Bt.name,new Nt),T.register(x.LINE_BREAK_SINGLE_BLOCK,Bt.name,new Ct),T.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Bt.name,new vt),T.register(x.INSERT_IMAGE_TO_BLOCK,Bt.name,new class extends V{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new yt(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new bt(e,r));else{const t=new _t(n,s);e.apply(t),e.parent.apply(new yt(e,r))}}}),T.register(x.TRANSFORM_LIST_BLOCK,Bt.name,new class extends V{handleAction(t,e){const n=e.parent,s=n.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>n.toListItem(t)));s.apply(new mt(i)),n.apply(new yt(t.selectedBlocks[0],s)),r.forEach((t=>{t.parent.apply(new Tt(t))}))}});class $t extends V{getPreviousNode(t){const e=t.parent,n=e.children.indexOf(t);if(n>0)return e.children[n-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,n=e.children.indexOf(t);if(e.children[n+1])return e.children[n+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,n=e.children.indexOf(t),s=e.parent;if(e.isListItemBlock()){const t=s.parent;return 0===n&&Array.isArray(s.children)&&s.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===s}return 0===n&&Array.isArray(s.children)&&s.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}}class Dt extends y{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class kt extends B{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new D(this.range)}}class Mt extends I{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(Mt.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${Mt.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=g.getDOMByEntity(this);if(t)return h(t,`.${Mt.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}Mt.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",Mt.DECORATOR_NODE_CLASS="v-internal-decorator-node";class jt extends Mt{constructor(t,e,n,s){super(t),this.type=A.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(){return new jt(this.id,this.text,this.language,this.parent)}doAnnotationActionApply(t){T.executeTheStrategy(t,this)}doModifyActionApply(t){T.executeTheStrategy(t,this)}}T.register(x.UPDATE_CODE_BLOCK,jt.name,new class extends V{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),T.register(kt.name,jt.name,new class extends V{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var Pt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Pt||(Pt={}));class Ft extends V{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new Tt(e)))}}class Ht extends L{constructor(t,e,n){super(t),this.type="code-block",this.children=[new jt(`${t}-1`,e,n,this)]}static from(t){return new Ht(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(){const{language:t=Pt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(){const t=Ht.from(this.toJSON());return t.parent=this.parent,t}apply(s){if(s instanceof y&&T.executeTheStrategy(s,this),s.isFlushable){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(u.SELECTION_RANGE)}}T.register(x.DELETE_CODE_BLOCK,Ht.name,new class extends $t{handleAction(t,e){const n=e.children[0],s=e.parent;if(s){let t=this.getPreviousNode(n),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(n),r=0),s.apply(new Tt(e));const i=t?g.getDOMByEntity(t):null;if(0===s.children.length){const n=Bt.from({id:a(),type:"paragraph",nodes:[{id:a(),type:"text",text:""}]});e.parent.apply(new mt([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const a=g.getDOMByEntity(o);if(a){const o=e.getSubjectFromParentNodeByEventId(a,s);o&&t.notify(o,{node:n,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t&&"CODE_BLOCK_NODE"!==t.type?"IMAGE"!==t.type?t.text.length:1:0}}),T.register(x.DELETE_CHILDREN,Ht.name,new Ft),T.register(x.SWITCH_OUT_FROM_CODE_BLOCK,Ht.name,new class extends V{handleAction(n,r){const{content:i,language:o}=n,c=i.split("\n"),l=new Dt(c.slice(0,c.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=Bt.from({id:a(),type:"paragraph",nodes:[{id:a(),text:"",type:"text"}]});r.parent.apply(new yt(r,h));const u=g.getDOMByEntity(r);if(u){const n=e.getSubjectFromParentNodeByEventId(u,s);n&&t.notify(n,{node:h.children[0]})}}}),T.register(x.INSERT_IMAGE_TO_BLOCK,Ht.name,new class extends V{handleAction(t,e){e.parent.apply(new yt(e,t.imageBlockToBeInserted))}}),Ht.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{ot as $,V as A,Ct as B,b as C,$t as D,Ft as E,W as F,H as G,Lt as H,yt as I,I as J,Pt as K,rt as L,x as M,R as N,u as O,m as P,Dt as Q,Bt as R,z as S,kt as T,ht as U,$ as V,J as W,jt as X,Q as Y,K as Z,st as _,xt as a,At as a0,wt as a1,P as a2,tt as a3,et as a4,it as a5,It as a6,mt as b,T as c,vt as d,Ot as e,St as f,Nt as g,Tt as h,bt as i,f as j,d as k,L as l,v as m,C as n,Ht as o,w as p,Mt as q,A as r,g as s,N as t,B as u,Et as v,y as w,_t as x,Rt as y,X as z}
|
|
1
|
+
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-b5822a21.js";import{b as n,c as s}from"./p-b5bef48a.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-b1faebe0.js";import{g as a}from"./p-a4670e23.js";import{V as c}from"./p-7e8f055d.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-575235c8.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const g=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const n=this.rootDomToContentEntity.get(t);n&&n!==e&&this.contentEntityToRootDom.delete(n),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var x,m,w,A;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_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.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",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",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE"}(x||(x={}));class y{constructor(){this.isFlushable=!1}}class E extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new E("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone())))})),t}toString(t,e){const n=this.toJsx(t,e);return Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${r(t)}="${n}"`})).join(" ")}toJsx(t,e){const n=this.getStyle(t,e),s=this.getClass(t,e),r=this.getAttribute(t,e);return s.length>0&&(r.class=s.join(" ")),n&&Object.keys(n).length>0&&(r.style=n),r}getClass(t,e){const n=[];return t.link.customClass&&n.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&n.push("v-rte--link"),n}getStyle(t,e){const n={};return t.link.customStyle&&Object.assign(n,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&(n.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),n}getAttribute(t,e){var n;const{href:s,customAttribute:r={}}=t.link,i=null===(n=null==e?void 0:e.autoMatchFormat)||void 0===n||n,o=r.target||(i?"_blank":"");return Object.assign(Object.assign(Object.assign({},r),s||i?{href:s}:{}),o?{target:o}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${r(t)}: ${e};`)).join(" ")}}class O extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new O(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new O(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class S extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new S(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new S(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class T{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n)}static get(t,e){const n=this.registry.get(e);if(n)return n.get(t)}static executeTheStrategy(t,e){const n=t instanceof y?t.type:t.constructor.name,s=T.get(n,e.constructor.name);if(s)return s.execute(t,e);i.error(`Type ${n} action handle strategy is not registered in class ${e.constructor.name}`)}}T.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(m||(m={}));class N extends p{}class C extends N{constructor(t){super(),this.type=m.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[m.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(o)}render(t={}){var e;const n=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete n[t])),Object.keys(n).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===n[t]&&(n[t]="true")})),n}}class v extends N{constructor(t){super(),this.type=m.CUSTOM_CLASS,this.customClass=t}static from(t){return[m.CUSTOM_CLASS,new v(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new v(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class b extends N{constructor(t){super(),this.type=m.CUSTOM_STYLE,this.customStyle=t}static from(t){return[m.CUSTOM_STYLE,new b(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new b(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class _ extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new _(t)]}clone(){return new _(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class L{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return O.from(e);case"indent":return S.from(e);case"customAttribute":return C.from(e);case"customClass":return v.from(e);case"customStyle":return b.from(e);case"internalWrapper":return _.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);o(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof E||t instanceof _))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof N)).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(s){if(this.doApply(s),s.isFlushable){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){return Object.assign(Object.assign({},Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof b)).map((e=>e.renderStyle(t))).filter(o).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof v)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(m.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const n=Object.entries(Object.assign({},this.getStyles({standalone:!0}))).map((([t,e])=>`${r(t)}: ${e};`)).join(""),s=this.annotationMap.get(m.CUSTOM_CLASS),i=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return i.length?` ${i.join(" ")}`:""}doApply(t){t instanceof y?T.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof E||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.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",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(w||(w={}));class R extends p{}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(A||(A={}));class I{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${n}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return C.from(e);case"customClass":return v.from(e);case"customStyle":return b.from(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}getStyles(t={standalone:!1}){const e=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof b)).map((e=>e.renderStyle(t))).filter(Boolean);return this.mergeAnnotationStyles(e,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof v)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(m.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}generateAttributeString(...t){var e;const n=Object.entries(Object.assign({},this.getStyles({standalone:!0}))).map((([t,e])=>`${r(t)}: ${e};`)).join(""),s=this.annotationMap.get(m.CUSTOM_CLASS),i=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return i.length?` ${i.join(" ")}`:""}doApply(t){t instanceof y?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}mergeAnnotationStyles(t,e){const n={};for(const s of t)for(const t in s){const r=s[t],i=n[t];n[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return n}}class B{}class $ extends B{constructor(){super(...arguments),this.doSplit=!0}}class D extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new D(this.range)}}class k extends R{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new k(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new k(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class M extends R{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new M(t)]}toJSON(){return{underline:this.underline}}clone(){return new M(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class j extends R{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)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class P extends R{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new P(t)]}toJSON(){return{bold:this.bold}}clone(){return new P(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class F extends R{constructor(t,e=!0){super(),this.type=w.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[w.CODE,new F(t,e)]}toJSON(){return{code:this.code}}clone(){return new F(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const H={key:"black",light:"#111128",dark:"#E3E3E8"},W=[H,{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"}],K="";class J extends R{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new J(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new J(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:c.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return W.find((e=>e.key===t))||W[0]}}class U extends R{constructor(t,e=!0){super(),this.type=w.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[w.LINK,new U(t,e)]}toJSON(){return{link:this.link}}clone(){return new U(this.link)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class G extends B{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new E(this.groupKey)}}class z extends B{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}const X=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof L)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof I))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class V{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(m.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new b(n.removeStyles(e)))}createNewParagraph(t){const e=X.getRTEBlockClass("paragraph");if(e)return e.from({id:a(),type:"paragraph",nodes:[{id:a(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,n){return e===t.children[0]&&0===n}isCaretPositionAtBlockEnd(t,e,n){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,n):this.isCaretPositionAtDecoratorBlockEnd(t,e,n)}isCaretPositionAtTextBlockEnd(t,e,n){const s=t.children[t.children.length-1];return e===s&&(e.isEmpty()||n===s.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,n){return e===t.children[t.children.length-1]&&0!==n}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class q extends y{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Y extends V{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof $&&t.doSplit&&n){const{startContainer:t,endContainer:s,startOffset:r,endOffset:i}=n.range,o=t===s&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(n.range)){const s=this.splitTextNode(n.range,e);return t.annotationMap.has("LINK")&&t.apply(new q(s)),s}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const n=e.cloneWithText("");return this.setApplyTargetNode(n),0===t?[n,e]:t===e.text.length?[e,n]:[e.cloneWithText(e.text.substring(0,t)),n,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:n,startOffset:s,endOffset:r}=t;return e!==n||s>0||r<(n.textContent?n.textContent.length:0)}splitTextNode(t,e){const{startContainer:n,endContainer:s,startOffset:r}=t,i=n.parentElement,o=s.parentElement,a=(t,n,s)=>{const r=t.substring(0,n),i=t.substring(n,s),o=t.substring(s);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},c=i&&g.getEntityByDOM(i),l=o&&g.getEntityByDOM(o);if(c&&c.id===e.id){const i=n===s?t.endOffset:e.text.length,[o,c,l]=a(e.text,r,i);return this.setApplyTargetNode(c),[o,c,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[n,s,r]=a(e.text,0,t.endOffset);return this.setApplyTargetNode(s),[n,s,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Q extends ${constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new P(this.bold)}}class Z extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE,m.CUSTOM_STYLE]}}class tt extends ${constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Z}}class et extends ${constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new F(this.code)}}class nt extends B{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class st extends ${constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new j(this.italic)}}class rt extends ${constructor({link:t,newText:e,needMergeNode:n,doSplit:s,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=n,this.newText=e,this.type=r,o(s)&&(this.doSplit=s)}toAnnotation(){return new U(this.link)}}class it extends ${constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new k(this.strikethrough)}}class ot extends ${constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new M(this.underline)}}class at extends V{handleAction(t,e){const n=t.toAnnotation();if(t instanceof nt)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof Z))return n instanceof R||n instanceof D?(t instanceof rt&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new G(t.link.groupKey,[e],t.type))),t instanceof et&&this.handleAction(new tt,e),t instanceof Q&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof st&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ot||t instanceof it)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class ct extends y{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class lt extends V{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new ct)}}class ht extends y{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class ut extends V{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,n){if(e&&e.startContainer&&e.endContainer){const{startContainer:s,endContainer:r,startOffset:i,endOffset:o}=e;let a=n.text;if(s===r&&i===o&&t)a=n.text.slice(0,i)+t+n.text.slice(i);else{const e=s.parentElement,c=r.parentElement,l=e&&g.getEntityByDOM(e),h=c&&g.getEntityByDOM(c);let u=0,d=n.text.length;l&&l===n?(u=i,d=s===r?o:d):h&&h===n&&(d=o),a=n.text.slice(0,u)+t+n.text.slice(d)}n.apply(new ht(a))}}}class dt extends p{constructor(t){super(),this.type=w.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new dt(e);return o.child=n?dt.from(n)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?v.from(r)[1]:void 0,o.customStyle=s?b.from(s)[1]:void 0,[w.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new dt(this.htmlTag);return r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(n=this.customClass)||void 0===n?void 0:n.clone(),r.customStyle=null===(s=this.customStyle)||void 0===s?void 0:s.clone(),r}toJSON(){var t,e,n,s;return{inlineHtml:l({htmlTag:this.htmlTag,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(n=this.customClass)||void 0===n?void 0:n.toJSON().customClass,customStyle:null===(s=this.customStyle)||void 0===s?void 0:s.toJSON().customStyle})}}}class pt extends V{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const s=e.annotationMap.get("LINK").link.groupKey,r=n.linkGroups.get(s);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),n.linkGroups.set(s,r))}}}}class ft extends V{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const t=e.annotationMap.get(w.LINK).link.groupKey,s=n.linkGroups.get(t);if(s){const r=s.indexOf(e);-1!==r&&s.splice(r,1),0===s.length&&n.linkGroups.delete(t),0===n.linkGroups.size&&e.parent.annotationMap.delete(u.LINK_GROUP)}}e.annotationMap.delete(w.LINK)}}class gt extends R{constructor(t){super(),this.type=w.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[w.PLAIN_TEXT,new gt(t)]}clone(){return new gt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return{plainText:this.plainText}}}class xt extends I{constructor(t,e,n,s){super(t,s),this.type=A.TEXT,this.parent=n,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,n={autoMatchFormat:!0}){const s=new xt(t.id,t.text,e),{annotations:r}=t;return r&&(s.annotationMap=new Map(Object.keys(r).map((t=>("link"===t&&r.link&&e&&e.apply(new G(r.link.groupKey,[s],"link")),this.createAnnotationEntity(t,r[t],n)))).filter(o))),s}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return P.from(e);case"italic":return j.from(e);case"underline":return M.from(e);case"strikethrough":return k.from(e);case"code":return F.from(e,s);case"textColor":return J.from(e);case"link":return U.from(e,s);case"inlineHtml":return dt.from(e);case"plainText":return gt.from(e)}return I.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof N||t instanceof dt)).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})}toHtml(){const t=this.getAnnotationByType(w.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new xt(a(),t,this.parent,super.cloneAnnotations())}clone(){return new xt(this.id,this.text,this.parent,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=g.getDOMByEntity(this);if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}registerModifyStrategy(){const t=this.constructor.name;xt.registerActionStrategyStatus[t]||(this.isContentEditable()&&(T.register(x.UPDATE_TEXT,t,new lt),T.register(x.REPLACE_SELECTED_TEXT,t,new ut),T.register($.name,t,new Y)),T.register(x.LINK_GROUP_NODE_SPLIT,t,new pt),T.register(x.DELETE_LINK_GROUP,t,new ft),T.register(B.name,t,new at),xt.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof $&&t.doSplit&&e){const e=T.get($.name,this.constructor.name);if(e){const n=e.execute(t,this);n&&this.applyActionToNode(n,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){T.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof z)return void this.syncUpSelectedNodes(t);n instanceof D||this.syncUpSelectedNodes(t);const s=T.get(B.name,xt.name);s&&s.execute(e,t)}syncUpSelectedNodes(n){const r=g.getDOMByEntity(this);if(r){const i=e.getSubjectFromParentNodeByEventId(r,s);i&&t.notify(i,{node:n})}}renderWithWrapperStr(t){const{htmlTag:e,customAttribute:n,customClass:s,customStyle:r,child:i}=t,a=[...(null==n?void 0:n.toString())||[],null==s?void 0:s.toString(),null==r?void 0:r.toString()].filter(o),c=a.length>0?` ${a.join(" ")}`:"";return i?`<${e}${c}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${c}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(w.CODE))||void 0===t?void 0:t.code)?"code":"span",n=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${n}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(w.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof R&&!(t instanceof U)&&!(t instanceof gt)||t instanceof N)).length}}xt.registerActionStrategyStatus={},xt.htmlTag="span";class mt extends y{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};switch(this.textStyle){case"paragraph":return e;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",marginTop:"0px",marginBottom:"0px"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"}}}}class At extends B{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class yt extends y{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Et extends y{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Ot extends V{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,n){if(t){const s=t.text.slice(0,e),r=t.text.slice(e),i=n.children.indexOf(t);if(i>-1){const e=n.children.slice(0,i),o=n.children.slice(i+1);s&&e.push(t.cloneWithText(s)),r&&o.unshift(t.cloneWithText(r)),n.apply(new Et(e));const a=n.cloneWithNodes(o);return n.parent.apply(new yt(n,a)),a}}}}class St extends V{handleAction(t,e){e.children=[],e.apply(new mt(t.newChildNodes))}}class Tt extends y{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Nt extends V{handleAction(t,e){const n=t.blockNeedToBeMerged;if(e.type===n.type||"image"!==e.type&&"image"!==n.type){let t=n.children;"image"!==n.type&&(t=n.children.filter((t=>t.text))),e.apply(new mt(t)),n.parent.apply(new Tt(n))}}}class Ct extends V{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new xt(a(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const e=n.children.slice(0,o),a=n.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&a.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,s,a,n)}return s}}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new xt(a(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new Et([...t,e,...n]))}}class vt extends V{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new xt(a(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(n,s,r,e),s}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Tt(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new xt(a(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new Et([...t,e,...n]))}}class bt extends y{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class _t extends y{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class Lt extends B{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new O(this.textAlign)}}class Rt extends V{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class It extends B{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new S(this.indent)}}class Bt extends L{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=Bt.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new Bt(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(s=null===(n=t.annotations)||void 0===n?void 0:n.textStyle)&&void 0!==s?s:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const n=X.getRTENodeClass(t.type);if(n)return n.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.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.children=this.children.reduce(((e,n)=>{const s=e.at(-1);if(t instanceof rt&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(w.LINK),r=n.getAnnotationByType(w.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,n]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),n=super.generateAttributeString(),s=this.getAnnotationByType(u.LINK_GROUP);let r=this.children.map((t=>t.toHtml())).join("");return s&&this.children.length>0&&(r=this.generateLinkHtml(s,r,t)),super.shouldRenderAsInternalWrapper()?r:[`<${e}${n}>`,r,`</${e}>`].join("")}cloneWithNodes(t){const e=new Bt(a(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new mt(t)),e}clone(){const t=new Bt(this.id,this.type);return t.children=this.children.map((e=>{const n=e.clone();return n.parent=t,n})),t.annotationMap=super.cloneAnnotations(),t.parent=this.parent,t}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}doAnnotationActionApply(t){const e=T.get(t.constructor.name,Bt.name);e&&e.execute(t,this)}generateLinkHtml(t,e,n){e="";let s=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(w.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(w.LINK):null;if(i){if(s.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,autoMatchFormat:null==n?void 0:n.autoMatchFormat});e+=[`<a${r?` ${r}`:""}>`,s.map((t=>t.toHtml())).join(""),"</a>"].join(""),s=[]}}else e+=this.children[r].toHtml()}return e}}T.register(At.name,Bt.name,new class extends V{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Q(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new nt(w.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}),T.register(Lt.name,Bt.name,new Rt),T.register(It.name,Bt.name,new class extends V{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),T.register(G.name,Bt.name,new class extends V{handleAction(t,e){let n=e.getAnnotationByType(u.LINK_GROUP);if("update_link"===t.type){if(n){const e=n.linkGroups.get(t.groupKey);e&&n.linkGroups.set(t.groupKey,[e[0]])}}else{if(n){const e=n.linkGroups.get(t.groupKey)||[];n.linkGroups.set(t.groupKey,[...e,...t.nodes])}else n=t.toAnnotation(),n.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(u.LINK_GROUP,n)}}}),T.register(x.UNLINK_LINK_GROUP,Bt.name,new class extends V{handleAction(t,e){const n=e.getAnnotationByType(u.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),T.register(x.SPLIT_BLOCK_WITH_NODE,Bt.name,new Ot),T.register(x.REPLACE_CHILD_NODES,Bt.name,new St),T.register(x.MERGE_TWO_BLOCKS_NODES,Bt.name,new Nt),T.register(x.LINE_BREAK_SINGLE_BLOCK,Bt.name,new Ct),T.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Bt.name,new vt),T.register(x.INSERT_IMAGE_TO_BLOCK,Bt.name,new class extends V{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new yt(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new bt(e,r));else{const t=new _t(n,s);e.apply(t),e.parent.apply(new yt(e,r))}}}),T.register(x.TRANSFORM_LIST_BLOCK,Bt.name,new class extends V{handleAction(t,e){const n=e.parent,s=n.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>n.toListItem(t)));s.apply(new mt(i)),n.apply(new yt(t.selectedBlocks[0],s)),r.forEach((t=>{t.parent.apply(new Tt(t))}))}});class $t extends V{getPreviousNode(t){const e=t.parent,n=e.children.indexOf(t);if(n>0)return e.children[n-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,n=e.children.indexOf(t);if(e.children[n+1])return e.children[n+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,n=e.children.indexOf(t),s=e.parent;if(e.isListItemBlock()){const t=s.parent;return 0===n&&Array.isArray(s.children)&&s.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===s}return 0===n&&Array.isArray(s.children)&&s.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}}class Dt extends y{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class kt extends B{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new D(this.range)}}class Mt extends I{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(Mt.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${Mt.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=g.getDOMByEntity(this);if(t)return h(t,`.${Mt.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}Mt.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",Mt.DECORATOR_NODE_CLASS="v-internal-decorator-node";class jt extends Mt{constructor(t,e,n,s){super(t),this.type=A.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(){return new jt(this.id,this.text,this.language,this.parent)}doAnnotationActionApply(t){T.executeTheStrategy(t,this)}doModifyActionApply(t){T.executeTheStrategy(t,this)}}T.register(x.UPDATE_CODE_BLOCK,jt.name,new class extends V{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),T.register(kt.name,jt.name,new class extends V{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var Pt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Pt||(Pt={}));class Ft extends V{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new Tt(e)))}}class Ht extends L{constructor(t,e,n){super(t),this.type="code-block",this.children=[new jt(`${t}-1`,e,n,this)]}static from(t){return new Ht(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(){const{language:t=Pt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(){const t=Ht.from(this.toJSON());return t.parent=this.parent,t}apply(s){if(s instanceof y&&T.executeTheStrategy(s,this),s.isFlushable){const s=g.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(u.SELECTION_RANGE)}}T.register(x.DELETE_CODE_BLOCK,Ht.name,new class extends $t{handleAction(t,e){const n=e.children[0],s=e.parent;if(s){let t=this.getPreviousNode(n),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(n),r=0),s.apply(new Tt(e));const i=t?g.getDOMByEntity(t):null;if(0===s.children.length){const n=Bt.from({id:a(),type:"paragraph",nodes:[{id:a(),type:"text",text:""}]});e.parent.apply(new mt([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const a=g.getDOMByEntity(o);if(a){const o=e.getSubjectFromParentNodeByEventId(a,s);o&&t.notify(o,{node:n,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t&&"CODE_BLOCK_NODE"!==t.type?"IMAGE"!==t.type?t.text.length:1:0}}),T.register(x.DELETE_CHILDREN,Ht.name,new Ft),T.register(x.SWITCH_OUT_FROM_CODE_BLOCK,Ht.name,new class extends V{handleAction(n,r){const{content:i,language:o}=n,c=i.split("\n"),l=new Dt(c.slice(0,c.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=Bt.from({id:a(),type:"paragraph",nodes:[{id:a(),text:"",type:"text"}]});r.parent.apply(new yt(r,h));const u=g.getDOMByEntity(r);if(u){const n=e.getSubjectFromParentNodeByEventId(u,s);n&&t.notify(n,{node:h.children[0]})}}}),T.register(x.INSERT_IMAGE_TO_BLOCK,Ht.name,new class extends V{handleAction(t,e){e.parent.apply(new yt(e,t.imageBlockToBeInserted))}}),Ht.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{ot as $,V as A,Ct as B,b as C,$t as D,Ft as E,W as F,H as G,Lt as H,yt as I,I as J,Pt as K,rt as L,x as M,R as N,u as O,m as P,Dt as Q,Bt as R,z as S,kt as T,ht as U,$ as V,J as W,jt as X,Q as Y,K as Z,st as _,xt as a,At as a0,wt as a1,P as a2,tt as a3,et as a4,it as a5,It as a6,mt as b,T as c,vt as d,Ot as e,St as f,Nt as g,Tt as h,bt as i,f as j,d as k,L as l,v as m,C as n,Ht as o,w as p,Mt as q,A as r,g as s,N as t,B as u,Et as v,y as w,_t as x,Rt as y,X as z}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as e,F as t,r as n,c as i,H as r,g as s}from"./p-48a58baf.js";import{c as o,V as a,M as l,I as c}from"./p-6e1ab235.js";import{V as d,I as u}from"./p-d849e0f5.js";import{s as p}from"./p-519a7d55.js";import{V as h}from"./p-f08a4adf.js";import{t as f}from"./p-aacf6920.js";import{D as g}from"./p-0cd89fb6.js";import{f as b,a as v,d as m,k as y}from"./p-b5822a21.js";import{K as F}from"./p-7f087c8b.js";import{a as x}from"./p-575235c8.js";import{c as w}from"./p-4474bc63.js";import{d as k}from"./p-bf19682d.js";import{T as A}from"./p-02b29c18.js";import{A as C,S as $,a as _,C as j}from"./p-86f17433.js";import{C as S}from"./p-2d0d575f.js";import{p as P}from"./p-b5bef48a.js";import{d as E}from"./p-1bc5b3bc.js";import{C as R}from"./p-bbb96a13.js";import{c as O,a as z}from"./p-112455b1.js";import{C as T}from"./p-13effc6b.js";import"./p-8c46e116.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-331a62d5.js";import"./p-02841589.js";import"./p-5e2c9e69.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-7e8f055d.js";import"./p-8a877e12.js";import"./p-af464251.js";import"./p-b75ee3ba.js";import"./p-bf0ced3c.js";import"./p-1fb56e14.js";import"./p-436f7e27.js";import"./p-b40adb9e.js";import"./p-5f377954.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";var L=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class D extends a{constructor(){super(...arguments),this.languageDropdownProps={searchable:!1},this.languageOptions=Object.keys(F).map((e=>({id:F[e],displayName:e}))),this.handleLanguageChange=e=>{g.addUniqueObserverToNode(e,b,(e=>{var t;this.valueController.updateValue(null===(t=this.value)||void 0===t?void 0:t.code,e.detail)}))},this.handleDeleteClick=e=>{g.addUniqueObserverToNode(e,v,(()=>{this.removeEventEmitter.emit().defaultPrevented||this.host.remove()}))}}getToolbarContainerRef(){return this.toolbarContainerRef}render(){return e(t,null,e("div",{part:"editor-toolbar",contenteditable:!1,class:{"editor-toolbar":!this.readOnly,"copy-button-container":this.showCopyButton&&this.readOnly},ref:e=>this.toolbarContainerRef=e},this.renderEditorToolbar(),this.copyButtonRenderer.render()),this.contentRenderer.render())}renderEditorToolbar(){var n,i;if(!this.readOnly)return e(t,null,e("vega-input-select",{source:this.languageOptions,value:null!==(i=null===(n=this.value)||void 0===n?void 0:n.language)&&void 0!==i?i:"",disabled:this.disabled,placeholder:this.translationSlimmer.t("Select Language"),size:"small",vegaDropdownProps:this.languageDropdownProps,exportparts:"select-container, selected-box, placeholder, toggle-icon-container, toggle-icon",ref:this.handleLanguageChange}),e("vega-button-circle",{key:"delete-button",disabled:this.disabled,label:this.translationSlimmer.t("Delete Code"),icon:h.getIconKey("trash-can"),iconColor:"text-secondary",variant:"icon-only",size:"extra-small",ref:this.handleDeleteClick}))}}h.register({"trash-can":f}),L([o()],D.prototype,"readOnly",void 0),L([o()],D.prototype,"host",void 0),L([o()],D.prototype,"disabled",void 0),L([o()],D.prototype,"showCopyButton",void 0),L([o()],D.prototype,"value",void 0),L([o()],D.prototype,"contentRenderer",void 0),L([o()],D.prototype,"valueController",void 0),L([o()],D.prototype,"removeEventEmitter",void 0),L([o()],D.prototype,"translationSlimmer",void 0),L([o()],D.prototype,"copyButtonRenderer",void 0);var N=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class H extends a{constructor(){super(...arguments),this.handleFocus=()=>{this.readOnly||this.disabled||this.host.classList.add("focus")},this.handleBlur=()=>{this.host.classList.remove("focus")}}getCodeContentContainerRef(){return this.codeContentContainerRef}registerEventListener(){this.codeContentContainerRef&&(this.codeContentContainerRef.addEventListener("focusin",this.handleFocus),this.codeContentContainerRef.addEventListener("focusout",this.handleBlur))}unregisterEventListener(){this.codeContentContainerRef&&(this.codeContentContainerRef.removeEventListener("focusin",this.handleFocus),this.codeContentContainerRef.removeEventListener("focusout",this.handleBlur))}render(){var n;const i=this.contentParseController.parseCode(),r=(null===(n=this.value)||void 0===n?void 0:n.language)||"";return e(t,null,e("style",null,this.getLineNumberStyleVariable(i)),e("code",{role:"textbox",tabIndex:0,spellcheck:!1,ref:e=>this.codeContentContainerRef=e,contenteditable:!this.readOnly&&!this.disabled,"data-language":r,innerHTML:i.map((e=>this.renderCodeNode(e))).join("")}))}renderCodeNode(e){const{key:t,className:n,mark:i,text:r}=e;return`<span key='${t}' class='${n}' data-mark='${i}' data-index='${t}'>${r}</span>`}getLineNumberStyleVariable(e){const t=10*(e.filter((e=>"\n"===e.text)).length+1).toString().length;return`code{--v-code-line-number-width:${t}px;--v-code-line-number-ml:-${t+16}px;--v-code-block-pl:${t+16}px}`}}N([o()],H.prototype,"host",void 0),N([o()],H.prototype,"readOnly",void 0),N([o()],H.prototype,"disabled",void 0),N([o()],H.prototype,"value",void 0),N([o()],H.prototype,"contentParseController",void 0),N([l("componentDidLoad")],H.prototype,"registerEventListener",null),N([l("disconnectedCallback")],H.prototype,"unregisterEventListener",null);var Z=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class B extends a{updateValue(e,t,n){this.value&&this.value.code===e&&this.value.language===t||(this.value={language:t,code:e},this.changeEventEmitter.emit(this.value),n&&n.recordHistory&&this.historyController.registerHistory({value:this.value,offset:n.offset}))}initialValue(){this.value||(this.value={code:"",language:"plainText"})}}Z([o({writable:!0})],B.prototype,"value",void 0),Z([o()],B.prototype,"changeEventEmitter",void 0),Z([o()],B.prototype,"historyController",void 0),Z([l("connectedCallback")],B.prototype,"initialValue",null);var I=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class M extends a{constructor(){super(...arguments),this.codeNodes=[]}getCurrentCodeNodes(){return this.codeNodes}parseCode(){const e=[this.prismCodeHighlightParser,this.defaultCodeHighlightParser];let t=[];for(const n of e)if(n.canParse()){t=n.parse();break}return this.codeNodes=t,t}}I([o()],M.prototype,"prismCodeHighlightParser",void 0),I([o()],M.prototype,"defaultCodeHighlightParser",void 0);class V{constructor(e){this.contentOffset=0,this.selectedText="",this.codeContainerRef=e}updateRange(e,t,n,i=""){const r=new V(this.codeContainerRef);return r.selectedText=i,r.contentOffset=r.getContentOffset(e,t,n),r}updateContentOffset(e){return this.contentOffset=Math.max(0,e),this.selectedText="",this.contentOffset}createNativeRange(e){const{nodeIndex:t,offset:n}=this.getFocusNodeState(e,this.contentOffset),i=new Range,r=this.codeContainerRef.querySelector(`span[data-index="${t}"]`);if(r){const e=Math.min(r.firstChild.textContent.length,n);return i.setStart(r.firstChild,e),i.setEnd(r.firstChild,e),i}}getContentOffset(e,t,n){let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;if("CODE"===i.nodeName&&i.childNodes&&i.childNodes.length&&(i=i.childNodes[Math.min(t,i.childNodes.length-1)],t=0),i&&i.hasAttribute("data-index")){const e=Number(i.dataset.index);let r="";for(let t=0;t<e;t++)r+=n[t].text;return r.length+t}return 0}getFocusNodeState(e,t){const n=this.getCodeContent(e),i={nodeIndex:0,offset:0};if(!n||t>=n.length)i.nodeIndex=e.length-1,i.offset=e[i.nodeIndex].text.length;else{let n="";for(let r=0;r<e.length;r++)if(n+=e[r].text,n.length>=t){i.offset=Math.max(0,e[r].text.length-(n.length-t)),i.nodeIndex=r;break}}return"\n"===e[i.nodeIndex].text&&i.offset>0&&e[i.nodeIndex+1]&&(i.nodeIndex+=1,i.offset=0),i}getCodeContent(e){return e.map((e=>e.text)).join("")}}var U=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class q extends C{constructor(){super(1),this.handleSelectionWithDebounce=E(this.handleSelectionChange,q.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.doTask=async()=>{await Promise.resolve();const e=this.getSelection(),t=this.codeBlockRange.createNativeRange(this.contentParseController.getCurrentCodeNodes());e&&t&&(e.removeAllRanges(),e.addRange(t))}}getCurrentRange(){return this.codeBlockRange}setNextCodeBlockRange(e,t=!1){this.codeBlockRange.updateContentOffset(e),super.enqueueTheTaskIntoQueue(t)}addSelectionChangeEventListener(){this.codeBlockRange=new V(this.contentRenderer.getCodeContentContainerRef()),document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}removeSelectionChangeEventListener(){document.removeEventListener("selectionchange",this.handleSelectionWithDebounce)}getSelection(){return $.getSelection(this.host.shadowRoot)}handleSelectionChange(){const e=this.getSelection();e&&e.rangeCount>0?(this.syncCodeRangeByNativeRange(),S.notify(m.getSubject(this.host,P),{detail:!0})):S.notify(m.getSubject(this.host,P),{detail:!1})}syncCodeRangeByNativeRange(){const e=this.getSelection();if(this.isCodeBlockActive()&&0===this.autoRunTaskQueue.queue.length&&!this.insertCompositionTextController.isComposing()){const t=e.getRangeAt(0),{startContainer:n,startOffset:i}=t;this.codeBlockRange=this.codeBlockRange.updateRange(n,i,this.contentParseController.getCurrentCodeNodes(),t.toString())}}isCodeBlockActive(){return this.host&&this.host.classList.contains("focus")}}q.SELECTION_CHANGE_DEBOUNCE_TIME=Math.min(_.SELECTION_CHANGE_DEBOUNCE_TIME,40),U([o()],q.prototype,"host",void 0),U([o()],q.prototype,"contentRenderer",void 0),U([o()],q.prototype,"contentParseController",void 0),U([o()],q.prototype,"insertCompositionTextController",void 0),U([l("componentDidLoad")],q.prototype,"addSelectionChangeEventListener",null),U([l("disconnectedCallback")],q.prototype,"removeSelectionChangeEventListener",null);var G=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class K extends a{constructor(){super(...arguments),this.handleInputEvent=e=>{this.stopEventPropagation(e),this.updateCodeContent()},this.handleBeforeInput=e=>{switch(e.stopPropagation(),e.inputType){case"insertFromPaste":if(e.dataTransfer){if(e.dataTransfer.files&&e.dataTransfer.files.length)return void e.preventDefault();const t=e.dataTransfer.getData("text/html"),n=document.createElement("div");if(n.innerHTML=t,t&&!n.innerText)return void e.preventDefault()}break;case"deleteContentBackward":return void(this.value&&this.value.code&&""!==this.value.code?this.handleDeleteAction(e):e.preventDefault());case"historyUndo":case"historyRedo":return void e.preventDefault()}this.updateCodeBlockRange(e)}}registerInputEvent(){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.addEventListener("beforeinput",this.handleBeforeInput),e.addEventListener("input",this.handleInputEvent))}unregisterEventListener(){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.removeEventListener("beforeinput",this.handleBeforeInput),e.removeEventListener("input",this.handleInputEvent))}stopEventPropagation(e){e.stopPropagation()}handleDeleteAction(e){const t=this.selectionController.getCurrentRange();if(t){e.preventDefault();const n=t.contentOffset,i=this.contentParseController.getCurrentCodeNodes();let r=this.getCodeNodesContent(i),s=n;t.selectedText.length?r=this.deleteSelectedText(r,n,t.selectedText.length):n>0&&(r=r.slice(0,n-1)+r.slice(n),s-=1),this.selectionController.setNextCodeBlockRange(s),this.valueController.updateValue(r,this.value.language,{recordHistory:!0,offset:s})}}deleteSelectedText(e,t,n){return n>=e.length?"":e.slice(0,t)+e.slice(t+n)}updateCodeBlockRange(e){const t=this.selectionController.getCurrentRange();!this.insertCompositionTextController.isComposing()&&t&&this.selectionController.setNextCodeBlockRange(t.contentOffset+this.getInsertDataLength(e))}getInsertDataLength(e){const{data:t,inputType:n}=e;switch(n){case"insertText":return t.length;case"insertParagraph":case"insertLineBreak":return 1;case"insertFromPaste":return this.getPasteContentLength(e);default:return 0}}getPasteContentLength(e){const t=e.dataTransfer.getData("text/html");if(t){const e=document.createElement("div");return e.innerHTML=t,e.innerText.length}return e.dataTransfer.getData("text/plain").length}updateCodeContent(){var e;if(!this.insertCompositionTextController.isComposing()){let t=this.contentRenderer.getCodeContentContainerRef().innerText;this.isInsertLineBreakInLowVersionFirefox(t)&&(t+="\n"),this.valueController.updateValue(t,null===(e=this.value)||void 0===e?void 0:e.language,{recordHistory:!0,offset:this.selectionController.getCurrentRange().contentOffset})}}getCodeNodesContent(e){return e.map((e=>e.text)).join("")}isInsertLineBreakInLowVersionFirefox(e){var t;const n=(null===(t=this.value)||void 0===t?void 0:t.code)||"";return!n.endsWith("\n")&&e===n+"\n"}}G([o()],K.prototype,"selectionController",void 0),G([o()],K.prototype,"contentRenderer",void 0),G([o()],K.prototype,"valueController",void 0),G([o()],K.prototype,"contentParseController",void 0),G([o()],K.prototype,"insertCompositionTextController",void 0),G([o()],K.prototype,"value",void 0),G([l("componentDidLoad")],K.prototype,"registerInputEvent",null),G([l("disconnectedCallback")],K.prototype,"unregisterEventListener",null);var W=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class Y extends a{focusAndUpdateSelection(){if(!this.disabled&&!this.readOnly){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.focus(),this.selectionController.setNextCodeBlockRange(this.value&&this.value.code&&" "!==this.value.code?this.value.code.length:0,!0))}}removeFocusAfterDisabled(){(this.disabled||this.readOnly)&&this.host.classList.remove("focus")}}W([o()],Y.prototype,"host",void 0),W([o()],Y.prototype,"value",void 0),W([o()],Y.prototype,"readOnly",void 0),W([o()],Y.prototype,"disabled",void 0),W([o()],Y.prototype,"contentRenderer",void 0),W([o()],Y.prototype,"selectionController",void 0),W([l("doFocus")],Y.prototype,"focusAndUpdateSelection",null),W([l("watchEditableChange")],Y.prototype,"removeFocusAfterDisabled",null);var X=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class J extends a{constructor(){super(...arguments),this.handleCopyClick=e=>{g.addUniqueObserverToNode(e,v,(async()=>{var t;const n=(null===(t=this.value)||void 0===t?void 0:t.code)||"";if(n&&globalThis.navigator&&globalThis.navigator.clipboard){clearTimeout(this.updateLabelTimer),await globalThis.navigator.clipboard.writeText(n);const t=e.label;e.label=this.translationSlimmer.t("Copied"),this.updateLabelTimer=setTimeout((()=>{e&&(e.label=t)}),J.RESET_TOOLTIP_TIME)}}))}}render(){if(this.showCopyButton&&this.readOnly)return e("vega-button-circle",{key:"copy-button",label:this.translationSlimmer.t("Copy Code"),class:"copy-code-button",icon:h.getIconKey("copy"),iconColor:"text-secondary",variant:"icon-only",size:"extra-small",ref:this.handleCopyClick})}}h.register({copy:{icon:'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><g clip-path="url(#clip0_70002_574)"><path fill="currentColor" d="M11.7794 1.65539L10.3439 0.219844C10.2044 0.0790078 10.0122 0 9.81303 0H5.97865C5.15014 0 4.47865 0.671719 4.47865 1.5L4.47911 7.5C4.49975 8.32969 5.1724 9 5.99975 9H10.4997C11.3247 9 11.9997 8.325 11.9997 7.5V2.18555C11.9997 1.9868 11.9201 1.79602 11.7794 1.65539ZM10.8747 7.5C10.8747 7.70709 10.7068 7.875 10.4997 7.875H5.97865C5.77151 7.875 5.60365 7.70709 5.60365 7.5V1.50305C5.60365 1.29595 5.77156 1.12805 5.97865 1.12805H8.97865L8.99975 2.25C8.99975 2.66414 9.33561 3 9.74975 3H10.8537V7.5H10.8747ZM6.37475 10.5C6.37475 10.7071 6.20684 10.875 5.99975 10.875H1.47865C1.27151 10.875 1.10365 10.7071 1.10365 10.5L1.12428 4.50234C1.12428 4.29525 1.29218 4.12734 1.49928 4.12734H3.74975V3H1.49951C0.670996 3 -0.000488281 3.67148 -0.000488281 4.5L-0.000258594 10.5C-0.000207031 11.3273 0.671465 12 1.49975 12H5.99975C6.82475 12 7.49975 11.325 7.49975 10.5V9.75H6.39584L6.37475 10.5Z"/></g><defs><clipPath id="clip0_70002_574"><rect width="12" height="12" fill="currentColor"/></clipPath></defs></svg>'}}),J.RESET_TOOLTIP_TIME=1e3,X([o()],J.prototype,"value",void 0),X([o()],J.prototype,"readOnly",void 0),X([o()],J.prototype,"showCopyButton",void 0),X([o()],J.prototype,"translationSlimmer",void 0);var Q=O((function(e){var t=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof s?new s(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var i,s;switch(n=n||{},r.util.type(t)){case"Object":if(s=r.util.objId(t),n[s])return n[s];for(var o in n[s]=i={},t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case"Array":return s=r.util.objId(t),n[s]?n[s]:(n[s]=i=[],t.forEach((function(t,r){i[r]=e(t,n)})),i);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(i){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(i.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var i="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(i))return!1;e=e.parentElement}return!!n}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){var s=(i=i||r.languages)[e],o={};for(var a in s)if(s.hasOwnProperty(a)){if(a==t)for(var l in n)n.hasOwnProperty(l)&&(o[l]=n[l]);n.hasOwnProperty(a)||(o[a]=s[a])}var c=i[e];return i[e]=o,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,i,s){s=s||{};var o=r.util.objId;for(var a in t)if(t.hasOwnProperty(a)){n.call(t,a,t[a],i||a);var l=t[a],c=r.util.type(l);"Object"!==c||s[o(l)]?"Array"!==c||s[o(l)]||(s[o(l)]=!0,e(l,n,a,s)):(s[o(l)]=!0,e(l,n,null,s))}}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var i={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",i),i.elements=Array.prototype.slice.apply(i.container.querySelectorAll(i.selector)),r.hooks.run("before-all-elements-highlight",i);for(var s,o=0;s=i.elements[o++];)r.highlightElement(s,!0===t,i.callback)},highlightElement:function(t,n,i){var s=r.util.getLanguage(t),o=r.languages[s];r.util.setLanguage(t,s);var a=t.parentElement;a&&"pre"===a.nodeName.toLowerCase()&&r.util.setLanguage(a,s);var l={element:t,language:s,grammar:o,code:t.textContent};function c(e){l.highlightedCode=e,r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,r.hooks.run("after-highlight",l),r.hooks.run("complete",l),i&&i.call(l.element)}if(r.hooks.run("before-sanity-check",l),(a=l.element.parentElement)&&"pre"===a.nodeName.toLowerCase()&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0"),!l.code)return r.hooks.run("complete",l),void(i&&i.call(l.element));if(r.hooks.run("before-highlight",l),l.grammar)if(n&&e.Worker){var d=new Worker(r.filename);d.onmessage=function(e){c(e.data)},d.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(r.highlight(l.code,l.grammar,l.language));else c(r.util.encode(l.code))},highlight:function(e,t,n){var i={code:e,grammar:t,language:n};if(r.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=r.tokenize(i.code,i.grammar),r.hooks.run("after-tokenize",i),s.stringify(r.util.encode(i.tokens),i.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var i in n)t[i]=n[i];delete t.rest}var r=new l;return c(r,r.head,e),a(e,r,t,r.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,s=0;i=n[s++];)i(t)}},Token:s};function s(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function o(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var s=r[1].length;r.index+=s,r[0]=r[0].slice(s)}return r}function a(e,t,n,i,l,u){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var h=n[p];h=Array.isArray(h)?h:[h];for(var f=0;f<h.length;++f){if(u&&u.cause==p+","+f)return;var g=h[f],b=g.inside,v=!!g.lookbehind,m=!!g.greedy,y=g.alias;if(m&&!g.pattern.global){var F=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,F+"g")}for(var x=g.pattern||g,w=i.next,k=l;w!==t.tail&&!(u&&k>=u.reach);k+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof s)){var C,$=1;if(m){if(!(C=o(x,k,e,v))||C.index>=e.length)break;var _=C.index,j=C.index+C[0].length,S=k;for(S+=w.value.length;_>=S;)S+=(w=w.next).value.length;if(k=S-=w.value.length,w.value instanceof s)continue;for(var P=w;P!==t.tail&&(S<j||"string"==typeof P.value);P=P.next)$++,S+=P.value.length;$--,A=e.slice(k,S),C.index-=k}else if(!(C=o(x,0,A,v)))continue;var E=C[0],R=A.slice(0,_=C.index),O=A.slice(_+E.length),z=k+A.length;u&&z>u.reach&&(u.reach=z);var T=w.prev;if(R&&(T=c(t,T,R),k+=R.length),d(t,T,$),w=c(t,T,new s(p,b?r.tokenize(E,b):E,y,E)),O&&c(t,w,O),$>1){var L={cause:p+","+f,reach:z};a(e,t,n,w.prev,k,L),u&&L.reach>u.reach&&(u.reach=L.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}function d(e,t,n){for(var i=t.next,r=0;r<n&&i!==e.tail;r++)i=i.next;t.next=i,i.prev=t,e.length-=r}if(e.Prism=r,s.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach((function(t){i+=e(t,n)})),i}var s={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(s.classes,o):s.classes.push(o)),r.hooks.run("wrap",s);var a="";for(var l in s.attributes)a+=" "+l+'="'+(s.attributes[l]||"").replace(/"/g,""")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'"'+a+">"+s.content+"</"+s.tag+">"},!e.document)return e.addEventListener?(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),i=n.language,s=n.immediateClose;e.postMessage(r.highlight(n.code,r.languages[i],i)),s&&e.close()}),!1),r):r;var u=r.util.currentScript();function p(){r.manual||r.highlightAll()}if(u&&(r.filename=u.src,u.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var h=document.readyState;"loading"===h||"interactive"===h&&u&&u.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
|
|
1
|
+
import{h as e,F as t,r as n,c as i,H as r,g as s}from"./p-48a58baf.js";import{c as o,V as a,M as l,I as c}from"./p-6e1ab235.js";import{V as d,I as u}from"./p-d849e0f5.js";import{s as p}from"./p-519a7d55.js";import{V as h}from"./p-f08a4adf.js";import{t as f}from"./p-aacf6920.js";import{D as g}from"./p-0cd89fb6.js";import{f as b,a as v,d as m,k as y}from"./p-b5822a21.js";import{K as F}from"./p-d1ebec08.js";import{a as x}from"./p-575235c8.js";import{c as w}from"./p-4474bc63.js";import{d as k}from"./p-bf19682d.js";import{T as A}from"./p-02b29c18.js";import{A as C,S as $,a as _,C as j}from"./p-1cabeb33.js";import{C as S}from"./p-2d0d575f.js";import{p as P}from"./p-b5bef48a.js";import{d as E}from"./p-1bc5b3bc.js";import{C as R}from"./p-bbb96a13.js";import{c as O,a as z}from"./p-112455b1.js";import{C as T}from"./p-13effc6b.js";import"./p-8c46e116.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-331a62d5.js";import"./p-02841589.js";import"./p-b1faebe0.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-d884c644.js";import"./p-7e8f055d.js";import"./p-8a877e12.js";import"./p-af464251.js";import"./p-b75ee3ba.js";import"./p-bf0ced3c.js";import"./p-1fb56e14.js";import"./p-743c5baf.js";import"./p-2608b9fe.js";import"./p-5f377954.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";var L=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class D extends a{constructor(){super(...arguments),this.languageDropdownProps={searchable:!1},this.languageOptions=Object.keys(F).map((e=>({id:F[e],displayName:e}))),this.handleLanguageChange=e=>{g.addUniqueObserverToNode(e,b,(e=>{var t;this.valueController.updateValue(null===(t=this.value)||void 0===t?void 0:t.code,e.detail)}))},this.handleDeleteClick=e=>{g.addUniqueObserverToNode(e,v,(()=>{this.removeEventEmitter.emit().defaultPrevented||this.host.remove()}))}}getToolbarContainerRef(){return this.toolbarContainerRef}render(){return e(t,null,e("div",{part:"editor-toolbar",contenteditable:!1,class:{"editor-toolbar":!this.readOnly,"copy-button-container":this.showCopyButton&&this.readOnly},ref:e=>this.toolbarContainerRef=e},this.renderEditorToolbar(),this.copyButtonRenderer.render()),this.contentRenderer.render())}renderEditorToolbar(){var n,i;if(!this.readOnly)return e(t,null,e("vega-input-select",{source:this.languageOptions,value:null!==(i=null===(n=this.value)||void 0===n?void 0:n.language)&&void 0!==i?i:"",disabled:this.disabled,placeholder:this.translationSlimmer.t("Select Language"),size:"small",vegaDropdownProps:this.languageDropdownProps,exportparts:"select-container, selected-box, placeholder, toggle-icon-container, toggle-icon",ref:this.handleLanguageChange}),e("vega-button-circle",{key:"delete-button",disabled:this.disabled,label:this.translationSlimmer.t("Delete Code"),icon:h.getIconKey("trash-can"),iconColor:"text-secondary",variant:"icon-only",size:"extra-small",ref:this.handleDeleteClick}))}}h.register({"trash-can":f}),L([o()],D.prototype,"readOnly",void 0),L([o()],D.prototype,"host",void 0),L([o()],D.prototype,"disabled",void 0),L([o()],D.prototype,"showCopyButton",void 0),L([o()],D.prototype,"value",void 0),L([o()],D.prototype,"contentRenderer",void 0),L([o()],D.prototype,"valueController",void 0),L([o()],D.prototype,"removeEventEmitter",void 0),L([o()],D.prototype,"translationSlimmer",void 0),L([o()],D.prototype,"copyButtonRenderer",void 0);var N=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class H extends a{constructor(){super(...arguments),this.handleFocus=()=>{this.readOnly||this.disabled||this.host.classList.add("focus")},this.handleBlur=()=>{this.host.classList.remove("focus")}}getCodeContentContainerRef(){return this.codeContentContainerRef}registerEventListener(){this.codeContentContainerRef&&(this.codeContentContainerRef.addEventListener("focusin",this.handleFocus),this.codeContentContainerRef.addEventListener("focusout",this.handleBlur))}unregisterEventListener(){this.codeContentContainerRef&&(this.codeContentContainerRef.removeEventListener("focusin",this.handleFocus),this.codeContentContainerRef.removeEventListener("focusout",this.handleBlur))}render(){var n;const i=this.contentParseController.parseCode(),r=(null===(n=this.value)||void 0===n?void 0:n.language)||"";return e(t,null,e("style",null,this.getLineNumberStyleVariable(i)),e("code",{role:"textbox",tabIndex:0,spellcheck:!1,ref:e=>this.codeContentContainerRef=e,contenteditable:!this.readOnly&&!this.disabled,"data-language":r,innerHTML:i.map((e=>this.renderCodeNode(e))).join("")}))}renderCodeNode(e){const{key:t,className:n,mark:i,text:r}=e;return`<span key='${t}' class='${n}' data-mark='${i}' data-index='${t}'>${r}</span>`}getLineNumberStyleVariable(e){const t=10*(e.filter((e=>"\n"===e.text)).length+1).toString().length;return`code{--v-code-line-number-width:${t}px;--v-code-line-number-ml:-${t+16}px;--v-code-block-pl:${t+16}px}`}}N([o()],H.prototype,"host",void 0),N([o()],H.prototype,"readOnly",void 0),N([o()],H.prototype,"disabled",void 0),N([o()],H.prototype,"value",void 0),N([o()],H.prototype,"contentParseController",void 0),N([l("componentDidLoad")],H.prototype,"registerEventListener",null),N([l("disconnectedCallback")],H.prototype,"unregisterEventListener",null);var Z=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class B extends a{updateValue(e,t,n){this.value&&this.value.code===e&&this.value.language===t||(this.value={language:t,code:e},this.changeEventEmitter.emit(this.value),n&&n.recordHistory&&this.historyController.registerHistory({value:this.value,offset:n.offset}))}initialValue(){this.value||(this.value={code:"",language:"plainText"})}}Z([o({writable:!0})],B.prototype,"value",void 0),Z([o()],B.prototype,"changeEventEmitter",void 0),Z([o()],B.prototype,"historyController",void 0),Z([l("connectedCallback")],B.prototype,"initialValue",null);var I=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class M extends a{constructor(){super(...arguments),this.codeNodes=[]}getCurrentCodeNodes(){return this.codeNodes}parseCode(){const e=[this.prismCodeHighlightParser,this.defaultCodeHighlightParser];let t=[];for(const n of e)if(n.canParse()){t=n.parse();break}return this.codeNodes=t,t}}I([o()],M.prototype,"prismCodeHighlightParser",void 0),I([o()],M.prototype,"defaultCodeHighlightParser",void 0);class V{constructor(e){this.contentOffset=0,this.selectedText="",this.codeContainerRef=e}updateRange(e,t,n,i=""){const r=new V(this.codeContainerRef);return r.selectedText=i,r.contentOffset=r.getContentOffset(e,t,n),r}updateContentOffset(e){return this.contentOffset=Math.max(0,e),this.selectedText="",this.contentOffset}createNativeRange(e){const{nodeIndex:t,offset:n}=this.getFocusNodeState(e,this.contentOffset),i=new Range,r=this.codeContainerRef.querySelector(`span[data-index="${t}"]`);if(r){const e=Math.min(r.firstChild.textContent.length,n);return i.setStart(r.firstChild,e),i.setEnd(r.firstChild,e),i}}getContentOffset(e,t,n){let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;if("CODE"===i.nodeName&&i.childNodes&&i.childNodes.length&&(i=i.childNodes[Math.min(t,i.childNodes.length-1)],t=0),i&&i.hasAttribute("data-index")){const e=Number(i.dataset.index);let r="";for(let t=0;t<e;t++)r+=n[t].text;return r.length+t}return 0}getFocusNodeState(e,t){const n=this.getCodeContent(e),i={nodeIndex:0,offset:0};if(!n||t>=n.length)i.nodeIndex=e.length-1,i.offset=e[i.nodeIndex].text.length;else{let n="";for(let r=0;r<e.length;r++)if(n+=e[r].text,n.length>=t){i.offset=Math.max(0,e[r].text.length-(n.length-t)),i.nodeIndex=r;break}}return"\n"===e[i.nodeIndex].text&&i.offset>0&&e[i.nodeIndex+1]&&(i.nodeIndex+=1,i.offset=0),i}getCodeContent(e){return e.map((e=>e.text)).join("")}}var U=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class q extends C{constructor(){super(1),this.handleSelectionWithDebounce=E(this.handleSelectionChange,q.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.doTask=async()=>{await Promise.resolve();const e=this.getSelection(),t=this.codeBlockRange.createNativeRange(this.contentParseController.getCurrentCodeNodes());e&&t&&(e.removeAllRanges(),e.addRange(t))}}getCurrentRange(){return this.codeBlockRange}setNextCodeBlockRange(e,t=!1){this.codeBlockRange.updateContentOffset(e),super.enqueueTheTaskIntoQueue(t)}addSelectionChangeEventListener(){this.codeBlockRange=new V(this.contentRenderer.getCodeContentContainerRef()),document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}removeSelectionChangeEventListener(){document.removeEventListener("selectionchange",this.handleSelectionWithDebounce)}getSelection(){return $.getSelection(this.host.shadowRoot)}handleSelectionChange(){const e=this.getSelection();e&&e.rangeCount>0?(this.syncCodeRangeByNativeRange(),S.notify(m.getSubject(this.host,P),{detail:!0})):S.notify(m.getSubject(this.host,P),{detail:!1})}syncCodeRangeByNativeRange(){const e=this.getSelection();if(this.isCodeBlockActive()&&0===this.autoRunTaskQueue.queue.length&&!this.insertCompositionTextController.isComposing()){const t=e.getRangeAt(0),{startContainer:n,startOffset:i}=t;this.codeBlockRange=this.codeBlockRange.updateRange(n,i,this.contentParseController.getCurrentCodeNodes(),t.toString())}}isCodeBlockActive(){return this.host&&this.host.classList.contains("focus")}}q.SELECTION_CHANGE_DEBOUNCE_TIME=Math.min(_.SELECTION_CHANGE_DEBOUNCE_TIME,40),U([o()],q.prototype,"host",void 0),U([o()],q.prototype,"contentRenderer",void 0),U([o()],q.prototype,"contentParseController",void 0),U([o()],q.prototype,"insertCompositionTextController",void 0),U([l("componentDidLoad")],q.prototype,"addSelectionChangeEventListener",null),U([l("disconnectedCallback")],q.prototype,"removeSelectionChangeEventListener",null);var G=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class K extends a{constructor(){super(...arguments),this.handleInputEvent=e=>{this.stopEventPropagation(e),this.updateCodeContent()},this.handleBeforeInput=e=>{switch(e.stopPropagation(),e.inputType){case"insertFromPaste":if(e.dataTransfer){if(e.dataTransfer.files&&e.dataTransfer.files.length)return void e.preventDefault();const t=e.dataTransfer.getData("text/html"),n=document.createElement("div");if(n.innerHTML=t,t&&!n.innerText)return void e.preventDefault()}break;case"deleteContentBackward":return void(this.value&&this.value.code&&""!==this.value.code?this.handleDeleteAction(e):e.preventDefault());case"historyUndo":case"historyRedo":return void e.preventDefault()}this.updateCodeBlockRange(e)}}registerInputEvent(){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.addEventListener("beforeinput",this.handleBeforeInput),e.addEventListener("input",this.handleInputEvent))}unregisterEventListener(){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.removeEventListener("beforeinput",this.handleBeforeInput),e.removeEventListener("input",this.handleInputEvent))}stopEventPropagation(e){e.stopPropagation()}handleDeleteAction(e){const t=this.selectionController.getCurrentRange();if(t){e.preventDefault();const n=t.contentOffset,i=this.contentParseController.getCurrentCodeNodes();let r=this.getCodeNodesContent(i),s=n;t.selectedText.length?r=this.deleteSelectedText(r,n,t.selectedText.length):n>0&&(r=r.slice(0,n-1)+r.slice(n),s-=1),this.selectionController.setNextCodeBlockRange(s),this.valueController.updateValue(r,this.value.language,{recordHistory:!0,offset:s})}}deleteSelectedText(e,t,n){return n>=e.length?"":e.slice(0,t)+e.slice(t+n)}updateCodeBlockRange(e){const t=this.selectionController.getCurrentRange();!this.insertCompositionTextController.isComposing()&&t&&this.selectionController.setNextCodeBlockRange(t.contentOffset+this.getInsertDataLength(e))}getInsertDataLength(e){const{data:t,inputType:n}=e;switch(n){case"insertText":return t.length;case"insertParagraph":case"insertLineBreak":return 1;case"insertFromPaste":return this.getPasteContentLength(e);default:return 0}}getPasteContentLength(e){const t=e.dataTransfer.getData("text/html");if(t){const e=document.createElement("div");return e.innerHTML=t,e.innerText.length}return e.dataTransfer.getData("text/plain").length}updateCodeContent(){var e;if(!this.insertCompositionTextController.isComposing()){let t=this.contentRenderer.getCodeContentContainerRef().innerText;this.isInsertLineBreakInLowVersionFirefox(t)&&(t+="\n"),this.valueController.updateValue(t,null===(e=this.value)||void 0===e?void 0:e.language,{recordHistory:!0,offset:this.selectionController.getCurrentRange().contentOffset})}}getCodeNodesContent(e){return e.map((e=>e.text)).join("")}isInsertLineBreakInLowVersionFirefox(e){var t;const n=(null===(t=this.value)||void 0===t?void 0:t.code)||"";return!n.endsWith("\n")&&e===n+"\n"}}G([o()],K.prototype,"selectionController",void 0),G([o()],K.prototype,"contentRenderer",void 0),G([o()],K.prototype,"valueController",void 0),G([o()],K.prototype,"contentParseController",void 0),G([o()],K.prototype,"insertCompositionTextController",void 0),G([o()],K.prototype,"value",void 0),G([l("componentDidLoad")],K.prototype,"registerInputEvent",null),G([l("disconnectedCallback")],K.prototype,"unregisterEventListener",null);var W=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class Y extends a{focusAndUpdateSelection(){if(!this.disabled&&!this.readOnly){const e=this.contentRenderer.getCodeContentContainerRef();e&&(e.focus(),this.selectionController.setNextCodeBlockRange(this.value&&this.value.code&&" "!==this.value.code?this.value.code.length:0,!0))}}removeFocusAfterDisabled(){(this.disabled||this.readOnly)&&this.host.classList.remove("focus")}}W([o()],Y.prototype,"host",void 0),W([o()],Y.prototype,"value",void 0),W([o()],Y.prototype,"readOnly",void 0),W([o()],Y.prototype,"disabled",void 0),W([o()],Y.prototype,"contentRenderer",void 0),W([o()],Y.prototype,"selectionController",void 0),W([l("doFocus")],Y.prototype,"focusAndUpdateSelection",null),W([l("watchEditableChange")],Y.prototype,"removeFocusAfterDisabled",null);var X=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o};class J extends a{constructor(){super(...arguments),this.handleCopyClick=e=>{g.addUniqueObserverToNode(e,v,(async()=>{var t;const n=(null===(t=this.value)||void 0===t?void 0:t.code)||"";if(n&&globalThis.navigator&&globalThis.navigator.clipboard){clearTimeout(this.updateLabelTimer),await globalThis.navigator.clipboard.writeText(n);const t=e.label;e.label=this.translationSlimmer.t("Copied"),this.updateLabelTimer=setTimeout((()=>{e&&(e.label=t)}),J.RESET_TOOLTIP_TIME)}}))}}render(){if(this.showCopyButton&&this.readOnly)return e("vega-button-circle",{key:"copy-button",label:this.translationSlimmer.t("Copy Code"),class:"copy-code-button",icon:h.getIconKey("copy"),iconColor:"text-secondary",variant:"icon-only",size:"extra-small",ref:this.handleCopyClick})}}h.register({copy:{icon:'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><g clip-path="url(#clip0_70002_574)"><path fill="currentColor" d="M11.7794 1.65539L10.3439 0.219844C10.2044 0.0790078 10.0122 0 9.81303 0H5.97865C5.15014 0 4.47865 0.671719 4.47865 1.5L4.47911 7.5C4.49975 8.32969 5.1724 9 5.99975 9H10.4997C11.3247 9 11.9997 8.325 11.9997 7.5V2.18555C11.9997 1.9868 11.9201 1.79602 11.7794 1.65539ZM10.8747 7.5C10.8747 7.70709 10.7068 7.875 10.4997 7.875H5.97865C5.77151 7.875 5.60365 7.70709 5.60365 7.5V1.50305C5.60365 1.29595 5.77156 1.12805 5.97865 1.12805H8.97865L8.99975 2.25C8.99975 2.66414 9.33561 3 9.74975 3H10.8537V7.5H10.8747ZM6.37475 10.5C6.37475 10.7071 6.20684 10.875 5.99975 10.875H1.47865C1.27151 10.875 1.10365 10.7071 1.10365 10.5L1.12428 4.50234C1.12428 4.29525 1.29218 4.12734 1.49928 4.12734H3.74975V3H1.49951C0.670996 3 -0.000488281 3.67148 -0.000488281 4.5L-0.000258594 10.5C-0.000207031 11.3273 0.671465 12 1.49975 12H5.99975C6.82475 12 7.49975 11.325 7.49975 10.5V9.75H6.39584L6.37475 10.5Z"/></g><defs><clipPath id="clip0_70002_574"><rect width="12" height="12" fill="currentColor"/></clipPath></defs></svg>'}}),J.RESET_TOOLTIP_TIME=1e3,X([o()],J.prototype,"value",void 0),X([o()],J.prototype,"readOnly",void 0),X([o()],J.prototype,"showCopyButton",void 0),X([o()],J.prototype,"translationSlimmer",void 0);var Q=O((function(e){var t=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof s?new s(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var i,s;switch(n=n||{},r.util.type(t)){case"Object":if(s=r.util.objId(t),n[s])return n[s];for(var o in n[s]=i={},t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case"Array":return s=r.util.objId(t),n[s]?n[s]:(n[s]=i=[],t.forEach((function(t,r){i[r]=e(t,n)})),i);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(i){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(i.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var i="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(i))return!1;e=e.parentElement}return!!n}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){var s=(i=i||r.languages)[e],o={};for(var a in s)if(s.hasOwnProperty(a)){if(a==t)for(var l in n)n.hasOwnProperty(l)&&(o[l]=n[l]);n.hasOwnProperty(a)||(o[a]=s[a])}var c=i[e];return i[e]=o,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,i,s){s=s||{};var o=r.util.objId;for(var a in t)if(t.hasOwnProperty(a)){n.call(t,a,t[a],i||a);var l=t[a],c=r.util.type(l);"Object"!==c||s[o(l)]?"Array"!==c||s[o(l)]||(s[o(l)]=!0,e(l,n,a,s)):(s[o(l)]=!0,e(l,n,null,s))}}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var i={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",i),i.elements=Array.prototype.slice.apply(i.container.querySelectorAll(i.selector)),r.hooks.run("before-all-elements-highlight",i);for(var s,o=0;s=i.elements[o++];)r.highlightElement(s,!0===t,i.callback)},highlightElement:function(t,n,i){var s=r.util.getLanguage(t),o=r.languages[s];r.util.setLanguage(t,s);var a=t.parentElement;a&&"pre"===a.nodeName.toLowerCase()&&r.util.setLanguage(a,s);var l={element:t,language:s,grammar:o,code:t.textContent};function c(e){l.highlightedCode=e,r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,r.hooks.run("after-highlight",l),r.hooks.run("complete",l),i&&i.call(l.element)}if(r.hooks.run("before-sanity-check",l),(a=l.element.parentElement)&&"pre"===a.nodeName.toLowerCase()&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0"),!l.code)return r.hooks.run("complete",l),void(i&&i.call(l.element));if(r.hooks.run("before-highlight",l),l.grammar)if(n&&e.Worker){var d=new Worker(r.filename);d.onmessage=function(e){c(e.data)},d.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(r.highlight(l.code,l.grammar,l.language));else c(r.util.encode(l.code))},highlight:function(e,t,n){var i={code:e,grammar:t,language:n};if(r.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=r.tokenize(i.code,i.grammar),r.hooks.run("after-tokenize",i),s.stringify(r.util.encode(i.tokens),i.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var i in n)t[i]=n[i];delete t.rest}var r=new l;return c(r,r.head,e),a(e,r,t,r.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,s=0;i=n[s++];)i(t)}},Token:s};function s(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function o(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var s=r[1].length;r.index+=s,r[0]=r[0].slice(s)}return r}function a(e,t,n,i,l,u){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var h=n[p];h=Array.isArray(h)?h:[h];for(var f=0;f<h.length;++f){if(u&&u.cause==p+","+f)return;var g=h[f],b=g.inside,v=!!g.lookbehind,m=!!g.greedy,y=g.alias;if(m&&!g.pattern.global){var F=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,F+"g")}for(var x=g.pattern||g,w=i.next,k=l;w!==t.tail&&!(u&&k>=u.reach);k+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof s)){var C,$=1;if(m){if(!(C=o(x,k,e,v))||C.index>=e.length)break;var _=C.index,j=C.index+C[0].length,S=k;for(S+=w.value.length;_>=S;)S+=(w=w.next).value.length;if(k=S-=w.value.length,w.value instanceof s)continue;for(var P=w;P!==t.tail&&(S<j||"string"==typeof P.value);P=P.next)$++,S+=P.value.length;$--,A=e.slice(k,S),C.index-=k}else if(!(C=o(x,0,A,v)))continue;var E=C[0],R=A.slice(0,_=C.index),O=A.slice(_+E.length),z=k+A.length;u&&z>u.reach&&(u.reach=z);var T=w.prev;if(R&&(T=c(t,T,R),k+=R.length),d(t,T,$),w=c(t,T,new s(p,b?r.tokenize(E,b):E,y,E)),O&&c(t,w,O),$>1){var L={cause:p+","+f,reach:z};a(e,t,n,w.prev,k,L),u&&L.reach>u.reach&&(u.reach=L.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}function d(e,t,n){for(var i=t.next,r=0;r<n&&i!==e.tail;r++)i=i.next;t.next=i,i.prev=t,e.length-=r}if(e.Prism=r,s.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach((function(t){i+=e(t,n)})),i}var s={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(s.classes,o):s.classes.push(o)),r.hooks.run("wrap",s);var a="";for(var l in s.attributes)a+=" "+l+'="'+(s.attributes[l]||"").replace(/"/g,""")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'"'+a+">"+s.content+"</"+s.tag+">"},!e.document)return e.addEventListener?(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),i=n.language,s=n.immediateClose;e.postMessage(r.highlight(n.code,r.languages[i],i)),s&&e.close()}),!1),r):r;var u=r.util.currentScript();function p(){r.manual||r.highlightAll()}if(u&&(r.filename=u.src,u.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var h=document.readyState;"loading"===h||"interactive"===h&&u&&u.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
|
|
2
2
|
/**
|
|
3
3
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
4
4
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as e}from"./p-8539e05e.js";import{I as r}from"./p-abd7aeaa.js";class i extends r{evaluate(e){var r,i;if(!this.isAcceptedInputType(e))throw new Error(`Invalid value ${e} for rich text editor`);const t=(null===(r=null==e?void 0:e.children)||void 0===r?void 0:r.length)>1||1===(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)&&e.children.some((e=>e.isNotEmpty()));return{isValid:t,message:t?"":"This field is required"}}canEvaluate(e,r){return r?this.isAcceptedInputType(e)&&!r.disabled&&r.visible:this.isAcceptedInputType(e)}shouldShowError(e){return!e.disabled&&e.visible&&(e.touched||e.modified)}isAcceptedInputType(r){return null==r||r instanceof e}}export{i as R}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as t,r as e,H as o,g as a}from"./p-48a58baf.js";import{s as r}from"./p-519a7d55.js";import{I as i}from"./p-27dfa896.js";import{c as n,M as p,I as s}from"./p-6e1ab235.js";import{V as l,I as c}from"./p-d849e0f5.js";import{E as d}from"./p-7e4fdccb.js";import{c as h}from"./p-8852361b.js";import"./p-2608b9fe.js";import"./p-575235c8.js";import"./p-b1faebe0.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-d884c644.js";import"./p-4a368e1e.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-7d9cd9c8.js";import"./p-b75ee3ba.js";import"./p-7e8f055d.js";import"./p-8a877e12.js";import"./p-2d0d575f.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-af464251.js";import"./p-b5822a21.js";import"./p-262ec334.js";import"./p-21873037.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-5f377954.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";import"./p-8c46e116.js";import"./p-5d676a94.js";import"./p-bf0ced3c.js";import"./p-8539e05e.js";import"./p-d1ebec08.js";import"./p-b5bef48a.js";import"./p-02841589.js";import"./p-bf19682d.js";import"./p-0cd89fb6.js";var m=function(t,e,o,a){var r,i=arguments.length,n=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,a);else for(var p=t.length-1;p>=0;p--)(r=t[p])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};class g extends d{constructor(){super((()=>this.getShowConfig()),(()=>this.trigger),"isTooltipShow",(()=>this.disableInteractive)),this.getShowConfig=()=>({target:this.host,appendableElement:this.vegaTooltipContentBoxRenderer.getTooltipContentBoxRef(),positionRelativeTo:this.positionRelativeTo,matchTargetWidth:!1,size:this.size,minWidth:this.minWidth,maxWidth:this.maxWidth,placement:this.placement,alignment:this.alignment})}watchTrigger(){"none"===this.trigger&&this.hide()}watchToShowTooltip(){this.isTooltipShow&&this.show()}watchTextChange(t,e){!t&&e&&this.isTooltipShow&&this.hide()}show(){this.deprecatedPropertySlimmer.getValue()&&super.show()}}m([n()],g.prototype,"host",void 0),m([n()],g.prototype,"positionRelativeTo",void 0),m([n()],g.prototype,"size",void 0),m([n()],g.prototype,"minWidth",void 0),m([n()],g.prototype,"maxWidth",void 0),m([n()],g.prototype,"placement",void 0),m([n()],g.prototype,"alignment",void 0),m([n()],g.prototype,"trigger",void 0),m([n()],g.prototype,"disableInteractive",void 0),m([n()],g.prototype,"deprecatedPropertySlimmer",void 0),m([n({writable:!0})],g.prototype,"isTooltipShow",void 0),m([n()],g.prototype,"vegaTooltipContentBoxRenderer",void 0),m([p("watchTrigger")],g.prototype,"watchTrigger",null),m([p("watchToShowTooltip")],g.prototype,"watchToShowTooltip",null),m([p("watchTextChange")],g.prototype,"watchTextChange",null);class v{getTooltipContentBoxRef(){return this.tooltip}render(){return t("vega-tooltip-content-box",{ref:t=>this.tooltip=t,text:this.deprecatedPropertySlimmer.getValue()})}}!function(t,e,o,a){var r,i=arguments.length,n=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,a);else for(var p=t.length-1;p>=0;p--)(r=t[p])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);i>3&&n&&Object.defineProperty(e,o,n)}([n()],v.prototype,"deprecatedPropertySlimmer",void 0);const f=[{payloadKey:"CONTENT_IS_EMPTY",payloadDescription:"@deprecated Specifies the content that is displayed inside the tooltip.",payloadValue:t=>void 0===t.content||""===t.content},{payloadKey:"CONTENT_IS_NOT_EMPTY",payloadDescription:"@deprecated Specifies the content that is displayed inside the tooltip.",payloadValue:t=>void 0!==t.content&&""!==t.content}];var b=function(t,e,o,a){var r,i=arguments.length,n=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,a);else for(var p=t.length-1;p>=0;p--)(r=t[p])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};const x=class{constructor(t){e(this,t),this.globalSlimmers={},this.vegaTooltipElementAppenderController=new g,this.vegaTooltipContentBoxRenderer=new v,this.deprecatedPropertySlimmer=h(x,"text","content",void 0),this.vegaComponentUsageRuntimeMetricsSlimmer=new l(f),this.isTooltipShow=!1,this.trigger="hover",this.placement="top",this.alignment="center",this.disableInteractive=!1}watchTrigger(){}watchTextChange(){}watchToShowTooltip(){}render(){return r(t(o,null,t("slot",null),this.vegaTooltipContentBoxRenderer.render()),this.host)}get host(){return a(this)}static get watchers(){return{trigger:["watchTrigger"],content:["watchTextChange"],text:["watchTextChange"],size:["watchToShowTooltip"],placement:["watchToShowTooltip"],alignment:["watchToShowTooltip"]}}};b([c()],x.prototype,"globalSlimmers",void 0),b([s()],x.prototype,"vegaTooltipElementAppenderController",void 0),b([s()],x.prototype,"vegaTooltipContentBoxRenderer",void 0),b([i((t=>[{keyCode:"Tab",activeElementInScope:[t.host],callback:()=>"hover"===t.trigger&&t.vegaTooltipElementAppenderController.show()},{keyCode:"Escape",activeElementInScope:[t.host,t.vegaTooltipContentBoxRenderer.getTooltipContentBoxRef()],callback:()=>t.vegaTooltipElementAppenderController.hide()},{keyCode:"Tab",activeElementOutScope:[t.host,t.vegaTooltipContentBoxRenderer.getTooltipContentBoxRef()],callback:()=>t.isTooltipShow&&t.vegaTooltipElementAppenderController.hide()}])),s()],x.prototype,"deprecatedPropertySlimmer",void 0),b([s()],x.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),x.style=":host{display:inline-block}";var j=function(t,e,o,a){var r,i=arguments.length,n=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,a);else for(var p=t.length-1;p>=0;p--)(r=t[p])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};const w=class{constructor(t){e(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new l}render(){return r(t(o,{class:"vega-tooltip",role:"tooltip"},t("div",{class:"vega-tooltip-content"},this.text)),this.host)}get host(){return a(this)}};j([c()],w.prototype,"globalSlimmers",void 0),j([s()],w.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),w.style=':host{position:absolute}:host(.vega-force-hidden){display:none !important}:host(.vega-placement-bottom){margin-top:8px}:host(.vega-placement-left){margin-left:-8px}:host(.vega-placement-right){margin-left:8px}:host(.vega-placement-top){margin-top:-8px}.vega-tooltip-content{border-radius:4px;padding-left:12px;padding-right:12px;padding-top:8px;padding-bottom:8px;overflow-wrap:break-word;background-color:rgba(var(--v-bg-inverted-primary, 4, 4, 28, 1));color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1));font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-tooltip-content{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-tooltip-content{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-tooltip-content{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.vega-tooltip-content::after{content:"";position:absolute;border-style:solid}:host(.vega-placement-bottom) .vega-tooltip-content::after{top:-4px;border-width:0 5px 4px 5px;border-bottom-color:rgba(var(--v-bg-inverted-primary, 4, 4, 28, 1));border-top-color:transparent;border-left-color:transparent;border-right-color:transparent}:host(.vega-placement-left) .vega-tooltip-content::after{left:100%;border-width:5px 0 5px 4px;border-left-color:rgba(var(--v-bg-inverted-primary, 4, 4, 28, 1));border-top-color:transparent;border-bottom-color:transparent;border-right-color:transparent}:host(.vega-placement-right) .vega-tooltip-content::after{left:-4px;border-width:5px 4px 5px 0;border-right-color:rgba(var(--v-bg-inverted-primary, 4, 4, 28, 1));border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent}:host(.vega-placement-top) .vega-tooltip-content::after{bottom:-4px;border-width:4px 5px 0px 5px;border-top-color:rgba(var(--v-bg-inverted-primary, 4, 4, 28, 1));border-bottom-color:transparent;border-left-color:transparent;border-right-color:transparent}:host(.vega-placement-bottom.vega-alignment-start) .vega-tooltip-content::after,:host(.vega-placement-top.vega-alignment-start) .vega-tooltip-content::after{left:8px}:host(.vega-placement-bottom.vega-alignment-center) .vega-tooltip-content::after,:host(.vega-placement-top.vega-alignment-center) .vega-tooltip-content::after{left:calc(50% - 5px)}:host(.vega-placement-bottom.vega-alignment-end) .vega-tooltip-content::after,:host(.vega-placement-top.vega-alignment-end) .vega-tooltip-content::after{right:8px}:host(.vega-placement-left.vega-alignment-start) .vega-tooltip-content::after,:host(.vega-placement-right.vega-alignment-start) .vega-tooltip-content::after{top:8px}:host(.vega-placement-left.vega-alignment-center) .vega-tooltip-content::after,:host(.vega-placement-right.vega-alignment-center) .vega-tooltip-content::after{top:calc(50% - 5px)}:host(.vega-placement-left.vega-alignment-end) .vega-tooltip-content::after,:host(.vega-placement-right.vega-alignment-end) .vega-tooltip-content::after{bottom:8px}';export{x as vega_tooltip,w as vega_tooltip_content_box}
|