@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,I as e,V as i,L as s,M as o}from"./p-6e1ab235.js";import{f as n,d as h,b as r}from"./p-575235c8.js";import{I as c}from"./p-4a368e1e.js";import{c as l}from"./p-6a334573.js";import{P as a}from"./p-7d9cd9c8.js";import{P as d,A as u}from"./p-74168615.js";import{A as f}from"./p-5e2c9e69.js";import{R as p}from"./p-8baacfc5.js";import{C as v}from"./p-2d0d575f.js";import{S as m}from"./p-8a877e12.js";import{O as g}from"./p-331a62d5.js";import{d as b}from"./p-b5822a21.js";import{r as w}from"./p-b5bef48a.js";import{D as j}from"./p-0cd89fb6.js";class R{canRetrieve(){return!0}retrieve(){const t=document.body;return this.showConfig.appendableElement.parentElement!==t&&t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],R.prototype,"showConfig",void 0);class y{canRetrieve(){return!this.showConfig.isScreenPosition}}class C extends y{canRetrieve(){return super.canRetrieve()&&!!this.showConfig.positionRelativeTo&&!!document.querySelector(this.showConfig.positionRelativeTo)}retrieve(){const t=document.querySelector(this.showConfig.positionRelativeTo);return this.showConfig.appendableElement.parentElement!==t&&t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],C.prototype,"showConfig",void 0);class x extends y{canRetrieve(){return super.canRetrieve()&&!!n(this.showConfig.target,"vega-modal")}retrieve(){return this.getVegaModalShowConfigContainer()}setElementSlot(t,e){var i;const s=null===(i=Array.from(t.children).find((t=>{const e=t.getAttribute("slot");return e&&["content","modal-content"].includes(e)})))||void 0===i?void 0:i.getAttribute("slot");s&&e.setAttribute("slot",s)}getVegaModalShowConfigContainer(){const t=n(this.showConfig.target,"vega-modal"),e=t.shadowRoot.querySelector(".vega-modal-content-with-scroll"),i=t.shadowRoot.querySelector(".modal-dialog");return this.setElementSlot(t,this.showConfig.appendableElement),t.append(this.showConfig.appendableElement),e||i}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t({writable:!0})],x.prototype,"showConfig",void 0);class O extends y{canRetrieve(){return super.canRetrieve()&&!!n(this.showConfig.target,".vega-popover")}retrieve(){const t=n(this.showConfig.target,".vega-popover");return t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],O.prototype,"showConfig",void 0);var S=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class E extends i{constructor(){super(...arguments),this.positionRelativeToWrapper=new C,this.vegaPopoverWrapper=new O,this.vegaModalWrapper=new x,this.defaultWrapper=new R}setContainer(){this.setContainerRetrievers();for(const t of this.containerRetrievers)if(t.canRetrieve())return void(this.container=t.retrieve())}setContainerRetrievers(){this.containerRetrievers=[this.positionRelativeToWrapper,this.vegaPopoverWrapper,this.vegaModalWrapper,this.defaultWrapper]}}S([t({writable:!0})],E.prototype,"container",void 0),S([t({writable:!0})],E.prototype,"showConfig",void 0),S([e()],E.prototype,"positionRelativeToWrapper",void 0),S([e()],E.prototype,"vegaPopoverWrapper",void 0),S([e()],E.prototype,"vegaModalWrapper",void 0),S([e()],E.prototype,"defaultWrapper",void 0);class A extends i{getPositionBox(t,e){const i=t||this.getPlacements(),s=e||this.getAlignments(),o=this.getTargetBoundBox(),n=this.getElementBoundBox(),h=this.getElementScrollDimension(),r=this.getSuitablePlacement(h,n,o,i),c=this.getSuitableAlignment(h,n,o,r,s),l=this.calculatePosition(n,o,r,c),a=this.getTranslocationBox(r);return l.placement=r,l.alignment=c,l.left+=a.X,l.top+=a.Y,l}getElementBoundBox(){const t=this.showConfig.appendableElement,e=t.classList.contains("vega-force-hidden");e&&t.classList.remove("vega-force-hidden");const i=t.getBoundingClientRect();return e&&t.classList.add("vega-force-hidden"),{width:i.width,height:i.height,left:i.left,top:i.top}}getPlacements(){const t=this.showConfig.placement;if("string"==typeof t){const e=d.filter((e=>e!==t));return[t,...e]}return Array.isArray(t)?t:[...d]}getAlignments(){const t=this.showConfig.alignment;if("string"==typeof t){const e=u.filter((e=>e!==t));return[t,...e]}return Array.isArray(t)?t:[...u]}calculatePosition(t,e,i,s){return{top:this.calculateTop(t,e,i,s),left:this.calculateLeft(t,e,i,s)}}getTranslocationBox(t){const e=Array.isArray(this.showConfig.placement)?this.showConfig.placement[0]:this.showConfig.placement,i=this.getTranslocation(),s={X:0,Y:0};if(f(i)){let o=i.X,n=i.Y;(e&&["left","right"].includes(e)&&["top","bottom"].includes(t)||e&&["top","bottom"].includes(e)&&["left","right"].includes(t))&&(o=i.Y,n=i.X),["bottom","top"].includes(t)&&(s.Y="top"===t?-n:n,s.X=o),["left","right"].includes(t)&&(s.X="left"===t?-o:o,s.Y=n)}return s}calculateLeft(t,e,i,s){switch(i){case"top":case"bottom":return"end"===s?e.left+e.width-t.width:"center"===s?e.left-(t.width-e.width)/2:e.left;case"left":return e.left-t.width;case"right":return e.left+e.width;default:throw new Error(`Unexpected placement: ${i}. Expected values are top, bottom, left, or right.`)}}calculateTop(t,e,i,s){switch(i){case"left":case"right":return"end"===s?e.top+e.height-t.height:"center"===s?e.top-(t.height-e.height)/2:e.top;case"top":return e.top-t.height;case"bottom":return e.top+e.height;default:throw new Error(`Unexpected placement: ${i}. Expected values are top, bottom, left, or right.`)}}getSuitablePlacement(t,e,i,o){const n=o[0];return o.find((s=>this.hasEnoughSpace(t,s,i,e)))||(s.warn(`\n No enough space found for placing element and we will keep using the defined placement:\n ${n}\n `),n)}getSuitableAlignment(t,e,i,o,n){const h=n[0];return n.find((s=>this.hasEnoughAlignmentSpace(t,i,e,o,s)))||(s.warn(`\n No enough space found for placing element and we will keep using the defined alignment:\n ${h}\n `),h)}hasEnoughAlignmentSpace(t,e,i,s,o){if(["top","bottom"].includes(s))switch(o){case"start":return e.left+i.width<=t.width;case"center":return e.left>=(i.width-e.width)/2&&e.left+e.width/2+i.width/2<=t.width;case"end":return e.left+e.width>=i.width}if(["right","left"].includes(s))switch(o){case"start":return e.top+i.height<=t.height;case"center":return e.top>=(i.height-e.height)/2&&e.top+e.height/2+i.height/2<=t.height;case"end":return e.top+e.height>=i.height}return!1}hasEnoughSpace(t,e,i,s){switch(e){case"top":return i.top>=s.height;case"bottom":return t.height-i.top-i.height>=s.height;case"left":return i.left>=s.width;case"right":return t.width-i.left-i.width>=s.width;default:return!1}}getTranslocation(){const t=this.showConfig.translocation;return t&&p.format(t,"translocation")}}var P=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class k extends A{getPosition(){return"relative"!==window.getComputedStyle(this.container).position&&s.warn("Calculate position should make container as 'position: relative', otherwise the result might not be accurate."),this.getPositionBox()}getTargetBoundBox(){const t=this.container.getBoundingClientRect(),e=this.showConfig.target.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top-t.top+this.container.scrollTop,left:e.left-t.left+this.container.scrollLeft}}getElementScrollDimension(){return{width:this.container.scrollWidth,height:this.container.scrollHeight}}}P([t()],k.prototype,"container",void 0),P([t()],k.prototype,"showConfig",void 0);class T extends A{getPosition(t){const e=t?this.getPositionBox([this.previousPositionBox.placement],[this.previousPositionBox.alignment]):this.getPositionBox();return this.previousPositionBox=e,e}getTargetBoundBox(){const t=this.showConfig.target.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,left:t.left}}getElementScrollDimension(){return{width:window.innerWidth,height:window.innerHeight}}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],T.prototype,"showConfig",void 0);var $=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class D extends i{constructor(){super(...arguments),this.bodyPositionStrategy=new k,this.screenPositionStrategy=new T}setCalculationStrategy(){this.positionStrategy=this.showConfig.isScreenPosition?this.screenPositionStrategy:this.bodyPositionStrategy}adjustPosition(t){this.adjustWidth(),this.adjustHeight(),this.applyPosition(this.positionStrategy.getPosition(t))}applyPosition(t){const e=this.showConfig.appendableElement;this.showConfig.isScreenPosition&&(e.style.position="fixed"),e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.classList.remove("vega-placement-left","vega-placement-right","vega-placement-top","vega-placement-bottom"),e.classList.remove("vega-alignment-start","vega-alignment-center","vega-alignment-end"),e.classList.add(`vega-placement-${t.placement}`),e.classList.add(`vega-alignment-${t.alignment}`)}adjustWidth(){if(this.showConfig.matchTargetWidth){const{width:t}=this.showConfig.target.getBoundingClientRect();this.setRelatedWidth("width",t)}else this.setRelatedWidth("width",this.showConfig.size),this.setRelatedWidth("minWidth",this.showConfig.minWidth),this.setRelatedWidth("maxWidth",this.showConfig.maxWidth)}setRelatedWidth(t,e){if(!e)return;const i=p.format(e,"size");i&&(this.showConfig.appendableElement.style[t]="number"==typeof i?`${i}px`:i)}adjustHeight(){if(this.showConfig.matchContainerHeight&&!this.showConfig.isScreenPosition){const{height:t}=this.showConfig.target.getBoundingClientRect();let e=this.container.scrollHeight-this.showConfig.target.offsetTop-t;this.showConfig.maxHeight&&(e=Math.min(e,this.showConfig.maxHeight)),this.showConfig.appendableElement.style.maxHeight=`${e}px`}else this.showConfig.maxHeight&&(this.showConfig.appendableElement.style.maxHeight=`${this.showConfig.maxHeight}px`)}}$([t()],D.prototype,"container",void 0),$([t()],D.prototype,"showConfig",void 0),$([e()],D.prototype,"bodyPositionStrategy",void 0),$([e()],D.prototype,"screenPositionStrategy",void 0);var B=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class L{constructor(t,e){var i,s;this.resizeObserverSlimmer=l(L,a,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"},{mapFrom:"disconnectResizeObserver",mapTo:"disconnectResizeObserver"}],[{callback:()=>{h(this.showConfig.target)&&h(this.showConfig.appendableElement)&&this.adjustPosition()},target:()=>[document.body,this.showConfig.appendableElement,this.showConfig.target]}]),this.elementAppenderContainerController=new E,this.positionCalculationController=new D,this.showConfigCallback=t,this.showConfigCallbackTarget=e;const o=this.getShowConfig();null===(i=o.appendableElement)||void 0===i||i.classList.add("vega-force-hidden"),null===(s=o.appendableElement)||void 0===s||s.classList.add("vega-element-appender-appendable")}show(){this.setShowConfig(),this.showConfig.target?this.showConfig.appendableElement?(this.prepareShow(),this.adjustPosition(),this.setZIndex(),this.toggleShow(!0),this.connectResizeObserver()):s.error("No appendable element found, please add it at new elementAppender."):s.error("No target element found, please add it at new elementAppender.")}hide(){this.showConfig&&(this.toggleShow(!1),this.resetContainerPosition(),c.removeZIndex(this.showConfig.appendableElement,"base"))}onScroll(){var t;const e=this.showConfig.target.getBoundingClientRect();!this.showConfig.isScreenPosition||e.left===(null===(t=this.previousTargetRect)||void 0===t?void 0:t.left)&&e.top===this.previousTargetRect.top||this.adjustPosition(!0)}destroy(){this.showConfig&&(this.removeVisibleAppendElement(this.showConfig.appendableElement),this.resetContainerPosition(),c.removeZIndex(this.showConfig.appendableElement,"base"),this.showConfig.appendableElement.remove(),this.disconnectResizeObserver())}connectResizeObserver(){}disconnectResizeObserver(){}toggleShow(t){t?(this.showConfig.appendableElement.classList.remove("vega-force-hidden"),this.saveVisibleAppendElement(this.showConfig.appendableElement)):(this.showConfig.appendableElement.classList.add("vega-force-hidden"),this.removeVisibleAppendElement(this.showConfig.appendableElement))}saveVisibleAppendElement(t){const e=L.containerMap.get(this.container);e&&e.visibleAppendElements.add(t)}removeVisibleAppendElement(t){const e=L.containerMap.get(this.container);e&&e.visibleAppendElements.delete(t)}resetContainerPosition(){const t=L.containerMap.get(this.container);if(t){const{visibleAppendElements:e,originPosition:i="static"}=t;0===e.size&&(this.container.style.position=i,L.containerMap.delete(this.container))}}setShowConfig(){this.showConfig=this.getShowConfig(),this.showConfig=Object.assign({matchTargetWidth:!1,matchContainerHeight:!1},this.showConfig),this.showConfig.target&&this.showConfig.appendableElement&&this.elementAppenderContainerController.setContainer()}prepareShow(){this.showConfig.isScreenPosition||this.initVisibleAppendElement(),this.showConfig.appendableElement.style.boxSizing="border-box",this.positionCalculationController.setCalculationStrategy()}initVisibleAppendElement(){const t=window.getComputedStyle(this.container).position;L.containerMap.has(this.container)||L.containerMap.set(this.container,{visibleAppendElements:new Set,originPosition:t}),"static"===t&&(this.container.style.position="relative")}adjustPosition(t){this.positionCalculationController.adjustPosition(t)}setZIndex(){c.setZIndex(this.showConfig.appendableElement,"base")}getShowConfig(){return this.showConfigCallback instanceof Function?this.showConfigCallback(this.showConfigCallbackTarget):this.showConfigCallback}}L.containerMap=new Map,B([e()],L.prototype,"resizeObserverSlimmer",void 0),B([e()],L.prototype,"elementAppenderContainerController",void 0),B([e()],L.prototype,"positionCalculationController",void 0);var W,z=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};!function(t){t.SHOW="show",t.HIDE="hide"}(W||(W={}));class M extends i{constructor(t){super(),this.childrenEA=[],this.currentEA=t}componentDidLoad(){this.register()}onShow(){this.notify(W.SHOW)}onHide(){this.notify(W.HIDE)}getParent(){return this.parentEA}getChildren(){return this.childrenEA}notify(t){const e=n(this.showConfig.target,".vega-element-appender-appendable");e&&v.notify(b.getSubject(e,w),{type:t,child:this.currentEA,callback:t=>{this.parentEA=t}})}register(){this.showConfig&&j.addUniqueObserverToNode(this.showConfig.appendableElement,w,(t=>{t.type===W.SHOW?this.childrenEA.push(t.child):t.type===W.HIDE&&(this.childrenEA=this.childrenEA.filter((e=>e!==t.child))),t.callback(this.currentEA)}))}}z([t()],M.prototype,"showConfig",void 0),z([o("componentDidLoad")],M.prototype,"componentDidLoad",null),z([o("show")],M.prototype,"onShow",null),z([o("hide")],M.prototype,"onHide",null);var V=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class F extends i{constructor(t,e,i="isDropdownShow",s=(()=>!1)){super(),this.hierarchyTreeManager=new M(this),this.registerElementAppenderListener=()=>{var t,e,i,s,o,n;this.unRegisterElementAppenderListener(),this.showConfig&&(null===(t=this.showConfig.target)||void 0===t||t.addEventListener("click",this.targetClickHandler),null===(e=this.showConfig.target)||void 0===e||e.addEventListener("mouseenter",this.targetMouseEnterHandler),null===(i=this.showConfig.target)||void 0===i||i.addEventListener("mouseleave",this.targetMouseLeaveHandler),null===(s=this.showConfig.target)||void 0===s||s.addEventListener("focusout",this.targetFocusoutHandler),null===(o=this.showConfig.appendableElement)||void 0===o||o.addEventListener("mouseenter",this.elementMouseEnterHandler),null===(n=this.showConfig.appendableElement)||void 0===n||n.addEventListener("mouseleave",this.elementMouseLeaveHandler)),window.addEventListener("mousedown",this.globalMouseDownHandler),document.addEventListener("scroll",this.globalScrollHandler,{capture:!0}),this.listenShadowRootElementScrolling()},this.targetClickHandler=()=>{this.shouldListenerWork("click")&&(this.isShowing()?this.hide():this.show())},this.targetMouseEnterHandler=()=>{this.shouldListenerWork("hover")&&(!1===this.isShowing()&&this.show(),this.clearDelayHideTimer())},this.targetMouseLeaveHandler=()=>{this.shouldListenerWork("hover")&&this.createDelayHideTimer()},this.targetFocusoutHandler=t=>{var e;r(t.relatedTarget,null===(e=this.showConfig)||void 0===e?void 0:e.appendableElement)||this.targetMouseLeaveHandler()},this.elementMouseEnterHandler=()=>{var t;null===(t=this.hierarchyTreeManager.getParent())||void 0===t||t.elementMouseEnterHandler(),this.shouldListenerWork("hover")&&!this.disableInteractiveGetter()&&this.clearDelayHideTimer()},this.elementMouseLeaveHandler=()=>{var t;null===(t=this.hierarchyTreeManager.getParent())||void 0===t||t.elementMouseLeaveHandler(),this.shouldListenerWork("hover")&&!this.disableInteractiveGetter()&&this.createDelayHideTimer()},this.globalMouseDownHandler=t=>{const e=t.composedPath()[0];!this.hierarchyTreeManager.getChildren().some((t=>t.isShowing()))&&this.shouldListenerWork("custom")&&this.isShowing()&&this.showConfig&&!r(e,this.showConfig.appendableElement)&&!r(e,this.showConfig.target)&&n(e,"vega-modal")===n(this.showConfig.target,"vega-modal")&&this.hide()},this.globalScrollHandler=()=>{var t;this.showConfig&&this.showConfig.isScreenPosition&&this.isShowing()&&(null===(t=this.elementAppender)||void 0===t||t.onScroll())},this.createDelayHideTimer=()=>{this.delayHideTimer=setTimeout((()=>{this.hide(),clearTimeout(this.delayHideTimer)}),F.DELAY_HIDE_TIME)},this.clearDelayHideTimer=()=>{this.delayHideTimer&&clearTimeout(this.delayHideTimer)},this.shouldListenerWork=t=>{const e=this.getTrigger();switch(t){case"custom":return"none"!==e;case"click":return"click"===e;case"hover":return"hover"===e}throw new Error(`Unexpected trigger: ${t}. Expected values are custom, click, or hover.`)},this.showConfigFactory=t,this.getTrigger=e,this.isDropdownShowName=i,this.disableInteractiveGetter=s}connectedCallback(){null===this.elementAppender&&(this.setElementAppender(),this.registerElementAppenderListener())}disconnectedCallback(){this.unRegisterElementAppenderListener(),this.destroyElementAppender()}componentDidLoad(){this.initElementAppender()}getElementAppender(){return this.elementAppender}show(){this.elementAppender&&this.elementAppender.show(),this[this.isDropdownShowName]=!0}hide(){this.elementAppender&&this.elementAppender.hide(),this[this.isDropdownShowName]=!1,this.hierarchyTreeManager.getChildren().map((t=>{t.hide()}))}destroy(){this.destroyElementAppender(),this[this.isDropdownShowName]=!1}updateShowConfigFactory(t){this.showConfigFactory=t,this.initElementAppender()}destroyElementAppender(){this.elementAppender&&(this.elementAppender.destroy(),this.elementAppender=null)}initElementAppender(){this.setShowConfig(),this.setElementAppender(),this.registerElementAppenderListener()}setElementAppender(){this.elementAppender=new L(this.showConfigFactory,this)}isShowing(){return this[this.isDropdownShowName]}setShowConfig(){this.showConfig=this.showConfigFactory()}unRegisterElementAppenderListener(){var t,e,i,s,o,n;this.showConfig&&(null===(t=this.showConfig.target)||void 0===t||t.removeEventListener("click",this.targetClickHandler),null===(e=this.showConfig.target)||void 0===e||e.removeEventListener("mouseenter",this.targetMouseEnterHandler),null===(i=this.showConfig.target)||void 0===i||i.removeEventListener("mouseleave",this.targetMouseLeaveHandler),null===(s=this.showConfig.target)||void 0===s||s.removeEventListener("focusout",this.targetMouseLeaveHandler),null===(o=this.showConfig.appendableElement)||void 0===o||o.removeEventListener("mouseenter",this.elementMouseEnterHandler),null===(n=this.showConfig.appendableElement)||void 0===n||n.removeEventListener("mouseleave",this.elementMouseLeaveHandler)),window.removeEventListener("mousedown",this.globalMouseDownHandler),document.removeEventListener("scroll",this.globalScrollHandler),this.removeShadowRootElementScrolling()}listenShadowRootElementScrolling(){this.shadowRootElementScrollingObserver=new g(this.canAcceptShadowRootScrollEvent.bind(this),this.globalScrollHandler.bind(this)),v.register(m,this.shadowRootElementScrollingObserver)}canAcceptShadowRootScrollEvent(t){return Boolean(this.showConfig&&r(this.showConfig.target,t.host))}removeShadowRootElementScrolling(){v.unregister(m,this.shadowRootElementScrollingObserver)}}F.DELAY_HIDE_TIME=100,V([e()],F.prototype,"hierarchyTreeManager",void 0),V([o("connectedCallback")],F.prototype,"connectedCallback",null),V([o("disconnectedCallback")],F.prototype,"disconnectedCallback",null),V([o("componentDidLoad")],F.prototype,"componentDidLoad",null);export{F as E}
|
|
1
|
+
import{c as t,I as e,V as i,L as s,M as o}from"./p-6e1ab235.js";import{f as n,d as h,b as r}from"./p-575235c8.js";import{I as c}from"./p-4a368e1e.js";import{c as l}from"./p-6a334573.js";import{P as a}from"./p-7d9cd9c8.js";import{P as d,A as u}from"./p-74168615.js";import{E as f}from"./p-b1faebe0.js";import{R as p}from"./p-21873037.js";import{C as v}from"./p-2d0d575f.js";import{S as m}from"./p-8a877e12.js";import{O as g}from"./p-331a62d5.js";import{d as b}from"./p-b5822a21.js";import{r as w}from"./p-b5bef48a.js";import{D as j}from"./p-0cd89fb6.js";class R{canRetrieve(){return!0}retrieve(){const t=document.body;return this.showConfig.appendableElement.parentElement!==t&&t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],R.prototype,"showConfig",void 0);class y{canRetrieve(){return!this.showConfig.isScreenPosition}}class C extends y{canRetrieve(){return super.canRetrieve()&&!!this.showConfig.positionRelativeTo&&!!document.querySelector(this.showConfig.positionRelativeTo)}retrieve(){const t=document.querySelector(this.showConfig.positionRelativeTo);return this.showConfig.appendableElement.parentElement!==t&&t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],C.prototype,"showConfig",void 0);class x extends y{canRetrieve(){return super.canRetrieve()&&!!n(this.showConfig.target,"vega-modal")}retrieve(){return this.getVegaModalShowConfigContainer()}setElementSlot(t,e){var i;const s=null===(i=Array.from(t.children).find((t=>{const e=t.getAttribute("slot");return e&&["content","modal-content"].includes(e)})))||void 0===i?void 0:i.getAttribute("slot");s&&e.setAttribute("slot",s)}getVegaModalShowConfigContainer(){const t=n(this.showConfig.target,"vega-modal"),e=t.shadowRoot.querySelector(".vega-modal-content-with-scroll"),i=t.shadowRoot.querySelector(".modal-dialog");return this.setElementSlot(t,this.showConfig.appendableElement),t.append(this.showConfig.appendableElement),e||i}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t({writable:!0})],x.prototype,"showConfig",void 0);class O extends y{canRetrieve(){return super.canRetrieve()&&!!n(this.showConfig.target,".vega-popover")}retrieve(){const t=n(this.showConfig.target,".vega-popover");return t.append(this.showConfig.appendableElement),t}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],O.prototype,"showConfig",void 0);var S=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class E extends i{constructor(){super(...arguments),this.positionRelativeToWrapper=new C,this.vegaPopoverWrapper=new O,this.vegaModalWrapper=new x,this.defaultWrapper=new R}setContainer(){this.setContainerRetrievers();for(const t of this.containerRetrievers)if(t.canRetrieve())return void(this.container=t.retrieve())}setContainerRetrievers(){this.containerRetrievers=[this.positionRelativeToWrapper,this.vegaPopoverWrapper,this.vegaModalWrapper,this.defaultWrapper]}}S([t({writable:!0})],E.prototype,"container",void 0),S([t({writable:!0})],E.prototype,"showConfig",void 0),S([e()],E.prototype,"positionRelativeToWrapper",void 0),S([e()],E.prototype,"vegaPopoverWrapper",void 0),S([e()],E.prototype,"vegaModalWrapper",void 0),S([e()],E.prototype,"defaultWrapper",void 0);class A extends i{getPositionBox(t,e){const i=t||this.getPlacements(),s=e||this.getAlignments(),o=this.getTargetBoundBox(),n=this.getElementBoundBox(),h=this.getElementScrollDimension(),r=this.getSuitablePlacement(h,n,o,i),c=this.getSuitableAlignment(h,n,o,r,s),l=this.calculatePosition(n,o,r,c),a=this.getTranslocationBox(r);return l.placement=r,l.alignment=c,l.left+=a.X,l.top+=a.Y,l}getElementBoundBox(){const t=this.showConfig.appendableElement,e=t.classList.contains("vega-force-hidden");e&&t.classList.remove("vega-force-hidden");const i=t.getBoundingClientRect();return e&&t.classList.add("vega-force-hidden"),{width:i.width,height:i.height,left:i.left,top:i.top}}getPlacements(){const t=this.showConfig.placement;if("string"==typeof t){const e=d.filter((e=>e!==t));return[t,...e]}return Array.isArray(t)?t:[...d]}getAlignments(){const t=this.showConfig.alignment;if("string"==typeof t){const e=u.filter((e=>e!==t));return[t,...e]}return Array.isArray(t)?t:[...u]}calculatePosition(t,e,i,s){return{top:this.calculateTop(t,e,i,s),left:this.calculateLeft(t,e,i,s)}}getTranslocationBox(t){const e=Array.isArray(this.showConfig.placement)?this.showConfig.placement[0]:this.showConfig.placement,i=this.getTranslocation(),s={X:0,Y:0};if(f(i)){let o=i.X,n=i.Y;(e&&["left","right"].includes(e)&&["top","bottom"].includes(t)||e&&["top","bottom"].includes(e)&&["left","right"].includes(t))&&(o=i.Y,n=i.X),["bottom","top"].includes(t)&&(s.Y="top"===t?-n:n,s.X=o),["left","right"].includes(t)&&(s.X="left"===t?-o:o,s.Y=n)}return s}calculateLeft(t,e,i,s){switch(i){case"top":case"bottom":return"end"===s?e.left+e.width-t.width:"center"===s?e.left-(t.width-e.width)/2:e.left;case"left":return e.left-t.width;case"right":return e.left+e.width;default:throw new Error(`Unexpected placement: ${i}. Expected values are top, bottom, left, or right.`)}}calculateTop(t,e,i,s){switch(i){case"left":case"right":return"end"===s?e.top+e.height-t.height:"center"===s?e.top-(t.height-e.height)/2:e.top;case"top":return e.top-t.height;case"bottom":return e.top+e.height;default:throw new Error(`Unexpected placement: ${i}. Expected values are top, bottom, left, or right.`)}}getSuitablePlacement(t,e,i,o){const n=o[0];return o.find((s=>this.hasEnoughSpace(t,s,i,e)))||(s.warn(`\n No enough space found for placing element and we will keep using the defined placement:\n ${n}\n `),n)}getSuitableAlignment(t,e,i,o,n){const h=n[0];return n.find((s=>this.hasEnoughAlignmentSpace(t,i,e,o,s)))||(s.warn(`\n No enough space found for placing element and we will keep using the defined alignment:\n ${h}\n `),h)}hasEnoughAlignmentSpace(t,e,i,s,o){if(["top","bottom"].includes(s))switch(o){case"start":return e.left+i.width<=t.width;case"center":return e.left>=(i.width-e.width)/2&&e.left+e.width/2+i.width/2<=t.width;case"end":return e.left+e.width>=i.width}if(["right","left"].includes(s))switch(o){case"start":return e.top+i.height<=t.height;case"center":return e.top>=(i.height-e.height)/2&&e.top+e.height/2+i.height/2<=t.height;case"end":return e.top+e.height>=i.height}return!1}hasEnoughSpace(t,e,i,s){switch(e){case"top":return i.top>=s.height;case"bottom":return t.height-i.top-i.height>=s.height;case"left":return i.left>=s.width;case"right":return t.width-i.left-i.width>=s.width;default:return!1}}getTranslocation(){const t=this.showConfig.translocation;return t&&p.format(t,"translocation")}}var P=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class k extends A{getPosition(){return"relative"!==window.getComputedStyle(this.container).position&&s.warn("Calculate position should make container as 'position: relative', otherwise the result might not be accurate."),this.getPositionBox()}getTargetBoundBox(){const t=this.container.getBoundingClientRect(),e=this.showConfig.target.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top-t.top+this.container.scrollTop,left:e.left-t.left+this.container.scrollLeft}}getElementScrollDimension(){return{width:this.container.scrollWidth,height:this.container.scrollHeight}}}P([t()],k.prototype,"container",void 0),P([t()],k.prototype,"showConfig",void 0);class T extends A{getPosition(t){const e=t?this.getPositionBox([this.previousPositionBox.placement],[this.previousPositionBox.alignment]):this.getPositionBox();return this.previousPositionBox=e,e}getTargetBoundBox(){const t=this.showConfig.target.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,left:t.left}}getElementScrollDimension(){return{width:window.innerWidth,height:window.innerHeight}}}!function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);n>3&&h&&Object.defineProperty(e,i,h)}([t()],T.prototype,"showConfig",void 0);var $=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class D extends i{constructor(){super(...arguments),this.bodyPositionStrategy=new k,this.screenPositionStrategy=new T}setCalculationStrategy(){this.positionStrategy=this.showConfig.isScreenPosition?this.screenPositionStrategy:this.bodyPositionStrategy}adjustPosition(t){this.adjustWidth(),this.adjustHeight(),this.applyPosition(this.positionStrategy.getPosition(t))}applyPosition(t){const e=this.showConfig.appendableElement;this.showConfig.isScreenPosition&&(e.style.position="fixed"),e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.classList.remove("vega-placement-left","vega-placement-right","vega-placement-top","vega-placement-bottom"),e.classList.remove("vega-alignment-start","vega-alignment-center","vega-alignment-end"),e.classList.add(`vega-placement-${t.placement}`),e.classList.add(`vega-alignment-${t.alignment}`)}adjustWidth(){if(this.showConfig.matchTargetWidth){const{width:t}=this.showConfig.target.getBoundingClientRect();this.setRelatedWidth("width",t)}else this.setRelatedWidth("width",this.showConfig.size),this.setRelatedWidth("minWidth",this.showConfig.minWidth),this.setRelatedWidth("maxWidth",this.showConfig.maxWidth)}setRelatedWidth(t,e){if(!e)return;const i=p.format(e,"size");i&&(this.showConfig.appendableElement.style[t]="number"==typeof i?`${i}px`:i)}adjustHeight(){if(this.showConfig.matchContainerHeight&&!this.showConfig.isScreenPosition){const{height:t}=this.showConfig.target.getBoundingClientRect();let e=this.container.scrollHeight-this.showConfig.target.offsetTop-t;this.showConfig.maxHeight&&(e=Math.min(e,this.showConfig.maxHeight)),this.showConfig.appendableElement.style.maxHeight=`${e}px`}else this.showConfig.maxHeight&&(this.showConfig.appendableElement.style.maxHeight=`${this.showConfig.maxHeight}px`)}}$([t()],D.prototype,"container",void 0),$([t()],D.prototype,"showConfig",void 0),$([e()],D.prototype,"bodyPositionStrategy",void 0),$([e()],D.prototype,"screenPositionStrategy",void 0);var B=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class L{constructor(t,e){var i,s;this.resizeObserverSlimmer=l(L,a,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"},{mapFrom:"disconnectResizeObserver",mapTo:"disconnectResizeObserver"}],[{callback:()=>{h(this.showConfig.target)&&h(this.showConfig.appendableElement)&&this.adjustPosition()},target:()=>[document.body,this.showConfig.appendableElement,this.showConfig.target]}]),this.elementAppenderContainerController=new E,this.positionCalculationController=new D,this.showConfigCallback=t,this.showConfigCallbackTarget=e;const o=this.getShowConfig();null===(i=o.appendableElement)||void 0===i||i.classList.add("vega-force-hidden"),null===(s=o.appendableElement)||void 0===s||s.classList.add("vega-element-appender-appendable")}show(){this.setShowConfig(),this.showConfig.target?this.showConfig.appendableElement?(this.prepareShow(),this.adjustPosition(),this.setZIndex(),this.toggleShow(!0),this.connectResizeObserver()):s.error("No appendable element found, please add it at new elementAppender."):s.error("No target element found, please add it at new elementAppender.")}hide(){this.showConfig&&(this.toggleShow(!1),this.resetContainerPosition(),c.removeZIndex(this.showConfig.appendableElement,"base"))}onScroll(){var t;const e=this.showConfig.target.getBoundingClientRect();!this.showConfig.isScreenPosition||e.left===(null===(t=this.previousTargetRect)||void 0===t?void 0:t.left)&&e.top===this.previousTargetRect.top||this.adjustPosition(!0)}destroy(){this.showConfig&&(this.removeVisibleAppendElement(this.showConfig.appendableElement),this.resetContainerPosition(),c.removeZIndex(this.showConfig.appendableElement,"base"),this.showConfig.appendableElement.remove(),this.disconnectResizeObserver())}connectResizeObserver(){}disconnectResizeObserver(){}toggleShow(t){t?(this.showConfig.appendableElement.classList.remove("vega-force-hidden"),this.saveVisibleAppendElement(this.showConfig.appendableElement)):(this.showConfig.appendableElement.classList.add("vega-force-hidden"),this.removeVisibleAppendElement(this.showConfig.appendableElement))}saveVisibleAppendElement(t){const e=L.containerMap.get(this.container);e&&e.visibleAppendElements.add(t)}removeVisibleAppendElement(t){const e=L.containerMap.get(this.container);e&&e.visibleAppendElements.delete(t)}resetContainerPosition(){const t=L.containerMap.get(this.container);if(t){const{visibleAppendElements:e,originPosition:i="static"}=t;0===e.size&&(this.container.style.position=i,L.containerMap.delete(this.container))}}setShowConfig(){this.showConfig=this.getShowConfig(),this.showConfig=Object.assign({matchTargetWidth:!1,matchContainerHeight:!1},this.showConfig),this.showConfig.target&&this.showConfig.appendableElement&&this.elementAppenderContainerController.setContainer()}prepareShow(){this.showConfig.isScreenPosition||this.initVisibleAppendElement(),this.showConfig.appendableElement.style.boxSizing="border-box",this.positionCalculationController.setCalculationStrategy()}initVisibleAppendElement(){const t=window.getComputedStyle(this.container).position;L.containerMap.has(this.container)||L.containerMap.set(this.container,{visibleAppendElements:new Set,originPosition:t}),"static"===t&&(this.container.style.position="relative")}adjustPosition(t){this.positionCalculationController.adjustPosition(t)}setZIndex(){c.setZIndex(this.showConfig.appendableElement,"base")}getShowConfig(){return this.showConfigCallback instanceof Function?this.showConfigCallback(this.showConfigCallbackTarget):this.showConfigCallback}}L.containerMap=new Map,B([e()],L.prototype,"resizeObserverSlimmer",void 0),B([e()],L.prototype,"elementAppenderContainerController",void 0),B([e()],L.prototype,"positionCalculationController",void 0);var W,z=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};!function(t){t.SHOW="show",t.HIDE="hide"}(W||(W={}));class M extends i{constructor(t){super(),this.childrenEA=[],this.currentEA=t}componentDidLoad(){this.register()}onShow(){this.notify(W.SHOW)}onHide(){this.notify(W.HIDE)}getParent(){return this.parentEA}getChildren(){return this.childrenEA}notify(t){const e=n(this.showConfig.target,".vega-element-appender-appendable");e&&v.notify(b.getSubject(e,w),{type:t,child:this.currentEA,callback:t=>{this.parentEA=t}})}register(){this.showConfig&&j.addUniqueObserverToNode(this.showConfig.appendableElement,w,(t=>{t.type===W.SHOW?this.childrenEA.push(t.child):t.type===W.HIDE&&(this.childrenEA=this.childrenEA.filter((e=>e!==t.child))),t.callback(this.currentEA)}))}}z([t()],M.prototype,"showConfig",void 0),z([o("componentDidLoad")],M.prototype,"componentDidLoad",null),z([o("show")],M.prototype,"onShow",null),z([o("hide")],M.prototype,"onHide",null);var V=function(t,e,i,s){var o,n=arguments.length,h=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(h=(n<3?o(h):n>3?o(e,i,h):o(e,i))||h);return n>3&&h&&Object.defineProperty(e,i,h),h};class F extends i{constructor(t,e,i="isDropdownShow",s=(()=>!1)){super(),this.hierarchyTreeManager=new M(this),this.registerElementAppenderListener=()=>{var t,e,i,s,o,n;this.unRegisterElementAppenderListener(),this.showConfig&&(null===(t=this.showConfig.target)||void 0===t||t.addEventListener("click",this.targetClickHandler),null===(e=this.showConfig.target)||void 0===e||e.addEventListener("mouseenter",this.targetMouseEnterHandler),null===(i=this.showConfig.target)||void 0===i||i.addEventListener("mouseleave",this.targetMouseLeaveHandler),null===(s=this.showConfig.target)||void 0===s||s.addEventListener("focusout",this.targetFocusoutHandler),null===(o=this.showConfig.appendableElement)||void 0===o||o.addEventListener("mouseenter",this.elementMouseEnterHandler),null===(n=this.showConfig.appendableElement)||void 0===n||n.addEventListener("mouseleave",this.elementMouseLeaveHandler)),window.addEventListener("mousedown",this.globalMouseDownHandler),document.addEventListener("scroll",this.globalScrollHandler,{capture:!0}),this.listenShadowRootElementScrolling()},this.targetClickHandler=()=>{this.shouldListenerWork("click")&&(this.isShowing()?this.hide():this.show())},this.targetMouseEnterHandler=()=>{this.shouldListenerWork("hover")&&(!1===this.isShowing()&&this.show(),this.clearDelayHideTimer())},this.targetMouseLeaveHandler=()=>{this.shouldListenerWork("hover")&&this.createDelayHideTimer()},this.targetFocusoutHandler=t=>{var e;r(t.relatedTarget,null===(e=this.showConfig)||void 0===e?void 0:e.appendableElement)||this.targetMouseLeaveHandler()},this.elementMouseEnterHandler=()=>{var t;null===(t=this.hierarchyTreeManager.getParent())||void 0===t||t.elementMouseEnterHandler(),this.shouldListenerWork("hover")&&!this.disableInteractiveGetter()&&this.clearDelayHideTimer()},this.elementMouseLeaveHandler=()=>{var t;null===(t=this.hierarchyTreeManager.getParent())||void 0===t||t.elementMouseLeaveHandler(),this.shouldListenerWork("hover")&&!this.disableInteractiveGetter()&&this.createDelayHideTimer()},this.globalMouseDownHandler=t=>{const e=t.composedPath()[0];!this.hierarchyTreeManager.getChildren().some((t=>t.isShowing()))&&this.shouldListenerWork("custom")&&this.isShowing()&&this.showConfig&&!r(e,this.showConfig.appendableElement)&&!r(e,this.showConfig.target)&&n(e,"vega-modal")===n(this.showConfig.target,"vega-modal")&&this.hide()},this.globalScrollHandler=()=>{var t;this.showConfig&&this.showConfig.isScreenPosition&&this.isShowing()&&(null===(t=this.elementAppender)||void 0===t||t.onScroll())},this.createDelayHideTimer=()=>{this.delayHideTimer=setTimeout((()=>{this.hide(),clearTimeout(this.delayHideTimer)}),F.DELAY_HIDE_TIME)},this.clearDelayHideTimer=()=>{this.delayHideTimer&&clearTimeout(this.delayHideTimer)},this.shouldListenerWork=t=>{const e=this.getTrigger();switch(t){case"custom":return"none"!==e;case"click":return"click"===e;case"hover":return"hover"===e}throw new Error(`Unexpected trigger: ${t}. Expected values are custom, click, or hover.`)},this.showConfigFactory=t,this.getTrigger=e,this.isDropdownShowName=i,this.disableInteractiveGetter=s}connectedCallback(){null===this.elementAppender&&(this.setElementAppender(),this.registerElementAppenderListener())}disconnectedCallback(){this.unRegisterElementAppenderListener(),this.destroyElementAppender()}componentDidLoad(){this.initElementAppender()}getElementAppender(){return this.elementAppender}show(){this.elementAppender&&this.elementAppender.show(),this[this.isDropdownShowName]=!0}hide(){this.elementAppender&&this.elementAppender.hide(),this[this.isDropdownShowName]=!1,this.hierarchyTreeManager.getChildren().map((t=>{t.hide()}))}destroy(){this.destroyElementAppender(),this[this.isDropdownShowName]=!1}updateShowConfigFactory(t){this.showConfigFactory=t,this.initElementAppender()}destroyElementAppender(){this.elementAppender&&(this.elementAppender.destroy(),this.elementAppender=null)}initElementAppender(){this.setShowConfig(),this.setElementAppender(),this.registerElementAppenderListener()}setElementAppender(){this.elementAppender=new L(this.showConfigFactory,this)}isShowing(){return this[this.isDropdownShowName]}setShowConfig(){this.showConfig=this.showConfigFactory()}unRegisterElementAppenderListener(){var t,e,i,s,o,n;this.showConfig&&(null===(t=this.showConfig.target)||void 0===t||t.removeEventListener("click",this.targetClickHandler),null===(e=this.showConfig.target)||void 0===e||e.removeEventListener("mouseenter",this.targetMouseEnterHandler),null===(i=this.showConfig.target)||void 0===i||i.removeEventListener("mouseleave",this.targetMouseLeaveHandler),null===(s=this.showConfig.target)||void 0===s||s.removeEventListener("focusout",this.targetMouseLeaveHandler),null===(o=this.showConfig.appendableElement)||void 0===o||o.removeEventListener("mouseenter",this.elementMouseEnterHandler),null===(n=this.showConfig.appendableElement)||void 0===n||n.removeEventListener("mouseleave",this.elementMouseLeaveHandler)),window.removeEventListener("mousedown",this.globalMouseDownHandler),document.removeEventListener("scroll",this.globalScrollHandler),this.removeShadowRootElementScrolling()}listenShadowRootElementScrolling(){this.shadowRootElementScrollingObserver=new g(this.canAcceptShadowRootScrollEvent.bind(this),this.globalScrollHandler.bind(this)),v.register(m,this.shadowRootElementScrollingObserver)}canAcceptShadowRootScrollEvent(t){return Boolean(this.showConfig&&r(this.showConfig.target,t.host))}removeShadowRootElementScrolling(){v.unregister(m,this.shadowRootElementScrollingObserver)}}F.DELAY_HIDE_TIME=100,V([e()],F.prototype,"hierarchyTreeManager",void 0),V([o("connectedCallback")],F.prototype,"connectedCallback",null),V([o("disconnectedCallback")],F.prototype,"disconnectedCallback",null),V([o("componentDidLoad")],F.prototype,"componentDidLoad",null);export{F as E}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{O as s,q as t,a,d as e}from"./p-b1faebe0.js";import{L as o}from"./p-6e1ab235.js";class r{format(t){if(s(t)){const s=[];return this.getStates().forEach((a=>{const e=this.formatToken(t[a]);e&&s.push(`:host${"default"===a?"":`(:${a})`}{\n\t${e}\n}`)})),s.join("\n")}return`:host{\n\t${this.formatToken(t)}\n}`}}const n=new class extends r{constructor(){super(...arguments),this.states=["default","hover","active","focus-visible"]}formatToken(s){return t(s)?`background-color: ${e[s]};`:(o.warn(`The backgroundColor value ${s} is invalid, it must be a value of: `,a),"")}getStates(){return this.states}};export{r as S,n as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as t,R as e,a as n,b as s,c as r,M as i,B as o,d as a,e as c,f as l,g as u,I as d,h,S as w,i as p,j as m,k as g,l as f,C as x,m as b,n as T,o as O,s as E,N as A,p as y,q as k,r as N,t as C,u as j,v as B,w as H,x as I,H as S,y as v,z as R,D as L,U as D,E as M,F as P,G as F}from"./p-7f087c8b.js";import{g as z}from"./p-a4670e23.js";import{i as U}from"./p-5e2c9e69.js";import{C as $}from"./p-2d0d575f.js";import{d as G}from"./p-b5822a21.js";import{a as V}from"./p-b5bef48a.js";import{d as J}from"./p-02841589.js";import{r as W,i as K}from"./p-575235c8.js";import{c as X}from"./p-bf19682d.js";class Y extends e{constructor(t,e,n){super(t,"list-item",n),this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const s=new Y(t.id,void 0,e);s.children=t.nodes.map((t=>n.from(t,s,e))),t.children&&(s.nestList=t.children.map((t=>{const e=_.from(t);return e.parent=s,e})));const{annotations:r}=t;return r&&Object.entries(r).forEach((([t,e])=>{const n=this.createAnnotationEntity(t,e);U(n)&&s.annotationMap.set(...n)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(){return[`<li${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),"</li>"].join("")}cloneWithNodes(t){const e=new Y(z());return e.children=[],e.apply(new s(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}createNewListItem(){return new Y(z())}clone(){var t;const e=new Y(this.id);return e.children=this.children.map((t=>{const n=t.clone();return n.parent=e,n})),e.annotationMap=super.cloneAnnotations(),e.nestList=null===(t=this.nestList)||void 0===t?void 0:t.map((t=>{const n=t.clone();return n.parent=e,n})),e.parent=this.parent,e}}r.register(i.LINE_BREAK_SINGLE_BLOCK,Y.name,new o),r.register(i.LINE_BREAK_MULTIPLE_BLOCKS,Y.name,new a),r.register(i.DELETE_NEST_LIST,Y.name,new class extends t{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),r.register(i.SPLIT_BLOCK_WITH_NODE,Y.name,new c),r.register(i.REPLACE_CHILD_NODES,Y.name,new l),r.register(i.REPLACE_NEST_LIST,Y.name,new class extends t{handleAction(t,e){t.newList.forEach((t=>{t.parent=e})),e.nestList=t.newList}}),r.register(i.MERGE_TWO_BLOCKS_NODES,Y.name,new u),r.register(i.INSERT_IMAGE_TO_BLOCK,Y.name,new class extends t{handleAction(t,e){e.parent.apply(t)}});class Z extends m{constructor(){super(...arguments),this.type=g.LIST}renderStyle(t){return(null==t?void 0:t.standalone)?{paddingLeft:"8px",marginLeft:"16px"}:null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new Z}toJSON(){}}class _ extends f{constructor(t,e,n){super(t),this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(g.LIST,new Z)}static from(t,e={autoMatchFormat:!0}){const n=new _(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);U(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=Y.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return T.from(e);case"customClass":return b.from(e);case"customStyle":return x.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(){const t=this.getBlockTag();return[`<${t}${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),`</${t}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(){const t=new _(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}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}r.register(i.TRANSFORM_LIST_BLOCK,_.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,r=e.parent.createList(t.listType);if(n.every((t=>t.parent===e)))r.apply(new s(e.children)),e.parent.apply(new d(e,r)),e.parent.apply(new h(e)),n.forEach((t=>t.children.map((t=>t.apply(new w)))));else{const n=t.selectedBlocks.map((t=>e.parent.toListItem(t)));r.apply(new s(n)),e.parent.apply(new d(e,r)),t.selectedBlocks.forEach((t=>{t.parent.apply(new h(t))})),0===e.children.length&&e.parent.apply(new h(e))}}}),r.register(i.TRANSFORM_PARAGRAPH_BLOCK,_.name,new class extends t{handleAction(t,e){let n=!1,r=!1;const i=t.selectedBlocks,o=i.map((t=>(t.children.map((t=>t.apply(new w))),t===e.children[0]&&(n=!0),t===e.children[e.children.length-1]&&(r=!0),this.toParagraph(t))));if(n)e.parent.apply(new p(e,...o));else if(r)e.parent.apply(new d(e,...o));else{const t=e.children.indexOf(i[0]),n=e.children.indexOf(i[i.length-1]),r=e.parent.createList(e.type);r.apply(new s(e.children.slice(0,t)));const a=e.parent.createList(e.type);a.apply(new s(e.children.slice(n+1))),e.parent.apply(new p(e,r,...o,a)),e.parent.apply(new h(e))}i.map((t=>{e.apply(new h(t))})),0===e.children.length&&e.parent.apply(new h(e))}toParagraph(t){const n=new e(z(),"paragraph");return n.apply(new s(t.children)),n.annotationMap=t.annotationMap,n}}),r.register(i.INSERT_IMAGE_TO_BLOCK,_.name,new class extends t{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new d(e,t.imageBlockToBeInserted):t)}});class Q{}class q{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(t={autoMatchFormat:!0,skipCustomAnnotations:!0}){const e=this.currentStrategy.handle(this.currentElements,t);return this.childrenOutput.length>0&&e&&this.currentStrategy.appendChildBlocks(e,this.childrenOutput.map((e=>e.toDto(t))).filter(U)),e}}const tt=new class{constructor(){this.elementToBlockStrategies=[],this.elementToNodeStrategies=[]}registerElementToBlockStrategy(t){this.hasDuplicateStrategy(t,this.elementToBlockStrategies)||this.elementToBlockStrategies.unshift(t)}registerElementToNodeStrategy(t){this.hasDuplicateStrategy(t,this.elementToNodeStrategies)||this.elementToNodeStrategies.unshift(t)}getElementToBlockStrategies(){return this.elementToBlockStrategies}getElementToNodeStrategies(){return this.elementToNodeStrategies}hasDuplicateStrategy(t,e){return e.includes(t)}},et=new class{process(t,e={autoMatchFormat:!0,skipCustomAnnotations:!0}){const n=this.getElementToBlockStrategies(),s=[];for(let r=0;r<t.length;r++){if(this.isInvalidElement(t[r]))continue;let i=0;for(const o of n)if(i=o.canHandle(t,r,e),i>0){const n=t.slice(r,r+i),a=new q(o,n);1===i&&o.shouldProceedToElementChildren()&&a.setChildrenOutput(this.process(Array.from(n[0].childNodes),e)),s.push(a),r+=i-1;break}if(0===i&&r<t.length){const n=Array.from(t[r].childNodes),i=this.process(Array.from(n),e);i.length>0&&s.push(...i)}}return s}isInvalidElement(t){return t.nodeType===Node.COMMENT_NODE||["META","STYLE"].includes(t.nodeName)}getElementToBlockStrategies(){return tt.getElementToBlockStrategies()}};class nt extends t{handleAction(t,e){const n=t.entityToBeAppended;e.children&&(n.forEach((t=>{t.parent=e})),e.children=e.children.concat(n))}}class st extends t{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[...t.childrenToBeInserted,t.referChildren])}replaceElementWithElements(t,e,n){t.children&&(n.forEach((e=>{e.parent=t})),t.children=t.children.flatMap((t=>t===e?n:t)))}}class rt extends st{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[t.referChildren,...t.childrenToBeInserted])}}class it extends A{constructor(t,e){super(),this.type=y.IMAGE,this.size=t,this.alt=e}static from(t,e){return[y.IMAGE,new it(t,e)]}toJSON(){return U(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new it(this.size,this.alt)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.size?`v-rte--image-size-${this.size}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={verticalAlign:"bottom"};switch(this.size){case"sm":return Object.assign(Object.assign({},e),{width:"25%"});case"md":return Object.assign(Object.assign({},e),{width:"50%"});case"lg":return Object.assign(Object.assign({},e),{width:"100%"})}}}class ot extends k{constructor(t,e,n,s){super(t,s),this.type=N.IMAGE,this.url=e,this.parent=n}static from(t,e,n={autoMatchFormat:!0}){const s=new ot(t.id,t.url,e),r=!!n.autoMatchFormat,i=Object.assign({},t.annotations),{size:o}=i,a=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(i,["size"]),c=Object.assign(Object.assign({},a),{size:null!=o?o:r?"md":void 0});return s.annotationMap=new Map(Object.keys(c).map((t=>"size"===t||"alt"===t?it.from(c.size,c.alt):this.createAnnotationEntity(t,c[t]))).filter(U)),s}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof it||t instanceof C)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return""==t.alt&&delete t.alt,Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"image",url:this.url})}clone(){return new ot(this.id,this.url,this.parent,super.cloneAnnotations())}toHtml(){const t=this.getAnnotationByType(y.IMAGE);return`<img${super.generateAttributeString(...[t&&t.alt?`alt="${t.alt}"`:null,`src="${this.url}"`,t&&t.size?`data-size="${t.size}"`:null].filter(U))}>`}doAnnotationActionApply(t){const e=r.get(j.name,ot.name);e&&e.execute(t,this)}doModifyActionApply(t){r.executeTheStrategy(t,this)}}r.register(i.UPDATE_IMAGE_NODE_URL,ot.name,new class extends t{handleAction(t,e){e.url=t.url}}),r.register(j.name,ot.name,new class extends t{handleAction(t,e){const n=t.toAnnotation();e.annotationMap.set(n.type,n)}});class at extends H{constructor(t,e){super(),this.type=i.INSERT_NEW_PARAGRAPH,this.startContainerNode=t,this.startOffset=e}}class ct extends f{constructor(t){super(t),this.type="image",this.children=[]}static from(t,e={autoMatchFormat:!0}){const n=new ct(t.id),{annotations:s}=t;return n.children=t.nodes.map((t=>ot.from(t,n,e))),s&&super.convertAnnotationsToMap(n.annotationMap,s),n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.children.map((t=>t.toJSON()))})}toHtml(){const t=super.generateAttributeString(),e=this.children.map((t=>t.toHtml())).join("");return super.shouldRenderAsInternalWrapper()?e:[`<div${t}>`,e,"</div>"].join("")}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.url.length>0))}getLastNode(){return this.children[this.children.length-1]}createNewImageBlock(){return new ct(z())}clone(){const t=new ct(this.id);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}}r.register(i.MERGE_TWO_BLOCKS_NODES,ct.name,new u),r.register(i.REPLACE_CHILD_NODES,ct.name,new l),r.register(i.SPLIT_BLOCK_WITH_NODE,ct.name,new class extends t{handleAction(t,e){t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode,e)}splitImageNodes(t,e,n){const s=n.children.indexOf(t);if(s>-1){const t=n.children.slice(0,s+e),r=n.children.slice(s+e);n.apply(new B(t));const i=this.cloneWithNodes(r,n);return n.parent.apply(new d(n,i)),i}}cloneWithNodes(t,e){const n=e.createNewImageBlock();return n.children=[],n.apply(new s(t)),n}}),r.register(i.LINE_BREAK_SINGLE_BLOCK,ct.name,new class extends t{handleAction(t,e){const n=new at(t.startContainerNode,t.startOffset);e.apply(n);const s=n.newBlock;s&&(t.lineBreakNode=s.children[0])}}),r.register(i.LINE_BREAK_MULTIPLE_BLOCKS,ct.name,new class extends t{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,r){const i=e.from({id:z(),type:"paragraph",nodes:[{id:z(),type:"text",text:"\n"}]});r.parent.apply(new d(r,i));const o=this.concatBlocksNodes(t.slice(1));return(0===o.length||o[0]&&""===o[0].text)&&o.push(new n(z(),"\n",i)),i.apply(new s(o)),i.children[0]}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new h(t)))})),e}}),r.register(i.INSERT_IMAGE_TO_BLOCK,ct.name,new class extends t{handleAction(t,e){const n=t.splitPointNode,r=t.startOffsetOfNode,i=t.imageBlockToBeInserted;e.children.length<1?e.apply(new s(i.children)):this.isCaretPositionAtBlockEnd(e,n,r)?e.parent.apply(new d(e,i)):this.isCaretPositionAtBlockStart(e,n,r)?e.parent.apply(new p(e,i)):(e.apply(new I(n,r)),e.parent.apply(new d(e,i)))}}),r.register(S.name,ct.name,new v);class lt extends f{constructor(t,e){super(t),this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new lt(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=t.children.map((t=>{const s=R.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(U),n}clone(){const t=new lt(this.id,this.htmlTag);return t.children=this.children.map((t=>t.clone())),t.annotationMap=super.cloneAnnotations(),t}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0}toHtml(){const t=this.htmlTag;return[`<${t}${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),`</${t}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}class ut extends H{constructor(t){super(),this.type=i.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class dt extends L{handleAction(t,e){const{startContainerNode:n}=t;n.isContentEditable()?n.isTextNode()&&this.deleteTextNodeContent(t,e):this.deleteDecoratorNodeContent(t,e);const s=e.parent;s&&e.isListItemBlock()&&0===s.children.length&&s.parent.apply(new h(s))}deleteTextNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;if(0!==s&&!n.isEmpty()){const r=n.text.slice(0,s-1)+n.text.slice(s);if(n.apply(new D(r)),r)return void(t.previousNode=n);{const s=this.getPreviousNode(n);return s&&s.parent===e&&"\n"===s.text||1===e.children.length?void(t.previousNode=n):(e.apply(new h(n)),void(t.previousNode=s))}}{let s=this.getPreviousNode(n),r=null;if(e.children.length&&s&&s.parent!==e)n.isEmpty()&&e.apply(new h(n)),e.type===s.parent.type&&s.parent.apply(new ut(e));else if(this.isContentFirstNode(n)&&n.isEmpty()&&(r=this.getNextNode(n)),n.isEmpty()&&e.apply(new h(n)),s&&s.isTextNode()&&s.isEmpty()){const t=s;s=this.getPreviousNode(s),t.parent.apply(new h(t)),s||(r=n)}0===e.children.length&&e.parent.apply(new h(e)),s?t.previousNode=s:r&&(t.nextNode=r)}}deleteDecoratorNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;let r=this.getPreviousNode(n),i=null;if(0!==s){const t=e;this.isContentFirstNode(n)&&(i=this.getNextNode(n)),1===t.children.length?t.parent.apply(new h(t)):t.apply(new h(n))}else{const e=r;e&&!e.isContentEditable()&&(r=this.getPreviousNode(e),e.parent.apply(new h(e)),r||(t.nextNode=n))}r?t.previousNode=r:i&&(t.nextNode=i)}}class ht extends t{handleAction(t,e){const{startContainerNode:n}=t;t.newBlock=this.breakSingleBlock(n,t.startOffset,e)}breakSingleBlock(t,e,n){const s=this.getNewParagraph(t);if(s){if(this.isCaretPositionAtBlockEnd(n,t,e))n.parent.apply(new d(n,s));else{if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new I(t,e);return n.apply(s),s.newBlock}n.parent.apply(new p(n,s))}return s}}getNewParagraph(t){const e=this.createNewParagraph("");if(e){let n=e.children[0];return t.isTextNode()&&t.isContentEditable()&&(e.children=[],n=t.cloneWithText(""),n.annotationMap.delete(y.LINK),e.apply(new s([n]))),e}}}class wt extends H{constructor(t,e){super(),this.type=i.UPDATE_CURSOR_POSITION,this.nextFocusNode=t,this.offset=e}}class pt extends t{handleAction(t,e){const{text:n,offset:s,decoratorNode:r}=t,i=this.createNewParagraph(n);if(i){const t=i.children[0];e.apply(0!==s?new d(r,t):new p(r,t)),this.setTheCursorPosition(t)}}setTheCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new wt(t))}}class mt extends t{handleAction(t,e){t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset,e)}breakSingleListItemBlock(t,e,n){const r=n.createNewListItem(),i=this.copyInlineStyleToNewNode(t);if(r.apply(new s([i])),this.isCaretPositionAtBlockEnd(n,t,e))return this.breakListItemAtEnd(r,n);if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new I(t,e);return n.apply(s),s.newBlock}return n.parent.apply(new p(n,r)),r}breakListItemAtEnd(t,n){const r=n.parent.children[n.parent.children.length-1],i=1===n.children.length&&n.children[0].isEmpty();if(n===r&&i){const r=n.parent.parent;if("list-item"!==r.type){const i=e.from({id:z(),type:"paragraph",nodes:[]});return i.apply(new s(t.children)),r.apply(new d(n.parent,i)),n.parent.apply(new h(n)),i}r.parent.apply(new d(r,t)),n.parent.apply(new h(n))}else n.parent.apply(new d(n,t));return t}copyInlineStyleToNewNode(t){const e=t.cloneWithText("");return e.annotationMap.delete(y.LINK),e}}class gt extends H{constructor(t){super(),this.type=i.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class ft extends M{handleAction(t,e){super.handleAction(t,e);const n=e.parent;0===e.children.length&&n&&n.apply("list-item"===n.type?new gt(e):new h(e))}}const xt=new class{registerBlockBasicStrategies(t){r.register(i.DELETE_CHILDREN,t,t===_.name?new ft:new M),r.register(i.APPEND_CHILDREN,t,new nt),r.register(i.INSERT_CHILDREN_BEFORE,t,new st),r.register(i.INSERT_CHILDREN_AFTER,t,new rt),r.register(i.DELETE_BLOCK_CONTENT,t,new dt),r.register(i.INSERT_NEW_PARAGRAPH,t,t===Y.name?new mt:new ht),r.register(i.INSERT_TEXT_TO_DECORATOR_NODE,t,new pt)}};class bt{}class Tt extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isBold(t)||e.bold?{bold:!0}:{}}isBold(t){return"STRONG"===t.nodeName||"B"===t.nodeName||"bold"===t.style.fontWeight||"700"===t.style.fontWeight||t.classList.contains("v-rte--bold")}}class Ot extends bt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getAttributes(t);return Object.keys(e).length>0?{customAttribute:e}:{}}getAttributes(t){return t.getAttributeNames().filter((t=>"style"!==t&&"class"!==t&&this.isValidAttr(t))).reduce(((e,n)=>(e[n]=t.getAttribute(n),e)),{})}isValidAttr(t){return/^[a-zA-Z_][\w-]*$/.test(t)}}class Et extends bt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getCustomClass(t);return e.length>0?{customClass:e}:{}}getCustomClass(t){return t.classList.toString().split(" ").filter((t=>!t.includes("v-rte")&&""!==t))}}class At extends bt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.generateCustomStyleAnnotations(t);return Object.keys(e).length>0?{customStyle:e}:{}}generateCustomStyleAnnotations(t){const e=t.getAttribute("style");return e?e.split(";").filter(Boolean).filter((t=>" "!==t)).map((t=>{const e=t.replace(/(['"])(.*?)\1/g,"$2").split(":");return{[J(e[0].trim())]:e[1].trim().replace(";","")}})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{}):{}}}class yt extends bt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.name)}handle(t){const e=this.getIndent(t);return e?{indent:e}:{}}getIndent(t){const e=t.style;let n;if(e.marginLeft)n=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:n=t[3];break;case 2:case 3:n=t[1];break;default:n=t[0]}}}const s=Number(n.replace("px",""));return s&&s>=0?Math.floor(s/16):null}}class kt extends bt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.name)}handle(t){const e=this.getTextAlign(t);return e?{textAlign:e}:{}}getTextAlign(t){const e=t.classList;if(e.contains("v-rte--horizontal-alignment-left"))return"left";if(e.contains("v-rte--horizontal-alignment-center"))return"center";if(e.contains("v-rte--horizontal-alignment-right"))return"right";if(e.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}}class Nt extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isCode(t)||e.code?{code:!0}:{}}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName||"PRE"===t.nodeName||"monospace"===t.style.fontFamily||"Roboto Mono"===t.style.fontFamily.replace(/["']/g,"")}}class Ct extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){const n=this.getColor(t)||e.textColor;return n?{textColor:n}:{}}getColor(t){var e;const n=null===(e=W(t.style.color))||void 0===e?void 0:e.toUpperCase();if(n){const t=P.filter((t=>t.key!==F.key)).find((t=>t.light===n||t.dark===n));return t?t.key:null}for(const e of P)if(t.style.color.includes(e.key))return e.key;return null}}class jt extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isItalic(t)||e.italic?{italic:!0}:{}}isItalic(t){return"I"===t.nodeName||"italic"===t.style.fontStyle||"EM"===t.nodeName||t.classList.contains("v-rte--italic")}}class Bt extends bt{constructor(){super(...arguments),this.handlers=[new Ot,new Et,new At]}canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return e.link?{link:e.link}:"A"===t.tagName?{link:this.generateLinkAnnotations(t)}:{}}generateLinkAnnotations(t){const e={href:t.getAttribute("href")||"",groupKey:z()};return this.handlers.forEach((n=>{Object.assign(e,n.handle(t))})),e}}class Ht extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isStrikethrough(t)||e.strikethrough?{strikethrough:!0}:{}}isStrikethrough(t){return t.style.textDecoration.includes("line-through")||"S"===t.nodeName||"DEL"===t.nodeName||t.classList.contains("v-rte--strikethrough")}}class It extends bt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isUnderline(t)||e.underline?{underline:!0}:{}}isUnderline(t){return t.style.textDecoration.includes("underline")||"U"===t.nodeName||"INS"===t.nodeName||t.classList.contains("v-rte--underline")}}class St extends bt{canHandle(t,e){return!!e.autoMatchFormat&&"RTETextBlock"===t.name}handle(t){const e=this.getTextStyle(t);return e?{textStyle:e}:{}}getTextStyle(t){const e=this.getElementTypeByDataType(t);if(e)return e;const n=this.getElementTypeByNodeName(t);if(n)return n;const s=this.getElementTypeByFontSize(t);if(s)return s;return this.getElementTypeByClassName(t)||null}getElementTypeByDataType(t){return t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type")?t.getAttribute("data-type"):null}getElementTypeByFontSize(t){var e;switch(null===(e=t.style)||void 0===e?void 0:e.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3";default:return null}}getElementTypeByNodeName(t){switch(t.nodeName){case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";case"H4":return"heading-4";case"H5":return"heading-5";case"H6":return"heading-6";default:return null}}getElementTypeByClassName(t){if(t.className){const e=/\bv-rte--text-style-(title|subtitle|heading-1|heading-2|heading-3|paragraph)\b/.exec(t.className);if(e)return e[1]}return null}}class vt extends bt{canHandle(t){return"RTEImageNode"===t.name}handle(t){const e=this.getImageSize(t);return e?{size:e}:{}}getImageSize(t){return t.getAttribute("data-size")?t.getAttribute("data-size"):null}}class Rt extends bt{canHandle(t){return"RTEImageNode"===t.name}handle(t){return t.hasAttribute("alt")?{alt:t.getAttribute("alt")}:{}}}class Lt extends bt{constructor(){super(...arguments),this.customAttributeHandler=new Ot,this.customStyleAnnotationHandler=new At,this.customClassAnnotationHandler=new Et}canHandle(t,e){return"RTETextNode"===t.name&&!1===e.autoMatchFormat}handle(t,e){if(Lt.canHandleTags.includes(t.nodeName)){const n=this.generateInlineHtmlAnnotation(t,Object.assign({},e));if(n)return{inlineHtml:n}}return{}}generateInlineHtmlAnnotation(t,e){let{inlineHtml:s}=e;if(!n.supportsHtmlTag(t.nodeName.toLowerCase())||1===t.childNodes.length&&t.childNodes[0].nodeType!==Node.TEXT_NODE){const e={htmlTag:t.nodeName.toLowerCase(),customAttribute:this.customAttributeHandler.handle(t).customAttribute,customStyle:this.customStyleAnnotationHandler.handle(t).customStyle,customClass:this.customClassAnnotationHandler.handle(t).customClass};if(s){let n=s;for(;n.child&&t.parentNode&&n.child.htmlTag===t.parentNode.nodeName.toLowerCase();)n=n.child;n.child=e}else s=e}return s?Object.assign({},s):null}}Lt.canHandleTags=["A","ABBR","AUDIO","B","BDI","BDO","CITE","CODE","DEL","DFN","EMBED","EM","I","INS","KBD","MARK","METER","OUTPUT","PROGRESS","Q","S","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","VIDEO"];const Dt=new class{constructor(){this.handlers=[new kt,new yt,new Tt,new jt,new It,new Ht,new Ct,new Bt,new Nt,new vt,new Rt,new Ot,new Et,new At,new Bt,new St,new Lt]}generate(t,e,n={autoMatchFormat:!0}){const s="A"===e.tagName;return this.handlers.filter((t=>!(!n.autoMatchFormat&&s)||t instanceof Bt)).filter((r=>e.nodeType!==Node.TEXT_NODE&&r.canHandle(t,{skipCustomAnnotations:n.skipCustomAnnotations||s,autoMatchFormat:n.autoMatchFormat}))).reduce(((t,s)=>{const r=s.handle(e,n.parentAnnotations);return Object.assign(Object.assign({},t),r)}),{})}};class Mt extends Q{constructor(){super(...arguments),this.annotationHandler=new St}generateChildNodes(t,e,s){const r=[],i=!(!s||!1!==s.autoMatchFormat),o=Object.assign({},e);return t.forEach((t=>{const a=tt.getElementToNodeStrategies().find((e=>e.canHandle([t],0,s)>0));let c=null;if(a&&(c=a.handle([t],s,o)),c)r.push(c);else if(K(t)&&t.childNodes.length>0){const a=Dt.generate(n,t,Object.assign({parentAnnotations:i?{inlineHtml:o.inlineHtml,link:o.link,code:o.code}:e},s));r.push(...this.generateChildNodes(Array.from(t.childNodes),a,s))}})),r}matchTextBlockType(t){var e;return null!==(e=this.annotationHandler.handle(t).textStyle)&&void 0!==e?e:"paragraph"}}class Pt extends Mt{canHandle(t,e,n){const s=t[e];return!n.autoMatchFormat&&("DIV"!==s.nodeName||s.childNodes.length>0&&"IMG"!==s.childNodes[0].nodeName)&&Pt.canHandleTags.includes(t[e].nodeName)?1:0}handle(t,e){return lt.from(this.generateHtmlBlock(t[0],e),e)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}generateHtmlBlock(t,e){return{id:z(),type:"html-block",htmlTag:t.nodeName.toLowerCase(),annotations:Dt.generate(lt,t,e),children:[]}}}Pt.canHandleTags=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","BUTTON","CAPTION","COL","COLGROUP","DIV","DD","DETAILS","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","HEADER","HR","HX","INPUT","LEGEND","MAIN","NAV","PRE","SECTION","SUMMARY","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR"];class Ft extends Mt{canHandle(t,e){return"PRE"!==t[e].tagName&&"CODE"!==t[e].tagName||!t[e].hasAttribute("data-language")?0:1}handle(t){const e=t[0];if(e){const t=e.textContent,n=e.dataset.language;return O.from({id:z(),type:"code-block",content:t,language:n})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class zt extends Mt{createRTEImageBlock(t,e){const n=!(e&&e.autoMatchFormat||!t.parentNode||"DIV"===t.parentNode.nodeName);return ct.from({id:z(),type:"image",nodes:[{id:z(),type:"image",url:t.src,annotations:Dt.generate(ot,t,e)}],annotations:Object.assign(Object.assign({},Dt.generate(ct,t.parentElement,e)),{internalWrapper:n})},e)}}class Ut extends Mt{canHandle(t,e){let n=0;for(let s=e;s<t.length;s++){const e=t[s];if(e.nodeType!==Node.TEXT_NODE&&(!Ut.canHandleTags.includes(e.nodeName)||""===e.textContent&&e.querySelector("IMG")))break;n++}return n}handle(t,s){const r=t[0].parentElement,i=s&&s.autoMatchFormat,o=this.generateChildNodes(t,i?Dt.generate(n,r,Object.assign(Object.assign({},s),{skipCustomAnnotations:!0})):{},s),a=i?super.matchTextBlockType(r):this.matchTextBlockTypeByTagName(r),c=!i&&!a;return e.from(Object.assign({id:z(),type:a||"paragraph",nodes:o},c?{annotations:{internalWrapper:c}}:{annotations:Dt.generate(e,r,s)}),s)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}matchTextBlockTypeByTagName(t){switch(t.nodeName){case"P":return"paragraph";default:return null}}}Ut.canHandleTags=[...Lt.canHandleTags,"CODE","A","VEGA-RICH-TEXT-LINK-EDITOR","BR"];class $t extends Q{shouldProceedToElementChildren(){return!1}appendChildBlocks(){}generateTextNode(t,e){return{id:z(),type:"text",text:t,annotations:e}}}R.registerRTEDTOClass("paragraph",e),R.registerRTEDTOClass("title",e),R.registerRTEDTOClass("subtitle",e),R.registerRTEDTOClass("heading-1",e),R.registerRTEDTOClass("heading-2",e),R.registerRTEDTOClass("heading-3",e),R.registerRTEDTOClass("heading-4",e),R.registerRTEDTOClass("heading-5",e),R.registerRTEDTOClass("heading-6",e),R.registerRTEDTOClass("heading-6",e),R.registerRTEDTOClass("list-item",Y),R.registerRTEDTOClass("bullet-list",_),R.registerRTEDTOClass("number-list",_),R.registerRTEDTOClass("image",ct),R.registerRTEDTOClass("code-block",O),R.registerRTEDTOClass("html-block",lt),R.registerRTEDTOClass("text",n),R.registerRTEDTOClass("image",ot),xt.registerBlockBasicStrategies(e.name),xt.registerBlockBasicStrategies(_.name),xt.registerBlockBasicStrategies(Y.name),xt.registerBlockBasicStrategies(ct.name),xt.registerBlockBasicStrategies(lt.name),tt.registerElementToBlockStrategy(new Ut),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){const n=t[e];return n.nodeType===Node.ELEMENT_NODE&&""===n.textContent&&n.querySelector("img")?1:0}handle(t,e){const n=t[0].querySelector("img");return this.createRTEImageBlock(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t,e){const n=t[0],s=n.querySelector("img");if(U(s))return ct.from({id:z(),type:"image",nodes:[{id:z(),type:"image",url:s.src,annotations:Dt.generate(ot,n,e)}],annotations:Dt.generate(ct,n.parentElement,e)},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t,e){return this.createRTEImageBlock(t[0],e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title","subtitle"].includes(super.matchTextBlockType(t[e]))?1:0}handle(t,n){const s=this.generateChildNodes(Array.from(t[0].childNodes),{},n);return 0===s.length?null:e.from({id:z(),type:super.matchTextBlockType(t[0]),nodes:s,annotations:Dt.generate(e,t[0],n)},n)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new Ft),tt.registerElementToBlockStrategy(new class extends Ft{canHandle(t,e){return"VEGA-CODE-BLOCK"===t[e].tagName&&0==!!t[e].querySelector("vega-code-block")||this.isCodeBlockContainer(t[e])?1:0}handle(t){const e=this.isCodeBlockContainer(t[0])?t[0].querySelector("vega-code-block"):t[0],n=e.querySelector("code");if(n)return super.handle([n]);if(e.hasAttribute("data-content")){const t=document.createElement("code");return t.textContent=e.dataset.content,t.dataset.language=e.dataset.language,super.handle([t])}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isCodeBlockContainer(t){return"PRE"===t.tagName&&t.classList.contains("code-block-container")&&1===t.querySelectorAll("vega-code-block").length}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){if(!["UL","OL"].includes(t[e].parentElement.nodeName)&&t.some((t=>"LI"===t.nodeName))){let n=0;for(let s=e;s<t.length&&"LI"===t[s].nodeName;s++)n++;return n}return"LI"===t[e].tagName?1:0}handle(t,e){const n=t[0];return["UL","OL"].includes(n.parentElement.nodeName)?Y.from(this.generateListItemBlockDTO(n,e),e):this.generateWithListBlock(t,e)}appendChildBlocks(t,e){t.nestList=e.filter((t=>["bullet-list","number-list"].includes(t.type)))}shouldProceedToElementChildren(){return!0}generateWithListBlock(t,e){return _.from({id:z(),type:"bullet-list",blocks:t.map((t=>this.generateListItemBlockDTO(t,e)))},e)}generateListItemBlockDTO(t,e){return{id:z(),type:"list-item",annotations:Dt.generate(Y,t,e),nodes:this.generateChildNodes(Array.from(t.childNodes.length?t.childNodes:[t]).filter((t=>!["UL","OL"].includes(t.nodeName))),Dt.generate(n,t,Object.assign(Object.assign({},e),{skipCustomAnnotations:!0})),e)}}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){const n=t[e],s=n.parentElement,r="LI"!==n.nodeName,i=n.nodeType===Node.TEXT_NODE&&""===n.textContent.trim(),o=U(s)&&["UL","OL"].includes(s.nodeName);return r&&!i&&o?1:0}handle(t,e){const n=this.generateChildNodes(t,{},e);return Y.from({id:z(),type:"list-item",nodes:n,annotations:{}},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:_.from({id:z(),type:"number-list",blocks:[],annotations:Dt.generate(_,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof Y)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:_.from({id:z(),type:"bullet-list",blocks:[],annotations:Dt.generate(_,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof Y)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),tt.registerElementToBlockStrategy(new Pt),tt.registerElementToNodeStrategy(new class extends $t{canHandle(t,e){const n=t[e];return!K(n)||"BR"!==n.nodeName&&0!==n.childNodes.length?0:1}handle(t,e,s){const r=!(!e||!1!==e.autoMatchFormat),i=Object.assign({},s),o=t[0],a=Dt.generate(n,o,Object.assign({parentAnnotations:r?{inlineHtml:i.inlineHtml,link:i.link,code:i.code}:s},e));if("BR"===o.nodeName)return this.generateTextNode("\n",a);if(0===o.childNodes.length){const t=r?X(Object.assign(Object.assign({},n.supportsHtmlTag(o.nodeName.toLowerCase())?a:{}),{inlineHtml:a.inlineHtml,plainText:U(a.inlineHtml)})):a;return Object.assign({},this.generateTextNode("",t))}}}),tt.registerElementToNodeStrategy(new class extends $t{canHandle(t,e){return t[e].nodeType===Node.TEXT_NODE?1:0}handle(t,e,s){const r=Object.assign({},s),i=!(!e||!1!==e.autoMatchFormat),o=t[0],a=o.parentNode.nodeName.toLowerCase(),c=i&&!n.supportsHtmlTag(a),l=this.generateTextNode(String(o.textContent),i?X(Object.assign(Object.assign({},"span"===a?r:{link:r.link,code:"code"===a?r.code:void 0}),{inlineHtml:r.inlineHtml,plainText:c||void 0})):r);return Object.assign({},l)}});class Gt{constructor(t){t.forEach((t=>{t.parent=this})),this.children=t}static fromJSON(t,e={autoMatchFormat:!0}){const n=t.map((t=>{const n=R.getRTEBlockClass(t.type);if(n)return n.from(t,e);throw new Error(`[Vega] Unknown block type: ${t.type}`)}));return new Gt(n)}static createEmptyContent(){return Gt.fromJSON([{id:z(),type:"paragraph",nodes:[{id:z(),type:"text",text:""}]}])}static fromHtml(t,e={autoMatchFormat:!0,skipCustomAnnotations:!1}){const n=t.replace(/>\s+<\/?/g,(t=>t.endsWith("</")?t:"><")).replace(/(>)[\n\t]+(?=[a-zA-Z0-9_\W])/g,"$1").replace(/([a-zA-Z0-9_\W])[\n\t]+(?=<)/g,"$1"),s=(new DOMParser).parseFromString(n,"text/html").body,r=et.process(Array.from(s.childNodes),e).filter(U).map((t=>t.toDto(e))).filter(U);return new Gt(r)}clone(t=!1){return new Gt(t?this.children.map((t=>t.clone())):[...this.children])}toJSON(){return this.children.map((t=>t.toJSON()))}toHtml(t){return this.children.map((e=>e.toHtml(t))).join("")}apply(t){r.executeTheStrategy(t,this)}toListItem(t){t.children.map((t=>t.apply(new w)));const e=new Y(z());return e.apply(new s(t.children)),e.annotationMap=t.annotationMap,e}createList(t){return new _(z(),t)}findNodeById(t){return this.findNodeInBlocksById(t,this.children)}findNodeInBlocksById(t,e){for(const n of e){if("children"in n)for(const e of n.children)if(e.id===t)return e;if(n instanceof Y&&n.nestList)for(const e of n.nestList){const n=this.findNodeInBlocksById(t,e.children);if(n)return n}if(n instanceof _&&n.children){const e=this.findNodeInBlocksById(t,n.children);if(e)return e}}return null}}r.register(i.DELETE_CHILDREN,Gt.name,new M),r.register(i.APPEND_CHILDREN,Gt.name,new nt),r.register(i.INSERT_CHILDREN_BEFORE,Gt.name,new st),r.register(i.INSERT_CHILDREN_AFTER,Gt.name,new rt),r.register(i.TRANSFORM_TO_CODE_BLOCK,Gt.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,s=new O(z(),this.getCodeContent(n),"plainText");e.apply(new p(n[0],s)),t.newCodeBlock=s,this.removeSelectBlocks(n,e)}getCodeContent(t){return t.filter((t=>"image"!==t.type&&"list-item"!==t.type)).map((t=>t.children.map((t=>t.text)).join(""))).join("\n")}removeSelectBlocks(t,e){for(let n=0;n<t.length;n++)e.apply(new h(t[n]))}}),r.register(i.UPDATE_CURSOR_POSITION,Gt.name,new class extends t{handleAction(t,e){const{offset:n,nextFocusNode:s}=t,r=E.getDOMByEntity(e);r&&$.notify(G.getSubject(r,V),{node:s,offset:n})}});export{et as E,it as I,ut as M,ct as R,Gt as V,Y as a,_ as b,ot as c,at as d}
|
|
1
|
+
import{A as t,R as e,a as n,b as s,c as r,M as i,B as o,d as a,e as c,f as l,g as u,I as d,h,S as w,i as p,j as m,k as g,l as f,C as b,m as x,n as T,o as O,s as E,N as A,p as y,q as k,r as N,t as C,u as j,v as B,w as H,x as I,H as S,y as v,z as R,D as L,U as D,E as M,F as P,G as F}from"./p-d1ebec08.js";import{g as z}from"./p-a4670e23.js";import{i as U}from"./p-b1faebe0.js";import{C as $}from"./p-2d0d575f.js";import{d as G}from"./p-b5822a21.js";import{a as V}from"./p-b5bef48a.js";import{d as J}from"./p-02841589.js";import{r as W,i as K}from"./p-575235c8.js";import{c as X}from"./p-bf19682d.js";class Y extends e{constructor(t,e,n){super(t,"list-item",n),this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const s=new Y(t.id,void 0,e);s.children=t.nodes.map((t=>n.from(t,s,e))),t.children&&(s.nestList=t.children.map((t=>{const e=_.from(t);return e.parent=s,e})));const{annotations:r}=t;return r&&Object.entries(r).forEach((([t,e])=>{const n=this.createAnnotationEntity(t,e);U(n)&&s.annotationMap.set(...n)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(){return[`<li${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),"</li>"].join("")}cloneWithNodes(t){const e=new Y(z());return e.children=[],e.apply(new s(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}createNewListItem(){return new Y(z())}clone(){var t;const e=new Y(this.id);return e.children=this.children.map((t=>{const n=t.clone();return n.parent=e,n})),e.annotationMap=super.cloneAnnotations(),e.nestList=null===(t=this.nestList)||void 0===t?void 0:t.map((t=>{const n=t.clone();return n.parent=e,n})),e.parent=this.parent,e}}r.register(i.LINE_BREAK_SINGLE_BLOCK,Y.name,new o),r.register(i.LINE_BREAK_MULTIPLE_BLOCKS,Y.name,new a),r.register(i.DELETE_NEST_LIST,Y.name,new class extends t{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),r.register(i.SPLIT_BLOCK_WITH_NODE,Y.name,new c),r.register(i.REPLACE_CHILD_NODES,Y.name,new l),r.register(i.REPLACE_NEST_LIST,Y.name,new class extends t{handleAction(t,e){t.newList.forEach((t=>{t.parent=e})),e.nestList=t.newList}}),r.register(i.MERGE_TWO_BLOCKS_NODES,Y.name,new u),r.register(i.INSERT_IMAGE_TO_BLOCK,Y.name,new class extends t{handleAction(t,e){e.parent.apply(t)}});class Z extends m{constructor(){super(...arguments),this.type=g.LIST}renderStyle(t){return(null==t?void 0:t.standalone)?{paddingLeft:"8px",marginLeft:"16px"}:null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new Z}toJSON(){}}class _ extends f{constructor(t,e,n){super(t),this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(g.LIST,new Z)}static from(t,e={autoMatchFormat:!0}){const n=new _(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);U(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=Y.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return T.from(e);case"customClass":return x.from(e);case"customStyle":return b.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(){const t=this.getBlockTag();return[`<${t}${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),`</${t}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(){const t=new _(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}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}r.register(i.TRANSFORM_LIST_BLOCK,_.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,r=e.parent.createList(t.listType);if(n.every((t=>t.parent===e)))r.apply(new s(e.children)),e.parent.apply(new d(e,r)),e.parent.apply(new h(e)),n.forEach((t=>t.children.map((t=>t.apply(new w)))));else{const n=t.selectedBlocks.map((t=>e.parent.toListItem(t)));r.apply(new s(n)),e.parent.apply(new d(e,r)),t.selectedBlocks.forEach((t=>{t.parent.apply(new h(t))})),0===e.children.length&&e.parent.apply(new h(e))}}}),r.register(i.TRANSFORM_PARAGRAPH_BLOCK,_.name,new class extends t{handleAction(t,e){let n=!1,r=!1;const i=t.selectedBlocks,o=i.map((t=>(t.children.map((t=>t.apply(new w))),t===e.children[0]&&(n=!0),t===e.children[e.children.length-1]&&(r=!0),this.toParagraph(t))));if(n)e.parent.apply(new p(e,...o));else if(r)e.parent.apply(new d(e,...o));else{const t=e.children.indexOf(i[0]),n=e.children.indexOf(i[i.length-1]),r=e.parent.createList(e.type);r.apply(new s(e.children.slice(0,t)));const a=e.parent.createList(e.type);a.apply(new s(e.children.slice(n+1))),e.parent.apply(new p(e,r,...o,a)),e.parent.apply(new h(e))}i.map((t=>{e.apply(new h(t))})),0===e.children.length&&e.parent.apply(new h(e))}toParagraph(t){const n=new e(z(),"paragraph");return n.apply(new s(t.children)),n.annotationMap=t.annotationMap,n}}),r.register(i.INSERT_IMAGE_TO_BLOCK,_.name,new class extends t{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new d(e,t.imageBlockToBeInserted):t)}});class Q{}class q{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(t={autoMatchFormat:!0,skipCustomAnnotations:!0}){const e=this.currentStrategy.handle(this.currentElements,t);return this.childrenOutput.length>0&&e&&this.currentStrategy.appendChildBlocks(e,this.childrenOutput.map((e=>e.toDto(t))).filter(U)),e}}const tt=new class{constructor(){this.elementToBlockStrategies=[],this.elementToNodeStrategies=[]}registerElementToBlockStrategy(t){this.hasDuplicateStrategy(t,this.elementToBlockStrategies)||this.elementToBlockStrategies.unshift(t)}registerElementToNodeStrategy(t){this.hasDuplicateStrategy(t,this.elementToNodeStrategies)||this.elementToNodeStrategies.unshift(t)}getElementToBlockStrategies(){return this.elementToBlockStrategies}getElementToNodeStrategies(){return this.elementToNodeStrategies}hasDuplicateStrategy(t,e){return e.includes(t)}},et=new class{process(t,e={autoMatchFormat:!0,skipCustomAnnotations:!0}){const n=this.getElementToBlockStrategies(),s=[];for(let r=0;r<t.length;r++){if(this.isInvalidElement(t[r]))continue;let i=0;for(const o of n)if(i=o.canHandle(t,r,e),i>0){const n=t.slice(r,r+i),a=new q(o,n);1===i&&o.shouldProceedToElementChildren()&&a.setChildrenOutput(this.process(Array.from(n[0].childNodes),e)),s.push(a),r+=i-1;break}if(0===i&&r<t.length){const n=Array.from(t[r].childNodes),i=this.process(Array.from(n),e);i.length>0&&s.push(...i)}}return s}isInvalidElement(t){return t.nodeType===Node.COMMENT_NODE||["META","STYLE"].includes(t.nodeName)}getElementToBlockStrategies(){return tt.getElementToBlockStrategies()}};class nt extends t{handleAction(t,e){const n=t.entityToBeAppended;e.children&&(n.forEach((t=>{t.parent=e})),e.children=e.children.concat(n))}}class st extends t{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[...t.childrenToBeInserted,t.referChildren])}replaceElementWithElements(t,e,n){t.children&&(n.forEach((e=>{e.parent=t})),t.children=t.children.flatMap((t=>t===e?n:t)))}}class rt extends st{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[t.referChildren,...t.childrenToBeInserted])}}class it extends A{constructor(t,e){super(),this.type=y.IMAGE,this.size=t,this.alt=e}static from(t,e){return[y.IMAGE,new it(t,e)]}toJSON(){return U(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new it(this.size,this.alt)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.size?`v-rte--image-size-${this.size}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={verticalAlign:"bottom"};switch(this.size){case"sm":return Object.assign(Object.assign({},e),{width:"25%"});case"md":return Object.assign(Object.assign({},e),{width:"50%"});case"lg":return Object.assign(Object.assign({},e),{width:"100%"})}}}class ot extends k{constructor(t,e,n,s){super(t,s),this.type=N.IMAGE,this.url=e,this.parent=n}static from(t,e,n={autoMatchFormat:!0}){const s=new ot(t.id,t.url,e),r=!!n.autoMatchFormat,i=Object.assign({},t.annotations),{size:o}=i,a=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(i,["size"]),c=Object.assign(Object.assign({},a),{size:null!=o?o:r?"md":void 0});return s.annotationMap=new Map(Object.keys(c).map((t=>"size"===t||"alt"===t?it.from(c.size,c.alt):this.createAnnotationEntity(t,c[t]))).filter(U)),s}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof it||t instanceof C)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return""==t.alt&&delete t.alt,Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"image",url:this.url})}clone(){return new ot(this.id,this.url,this.parent,super.cloneAnnotations())}toHtml(){const t=this.getAnnotationByType(y.IMAGE);return`<img${super.generateAttributeString(...[t&&t.alt?`alt="${t.alt}"`:null,`src="${this.url}"`,t&&t.size?`data-size="${t.size}"`:null].filter(U))}>`}doAnnotationActionApply(t){const e=r.get(j.name,ot.name);e&&e.execute(t,this)}doModifyActionApply(t){r.executeTheStrategy(t,this)}}r.register(i.UPDATE_IMAGE_NODE_URL,ot.name,new class extends t{handleAction(t,e){e.url=t.url}}),r.register(j.name,ot.name,new class extends t{handleAction(t,e){const n=t.toAnnotation();e.annotationMap.set(n.type,n)}});class at extends H{constructor(t,e){super(),this.type=i.INSERT_NEW_PARAGRAPH,this.startContainerNode=t,this.startOffset=e}}class ct extends f{constructor(t){super(t),this.type="image",this.children=[]}static from(t,e={autoMatchFormat:!0}){const n=new ct(t.id),{annotations:s}=t;return n.children=t.nodes.map((t=>ot.from(t,n,e))),s&&super.convertAnnotationsToMap(n.annotationMap,s),n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.children.map((t=>t.toJSON()))})}toHtml(){const t=super.generateAttributeString(),e=this.children.map((t=>t.toHtml())).join("");return super.shouldRenderAsInternalWrapper()?e:[`<div${t}>`,e,"</div>"].join("")}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.url.length>0))}getLastNode(){return this.children[this.children.length-1]}createNewImageBlock(){return new ct(z())}clone(){const t=new ct(this.id);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}}r.register(i.MERGE_TWO_BLOCKS_NODES,ct.name,new u),r.register(i.REPLACE_CHILD_NODES,ct.name,new l),r.register(i.SPLIT_BLOCK_WITH_NODE,ct.name,new class extends t{handleAction(t,e){t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode,e)}splitImageNodes(t,e,n){const s=n.children.indexOf(t);if(s>-1){const t=n.children.slice(0,s+e),r=n.children.slice(s+e);n.apply(new B(t));const i=this.cloneWithNodes(r,n);return n.parent.apply(new d(n,i)),i}}cloneWithNodes(t,e){const n=e.createNewImageBlock();return n.children=[],n.apply(new s(t)),n}}),r.register(i.LINE_BREAK_SINGLE_BLOCK,ct.name,new class extends t{handleAction(t,e){const n=new at(t.startContainerNode,t.startOffset);e.apply(n);const s=n.newBlock;s&&(t.lineBreakNode=s.children[0])}}),r.register(i.LINE_BREAK_MULTIPLE_BLOCKS,ct.name,new class extends t{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,r){const i=e.from({id:z(),type:"paragraph",nodes:[{id:z(),type:"text",text:"\n"}]});r.parent.apply(new d(r,i));const o=this.concatBlocksNodes(t.slice(1));return(0===o.length||o[0]&&""===o[0].text)&&o.push(new n(z(),"\n",i)),i.apply(new s(o)),i.children[0]}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new h(t)))})),e}}),r.register(i.INSERT_IMAGE_TO_BLOCK,ct.name,new class extends t{handleAction(t,e){const n=t.splitPointNode,r=t.startOffsetOfNode,i=t.imageBlockToBeInserted;e.children.length<1?e.apply(new s(i.children)):this.isCaretPositionAtBlockEnd(e,n,r)?e.parent.apply(new d(e,i)):this.isCaretPositionAtBlockStart(e,n,r)?e.parent.apply(new p(e,i)):(e.apply(new I(n,r)),e.parent.apply(new d(e,i)))}}),r.register(S.name,ct.name,new v);class lt extends f{constructor(t,e){super(t),this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new lt(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=t.children.map((t=>{const s=R.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(U),n}clone(){const t=new lt(this.id,this.htmlTag);return t.children=this.children.map((t=>t.clone())),t.annotationMap=super.cloneAnnotations(),t}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0}toHtml(){const t=this.htmlTag;return[`<${t}${super.generateAttributeString()}>`,this.children.map((t=>t.toHtml())).join(""),`</${t}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}class ut extends H{constructor(t){super(),this.type=i.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class dt extends L{handleAction(t,e){const{startContainerNode:n}=t;n.isContentEditable()?n.isTextNode()&&this.deleteTextNodeContent(t,e):this.deleteDecoratorNodeContent(t,e);const s=e.parent;s&&e.isListItemBlock()&&0===s.children.length&&s.parent.apply(new h(s))}deleteTextNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;if(0!==s&&!n.isEmpty()){const r=n.text.slice(0,s-1)+n.text.slice(s);if(n.apply(new D(r)),r)return void(t.previousNode=n);{const s=this.getPreviousNode(n);return s&&s.parent===e&&"\n"===s.text||1===e.children.length?void(t.previousNode=n):(e.apply(new h(n)),void(t.previousNode=s))}}{let s=this.getPreviousNode(n),r=null;if(e.children.length&&s&&s.parent!==e)n.isEmpty()&&e.apply(new h(n)),e.type===s.parent.type&&s.parent.apply(new ut(e));else if(this.isContentFirstNode(n)&&n.isEmpty()&&(r=this.getNextNode(n)),n.isEmpty()&&e.apply(new h(n)),s&&s.isTextNode()&&s.isEmpty()){const t=s;s=this.getPreviousNode(s),t.parent.apply(new h(t)),s||(r=n)}0===e.children.length&&e.parent.apply(new h(e)),s?t.previousNode=s:r&&(t.nextNode=r)}}deleteDecoratorNodeContent(t,e){const n=t.startContainerNode,s=t.startOffset;let r=this.getPreviousNode(n),i=null;if(0!==s){const t=e;this.isContentFirstNode(n)&&(i=this.getNextNode(n)),1===t.children.length?t.parent.apply(new h(t)):t.apply(new h(n))}else{const e=r;e&&!e.isContentEditable()&&(r=this.getPreviousNode(e),e.parent.apply(new h(e)),r||(t.nextNode=n))}r?t.previousNode=r:i&&(t.nextNode=i)}}class ht extends t{handleAction(t,e){const{startContainerNode:n}=t;t.newBlock=this.breakSingleBlock(n,t.startOffset,e)}breakSingleBlock(t,e,n){const s=this.getNewParagraph(t);if(s){if(this.isCaretPositionAtBlockEnd(n,t,e))n.parent.apply(new d(n,s));else{if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new I(t,e);return n.apply(s),s.newBlock}n.parent.apply(new p(n,s))}return s}}getNewParagraph(t){const e=this.createNewParagraph("");if(e){let n=e.children[0];return t.isTextNode()&&t.isContentEditable()&&(e.children=[],n=t.cloneWithText(""),n.annotationMap.delete(y.LINK),e.apply(new s([n]))),e}}}class wt extends H{constructor(t,e){super(),this.type=i.UPDATE_CURSOR_POSITION,this.nextFocusNode=t,this.offset=e}}class pt extends t{handleAction(t,e){const{text:n,offset:s,decoratorNode:r}=t,i=this.createNewParagraph(n);if(i){const t=i.children[0];e.apply(0!==s?new d(r,t):new p(r,t)),this.setTheCursorPosition(t)}}setTheCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new wt(t))}}class mt extends t{handleAction(t,e){t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset,e)}breakSingleListItemBlock(t,e,n){const r=n.createNewListItem(),i=this.copyInlineStyleToNewNode(t);if(r.apply(new s([i])),this.isCaretPositionAtBlockEnd(n,t,e))return this.breakListItemAtEnd(r,n);if(!this.isCaretPositionAtBlockStart(n,t,e)){const s=new I(t,e);return n.apply(s),s.newBlock}return n.parent.apply(new p(n,r)),r}breakListItemAtEnd(t,n){const r=n.parent.children[n.parent.children.length-1],i=1===n.children.length&&n.children[0].isEmpty();if(n===r&&i){const r=n.parent.parent;if("list-item"!==r.type){const i=e.from({id:z(),type:"paragraph",nodes:[]});return i.apply(new s(t.children)),r.apply(new d(n.parent,i)),n.parent.apply(new h(n)),i}r.parent.apply(new d(r,t)),n.parent.apply(new h(n))}else n.parent.apply(new d(n,t));return t}copyInlineStyleToNewNode(t){const e=t.cloneWithText("");return e.annotationMap.delete(y.LINK),e}}class gt extends H{constructor(t){super(),this.type=i.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class ft extends M{handleAction(t,e){super.handleAction(t,e);const n=e.parent;0===e.children.length&&n&&n.apply("list-item"===n.type?new gt(e):new h(e))}}const bt=new class{registerBlockBasicStrategies(t){r.register(i.DELETE_CHILDREN,t,t===_.name?new ft:new M),r.register(i.APPEND_CHILDREN,t,new nt),r.register(i.INSERT_CHILDREN_BEFORE,t,new st),r.register(i.INSERT_CHILDREN_AFTER,t,new rt),r.register(i.DELETE_BLOCK_CONTENT,t,new dt),r.register(i.INSERT_NEW_PARAGRAPH,t,t===Y.name?new mt:new ht),r.register(i.INSERT_TEXT_TO_DECORATOR_NODE,t,new pt)}};class xt{}class Tt extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isBold(t)||e.bold?{bold:!0}:{}}isBold(t){return"STRONG"===t.nodeName||"B"===t.nodeName||"bold"===t.style.fontWeight||"700"===t.style.fontWeight||t.classList.contains("v-rte--bold")}}class Ot extends xt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getAttributes(t);return Object.keys(e).length>0?{customAttribute:e}:{}}getAttributes(t){return t.getAttributeNames().filter((t=>"style"!==t&&"class"!==t&&this.isValidAttr(t))).reduce(((e,n)=>(e[n]=t.getAttribute(n),e)),{})}isValidAttr(t){return/^[a-zA-Z_][\w-]*$/.test(t)}}class Et extends xt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getCustomClass(t);return e.length>0?{customClass:e}:{}}getCustomClass(t){return t.classList.toString().split(" ").filter((t=>!t.includes("v-rte")&&""!==t))}}class At extends xt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.generateCustomStyleAnnotations(t);return Object.keys(e).length>0?{customStyle:e}:{}}generateCustomStyleAnnotations(t){const e=t.getAttribute("style");return e?e.split(";").filter(Boolean).filter((t=>" "!==t)).map((t=>{const e=t.replace(/(['"])(.*?)\1/g,"$2").split(":");return{[J(e[0].trim())]:e[1].trim().replace(";","")}})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{}):{}}}class yt extends xt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.name)}handle(t){const e=this.getIndent(t);return e?{indent:e}:{}}getIndent(t){const e=t.style;let n;if(e.marginLeft)n=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:n=t[3];break;case 2:case 3:n=t[1];break;default:n=t[0]}}}const s=Number(n.replace("px",""));return s&&s>=0?Math.floor(s/16):null}}class kt extends xt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.name)}handle(t){const e=this.getTextAlign(t);return e?{textAlign:e}:{}}getTextAlign(t){const e=t.classList;if(e.contains("v-rte--horizontal-alignment-left"))return"left";if(e.contains("v-rte--horizontal-alignment-center"))return"center";if(e.contains("v-rte--horizontal-alignment-right"))return"right";if(e.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}}class Nt extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isCode(t)||e.code?{code:!0}:{}}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName||"PRE"===t.nodeName||"monospace"===t.style.fontFamily||"Roboto Mono"===t.style.fontFamily.replace(/["']/g,"")}}class Ct extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){const n=this.getColor(t)||e.textColor;return n?{textColor:n}:{}}getColor(t){var e;const n=null===(e=W(t.style.color))||void 0===e?void 0:e.toUpperCase();if(n){const t=P.filter((t=>t.key!==F.key)).find((t=>t.light===n||t.dark===n));return t?t.key:null}for(const e of P)if(t.style.color.includes(e.key))return e.key;return null}}class jt extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isItalic(t)||e.italic?{italic:!0}:{}}isItalic(t){return"I"===t.nodeName||"italic"===t.style.fontStyle||"EM"===t.nodeName||t.classList.contains("v-rte--italic")}}class Bt extends xt{constructor(){super(...arguments),this.handlers=[new Ot,new Et,new At]}canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return e.link?{link:e.link}:"A"===t.tagName?{link:this.generateLinkAnnotations(t)}:{}}generateLinkAnnotations(t){const e={href:t.getAttribute("href")||"",groupKey:z()};return this.handlers.forEach((n=>{Object.assign(e,n.handle(t))})),e}}class Ht extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isStrikethrough(t)||e.strikethrough?{strikethrough:!0}:{}}isStrikethrough(t){return t.style.textDecoration.includes("line-through")||"S"===t.nodeName||"DEL"===t.nodeName||t.classList.contains("v-rte--strikethrough")}}class It extends xt{canHandle(t){return"RTETextNode"===t.name}handle(t,e={}){return this.isUnderline(t)||e.underline?{underline:!0}:{}}isUnderline(t){return t.style.textDecoration.includes("underline")||"U"===t.nodeName||"INS"===t.nodeName||t.classList.contains("v-rte--underline")}}class St extends xt{canHandle(t,e){return!!e.autoMatchFormat&&"RTETextBlock"===t.name}handle(t){const e=this.getTextStyle(t);return e?{textStyle:e}:{}}getTextStyle(t){const e=this.getElementTypeByDataType(t);if(e)return e;const n=this.getElementTypeByNodeName(t);if(n)return n;const s=this.getElementTypeByFontSize(t);if(s)return s;return this.getElementTypeByClassName(t)||null}getElementTypeByDataType(t){return t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type")?t.getAttribute("data-type"):null}getElementTypeByFontSize(t){var e;switch(null===(e=t.style)||void 0===e?void 0:e.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3";default:return null}}getElementTypeByNodeName(t){switch(t.nodeName){case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";case"H4":return"heading-4";case"H5":return"heading-5";case"H6":return"heading-6";default:return null}}getElementTypeByClassName(t){if(t.className){const e=/\bv-rte--text-style-(title|subtitle|heading-1|heading-2|heading-3|paragraph)\b/.exec(t.className);if(e)return e[1]}return null}}class vt extends xt{canHandle(t){return"RTEImageNode"===t.name}handle(t){const e=this.getImageSize(t);return e?{size:e}:{}}getImageSize(t){return t.getAttribute("data-size")?t.getAttribute("data-size"):null}}class Rt extends xt{canHandle(t){return"RTEImageNode"===t.name}handle(t){return t.hasAttribute("alt")?{alt:t.getAttribute("alt")}:{}}}class Lt extends xt{constructor(){super(...arguments),this.customAttributeHandler=new Ot,this.customStyleAnnotationHandler=new At,this.customClassAnnotationHandler=new Et}canHandle(t,e){return"RTETextNode"===t.name&&!1===e.autoMatchFormat}handle(t,e){if(Lt.canHandleTags.includes(t.nodeName)){const n=this.generateInlineHtmlAnnotation(t,Object.assign({},e));if(n)return{inlineHtml:n}}return{}}generateInlineHtmlAnnotation(t,e){let{inlineHtml:s}=e;if(!n.supportsHtmlTag(t.nodeName.toLowerCase())||1===t.childNodes.length&&t.childNodes[0].nodeType!==Node.TEXT_NODE){const e={htmlTag:t.nodeName.toLowerCase(),customAttribute:this.customAttributeHandler.handle(t).customAttribute,customStyle:this.customStyleAnnotationHandler.handle(t).customStyle,customClass:this.customClassAnnotationHandler.handle(t).customClass};if(s){let n=s;for(;n.child&&t.parentNode&&n.child.htmlTag===t.parentNode.nodeName.toLowerCase();)n=n.child;n.child=e}else s=e}return s?Object.assign({},s):null}}Lt.canHandleTags=["A","ABBR","AUDIO","B","BDI","BDO","CITE","CODE","DEL","DFN","EMBED","EM","I","INS","KBD","MARK","METER","OUTPUT","PROGRESS","Q","S","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","VIDEO"];const Dt=new class{constructor(){this.handlers=[new kt,new yt,new Tt,new jt,new It,new Ht,new Ct,new Bt,new Nt,new vt,new Rt,new Ot,new Et,new At,new Bt,new St,new Lt]}generate(t,e,n={autoMatchFormat:!0}){const s="A"===e.tagName;return this.handlers.filter((t=>!(!n.autoMatchFormat&&s)||t instanceof Bt)).filter((r=>e.nodeType!==Node.TEXT_NODE&&r.canHandle(t,{skipCustomAnnotations:n.skipCustomAnnotations||s,autoMatchFormat:n.autoMatchFormat}))).reduce(((t,s)=>{const r=s.handle(e,n.parentAnnotations);return Object.assign(Object.assign({},t),r)}),{})}};class Mt extends Q{constructor(){super(...arguments),this.annotationHandler=new St}generateChildNodes(t,e,s){const r=[],i=!(!s||!1!==s.autoMatchFormat),o=Object.assign({},e);return t.forEach((t=>{const a=tt.getElementToNodeStrategies().find((e=>e.canHandle([t],0,s)>0));let c=null;if(a&&(c=a.handle([t],s,o)),c)r.push(c);else if(K(t)&&t.childNodes.length>0){const a=Dt.generate(n,t,Object.assign({parentAnnotations:i?{inlineHtml:o.inlineHtml,link:o.link,code:o.code}:e},s));r.push(...this.generateChildNodes(Array.from(t.childNodes),a,s))}})),r}matchTextBlockType(t){var e;return null!==(e=this.annotationHandler.handle(t).textStyle)&&void 0!==e?e:"paragraph"}}class Pt extends Mt{canHandle(t,e,n){const s=t[e];return!n.autoMatchFormat&&("DIV"!==s.nodeName||s.childNodes.length>0&&"IMG"!==s.childNodes[0].nodeName)&&Pt.canHandleTags.includes(t[e].nodeName)?1:0}handle(t,e){return lt.from(this.generateHtmlBlock(t[0],e),e)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}generateHtmlBlock(t,e){return{id:z(),type:"html-block",htmlTag:t.nodeName.toLowerCase(),annotations:Dt.generate(lt,t,e),children:[]}}}Pt.canHandleTags=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","BUTTON","CAPTION","COL","COLGROUP","DIV","DD","DETAILS","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","HEADER","HR","HX","INPUT","LEGEND","MAIN","NAV","PRE","SECTION","SUMMARY","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR"];class Ft extends Mt{canHandle(t,e){return"PRE"!==t[e].tagName&&"CODE"!==t[e].tagName||!t[e].hasAttribute("data-language")?0:1}handle(t){const e=t[0];if(e){const t=e.textContent,n=e.dataset.language;return O.from({id:z(),type:"code-block",content:t,language:n})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class zt extends Mt{createRTEImageBlock(t,e){const n=!(e&&e.autoMatchFormat||!t.parentNode||"DIV"===t.parentNode.nodeName);return ct.from({id:z(),type:"image",nodes:[{id:z(),type:"image",url:t.src,annotations:Dt.generate(ot,t,e)}],annotations:Object.assign(Object.assign({},Dt.generate(ct,t.parentElement,e)),{internalWrapper:n})},e)}}class Ut extends Mt{canHandle(t,e){let n=0;for(let s=e;s<t.length;s++){const e=t[s];if(e.nodeType!==Node.TEXT_NODE&&(!Ut.canHandleTags.includes(e.nodeName)||""===e.textContent&&e.querySelector("IMG")))break;n++}return n}handle(t,s){const r=t[0].parentElement,i=s&&s.autoMatchFormat,o=this.generateChildNodes(t,i?Dt.generate(n,r,Object.assign(Object.assign({},s),{skipCustomAnnotations:!0})):{},s),a=i?super.matchTextBlockType(r):this.matchTextBlockTypeByTagName(r),c=!i&&!a;return e.from(Object.assign({id:z(),type:a||"paragraph",nodes:o},c?{annotations:{internalWrapper:c}}:{annotations:Dt.generate(e,r,s)}),s)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}matchTextBlockTypeByTagName(t){switch(t.nodeName){case"P":return"paragraph";default:return null}}}Ut.canHandleTags=[...Lt.canHandleTags,"CODE","A","VEGA-RICH-TEXT-LINK-EDITOR","BR"];class $t extends Q{shouldProceedToElementChildren(){return!1}appendChildBlocks(){}generateTextNode(t,e){return{id:z(),type:"text",text:t,annotations:e}}}R.registerRTEDTOClass("paragraph",e),R.registerRTEDTOClass("title",e),R.registerRTEDTOClass("subtitle",e),R.registerRTEDTOClass("heading-1",e),R.registerRTEDTOClass("heading-2",e),R.registerRTEDTOClass("heading-3",e),R.registerRTEDTOClass("heading-4",e),R.registerRTEDTOClass("heading-5",e),R.registerRTEDTOClass("heading-6",e),R.registerRTEDTOClass("heading-6",e),R.registerRTEDTOClass("list-item",Y),R.registerRTEDTOClass("bullet-list",_),R.registerRTEDTOClass("number-list",_),R.registerRTEDTOClass("image",ct),R.registerRTEDTOClass("code-block",O),R.registerRTEDTOClass("html-block",lt),R.registerRTEDTOClass("text",n),R.registerRTEDTOClass("image",ot),bt.registerBlockBasicStrategies(e.name),bt.registerBlockBasicStrategies(_.name),bt.registerBlockBasicStrategies(Y.name),bt.registerBlockBasicStrategies(ct.name),bt.registerBlockBasicStrategies(lt.name),tt.registerElementToBlockStrategy(new Ut),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){const n=t[e];return n.nodeType===Node.ELEMENT_NODE&&""===n.textContent&&n.querySelector("img")?1:0}handle(t,e){const n=t[0].querySelector("img");return this.createRTEImageBlock(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t,e){const n=t[0],s=n.querySelector("img");if(U(s))return ct.from({id:z(),type:"image",nodes:[{id:z(),type:"image",url:s.src,annotations:Dt.generate(ot,n,e)}],annotations:Dt.generate(ct,n.parentElement,e)},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends zt{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t,e){return this.createRTEImageBlock(t[0],e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title","subtitle"].includes(super.matchTextBlockType(t[e]))?1:0}handle(t,n){const s=this.generateChildNodes(Array.from(t[0].childNodes),{},n);return 0===s.length?null:e.from({id:z(),type:super.matchTextBlockType(t[0]),nodes:s,annotations:Dt.generate(e,t[0],n)},n)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new Ft),tt.registerElementToBlockStrategy(new class extends Ft{canHandle(t,e){return"VEGA-CODE-BLOCK"===t[e].tagName&&0==!!t[e].querySelector("vega-code-block")||this.isCodeBlockContainer(t[e])?1:0}handle(t){const e=this.isCodeBlockContainer(t[0])?t[0].querySelector("vega-code-block"):t[0],n=e.querySelector("code");if(n)return super.handle([n]);if(e.hasAttribute("data-content")){const t=document.createElement("code");return t.textContent=e.dataset.content,t.dataset.language=e.dataset.language,super.handle([t])}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isCodeBlockContainer(t){return"PRE"===t.tagName&&t.classList.contains("code-block-container")&&1===t.querySelectorAll("vega-code-block").length}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){if(!["UL","OL"].includes(t[e].parentElement.nodeName)&&t.some((t=>"LI"===t.nodeName))){let n=0;for(let s=e;s<t.length&&"LI"===t[s].nodeName;s++)n++;return n}return"LI"===t[e].tagName?1:0}handle(t,e){const n=t[0];return["UL","OL"].includes(n.parentElement.nodeName)?Y.from(this.generateListItemBlockDTO(n,e),e):this.generateWithListBlock(t,e)}appendChildBlocks(t,e){t.nestList=e.filter((t=>["bullet-list","number-list"].includes(t.type)))}shouldProceedToElementChildren(){return!0}generateWithListBlock(t,e){return _.from({id:z(),type:"bullet-list",blocks:t.map((t=>this.generateListItemBlockDTO(t,e)))},e)}generateListItemBlockDTO(t,e){return{id:z(),type:"list-item",annotations:Dt.generate(Y,t,e),nodes:this.generateChildNodes(Array.from(t.childNodes.length?t.childNodes:[t]).filter((t=>!["UL","OL"].includes(t.nodeName))),Dt.generate(n,t,Object.assign(Object.assign({},e),{skipCustomAnnotations:!0})),e)}}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){const n=t[e],s=n.parentElement,r="LI"!==n.nodeName,i=n.nodeType===Node.TEXT_NODE&&""===n.textContent.trim(),o=U(s)&&["UL","OL"].includes(s.nodeName);return r&&!i&&o?1:0}handle(t,e){const n=this.generateChildNodes(t,{},e);return Y.from({id:z(),type:"list-item",nodes:n,annotations:{}},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:_.from({id:z(),type:"number-list",blocks:[],annotations:Dt.generate(_,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof Y)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),tt.registerElementToBlockStrategy(new class extends Mt{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:_.from({id:z(),type:"bullet-list",blocks:[],annotations:Dt.generate(_,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof Y)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),tt.registerElementToBlockStrategy(new Pt),tt.registerElementToNodeStrategy(new class extends $t{canHandle(t,e){const n=t[e];return!K(n)||"BR"!==n.nodeName&&0!==n.childNodes.length?0:1}handle(t,e,s){const r=!(!e||!1!==e.autoMatchFormat),i=Object.assign({},s),o=t[0],a=Dt.generate(n,o,Object.assign({parentAnnotations:r?{inlineHtml:i.inlineHtml,link:i.link,code:i.code}:s},e));if("BR"===o.nodeName)return this.generateTextNode("\n",a);if(0===o.childNodes.length){const t=r?X(Object.assign(Object.assign({},n.supportsHtmlTag(o.nodeName.toLowerCase())?a:{}),{inlineHtml:a.inlineHtml,plainText:U(a.inlineHtml)})):a;return Object.assign({},this.generateTextNode("",t))}}}),tt.registerElementToNodeStrategy(new class extends $t{canHandle(t,e){return t[e].nodeType===Node.TEXT_NODE?1:0}handle(t,e,s){const r=Object.assign({},s),i=!(!e||!1!==e.autoMatchFormat),o=t[0],a=o.parentNode.nodeName.toLowerCase(),c=i&&!n.supportsHtmlTag(a),l=this.generateTextNode(String(o.textContent),i?X(Object.assign(Object.assign({},"span"===a?r:{link:r.link,code:"code"===a?r.code:void 0}),{inlineHtml:r.inlineHtml,plainText:c||void 0})):r);return Object.assign({},l)}});class Gt{constructor(t){t.forEach((t=>{t.parent=this})),this.children=t}static fromJSON(t,e={autoMatchFormat:!0}){const n=t.map((t=>{const n=R.getRTEBlockClass(t.type);if(n)return n.from(t,e);throw new Error(`[Vega] Unknown block type: ${t.type}`)}));return new Gt(n)}static createEmptyContent(){return Gt.fromJSON([{id:z(),type:"paragraph",nodes:[{id:z(),type:"text",text:""}]}])}static fromHtml(t,e={autoMatchFormat:!0,skipCustomAnnotations:!1}){const n=t.replace(/>\s+<\/?/g,(t=>t.endsWith("</")?t:"><")).replace(/(>)[\n\t]+(?=[a-zA-Z0-9_\W])/g,"$1").replace(/([a-zA-Z0-9_\W])[\n\t]+(?=<)/g,"$1"),s=(new DOMParser).parseFromString(n,"text/html").body,r=et.process(Array.from(s.childNodes),e).filter(U).map((t=>t.toDto(e))).filter(U);return new Gt(r)}clone(t=!1){return new Gt(t?this.children.map((t=>t.clone())):[...this.children])}toJSON(){return this.children.map((t=>t.toJSON()))}toHtml(t){return this.children.map((e=>e.toHtml(t))).join("")}apply(t){r.executeTheStrategy(t,this)}toListItem(t){t.children.map((t=>t.apply(new w)));const e=new Y(z());return e.apply(new s(t.children)),e.annotationMap=t.annotationMap,e}createList(t){return new _(z(),t)}findNodeById(t){return this.findNodeInBlocksById(t,this.children)}findNodeInBlocksById(t,e){for(const n of e){if("children"in n)for(const e of n.children)if(e.id===t)return e;if(n instanceof Y&&n.nestList)for(const e of n.nestList){const n=this.findNodeInBlocksById(t,e.children);if(n)return n}if(n instanceof _&&n.children){const e=this.findNodeInBlocksById(t,n.children);if(e)return e}}return null}}r.register(i.DELETE_CHILDREN,Gt.name,new M),r.register(i.APPEND_CHILDREN,Gt.name,new nt),r.register(i.INSERT_CHILDREN_BEFORE,Gt.name,new st),r.register(i.INSERT_CHILDREN_AFTER,Gt.name,new rt),r.register(i.TRANSFORM_TO_CODE_BLOCK,Gt.name,new class extends t{handleAction(t,e){const n=t.selectedBlocks,s=new O(z(),this.getCodeContent(n),"plainText");e.apply(new p(n[0],s)),t.newCodeBlock=s,this.removeSelectBlocks(n,e)}getCodeContent(t){return t.filter((t=>"image"!==t.type&&"list-item"!==t.type)).map((t=>t.children.map((t=>t.text)).join(""))).join("\n")}removeSelectBlocks(t,e){for(let n=0;n<t.length;n++)e.apply(new h(t[n]))}}),r.register(i.UPDATE_CURSOR_POSITION,Gt.name,new class extends t{handleAction(t,e){const{offset:n,nextFocusNode:s}=t,r=E.getDOMByEntity(e);r&&$.notify(G.getSubject(r,V),{node:s,offset:n})}});export{et as E,it as I,ut as M,ct as R,Gt as V,Y as a,_ as b,ot as c,at as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as n}from"./p-b1faebe0.js";class r{canFormat(r,t,e){if("init"===r||"change"===r){if("component"===t&&n(null==e?void 0:e.isBlurred))return!1;if(this.shouldTriggerAtInit())return!0}if("input"===r&&"native-input"===t)return!0;if("change"===r&&("component"===t||"native-input"===t))return!0;if("blur"===r&&(null==e?void 0:e.isBlurred)){if("component"===t&&this.shouldOverrideComponentValueAfterBlur())return!0;if("native-input"===t)return!0}return!1}shouldOverrideComponentValueAfterBlur(){return!1}shouldTriggerAtInit(){return!1}}export{r as S}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{C as CheckBoxRequiredRule}from"./p-590fd123.js";export{D as DateRequiredRule}from"./p-8fae8f9e.js";export{I as InputPhoneNumberRequiredRule}from"./p-07c2725a.js";export{I as InputRangeRequiredRule}from"./p-f396c69a.js";export{R as RequiredFieldRule}from"./p-280cbcdb.js";export{R as RichTextEditorRequiredRule}from"./p-
|
|
1
|
+
export{C as CheckBoxRequiredRule}from"./p-590fd123.js";export{D as DateRequiredRule}from"./p-8fae8f9e.js";export{I as InputPhoneNumberRequiredRule}from"./p-07c2725a.js";export{I as InputRangeRequiredRule}from"./p-f396c69a.js";export{R as RequiredFieldRule}from"./p-280cbcdb.js";export{R as RichTextEditorRequiredRule}from"./p-dbe5daa7.js";export{T as TimeRangeRequiredRule,a as TimeRequiredRule}from"./p-924b4e24.js";export{T as ToggleSwitchRequiredRule}from"./p-7c0b4c36.js";export{F as FileUploaderRequiredRule}from"./p-0bb860cc.js";import"./p-abd7aeaa.js";import"./p-08835909.js";import"./p-6e1ab235.js";import"./p-8539e05e.js";import"./p-d1ebec08.js";import"./p-2d0d575f.js";import"./p-b5822a21.js";import"./p-575235c8.js";import"./p-b5bef48a.js";import"./p-02841589.js";import"./p-b1faebe0.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-d884c644.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-7e8f055d.js";import"./p-8a877e12.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-bf19682d.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,H as t,r as i,c as r,g as n}from"./p-48a58baf.js";import{c as o,V as a,M as s,I as l}from"./p-6e1ab235.js";import{V as c,I as d}from"./p-d849e0f5.js";import{V as p}from"./p-f08a4adf.js";import{s as h}from"./p-519a7d55.js";import{D as u}from"./p-0cd89fb6.js";import{a as f,f as g}from"./p-b5822a21.js";import{f as m}from"./p-200ba358.js";import{b}from"./p-8a877e12.js";import{C as v}from"./p-2d0d575f.js";import{d as w}from"./p-bf19682d.js";import{c as x}from"./p-4474bc63.js";import{F as j}from"./p-7a3b142b.js";import{R as y}from"./p-280cbcdb.js";import{P as R,g as C}from"./p-7d9cd9c8.js";import{T as z}from"./p-02b29c18.js";import"./p-8c46e116.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-331a62d5.js";import"./p-575235c8.js";import"./p-b1faebe0.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-d884c644.js";import"./p-21873037.js";import"./p-262ec334.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-5f377954.js";import"./p-4a368e1e.js";import"./p-7e8f055d.js";import"./p-112455b1.js";import"./p-af464251.js";import"./p-e77a83e4.js";import"./p-db8cdba6.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-824a06ba.js";import"./p-b75ee3ba.js";import"./p-abd7aeaa.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-1bd516c5.js";var I=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};class V extends a{render(){return e(t,null,"written"===this.mode&&this.writtenModeRenderer.render())}}I([o()],V.prototype,"mode",void 0),I([o()],V.prototype,"writtenModeRenderer",void 0);var S=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};class L extends a{constructor(){super(...arguments),this.signatureCaptureFocus=()=>{this.signatureCaptureContainerRef.focus()}}getSignatureCaptureContainer(){return this.signatureCaptureContainerRef}render(){return e("vega-flex",{direction:"col",gap:"size-8"},this.renderLabel(),this.renderContainer(),this.renderFooter())}renderLabel(){return this.label&&e("vega-field-label",{onClick:this.signatureCaptureFocus,isFieldRequired:this.required,label:this.label,disabled:this.disabled})}renderContainer(){return e("div",{class:{"signature-capture-written-container":!0,disabled:this.disabled},"aria-label":"Please sign here",role:"textbox",tabIndex:this.disabled?-1:0,ref:e=>this.signatureCaptureContainerRef=e},this.renderPlaceholder(),this.renderSignaturePad())}renderPlaceholder(){if(!this.isDrawing&&!this.value)return this.placeholder&&e("vega-flex",{class:"placeholder-container",gap:"size-8",justifyContent:"center",alignItems:"center",margin:{left:"size-24",right:"size-24"}},this.placeholderIcon&&e("vega-icon",{class:"placeholder-container-icon",size:"size-20",color:"text-secondary",icon:this.placeholderIcon}),e("div",{class:"placeholder-container-content"},this.translationSlimmer.t(this.placeholder)))}renderSignaturePad(){return e("svg",{style:{width:"100%",height:m(this.height,"widthAndHeight"),touchAction:"none"},ref:e=>this.writtenModeSvgController.setSignatureContainerRef(e)})}renderFooter(){return this.showClearBtn&&e("vega-flex",{class:"signature-capture-written-footer",justifyContent:"space-between"},e("div",{class:"vega-error vega-hidden vega-error-content"}),this.renderClearBtn())}renderClearBtn(){return e("div",{class:"clear-button"},e("vega-button-link",{size:"small",disabled:this.disabled,ref:e=>{u.addUniqueObserverToNode(e,f,(()=>{this.writtenModeSvgController.clear()}))},label:this.translationSlimmer.t("Clear Signature")}))}}p.register({signature:{icon:'<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M176 128c0-26.5 21.5-48 48-48s48 21.5 48 48v7.9c0 27.5-2.3 55-7 82.1L158 251.1c-36.9 11.4-62 45.5-62 84.1V410c0 38.6 31.3 70 70 70c24.6 0 47.4-12.9 60-34l15.9-26.4c29.6-49.4 51.1-103.3 63.6-159.5l1-4.7 110.8-34.3-23.9 66.8c-2.6 7.4-1.5 15.5 3 21.9s11.8 10.2 19.6 10.2H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H450.1l28.5-79.9c3.1-8.6 1-18.1-5.3-24.7s-15.7-9-24.4-6.3l-133 41.2c2.7-22 4.1-44.2 4.1-66.4V128c0-53-43-96-96-96s-96 43-96 96v40c0 13.3 10.7 24 24 24s24-10.7 24-24V128zm-3.8 169l80.9-25c-11.7 43.2-29.4 84.5-52.4 123l-15.9 26.4c-4 6.6-11.1 10.7-18.8 10.7c-12.1 0-22-9.8-22-22V335.2c0-17.5 11.4-33 28.2-38.2zM64 368H24c-13.3 0-24 10.7-24 24s10.7 24 24 24H64.2c-.1-2-.2-4-.2-6V368zm216.8 48H616c13.3 0 24-10.7 24-24s-10.7-24-24-24H304.1c-7 16.3-14.8 32.4-23.3 48z"/></svg>'}}),S([o()],L.prototype,"label",void 0),S([o()],L.prototype,"required",void 0),S([o()],L.prototype,"showClearBtn",void 0),S([o()],L.prototype,"placeholder",void 0),S([o()],L.prototype,"placeholderIcon",void 0),S([o()],L.prototype,"disabled",void 0),S([o()],L.prototype,"value",void 0),S([o()],L.prototype,"isDrawing",void 0),S([o()],L.prototype,"height",void 0),S([o()],L.prototype,"writtenModeSvgController",void 0),S([o()],L.prototype,"translationSlimmer",void 0);var k=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};class M extends a{constructor(){super(...arguments),this.penWidth="4px",this.clear=()=>{this.signatureContainerRef.innerHTML="",this.value=null},this.startDrawing=e=>{if(this.disabled)return;this.isDrawing=!0;const{x:t,y:i}=this.getPoint(e);this.currentPath=document.createElementNS("http://www.w3.org/2000/svg","path"),this.currentPath.setAttribute("d",`M ${t} ${i}`),Object.assign(this.currentPath.style,{stroke:"rgba(4, 4, 28, 1)",strokeWidth:this.penWidth,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),this.signatureContainerRef.appendChild(this.currentPath)},this.getPoint=e=>{var t,i;const r=this.signatureContainerRef.getBoundingClientRect(),n=null!==(t=e.clientX)&&void 0!==t?t:e.touches[0].clientX,o=null!==(i=e.clientY)&&void 0!==i?i:e.touches[0].clientY;return{x:n-r.left,y:o-r.top}},this.draw=e=>{if(!this.isDrawing)return;const{x:t,y:i}=this.getPoint(e),r=this.currentPath.getAttribute("d");this.currentPath.setAttribute("d",`${r} L ${t} ${i}`)},this.stopDrawing=()=>{this.isDrawing&&(this.isDrawing=!1,this.value={type:"written",img:this.generateSignatureImage()})}}componentDidLoad(){this.setupListeners(),this.fillSignature(this.value)}handleClear(){this.clear()}watchValue(e,t){w(e,t)||(this.changeEventEmitter.emit(e),this.fillSignature(e),v.notify(b,{host:this.host,detail:e}))}setSignatureContainerRef(e){this.signatureContainerRef=e}setupListeners(){const e=this.signatureContainerRef;e.addEventListener("mousedown",this.startDrawing),e.addEventListener("mousemove",this.draw),e.addEventListener("mouseup",this.stopDrawing),e.addEventListener("mouseleave",this.stopDrawing),e.addEventListener("touchstart",this.startDrawing),e.addEventListener("touchmove",this.draw),e.addEventListener("touchend",this.stopDrawing)}generateSignatureImage(){const e=(new XMLSerializer).serializeToString(this.signatureContainerRef);return`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(e)))}`}fromDataURL(e){if(!e||!e.img)return;const t=this.value.img.replace("data:image/svg+xml;base64,","");return(new DOMParser).parseFromString(atob(t),"image/svg+xml").documentElement}fillSignature(e){this.signatureContainerRef.replaceChildren();const t=this.fromDataURL(e);if(t){const e=Array.from(t.childNodes);this.signatureContainerRef.append(...e)}}}k([o()],M.prototype,"changeEventEmitter",void 0),k([o()],M.prototype,"host",void 0),k([o({writable:!0})],M.prototype,"value",void 0),k([o({writable:!0})],M.prototype,"isDrawing",void 0),k([o()],M.prototype,"disabled",void 0),k([s("componentDidLoad")],M.prototype,"componentDidLoad",null),k([s("clear")],M.prototype,"handleClear",null),k([s("watchValue")],M.prototype,"watchValue",null);var O=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const D=class{constructor(e){i(this,e),this.vegaChange=r(this,"vegaChange",7),this.change=r(this,"change",7),this.globalSlimmers={},this.translationSlimmer=new z,this.vegaComponentUsageRuntimeMetricsSlimmer=new c,this.vegaSignatureCaptureRenderer=new V,this.writtenModeRenderer=new L,this.writtenModeSvgController=new M,this.changeEventEmitter=x(D,g),this.formFieldController=new j({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new y:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:e=>this[e],inputContainerGetter:()=>this.writtenModeRenderer.getSignatureCaptureContainer(),touchableAreaGetter:()=>[this.writtenModeRenderer.getSignatureCaptureContainer()]}),this.pageResizeSlimmer=new R,this.currentBreakpoint=C(),this.isDrawing=!1,this.mode="written",this.label="",this.required=!1,this.showClearBtn=!0,this.placeholder="Please sign here",this.placeholderIcon=p.getIconKey("signature"),this.disabled=!1,this.value=null,this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.height="320px"}watchValue(e,t){}watchValidationRules(){}async clear(){}render(){return h(this.vegaSignatureCaptureRenderer.render(),this.host)}get host(){return n(this)}static get watchers(){return{value:["watchValue"],validationRules:["watchValidationRules"]}}};O([d()],D.prototype,"globalSlimmers",void 0),O([l()],D.prototype,"translationSlimmer",void 0),O([l()],D.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),O([l()],D.prototype,"vegaSignatureCaptureRenderer",void 0),O([l()],D.prototype,"writtenModeRenderer",void 0),O([l()],D.prototype,"writtenModeSvgController",void 0),O([l()],D.prototype,"changeEventEmitter",void 0),O([l()],D.prototype,"formFieldController",void 0),O([l()],D.prototype,"pageResizeSlimmer",void 0),D.style=':host{display:block}.signature-capture-written-container{border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;overflow:hidden;width:100%;position:relative;background-color:rgb(252, 252, 252)}.signature-capture-written-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}.signature-capture-written-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1))}.signature-capture-written-container .placeholder-container{height:100%;position:absolute;top:0px;right:0px;bottom:0px;left:0px;pointer-events:none}.signature-capture-written-container .placeholder-container-content{font-family:"Inter", sans-serif;font-size:18px;font-weight:500;line-height:28px;letter-spacing:0px;color:rgba(4, 4, 28, 0.64)}@media screen and (min-width: 768px) and (max-width: 1023px){.signature-capture-written-container .placeholder-container-content{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.signature-capture-written-container .placeholder-container-content{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.signature-capture-written-container .placeholder-container-content{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}.signature-capture-written-container .placeholder-container-icon{flex-shrink:0;color:rgba(4, 4, 28, 0.64)}.signature-capture-written-container.error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}.signature-capture-written-container.error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}.signature-capture-written-container.error:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1));border:1px solid rgba(var(--v-border-input-field-danger-focus, 233, 71, 104, 1))}.signature-capture-written-container.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}.signature-capture-written-container.disabled:hover,.signature-capture-written-container.disabled:focus-within{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}.signature-capture-written-container.disabled:focus-within{outline:none}.signature-capture-written-container.disabled .placeholder-container-content,.signature-capture-written-container.disabled .placeholder-container-icon{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}.signature-capture-written-footer .clear-button{flex-grow:1;padding-right:8px;text-align:right}.signature-capture-written-footer .vega-error-content{padding-top:0px;padding-right:0px;flex-grow:1}.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;padding-right:8px;padding-left:8px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}';export{D as vega_signature_capture}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as t,M as r,A as s,D as
|
|
1
|
+
import{V as t,M as r,A as s,D as e}from"./p-b1faebe0.js";import{m as i,a,s as d}from"./p-262ec334.js";import{I as n}from"./p-abd7aeaa.js";class o extends n{static validateCreditCardDigits(t){const r=i(t).reverse();return!(r.length<12||r.length>19)&&a(r,(t=>t%2==0)).reduce(d,0)%10==0}evaluate(t){if(!this.isAcceptedInputType(t))throw new Error(`Unexpected type of input: ${typeof t}: ${t}`);const r=this.formatCreditCardNumber(t),s=this.isValidVisaCreditCard(t)||this.isValidAmexCreditCard(t)||this.isValidDiscoverCreditCard(t)||this.isValidMasterCardCreditCard(t)||!this.isSupportedCreditCardType(r)&&o.validateCreditCardDigits(r);return{isValid:s,message:s?"":"Credit card number is invalid"}}canEvaluate(t,r){return r?this.isAcceptedInputType(t)&&!r.disabled&&r.visible:this.isAcceptedInputType(t)}shouldShowError(t){return!t.disabled&&t.visible&&(t.touched||t.modified)}isValidVisaCreditCard(r){const s=this.formatCreditCardNumber(r);return t.test(s)&&(13===s.length||16===s.length||19===s.length)&&o.validateCreditCardDigits(s)}isValidMasterCardCreditCard(t){const s=this.formatCreditCardNumber(t);return r.test(s)&&16===s.length&&o.validateCreditCardDigits(s)}isValidAmexCreditCard(t){const r=this.formatCreditCardNumber(t);return s.test(r)&&15===r.length&&o.validateCreditCardDigits(r)}isValidDiscoverCreditCard(t){const r=this.formatCreditCardNumber(t);return e.test(r)&&16===r.length&&o.validateCreditCardDigits(r)}isAcceptedInputType(t){return"string"==typeof t}formatCreditCardNumber(t){return t.replace(/\s/g,"")}isSupportedCreditCardType(i){return t.test(i)||r.test(i)||s.test(i)||e.test(i)}}export{o as V}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t}from"./p-48a58baf.js";import{V as e}from"./p-f08a4adf.js";import{c as s,V as o}from"./p-6e1ab235.js";import{V as r,W as i,F as n,a as c,X as a,p as l,u as h}from"./p-
|
|
1
|
+
import{h as t}from"./p-48a58baf.js";import{V as e}from"./p-f08a4adf.js";import{c as s,V as o}from"./p-6e1ab235.js";import{V as r,W as i,F as n,a as c,X as a,p as l,u as h}from"./p-d1ebec08.js";import{D as u}from"./p-0cd89fb6.js";import{a as d,M as p,N as f,f as v}from"./p-b5822a21.js";import{a as m}from"./p-7e8f055d.js";import{I as b}from"./p-8539e05e.js";class w extends r{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new i(this.textColor)}}var C=function(t,e,s,o){var r,i=arguments.length,n=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,o);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,s,n):r(e,s))||n);return i>3&&n&&Object.defineProperty(e,s,n),n};class g extends o{constructor({icon:e,tooltip:s,autoFocusOnClick:o=!0}){super(),this.renderBtn=({showArrowIcon:e,iconColor:s}={})=>{var o;return t("vega-tooltip",{text:this.translationSlimmer.t(this.tooltip.text),placement:["bottom","top"]},t("vega-rich-text-editor-toolbar-button",Object.assign({showArrowIcon:e,icon:this.icon,iconColor:s,ref:t=>{u.addUniqueObserverToNode(t,d,(()=>{this.handleClick()}))},selected:this.isSelected(),disabled:this.isDisabled(),hidden:this.isHidden()},this.preventLostFocus()),null===(o=this.renderSlotContent)||void 0===o?void 0:o.call(this)))},this.handleClick=()=>{"function"==typeof this.onClick&&(!this.selectionController.getSelectedNodes().length&&this.autoFocusOnClick?this.focusController.focusOnLastTextNode().then((()=>{this.onClick()})):this.onClick())},this.icon=e,this.tooltip=s,this.autoFocusOnClick=o}setIcon(t){this.icon=t}render(){return"function"==typeof this.renderBtnWrapper?this.renderBtnWrapper(this.renderBtn):this.renderBtn()}isDisabled(){return this.disabled}isHidden(){return!1}preventLostFocus(){return{onMouseDown:t=>t.preventDefault()}}}C([s()],g.prototype,"translationSlimmer",void 0),C([s()],g.prototype,"selectionController",void 0),C([s()],g.prototype,"focusController",void 0),C([s()],g.prototype,"disabled",void 0);class x extends g{constructor(t){super(t)}isDisabled(){return super.isDisabled()&&!this.sourceView}isHidden(){return this.sourceView}}!function(t,e,s,o){var r,i=arguments.length,n=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,o);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,s,n):r(e,s))||n);i>3&&n&&Object.defineProperty(e,s,n)}([s()],x.prototype,"sourceView",void 0);var R=function(t,e,s,o){var r,i=arguments.length,n=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,o);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,s,n):r(e,s))||n);return i>3&&n&&Object.defineProperty(e,s,n),n};class j extends x{constructor(){super({icon:"text",tooltip:{text:"Text Color"}}),this.popoverShow=!1,m.registerCustomDarkModeColor(j.formatDarkModeColor())}static formatDarkModeColor(){return n.reduce(((t,e)=>(e.dark&&(t[`rich-text-editor-${e.key}`]=e.dark),t)),{})}renderSlotContent(){return t("div",{class:{"toolbar-btn-color-preview-box":!0,disabled:this.isDisabled()},style:{backgroundColor:this.getCurrentColor()}})}handlePopoverShowChange(){this.popoverShow=!0}handlePopoverHideChange(){this.popoverShow=!1}renderBtnWrapper(e){return t("vega-popover",{placement:"bottom",alignment:"center",ref:t=>{this.popoverRef=t,u.addUniqueObserverToNode(t,p,this.handlePopoverShowChange.bind(this)),u.addUniqueObserverToNode(t,f,this.handlePopoverHideChange.bind(this))}},t("div",{slot:"popover-content"},e({showArrowIcon:!1})),t("div",Object.assign({slot:"popover",style:{userSelect:"none"}},super.preventLostFocus()),this.renderPopoverContent()))}renderPopoverContent(){return t("vega-color-picker",{isInline:!0,colors:n.map((t=>t[this.isInDarkMode?"dark":"light"])),ref:t=>{u.addUniqueObserverToNode(t,v,this.handleChange.bind(this))},value:this.getCurrentColor()})}async handleChange(t){this.popoverShow&&(this.selectionController.getSelectedNodes().length||await this.focusController.focusOnLastTextNode(),this.selectionController.getSelectedNodes().filter((t=>t instanceof c)).forEach((e=>e.apply(new w(this.matchColor(t.detail).key))))),this.popoverRef.hide()}matchColor(t){return n.find((e=>e[this.isInDarkMode?"dark":"light"]===t))}getCurrentColor(){let t=n[0];const e=this.selectionController.getSelectedNodes();return e.length>1&&(t=this.isSelectedSameColor(e)?this.getTextColor(e[0]):null),1===e.length&&(t=this.getTextColor(e[0])),t?t[this.isInDarkMode?"dark":"light"]:null}isSelected(){return!1}isSelectedSameColor(t){return t.every((e=>this.getTextColor(e).key===this.getTextColor(t[0]).key))}getTextColor(t){var e;return(null===(e=t.getAnnotationByType("TEXT_COLOR"))||void 0===e?void 0:e.textColor)||n[0]}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return t instanceof a||(null===(e=t.getAnnotationByType(l.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(l.LINK)||t.getAnnotationByType(l.IMAGE)}))}}e.register({text:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 96v32c0 17.7-14.3 32-32 32s-32-14.3-32-32V80C0 53.5 21.5 32 48 32H224 400c26.5 0 48 21.5 48 48v48c0 17.7-14.3 32-32 32s-32-14.3-32-32V96H256l0 320h48c17.7 0 32 14.3 32 32s-14.3 32-32 32H144c-17.7 0-32-14.3-32-32s14.3-32 32-32h48l0-320H64z"/></svg>'}}),R([s()],j.prototype,"host",void 0),R([s()],j.prototype,"isInDarkMode",void 0),R([s()],j.prototype,"selectionController",void 0),R([s()],j.prototype,"focusController",void 0);const y=new class{constructor(){this.textNodeElements=new Map}register(t,e){this.textNodeElements.set(t,e)}getTextNodeElements(){return this.textNodeElements}},T=new class{constructor(){this.RTE_DTO_RENDERER_MAP=new Map,this.RTE_TOOLBAR_BUTTON_RENDERER_MAP=new Map}registerRTEDTORenderer(t,e){const s=this.RTE_DTO_RENDERER_MAP.get(t);if(e&&s&&s.constructor.name!==e.constructor.name)throw new Error(`Renderer for type ${t} is already registered with a different class(${s.constructor.name}).`);this.RTE_DTO_RENDERER_MAP.set(t,e)}registerRTEToolbarButtonRenderer(t,e){this.RTE_TOOLBAR_BUTTON_RENDERER_MAP.set(t,e)}getRTERenderer(t){return this.RTE_DTO_RENDERER_MAP.get(t)}getRTEToolbarButtonRenderer(t){return this.RTE_TOOLBAR_BUTTON_RENDERER_MAP.get(t)}};class O extends h{constructor(t,e){super(),this.isFlushable=!0,this.size=t,this.alt=e}toAnnotation(){return new b(this.size,this.alt)}}export{O as I,T as R,y as T,x as V,j as a,g as b}
|