@templatical/editor 0.14.0 → 0.15.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.
Files changed (152) hide show
  1. package/dist/{AiChatSidebar-J8iO_sX7.js → AiChatSidebar-BIKvYREk.js} +57 -56
  2. package/dist/{AiFeatureMenu-F2diEDgV.js → AiFeatureMenu-QbD82crt.js} +20 -20
  3. package/dist/{BlockIssueBadge-a-qlByxF.js → BlockIssueBadge-B3xVgMTh.js} +11 -11
  4. package/dist/{CloudEditor-CDjtwb4i.js → CloudEditor-DptuSf7A.js} +470 -468
  5. package/dist/{CollaboratorBar-B_EnJLtW.js → CollaboratorBar-DrA_K69w.js} +20 -20
  6. package/dist/{CommentsSidebar-DaP9BA_r.js → CommentsSidebar-D_tSGvTX.js} +154 -153
  7. package/dist/CountdownBlock-apiYUhkQ.js +92 -0
  8. package/dist/CountdownToolbar-CS0axcjz.js +210 -0
  9. package/dist/{DesignReferenceSidebar-BHRlTqlT.js → DesignReferenceSidebar-DWYK9nTk.js} +58 -57
  10. package/dist/{IssuesPanel-u7ee3Wrl.js → IssuesPanel-CR1MPaDE.js} +40 -40
  11. package/dist/{LoadingTrack-CV3ID80N.js → LoadingTrack-DsecR8Rw.js} +1 -1
  12. package/dist/MergeTagSuggestion-CH2SUxBo.js +1327 -0
  13. package/dist/{ModuleBrowserModal-DOsdaS6s.js → ModuleBrowserModal-D45rBj5C.js} +60 -59
  14. package/dist/{ModulePreviewCanvas-Cx4MOJ0X.js → ModulePreviewCanvas-BiQ6B2-l.js} +29 -29
  15. package/dist/{NumberWithSuffix-D2mW_DhT.js → NumberWithSuffix-CrA6quxx.js} +143 -142
  16. package/dist/{ParagraphEditor-DMzkVnST.js → ParagraphEditor-1NaUJpZO.js} +247 -246
  17. package/dist/{RichTextEditorContent-CRCxCwKf.js → RichTextEditorContent-BqLHIZY7.js} +45 -44
  18. package/dist/{SaveModuleDialog-DuEKgumL.js → SaveModuleDialog-B0sPOTgO.js} +38 -37
  19. package/dist/{SnapshotHistory-CVgiNJtE.js → SnapshotHistory-DslVzmSb.js} +34 -33
  20. package/dist/{TemplateScoringPanel-lm0_9nYi.js → TemplateScoringPanel-CZ62rGHz.js} +83 -82
  21. package/dist/{TestEmailModal-WBMdiW5S.js → TestEmailModal-DWGniJVu.js} +22 -21
  22. package/dist/{TitleEditor-eyT0h-Sa.js → TitleEditor-D4t_gZZJ.js} +44 -44
  23. package/dist/{TplModal-tjQ7OB0g.js → TplModal-Br2VG6cn.js} +14 -13
  24. package/dist/{blockTypeIcons-DdB3uTKD.js → blockTypeIcons-CXhCS5WV.js} +2 -2
  25. package/dist/bundle-stats.json +8 -8
  26. package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js → AiFeatureMenu-3Slo_LGA.js} +5 -5
  27. package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js.map → AiFeatureMenu-3Slo_LGA.js.map} +1 -1
  28. package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js → BlockIssueBadge-BxwEiiF3.js} +3 -3
  29. package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js.map → BlockIssueBadge-BxwEiiF3.js.map} +1 -1
  30. package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js → CloudEditor-DFIFWD9G.js} +89 -89
  31. package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js.map → CloudEditor-DFIFWD9G.js.map} +1 -1
  32. package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js → CollaboratorBar-Cu3vuN66.js} +4 -4
  33. package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js.map → CollaboratorBar-Cu3vuN66.js.map} +1 -1
  34. package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js → CountdownBlock-BEVAJQtQ.js} +3 -3
  35. package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js.map → CountdownBlock-BEVAJQtQ.js.map} +1 -1
  36. package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js → CountdownToolbar-CI2sQZv5.js} +4 -4
  37. package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js.map → CountdownToolbar-CI2sQZv5.js.map} +1 -1
  38. package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js → IssuesPanel-BdeDoTcn.js} +4 -4
  39. package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js.map → IssuesPanel-BdeDoTcn.js.map} +1 -1
  40. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js +213 -0
  41. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js.map +1 -0
  42. package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js → ModuleBrowserModal-Dz-I5zfj.js} +6 -6
  43. package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js.map → ModuleBrowserModal-Dz-I5zfj.js.map} +1 -1
  44. package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js → ModulePreviewCanvas-BfinyuAN.js} +3 -3
  45. package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js.map → ModulePreviewCanvas-BfinyuAN.js.map} +1 -1
  46. package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js → NumberWithSuffix-CDjEa08X.js} +6 -6
  47. package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js.map → NumberWithSuffix-CDjEa08X.js.map} +1 -1
  48. package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js → ParagraphEditor-B3fG0vge.js} +22 -22
  49. package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js.map → ParagraphEditor-B3fG0vge.js.map} +1 -1
  50. package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js → RichTextEditorContent-C6YPCp9j.js} +4 -4
  51. package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js.map → RichTextEditorContent-C6YPCp9j.js.map} +1 -1
  52. package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js → SaveModuleDialog-C6UIIVAM.js} +3 -3
  53. package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js.map → SaveModuleDialog-C6UIIVAM.js.map} +1 -1
  54. package/dist/cdn/chunks/{TitleEditor-DO1-h3RY.js → TitleEditor-BiZbLYF1.js} +10 -10
  55. package/dist/cdn/chunks/{TitleEditor-DO1-h3RY.js.map → TitleEditor-BiZbLYF1.js.map} +1 -1
  56. package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js → blockTypeIcons-BernVG06.js} +3 -3
  57. package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js.map → blockTypeIcons-BernVG06.js.map} +1 -1
  58. package/dist/cdn/chunks/{draggable-kPCz_3zM.js → draggable-kG-D5Xsm.js} +6 -6
  59. package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +1 -0
  60. package/dist/cdn/chunks/extensions-Drp8UDc6.js +421 -0
  61. package/dist/cdn/chunks/extensions-Drp8UDc6.js.map +1 -0
  62. package/dist/cdn/chunks/{features-CkTMVylx.js → features-Dpczf9Su.js} +884 -835
  63. package/dist/cdn/chunks/features-Dpczf9Su.js.map +1 -0
  64. package/dist/cdn/chunks/{icons-9zjCuoJx.js → icons-CuxnJiGQ.js} +26 -26
  65. package/dist/cdn/chunks/{icons-9zjCuoJx.js.map → icons-CuxnJiGQ.js.map} +1 -1
  66. package/dist/cdn/chunks/{liquid.browser-DKKBzRQu.js → liquid.browser-BJOEu6Cg.js} +693 -678
  67. package/dist/cdn/chunks/liquid.browser-BJOEu6Cg.js.map +1 -0
  68. package/dist/cdn/chunks/{media-library-DMRIPx4g.js → media-library-CiYl_BO7.js} +33 -33
  69. package/dist/cdn/chunks/{media-library-DMRIPx4g.js.map → media-library-CiYl_BO7.js.map} +1 -1
  70. package/dist/cdn/chunks/{pusher-CdEqyLwF.js → pusher-CIwiKF8H.js} +4 -4
  71. package/dist/cdn/chunks/{pusher-CdEqyLwF.js.map → pusher-CIwiKF8H.js.map} +1 -1
  72. package/dist/cdn/chunks/{quality-CyeUgs_c.js → quality-CNjGxBG0.js} +112 -112
  73. package/dist/cdn/chunks/{quality-CyeUgs_c.js.map → quality-CNjGxBG0.js.map} +1 -1
  74. package/dist/cdn/chunks/{renderer-BIKUEKDD.js → renderer-CFkg8h-K.js} +20 -20
  75. package/dist/cdn/chunks/renderer-CFkg8h-K.js.map +1 -0
  76. package/dist/cdn/chunks/{src-pDy_imWG.js → src-DRpKu4Dy.js} +5 -5
  77. package/dist/cdn/chunks/{src-pDy_imWG.js.map → src-DRpKu4Dy.js.map} +1 -1
  78. package/dist/cdn/chunks/{styles-D4Bd3SCx.js → styles-B7wryV0l.js} +1484 -1344
  79. package/dist/cdn/chunks/styles-B7wryV0l.js.map +1 -0
  80. package/dist/cdn/chunks/{tiptap-BlLFFU3M.js → tiptap-DF9PEiqH.js} +6859 -6823
  81. package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +1 -0
  82. package/dist/cdn/editor.css +1 -1
  83. package/dist/cdn/editor.js +35 -35
  84. package/dist/cdn/editor.js.map +1 -1
  85. package/dist/{check-CYJwFmjy.js → check-rl7ok6uJ.js} +1 -1
  86. package/dist/{chevron-down-C5l-DzAA.js → chevron-down-BKe__NOD.js} +1 -1
  87. package/dist/{circle-alert-wf5HUFZY.js → circle-alert-C8xmpMsK.js} +1 -1
  88. package/dist/{clock-Bj0bQw-K.js → clock-BW4JuDCN.js} +1 -1
  89. package/dist/{cloud-CoFDm9YA.js → cloud-BQusL53H.js} +208 -208
  90. package/dist/createLucideIcon-Dx-EjR9r.js +43 -0
  91. package/dist/{dist-CLpPNKy9.js → dist-B5Sov3sS.js} +7 -7
  92. package/dist/dist-BEWiuOMi.js +251 -0
  93. package/dist/{dist-CrQZ_af9.js → dist-BFmE-7hB.js} +2 -2
  94. package/dist/{dist-U5vfDdYI.js → dist-BMoa33wT.js} +2 -2
  95. package/dist/{dist-BctFrpeA.js → dist-BibU4HNl.js} +74 -65
  96. package/dist/{dist-Dd3ibRZm.js → dist-BsCGIDSt.js} +103 -102
  97. package/dist/dist-CNLKj9wa.js +5 -0
  98. package/dist/{dist-BX3gGwL8.js → dist-CNXDNYQn.js} +728 -694
  99. package/dist/{dist-Bn703mnA.js → dist-COG3IdPK.js} +3 -3
  100. package/dist/{dist-B7w6xTU6.js → dist-CQZxDvFw.js} +3 -3
  101. package/dist/{dist-34OcyoK1.js → dist-CRsjOQM-.js} +2 -2
  102. package/dist/dist-CTT6WYJ6.js +134 -0
  103. package/dist/dist-Cqa6aeAJ.js +5 -0
  104. package/dist/{dist-ChMninLH.js → dist-SXJJ2v41.js} +2 -2
  105. package/dist/{dist-CyjyYg52.js → dist-itdjZraK.js} +28 -23
  106. package/dist/extensions-DwaZAqm6.js +423 -0
  107. package/dist/{image-up-x8-WXfsx.js → image-up-BwBCmQ4P.js} +1 -1
  108. package/dist/{info-RS_fGcGi.js → info-TCn7uWR5.js} +1 -1
  109. package/dist/{keys-DgYXDafq.js → keys-Cv8-8GsD.js} +1 -1
  110. package/dist/{liquid.browser-CVjP5Mex.js → liquid.browser-DZLtv26k.js} +692 -677
  111. package/dist/{list-checks-Bf7XdDyv.js → list-checks-CSrOWNgq.js} +1 -1
  112. package/dist/{loader-circle-CLZ0_FvW.js → loader-circle-BLmicnPG.js} +1 -1
  113. package/dist/{message-circle-B-1bN9ab.js → message-circle-C9hHMQCI.js} +1 -1
  114. package/dist/{refresh-cw-CWKWqJYG.js → refresh-cw-D1JQ1LNa.js} +1 -1
  115. package/dist/runtime-dom.esm-bundler-BzuoCyNp.js +523 -0
  116. package/dist/{scan-line-BtK5dEai.js → scan-line-DgijVq9y.js} +1 -1
  117. package/dist/{send-Cn1IUdzh.js → send-DjPdq69F.js} +1 -1
  118. package/dist/{shield-check-CrvMk4Ea.js → shield-check-Bqluu8FS.js} +1 -1
  119. package/dist/{sparkles-CgfjwvnG.js → sparkles-M4azPVSP.js} +1 -1
  120. package/dist/style.css +1 -1
  121. package/dist/styles-D7fQ7f_1.js +4164 -0
  122. package/dist/templatical-editor.js +127 -126
  123. package/dist/{text-align-start-C3r_Rnvy.js → text-align-start-CMya5pCQ.js} +11 -11
  124. package/dist/{trash-2-CjERg4x9.js → trash-2-C-81rkLS.js} +1 -1
  125. package/dist/{triangle-alert-Chkny574.js → triangle-alert-BuRWnynk.js} +1 -1
  126. package/dist/{upload-e5kDRkPb.js → upload-CWBIoLd4.js} +1 -1
  127. package/dist/{useAliveFlag-cUQj9rmB.js → useAliveFlag-CECL_OUb.js} +1 -1
  128. package/dist/{useCloudI18n-CYJKqXtI.js → useCloudI18n-AKCy98qD.js} +2 -2
  129. package/dist/{useEditorCore-8JxXDOA4.js → useEditorCore-vcWLdnjN.js} +1406 -1364
  130. package/dist/{useI18n-BWqM8i78.js → useI18n-C-TDeJBt.js} +2 -2
  131. package/dist/{useMergeTag-NHC4ylza.js → useMergeTag-DSrBY0-2.js} +5 -5
  132. package/dist/usePopoverRoot-DKUDnr55.js +8 -0
  133. package/dist/{vue.runtime.esm-bundler-BPa483TZ.js → vue.runtime.esm-bundler-l0XAqiyv.js} +626 -1147
  134. package/dist/{x-DiPIbccg.js → x-CQSvXnGR.js} +1 -1
  135. package/package.json +26 -26
  136. package/dist/CountdownBlock-DtAokAVw.js +0 -92
  137. package/dist/CountdownToolbar-Dtqgwy0g.js +0 -210
  138. package/dist/cdn/chunks/draggable-kPCz_3zM.js.map +0 -1
  139. package/dist/cdn/chunks/extensions-iwBXnEwq.js +0 -605
  140. package/dist/cdn/chunks/extensions-iwBXnEwq.js.map +0 -1
  141. package/dist/cdn/chunks/features-CkTMVylx.js.map +0 -1
  142. package/dist/cdn/chunks/liquid.browser-DKKBzRQu.js.map +0 -1
  143. package/dist/cdn/chunks/renderer-BIKUEKDD.js.map +0 -1
  144. package/dist/cdn/chunks/styles-D4Bd3SCx.js.map +0 -1
  145. package/dist/cdn/chunks/tiptap-BlLFFU3M.js.map +0 -1
  146. package/dist/createLucideIcon-Bad2kKE0.js +0 -43
  147. package/dist/dist-CADDCv0o.js +0 -5
  148. package/dist/dist-CGvz7vkq.js +0 -5
  149. package/dist/dist-DuCzdgDA.js +0 -382
  150. package/dist/extensions-J439b7y7.js +0 -1720
  151. package/dist/styles-BUwDOWd3.js +0 -4022
  152. package/dist/usePopoverRoot-B1sdY4es.js +0 -8
@@ -1,1720 +0,0 @@
1
- import { A as e, B as t, E as n, M as r, S as i, X as a, a as o, at as s, b as c, c as l, d as u, f as d, h as f, l as p, m, n as h, ot as g, p as _, rt as v, s as y, st as b, z as x } from "./vue.runtime.esm-bundler-BPa483TZ.js";
2
- import { O as S, T as C, r as w, w as T } from "./dist-BctFrpeA.js";
3
- import { t as ee } from "./useI18n-BWqM8i78.js";
4
- import { t as E } from "./useMergeTag-NHC4ylza.js";
5
- import { F as D, Sn as O, i as k, o as A, p as j, qt as M, u as te, vn as ne, xn as re, yn as ie } from "./dist-CyjyYg52.js";
6
- import { n as ae, t as oe } from "./dist-Dd3ibRZm.js";
7
- //#region src/extensions/FontSize.ts
8
- var se = k.create({
9
- name: "fontSize",
10
- addOptions() {
11
- return { types: ["textStyle"] };
12
- },
13
- addGlobalAttributes() {
14
- return [{
15
- types: this.options.types,
16
- attributes: { fontSize: {
17
- default: null,
18
- parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, "") || null,
19
- renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
20
- } }
21
- }];
22
- },
23
- addCommands() {
24
- return {
25
- setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
26
- unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
27
- };
28
- }
29
- }), ce = k.create({
30
- name: "letterSpacing",
31
- addOptions() {
32
- return { types: ["textStyle"] };
33
- },
34
- addGlobalAttributes() {
35
- return [{
36
- types: this.options.types,
37
- attributes: { letterSpacing: {
38
- default: null,
39
- parseHTML: (e) => e.style.letterSpacing?.replace(/['"]+/g, "") || null,
40
- renderHTML: (e) => e.letterSpacing ? { style: `letter-spacing: ${e.letterSpacing}` } : {}
41
- } }
42
- }];
43
- },
44
- addCommands() {
45
- return {
46
- setLetterSpacing: (e) => ({ chain: t }) => t().setMark("textStyle", { letterSpacing: e }).run(),
47
- unsetLetterSpacing: () => ({ chain: e }) => e().setMark("textStyle", { letterSpacing: null }).removeEmptyTextStyle().run()
48
- };
49
- }
50
- }), le = k.create({
51
- name: "lineHeight",
52
- addOptions() {
53
- return {
54
- types: ["paragraph"],
55
- defaultLineHeight: "1.5"
56
- };
57
- },
58
- addGlobalAttributes() {
59
- return [{
60
- types: this.options.types,
61
- attributes: { lineHeight: {
62
- default: null,
63
- parseHTML: (e) => e.style.lineHeight || null,
64
- renderHTML: (e) => e.lineHeight ? { style: `line-height: ${e.lineHeight}` } : {}
65
- } }
66
- }];
67
- },
68
- addCommands() {
69
- return {
70
- setLineHeight: (e) => ({ commands: t }) => this.options.types.every((n) => t.updateAttributes(n, { lineHeight: e })),
71
- unsetLineHeight: () => ({ commands: e }) => this.options.types.every((t) => e.resetAttributes(t, "lineHeight"))
72
- };
73
- }
74
- }), ue = [
75
- "aria-label",
76
- "data-tooltip",
77
- "onKeydown"
78
- ], de = ["aria-label", "onKeydown"], fe = ["aria-label"], pe = /* @__PURE__ */ c({
79
- __name: "LogicMergeTagNodeView",
80
- props: {
81
- node: {},
82
- editor: {},
83
- getPos: { type: Function },
84
- deleteNode: { type: Function },
85
- updateAttributes: { type: Function }
86
- },
87
- setup(r) {
88
- let i = r, { syntax: c } = E(), { t: p } = ee(), h = u(() => S(i.node.attrs.value, c)), C = u(() => T(i.node.attrs.value, c)), w = a(!1), D = a(""), O = a(null), k = !1;
89
- function A() {
90
- D.value = i.node.attrs.value, k = !1, w.value = !0, n(() => {
91
- O.value?.focus(), O.value?.select();
92
- });
93
- }
94
- function j() {
95
- if (k) return;
96
- k = !0;
97
- let e = D.value.trim();
98
- if (!e) {
99
- w.value = !1;
100
- return;
101
- }
102
- e !== i.node.attrs.value && i.updateAttributes({
103
- value: e,
104
- keyword: S(e, c) ? T(e, c) : ""
105
- }), w.value = !1;
106
- }
107
- function M(e) {
108
- e.key === "Enter" ? (e.preventDefault(), j()) : e.key === "Escape" && (w.value = !1);
109
- }
110
- return (n, i) => (e(), _(v(oe), {
111
- as: "span",
112
- class: s(h.value ? "tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none" : ""),
113
- style: g(h.value ? "background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);" : ""),
114
- contenteditable: "false"
115
- }, {
116
- default: x(() => [w.value ? t((e(), f("input", {
117
- key: 0,
118
- ref_key: "inputRef",
119
- ref: O,
120
- "onUpdate:modelValue": i[0] ||= (e) => D.value = e,
121
- type: "text",
122
- class: "tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]",
123
- onBlur: j,
124
- onKeydown: M
125
- }, null, 544)), [[o, D.value]]) : h.value ? (e(), f("span", {
126
- key: 1,
127
- role: "button",
128
- tabindex: "0",
129
- "aria-label": v(p).mergeTag.editValue,
130
- class: "tpl-tooltip tpl:cursor-pointer",
131
- "data-tooltip": r.node.attrs.value,
132
- onClick: l(A, ["stop"]),
133
- onKeydown: [y(l(A, ["stop"]), ["enter"]), y(l(A, ["prevent", "stop"]), ["space"])]
134
- }, b(C.value), 41, ue)) : (e(), f("span", {
135
- key: 2,
136
- role: "button",
137
- tabindex: "0",
138
- "aria-label": v(p).mergeTag.editValue,
139
- onClick: l(A, ["stop"]),
140
- onKeydown: [y(l(A, ["stop"]), ["enter"]), y(l(A, ["prevent", "stop"]), ["space"])]
141
- }, b(r.node.attrs.value), 41, de)), h.value ? (e(), f("button", {
142
- key: 3,
143
- type: "button",
144
- "aria-label": v(p).mergeTag.deleteMergeTag,
145
- class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
146
- contenteditable: "false",
147
- onClick: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
148
- }, [...i[2] ||= [d("svg", {
149
- width: "10",
150
- height: "10",
151
- viewBox: "0 0 24 24",
152
- fill: "none",
153
- stroke: "currentColor",
154
- "stroke-width": "3",
155
- "aria-hidden": "true"
156
- }, [d("line", {
157
- x1: "18",
158
- y1: "6",
159
- x2: "6",
160
- y2: "18"
161
- }), d("line", {
162
- x1: "6",
163
- y1: "6",
164
- x2: "18",
165
- y2: "18"
166
- })], -1)]], 8, fe)) : m("", !0)]),
167
- _: 1
168
- }, 8, ["class", "style"]));
169
- }
170
- });
171
- //#endregion
172
- //#region src/extensions/isNodeSelected.ts
173
- function N(e, t) {
174
- let { $from: n, $to: r } = e.state.selection;
175
- return n.pos === r.pos ? n.pos > 0 && n.nodeBefore?.type.name === t || n.nodeAfter?.type.name === t : !1;
176
- }
177
- //#endregion
178
- //#region src/extensions/renderVueNodeView.ts
179
- function me(e) {
180
- return ae(e);
181
- }
182
- //#endregion
183
- //#region src/extensions/LogicMergeTagNode.ts
184
- var he = te.create({
185
- name: "logicMergeTagNode",
186
- group: "inline",
187
- inline: !0,
188
- atom: !0,
189
- addOptions() {
190
- return { syntax: w.liquid };
191
- },
192
- addAttributes() {
193
- return {
194
- value: {
195
- default: "",
196
- parseHTML: (e) => e.getAttribute("data-logic-merge-tag") || ""
197
- },
198
- keyword: {
199
- default: "",
200
- parseHTML: (e) => e.getAttribute("data-keyword") || e.textContent || ""
201
- }
202
- };
203
- },
204
- parseHTML() {
205
- return [{ tag: "span[data-logic-merge-tag]" }];
206
- },
207
- renderHTML({ node: e, HTMLAttributes: t }) {
208
- if (!S(e.attrs.value, this.options.syntax)) return [
209
- "span",
210
- {},
211
- e.attrs.value
212
- ];
213
- let n = T(e.attrs.value, this.options.syntax);
214
- return [
215
- "span",
216
- M(t, {
217
- "data-logic-merge-tag": e.attrs.value,
218
- "data-keyword": n
219
- }),
220
- n
221
- ];
222
- },
223
- addNodeView() {
224
- return me(pe);
225
- },
226
- addKeyboardShortcuts() {
227
- return {
228
- Backspace: () => N(this.editor, this.name),
229
- Delete: () => N(this.editor, this.name)
230
- };
231
- },
232
- addInputRules() {
233
- return [new A({
234
- find: RegExp(this.options.syntax.logic.source + "$", ""),
235
- handler: ({ state: e, range: t, match: n }) => {
236
- let r = n[0];
237
- if (!S(r, this.options.syntax)) return;
238
- let i = T(r, this.options.syntax), a = this.type.create({
239
- value: r,
240
- keyword: i
241
- });
242
- e.tr.replaceWith(t.from, t.to, a);
243
- }
244
- })];
245
- },
246
- addPasteRules() {
247
- return [new j({
248
- find: new RegExp(this.options.syntax.logic.source, "g"),
249
- handler: ({ state: e, range: t, match: n }) => {
250
- let r = n[0];
251
- if (!S(r, this.options.syntax)) return;
252
- let i = T(r, this.options.syntax), a = this.type.create({
253
- value: r,
254
- keyword: i
255
- });
256
- e.tr.replaceWith(t.from, t.to, a);
257
- }
258
- })];
259
- }
260
- }), ge = [
261
- "aria-label",
262
- "data-tooltip",
263
- "onKeydown"
264
- ], _e = ["aria-label"], ve = /* @__PURE__ */ c({
265
- __name: "MergeTagNodeView",
266
- props: {
267
- node: {},
268
- deleteNode: { type: Function },
269
- updateAttributes: { type: Function }
270
- },
271
- setup(r) {
272
- let i = r, { getMergeTagLabel: s } = E(), { t: c } = ee(), p = u(() => s(i.node.attrs.value)), m = a(!1), h = a(""), g = a(null);
273
- function S() {
274
- h.value = i.node.attrs.value, m.value = !0, n(() => {
275
- g.value?.focus(), g.value?.select();
276
- });
277
- }
278
- function C() {
279
- let e = h.value.trim();
280
- e && e !== i.node.attrs.value && i.updateAttributes({
281
- value: e,
282
- label: s(e)
283
- }), m.value = !1;
284
- }
285
- function w(e) {
286
- e.key === "Enter" ? (e.preventDefault(), C()) : e.key === "Escape" && (m.value = !1);
287
- }
288
- return (n, i) => (e(), _(v(oe), {
289
- as: "span",
290
- class: "tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]",
291
- style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)" },
292
- contenteditable: "false"
293
- }, {
294
- default: x(() => [m.value ? t((e(), f("input", {
295
- key: 0,
296
- ref_key: "inputRef",
297
- ref: g,
298
- "onUpdate:modelValue": i[0] ||= (e) => h.value = e,
299
- type: "text",
300
- class: "tpl:w-32 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]",
301
- onBlur: C,
302
- onKeydown: w
303
- }, null, 544)), [[o, h.value]]) : (e(), f("span", {
304
- key: 1,
305
- role: "button",
306
- tabindex: "0",
307
- "aria-label": v(c).mergeTag.editValue,
308
- class: "tpl-tooltip tpl:cursor-pointer",
309
- "data-tooltip": r.node.attrs.value,
310
- onClick: l(S, ["stop"]),
311
- onKeydown: [y(l(S, ["stop"]), ["enter"]), y(l(S, ["prevent", "stop"]), ["space"])]
312
- }, b(p.value), 41, ge)), d("button", {
313
- type: "button",
314
- "aria-label": v(c).mergeTag.deleteMergeTag,
315
- class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
316
- contenteditable: "false",
317
- onClick: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
318
- }, [...i[2] ||= [d("svg", {
319
- width: "10",
320
- height: "10",
321
- viewBox: "0 0 24 24",
322
- fill: "none",
323
- stroke: "currentColor",
324
- "stroke-width": "3",
325
- "aria-hidden": "true"
326
- }, [d("line", {
327
- x1: "18",
328
- y1: "6",
329
- x2: "6",
330
- y2: "18"
331
- }), d("line", {
332
- x1: "6",
333
- y1: "6",
334
- x2: "18",
335
- y2: "18"
336
- })], -1)]], 8, _e)]),
337
- _: 1
338
- }));
339
- }
340
- }), ye = te.create({
341
- name: "mergeTagNode",
342
- group: "inline",
343
- inline: !0,
344
- atom: !0,
345
- addOptions() {
346
- return {
347
- mergeTags: [],
348
- syntax: w.liquid
349
- };
350
- },
351
- addAttributes() {
352
- return {
353
- label: {
354
- default: "",
355
- parseHTML: (e) => e.getAttribute("data-label") || e.textContent || ""
356
- },
357
- value: {
358
- default: "",
359
- parseHTML: (e) => e.getAttribute("data-merge-tag") || ""
360
- }
361
- };
362
- },
363
- parseHTML() {
364
- return [{ tag: "span[data-merge-tag]" }];
365
- },
366
- renderHTML({ node: e, HTMLAttributes: t }) {
367
- let n = C(e.attrs.value, this.options.mergeTags);
368
- return [
369
- "span",
370
- M(t, {
371
- "data-merge-tag": e.attrs.value,
372
- "data-label": n
373
- }),
374
- n
375
- ];
376
- },
377
- addNodeView() {
378
- return me(ve);
379
- },
380
- addCommands() {
381
- return { insertMergeTag: (e) => ({ commands: t }) => t.insertContent({
382
- type: this.name,
383
- attrs: {
384
- label: e.label,
385
- value: e.value
386
- }
387
- }) };
388
- },
389
- addKeyboardShortcuts() {
390
- return {
391
- Backspace: () => N(this.editor, this.name),
392
- Delete: () => N(this.editor, this.name)
393
- };
394
- },
395
- addInputRules() {
396
- return [new A({
397
- find: RegExp(this.options.syntax.value.source + "$", ""),
398
- handler: ({ state: e, range: t, match: n }) => {
399
- let r = n[0], i = C(r, this.options.mergeTags), a = this.type.create({
400
- label: i,
401
- value: r
402
- });
403
- e.tr.replaceWith(t.from, t.to, a);
404
- }
405
- })];
406
- },
407
- addPasteRules() {
408
- return [new j({
409
- find: new RegExp(this.options.syntax.value.source, "g"),
410
- handler: ({ state: e, range: t, match: n }) => {
411
- let r = n[0], i = C(r, this.options.mergeTags), a = this.type.create({
412
- label: i,
413
- value: r
414
- });
415
- e.tr.replaceWith(t.from, t.to, a);
416
- }
417
- })];
418
- }
419
- }), be = Math.min, P = Math.max, F = Math.round, xe = Math.floor, I = (e) => ({
420
- x: e,
421
- y: e
422
- }), Se = {
423
- left: "right",
424
- right: "left",
425
- bottom: "top",
426
- top: "bottom"
427
- };
428
- function Ce(e, t) {
429
- return typeof e == "function" ? e(t) : e;
430
- }
431
- function L(e) {
432
- return e.split("-")[0];
433
- }
434
- function R(e) {
435
- return e.split("-")[1];
436
- }
437
- function we(e) {
438
- return e === "x" ? "y" : "x";
439
- }
440
- function Te(e) {
441
- return e === "y" ? "height" : "width";
442
- }
443
- function z(e) {
444
- let t = e[0];
445
- return t === "t" || t === "b" ? "y" : "x";
446
- }
447
- function Ee(e) {
448
- return we(z(e));
449
- }
450
- function De(e, t, n) {
451
- n === void 0 && (n = !1);
452
- let r = R(e), i = Ee(e), a = Te(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
453
- return t.reference[a] > t.floating[a] && (o = Ie(o)), [o, Ie(o)];
454
- }
455
- function Oe(e) {
456
- let t = Ie(e);
457
- return [
458
- ke(e),
459
- t,
460
- ke(t)
461
- ];
462
- }
463
- function ke(e) {
464
- return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
465
- }
466
- var Ae = ["left", "right"], je = ["right", "left"], Me = ["top", "bottom"], Ne = ["bottom", "top"];
467
- function Pe(e, t, n) {
468
- switch (e) {
469
- case "top":
470
- case "bottom": return n ? t ? je : Ae : t ? Ae : je;
471
- case "left":
472
- case "right": return t ? Me : Ne;
473
- default: return [];
474
- }
475
- }
476
- function Fe(e, t, n, r) {
477
- let i = R(e), a = Pe(L(e), n === "start", r);
478
- return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(ke)))), a;
479
- }
480
- function Ie(e) {
481
- let t = L(e);
482
- return Se[t] + e.slice(t.length);
483
- }
484
- function Le(e) {
485
- return {
486
- top: 0,
487
- right: 0,
488
- bottom: 0,
489
- left: 0,
490
- ...e
491
- };
492
- }
493
- function Re(e) {
494
- return typeof e == "number" ? {
495
- top: e,
496
- right: e,
497
- bottom: e,
498
- left: e
499
- } : Le(e);
500
- }
501
- function ze(e) {
502
- let { x: t, y: n, width: r, height: i } = e;
503
- return {
504
- width: r,
505
- height: i,
506
- top: n,
507
- left: t,
508
- right: t + r,
509
- bottom: n + i,
510
- x: t,
511
- y: n
512
- };
513
- }
514
- //#endregion
515
- //#region ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
516
- function Be(e, t, n) {
517
- let { reference: r, floating: i } = e, a = z(t), o = Ee(t), s = Te(o), c = L(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
518
- switch (c) {
519
- case "top":
520
- p = {
521
- x: u,
522
- y: r.y - i.height
523
- };
524
- break;
525
- case "bottom":
526
- p = {
527
- x: u,
528
- y: r.y + r.height
529
- };
530
- break;
531
- case "right":
532
- p = {
533
- x: r.x + r.width,
534
- y: d
535
- };
536
- break;
537
- case "left":
538
- p = {
539
- x: r.x - i.width,
540
- y: d
541
- };
542
- break;
543
- default: p = {
544
- x: r.x,
545
- y: r.y
546
- };
547
- }
548
- switch (R(t)) {
549
- case "start":
550
- p[o] -= f * (n && l ? -1 : 1);
551
- break;
552
- case "end":
553
- p[o] += f * (n && l ? -1 : 1);
554
- break;
555
- }
556
- return p;
557
- }
558
- async function Ve(e, t) {
559
- t === void 0 && (t = {});
560
- let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = Ce(t, e), p = Re(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = ze(await i.getClippingRect({
561
- element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
562
- boundary: c,
563
- rootBoundary: l,
564
- strategy: s
565
- })), g = u === "floating" ? {
566
- x: n,
567
- y: r,
568
- width: a.floating.width,
569
- height: a.floating.height
570
- } : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
571
- x: 1,
572
- y: 1
573
- }, y = ze(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
574
- elements: o,
575
- rect: g,
576
- offsetParent: _,
577
- strategy: s
578
- }) : g);
579
- return {
580
- top: (h.top - y.top + p.top) / v.y,
581
- bottom: (y.bottom - h.bottom + p.bottom) / v.y,
582
- left: (h.left - y.left + p.left) / v.x,
583
- right: (y.right - h.right + p.right) / v.x
584
- };
585
- }
586
- var He = 50, Ue = async (e, t, n) => {
587
- let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = o.detectOverflow ? o : {
588
- ...o,
589
- detectOverflow: Ve
590
- }, c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
591
- reference: e,
592
- floating: t,
593
- strategy: i
594
- }), { x: u, y: d } = Be(l, r, c), f = r, p = 0, m = {};
595
- for (let n = 0; n < a.length; n++) {
596
- let h = a[n];
597
- if (!h) continue;
598
- let { name: g, fn: _ } = h, { x: v, y, data: b, reset: x } = await _({
599
- x: u,
600
- y: d,
601
- initialPlacement: r,
602
- placement: f,
603
- strategy: i,
604
- middlewareData: m,
605
- rects: l,
606
- platform: s,
607
- elements: {
608
- reference: e,
609
- floating: t
610
- }
611
- });
612
- u = v ?? u, d = y ?? d, m[g] = {
613
- ...m[g],
614
- ...b
615
- }, x && p < He && (p++, typeof x == "object" && (x.placement && (f = x.placement), x.rects && (l = x.rects === !0 ? await o.getElementRects({
616
- reference: e,
617
- floating: t,
618
- strategy: i
619
- }) : x.rects), {x: u, y: d} = Be(l, f, c)), n = -1);
620
- }
621
- return {
622
- x: u,
623
- y: d,
624
- placement: f,
625
- strategy: i,
626
- middlewareData: m
627
- };
628
- }, We = function(e) {
629
- return e === void 0 && (e = {}), {
630
- name: "flip",
631
- options: e,
632
- async fn(t) {
633
- var n;
634
- let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = Ce(e, t);
635
- if ((n = i.arrow) != null && n.alignmentOffset) return {};
636
- let g = L(r), _ = z(o), v = L(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Ie(o)] : Oe(o)), x = p !== "none";
637
- !d && x && b.push(...Fe(o, m, p, y));
638
- let S = [o, ...b], C = await s.detectOverflow(t, h), w = [], T = i.flip?.overflows || [];
639
- if (l && w.push(C[g]), u) {
640
- let e = De(r, a, y);
641
- w.push(C[e[0]], C[e[1]]);
642
- }
643
- if (T = [...T, {
644
- placement: r,
645
- overflows: w
646
- }], !w.every((e) => e <= 0)) {
647
- let e = (i.flip?.index || 0) + 1, t = S[e];
648
- if (t && (!(u === "alignment" && _ !== z(t)) || T.every((e) => z(e.placement) === _ ? e.overflows[0] > 0 : !0))) return {
649
- data: {
650
- index: e,
651
- overflows: T
652
- },
653
- reset: { placement: t }
654
- };
655
- let n = T.filter((e) => e.overflows[0] <= 0).sort((e, t) => e.overflows[1] - t.overflows[1])[0]?.placement;
656
- if (!n) switch (f) {
657
- case "bestFit": {
658
- let e = T.filter((e) => {
659
- if (x) {
660
- let t = z(e.placement);
661
- return t === _ || t === "y";
662
- }
663
- return !0;
664
- }).map((e) => [e.placement, e.overflows.filter((e) => e > 0).reduce((e, t) => e + t, 0)]).sort((e, t) => e[1] - t[1])[0]?.[0];
665
- e && (n = e);
666
- break;
667
- }
668
- case "initialPlacement":
669
- n = o;
670
- break;
671
- }
672
- if (r !== n) return { reset: { placement: n } };
673
- }
674
- return {};
675
- }
676
- };
677
- }, Ge = /*#__PURE__*/ new Set(["left", "top"]);
678
- async function Ke(e, t) {
679
- let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = L(n), s = R(n), c = z(n) === "y", l = Ge.has(o) ? -1 : 1, u = a && c ? -1 : 1, d = Ce(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
680
- mainAxis: d,
681
- crossAxis: 0,
682
- alignmentAxis: null
683
- } : {
684
- mainAxis: d.mainAxis || 0,
685
- crossAxis: d.crossAxis || 0,
686
- alignmentAxis: d.alignmentAxis
687
- };
688
- return s && typeof m == "number" && (p = s === "end" ? m * -1 : m), c ? {
689
- x: p * u,
690
- y: f * l
691
- } : {
692
- x: f * l,
693
- y: p * u
694
- };
695
- }
696
- var qe = function(e) {
697
- return e === void 0 && (e = 0), {
698
- name: "offset",
699
- options: e,
700
- async fn(t) {
701
- var n;
702
- let { x: r, y: i, placement: a, middlewareData: o } = t, s = await Ke(t, e);
703
- return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
704
- x: r + s.x,
705
- y: i + s.y,
706
- data: {
707
- ...s,
708
- placement: a
709
- }
710
- };
711
- }
712
- };
713
- };
714
- //#endregion
715
- //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
716
- function Je() {
717
- return typeof window < "u";
718
- }
719
- function B(e) {
720
- return Ye(e) ? (e.nodeName || "").toLowerCase() : "#document";
721
- }
722
- function V(e) {
723
- var t;
724
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
725
- }
726
- function H(e) {
727
- return ((Ye(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
728
- }
729
- function Ye(e) {
730
- return Je() ? e instanceof Node || e instanceof V(e).Node : !1;
731
- }
732
- function U(e) {
733
- return Je() ? e instanceof Element || e instanceof V(e).Element : !1;
734
- }
735
- function W(e) {
736
- return Je() ? e instanceof HTMLElement || e instanceof V(e).HTMLElement : !1;
737
- }
738
- function Xe(e) {
739
- return !Je() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof V(e).ShadowRoot;
740
- }
741
- function G(e) {
742
- let { overflow: t, overflowX: n, overflowY: r, display: i } = Y(e);
743
- return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && i !== "inline" && i !== "contents";
744
- }
745
- function Ze(e) {
746
- return /^(table|td|th)$/.test(B(e));
747
- }
748
- function K(e) {
749
- try {
750
- if (e.matches(":popover-open")) return !0;
751
- } catch {}
752
- try {
753
- return e.matches(":modal");
754
- } catch {
755
- return !1;
756
- }
757
- }
758
- var Qe = /transform|translate|scale|rotate|perspective|filter/, $e = /paint|layout|strict|content/, q = (e) => !!e && e !== "none", et;
759
- function tt(e) {
760
- let t = U(e) ? Y(e) : e;
761
- return q(t.transform) || q(t.translate) || q(t.scale) || q(t.rotate) || q(t.perspective) || !rt() && (q(t.backdropFilter) || q(t.filter)) || Qe.test(t.willChange || "") || $e.test(t.contain || "");
762
- }
763
- function nt(e) {
764
- let t = X(e);
765
- for (; W(t) && !J(t);) {
766
- if (tt(t)) return t;
767
- if (K(t)) return null;
768
- t = X(t);
769
- }
770
- return null;
771
- }
772
- function rt() {
773
- return et ??= typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"), et;
774
- }
775
- function J(e) {
776
- return /^(html|body|#document)$/.test(B(e));
777
- }
778
- function Y(e) {
779
- return V(e).getComputedStyle(e);
780
- }
781
- function it(e) {
782
- return U(e) ? {
783
- scrollLeft: e.scrollLeft,
784
- scrollTop: e.scrollTop
785
- } : {
786
- scrollLeft: e.scrollX,
787
- scrollTop: e.scrollY
788
- };
789
- }
790
- function X(e) {
791
- if (B(e) === "html") return e;
792
- let t = e.assignedSlot || e.parentNode || Xe(e) && e.host || H(e);
793
- return Xe(t) ? t.host : t;
794
- }
795
- function at(e) {
796
- let t = X(e);
797
- return J(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : W(t) && G(t) ? t : at(t);
798
- }
799
- function Z(e, t, n) {
800
- t === void 0 && (t = []), n === void 0 && (n = !0);
801
- let r = at(e), i = r === e.ownerDocument?.body, a = V(r);
802
- if (i) {
803
- let e = ot(a);
804
- return t.concat(a, a.visualViewport || [], G(r) ? r : [], e && n ? Z(e) : []);
805
- } else return t.concat(r, Z(r, [], n));
806
- }
807
- function ot(e) {
808
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
809
- }
810
- //#endregion
811
- //#region ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
812
- function st(e) {
813
- let t = Y(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = W(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = F(n) !== a || F(r) !== o;
814
- return s && (n = a, r = o), {
815
- width: n,
816
- height: r,
817
- $: s
818
- };
819
- }
820
- function ct(e) {
821
- return U(e) ? e : e.contextElement;
822
- }
823
- function Q(e) {
824
- let t = ct(e);
825
- if (!W(t)) return I(1);
826
- let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = st(t), o = (a ? F(n.width) : n.width) / r, s = (a ? F(n.height) : n.height) / i;
827
- return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
828
- x: o,
829
- y: s
830
- };
831
- }
832
- var lt = /*#__PURE__*/ I(0);
833
- function ut(e) {
834
- let t = V(e);
835
- return !rt() || !t.visualViewport ? lt : {
836
- x: t.visualViewport.offsetLeft,
837
- y: t.visualViewport.offsetTop
838
- };
839
- }
840
- function dt(e, t, n) {
841
- return t === void 0 && (t = !1), !n || t && n !== V(e) ? !1 : t;
842
- }
843
- function $(e, t, n, r) {
844
- t === void 0 && (t = !1), n === void 0 && (n = !1);
845
- let i = e.getBoundingClientRect(), a = ct(e), o = I(1);
846
- t && (r ? U(r) && (o = Q(r)) : o = Q(e));
847
- let s = dt(a, n, r) ? ut(a) : I(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
848
- if (a) {
849
- let e = V(a), t = r && U(r) ? V(r) : r, n = e, i = ot(n);
850
- for (; i && r && t !== n;) {
851
- let e = Q(i), t = i.getBoundingClientRect(), r = Y(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
852
- c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = V(i), i = ot(n);
853
- }
854
- }
855
- return ze({
856
- width: u,
857
- height: d,
858
- x: c,
859
- y: l
860
- });
861
- }
862
- function ft(e, t) {
863
- let n = it(e).scrollLeft;
864
- return t ? t.left + n : $(H(e)).left + n;
865
- }
866
- function pt(e, t) {
867
- let n = e.getBoundingClientRect();
868
- return {
869
- x: n.left + t.scrollLeft - ft(e, n),
870
- y: n.top + t.scrollTop
871
- };
872
- }
873
- function mt(e) {
874
- let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = H(r), s = t ? K(t.floating) : !1;
875
- if (r === o || s && a) return n;
876
- let c = {
877
- scrollLeft: 0,
878
- scrollTop: 0
879
- }, l = I(1), u = I(0), d = W(r);
880
- if ((d || !d && !a) && ((B(r) !== "body" || G(o)) && (c = it(r)), d)) {
881
- let e = $(r);
882
- l = Q(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
883
- }
884
- let f = o && !d && !a ? pt(o, c) : I(0);
885
- return {
886
- width: n.width * l.x,
887
- height: n.height * l.y,
888
- x: n.x * l.x - c.scrollLeft * l.x + u.x + f.x,
889
- y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
890
- };
891
- }
892
- function ht(e) {
893
- return Array.from(e.getClientRects());
894
- }
895
- function gt(e) {
896
- let t = H(e), n = it(e), r = e.ownerDocument.body, i = P(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = P(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + ft(e), s = -n.scrollTop;
897
- return Y(r).direction === "rtl" && (o += P(t.clientWidth, r.clientWidth) - i), {
898
- width: i,
899
- height: a,
900
- x: o,
901
- y: s
902
- };
903
- }
904
- var _t = 25;
905
- function vt(e, t) {
906
- let n = V(e), r = H(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
907
- if (i) {
908
- a = i.width, o = i.height;
909
- let e = rt();
910
- (!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
911
- }
912
- let l = ft(r);
913
- if (l <= 0) {
914
- let e = r.ownerDocument, t = e.body, n = getComputedStyle(t), i = e.compatMode === "CSS1Compat" && parseFloat(n.marginLeft) + parseFloat(n.marginRight) || 0, o = Math.abs(r.clientWidth - t.clientWidth - i);
915
- o <= _t && (a -= o);
916
- } else l <= _t && (a += l);
917
- return {
918
- width: a,
919
- height: o,
920
- x: s,
921
- y: c
922
- };
923
- }
924
- function yt(e, t) {
925
- let n = $(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = W(e) ? Q(e) : I(1);
926
- return {
927
- width: e.clientWidth * a.x,
928
- height: e.clientHeight * a.y,
929
- x: i * a.x,
930
- y: r * a.y
931
- };
932
- }
933
- function bt(e, t, n) {
934
- let r;
935
- if (t === "viewport") r = vt(e, n);
936
- else if (t === "document") r = gt(H(e));
937
- else if (U(t)) r = yt(t, n);
938
- else {
939
- let n = ut(e);
940
- r = {
941
- x: t.x - n.x,
942
- y: t.y - n.y,
943
- width: t.width,
944
- height: t.height
945
- };
946
- }
947
- return ze(r);
948
- }
949
- function xt(e, t) {
950
- let n = X(e);
951
- return n === t || !U(n) || J(n) ? !1 : Y(n).position === "fixed" || xt(n, t);
952
- }
953
- function St(e, t) {
954
- let n = t.get(e);
955
- if (n) return n;
956
- let r = Z(e, [], !1).filter((e) => U(e) && B(e) !== "body"), i = null, a = Y(e).position === "fixed", o = a ? X(e) : e;
957
- for (; U(o) && !J(o);) {
958
- let t = Y(o), n = tt(o);
959
- !n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && (i.position === "absolute" || i.position === "fixed") || G(o) && !n && xt(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = X(o);
960
- }
961
- return t.set(e, r), r;
962
- }
963
- function Ct(e) {
964
- let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? K(t) ? [] : St(t, this._c) : [].concat(n), r], o = bt(t, a[0], i), s = o.top, c = o.right, l = o.bottom, u = o.left;
965
- for (let e = 1; e < a.length; e++) {
966
- let n = bt(t, a[e], i);
967
- s = P(n.top, s), c = be(n.right, c), l = be(n.bottom, l), u = P(n.left, u);
968
- }
969
- return {
970
- width: c - u,
971
- height: l - s,
972
- x: u,
973
- y: s
974
- };
975
- }
976
- function wt(e) {
977
- let { width: t, height: n } = st(e);
978
- return {
979
- width: t,
980
- height: n
981
- };
982
- }
983
- function Tt(e, t, n) {
984
- let r = W(t), i = H(t), a = n === "fixed", o = $(e, !0, a, t), s = {
985
- scrollLeft: 0,
986
- scrollTop: 0
987
- }, c = I(0);
988
- function l() {
989
- c.x = ft(i);
990
- }
991
- if (r || !r && !a) if ((B(t) !== "body" || G(i)) && (s = it(t)), r) {
992
- let e = $(t, !0, a, t);
993
- c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
994
- } else i && l();
995
- a && !r && i && l();
996
- let u = i && !r && !a ? pt(i, s) : I(0);
997
- return {
998
- x: o.left + s.scrollLeft - c.x - u.x,
999
- y: o.top + s.scrollTop - c.y - u.y,
1000
- width: o.width,
1001
- height: o.height
1002
- };
1003
- }
1004
- function Et(e) {
1005
- return Y(e).position === "static";
1006
- }
1007
- function Dt(e, t) {
1008
- if (!W(e) || Y(e).position === "fixed") return null;
1009
- if (t) return t(e);
1010
- let n = e.offsetParent;
1011
- return H(e) === n && (n = n.ownerDocument.body), n;
1012
- }
1013
- function Ot(e, t) {
1014
- let n = V(e);
1015
- if (K(e)) return n;
1016
- if (!W(e)) {
1017
- let t = X(e);
1018
- for (; t && !J(t);) {
1019
- if (U(t) && !Et(t)) return t;
1020
- t = X(t);
1021
- }
1022
- return n;
1023
- }
1024
- let r = Dt(e, t);
1025
- for (; r && Ze(r) && Et(r);) r = Dt(r, t);
1026
- return r && J(r) && Et(r) && !tt(r) ? n : r || nt(e) || n;
1027
- }
1028
- var kt = async function(e) {
1029
- let t = this.getOffsetParent || Ot, n = this.getDimensions, r = await n(e.floating);
1030
- return {
1031
- reference: Tt(e.reference, await t(e.floating), e.strategy),
1032
- floating: {
1033
- x: 0,
1034
- y: 0,
1035
- width: r.width,
1036
- height: r.height
1037
- }
1038
- };
1039
- };
1040
- function At(e) {
1041
- return Y(e).direction === "rtl";
1042
- }
1043
- var jt = {
1044
- convertOffsetParentRelativeRectToViewportRelativeRect: mt,
1045
- getDocumentElement: H,
1046
- getClippingRect: Ct,
1047
- getOffsetParent: Ot,
1048
- getElementRects: kt,
1049
- getClientRects: ht,
1050
- getDimensions: wt,
1051
- getScale: Q,
1052
- isElement: U,
1053
- isRTL: At
1054
- };
1055
- function Mt(e, t) {
1056
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1057
- }
1058
- function Nt(e, t) {
1059
- let n = null, r, i = H(e);
1060
- function a() {
1061
- var e;
1062
- clearTimeout(r), (e = n) == null || e.disconnect(), n = null;
1063
- }
1064
- function o(s, c) {
1065
- s === void 0 && (s = !1), c === void 0 && (c = 1), a();
1066
- let l = e.getBoundingClientRect(), { left: u, top: d, width: f, height: p } = l;
1067
- if (s || t(), !f || !p) return;
1068
- let m = xe(d), h = xe(i.clientWidth - (u + f)), g = xe(i.clientHeight - (d + p)), _ = xe(u), v = {
1069
- rootMargin: -m + "px " + -h + "px " + -g + "px " + -_ + "px",
1070
- threshold: P(0, be(1, c)) || 1
1071
- }, y = !0;
1072
- function b(t) {
1073
- let n = t[0].intersectionRatio;
1074
- if (n !== c) {
1075
- if (!y) return o();
1076
- n ? o(!1, n) : r = setTimeout(() => {
1077
- o(!1, 1e-7);
1078
- }, 1e3);
1079
- }
1080
- n === 1 && !Mt(l, e.getBoundingClientRect()) && o(), y = !1;
1081
- }
1082
- try {
1083
- n = new IntersectionObserver(b, {
1084
- ...v,
1085
- root: i.ownerDocument
1086
- });
1087
- } catch {
1088
- n = new IntersectionObserver(b, v);
1089
- }
1090
- n.observe(e);
1091
- }
1092
- return o(!0), a;
1093
- }
1094
- function Pt(e, t, n, r) {
1095
- r === void 0 && (r = {});
1096
- let { ancestorScroll: i = !0, ancestorResize: a = !0, elementResize: o = typeof ResizeObserver == "function", layoutShift: s = typeof IntersectionObserver == "function", animationFrame: c = !1 } = r, l = ct(e), u = i || a ? [...l ? Z(l) : [], ...t ? Z(t) : []] : [];
1097
- u.forEach((e) => {
1098
- i && e.addEventListener("scroll", n, { passive: !0 }), a && e.addEventListener("resize", n);
1099
- });
1100
- let d = l && s ? Nt(l, n) : null, f = -1, p = null;
1101
- o && (p = new ResizeObserver((e) => {
1102
- let [r] = e;
1103
- r && r.target === l && p && t && (p.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
1104
- var e;
1105
- (e = p) == null || e.observe(t);
1106
- })), n();
1107
- }), l && !c && p.observe(l), t && p.observe(t));
1108
- let m, h = c ? $(e) : null;
1109
- c && g();
1110
- function g() {
1111
- let t = $(e);
1112
- h && !Mt(h, t) && n(), h = t, m = requestAnimationFrame(g);
1113
- }
1114
- return n(), () => {
1115
- var e;
1116
- u.forEach((e) => {
1117
- i && e.removeEventListener("scroll", n), a && e.removeEventListener("resize", n);
1118
- }), d?.(), (e = p) == null || e.disconnect(), p = null, c && cancelAnimationFrame(m);
1119
- };
1120
- }
1121
- var Ft = qe, It = We, Lt = (e, t, n) => {
1122
- let r = /* @__PURE__ */ new Map(), i = {
1123
- platform: jt,
1124
- ...n
1125
- }, a = {
1126
- ...i.platform,
1127
- _c: r
1128
- };
1129
- return Ue(e, t, {
1130
- ...i,
1131
- platform: a
1132
- });
1133
- };
1134
- //#endregion
1135
- //#region ../../node_modules/.pnpm/@tiptap+suggestion@3.27.1_@floating-ui+dom@1.7.6_@tiptap+core@3.27.1_@tiptap+pm@3.27.1__@tiptap+pm@3.27.1/node_modules/@tiptap/suggestion/dist/index.js
1136
- function Rt(e) {
1137
- let { char: t, allowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, $position: o } = e, s = n && !r, c = D(t), l = RegExp(`\\s${c}$`), u = a ? "^" : "", d = r ? "" : c, f = RegExp(s ? `${u}${c}.*?(?=\\s${d}|$)` : `${u}(?:^)?${c}[^\\s${d}]*`, "gm"), p = o.nodeBefore?.isText && o.nodeBefore.text;
1138
- if (!p) return null;
1139
- let m = o.pos - p.length, h = Array.from(p.matchAll(f)).pop();
1140
- if (!h || h.input === void 0 || h.index === void 0) return null;
1141
- let g = h.input.slice(Math.max(0, h.index - 1), h.index), _ = RegExp(`^[${i?.join("")}\0]?$`).test(g);
1142
- if (i !== null && !_) return null;
1143
- let v = m + h.index, y = v + h[0].length;
1144
- return s && l.test(p.slice(y - 1, y + 1)) && (h[0] += " ", y += 1), v < o.pos && y >= o.pos ? {
1145
- range: {
1146
- from: v,
1147
- to: y
1148
- },
1149
- query: h[0].slice(t.length),
1150
- text: h[0]
1151
- } : null;
1152
- }
1153
- function zt(e) {
1154
- return e.docChanged ? e.steps.some((e) => {
1155
- let t = e.slice;
1156
- if (!t?.content) return !1;
1157
- let n = t.content.textBetween(0, t.content.size, "\n");
1158
- return /\s/.test(n);
1159
- }) : !1;
1160
- }
1161
- function Bt(e) {
1162
- return () => {
1163
- let t = e.state.selection.$anchor.pos, { top: n, right: r, bottom: i, left: a } = e.view.coordsAtPos(t);
1164
- try {
1165
- return new DOMRect(a, n, r - a, i - n);
1166
- } catch {
1167
- return null;
1168
- }
1169
- };
1170
- }
1171
- function Vt(e, t, n, r) {
1172
- return n ? () => {
1173
- let n = r.getState(e.state)?.decorationId;
1174
- return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect() || null;
1175
- } : Bt(e);
1176
- }
1177
- function Ht({ match: e, dismissedRange: t, state: n, transaction: r, editor: i, shouldResetDismissed: a, effectiveAllowSpaces: o }) {
1178
- return a?.({
1179
- editor: i,
1180
- state: n,
1181
- range: t,
1182
- match: e,
1183
- transaction: r,
1184
- allowSpaces: o
1185
- }) ? !1 : o ? e.range.from === t.from : e.range.from === t.from && !zt(r);
1186
- }
1187
- function Ut({ view: e, pluginKeyRef: t }) {
1188
- let n = e.state.tr.setMeta(t, { exit: !0 });
1189
- e.dispatch(n);
1190
- }
1191
- function Wt({ pluginKey: e, decorationTag: t, decorationClass: n, decorationContent: r, decorationEmptyClass: i, renderer: a, dispatchExit: o }) {
1192
- return {
1193
- handleKeyDown(t, n) {
1194
- var r;
1195
- let i = e.getState(t.state);
1196
- return i.active ? n.key === "Escape" || n.key === "Esc" ? ((r = a?.onKeyDown) == null || r.call(a, {
1197
- view: t,
1198
- event: n,
1199
- range: i.range
1200
- }), o(t), !0) : (a?.onKeyDown)?.call(a, {
1201
- view: t,
1202
- event: n,
1203
- range: i.range
1204
- }) || !1 : !1;
1205
- },
1206
- decorations(a) {
1207
- let { active: o, range: s, decorationId: c, query: l } = e.getState(a);
1208
- if (!o) return null;
1209
- let u = !l?.length, d = [n];
1210
- return u && d.push(i), ie.create(a.doc, [ne.inline(s.from, s.to, {
1211
- nodeName: t,
1212
- class: d.join(" "),
1213
- "data-decoration-id": c || void 0,
1214
- "data-decoration-content": r
1215
- })]);
1216
- }
1217
- };
1218
- }
1219
- function Gt({ editor: e, char: t, effectiveAllowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, findSuggestionMatch: o, allow: s, shouldShow: c, shouldKeepDismissed: l, pluginKey: u }) {
1220
- return {
1221
- init() {
1222
- return {
1223
- active: !1,
1224
- range: {
1225
- from: 0,
1226
- to: 0
1227
- },
1228
- query: null,
1229
- text: null,
1230
- composing: !1,
1231
- dismissedRange: null
1232
- };
1233
- },
1234
- apply(d, f, p, m) {
1235
- let { isEditable: h } = e, { composing: g } = e.view, { selection: _ } = d, { empty: v, from: y } = _, b = { ...f }, x = d.getMeta(u);
1236
- if (x && x.exit) return b.active = !1, b.decorationId = null, b.range = {
1237
- from: 0,
1238
- to: 0
1239
- }, b.query = null, b.text = null, b.dismissedRange = f.active ? { ...f.range } : f.dismissedRange, b;
1240
- if (b.composing = g, d.docChanged && b.dismissedRange !== null && (b.dismissedRange = {
1241
- from: d.mapping.map(b.dismissedRange.from),
1242
- to: d.mapping.map(b.dismissedRange.to)
1243
- }), h && (v || e.view.composing)) {
1244
- (y < f.range.from || y > f.range.to) && !g && !f.composing && (b.active = !1);
1245
- let u = o({
1246
- char: t,
1247
- allowSpaces: n,
1248
- allowToIncludeChar: r,
1249
- allowedPrefixes: i,
1250
- startOfLine: a,
1251
- $position: _.$from
1252
- }), p = `id_${Math.floor(Math.random() * 4294967295)}`;
1253
- u && s({
1254
- editor: e,
1255
- state: m,
1256
- range: u.range,
1257
- isActive: f.active
1258
- }) && (!c || c({
1259
- editor: e,
1260
- range: u.range,
1261
- query: u.query,
1262
- text: u.text,
1263
- transaction: d
1264
- })) ? (b.dismissedRange !== null && !l({
1265
- match: u,
1266
- dismissedRange: b.dismissedRange,
1267
- state: m,
1268
- transaction: d
1269
- }) && (b.dismissedRange = null), b.dismissedRange === null ? (b.active = !0, b.decorationId = f.decorationId || p, b.range = u.range, b.query = u.query, b.text = u.text) : b.active = !1) : (u || (b.dismissedRange = null), b.active = !1);
1270
- } else b.active = !1;
1271
- return b.active || (b.decorationId = null, b.range = {
1272
- from: 0,
1273
- to: 0
1274
- }, b.query = null, b.text = null), b;
1275
- }
1276
- };
1277
- }
1278
- function Kt({ editor: e, items: t }) {
1279
- let n = null, r = null, i = null, a = () => {
1280
- r !== null && (clearTimeout(r), r = null), i?.(), i = null;
1281
- }, o = (e) => new Promise((t) => {
1282
- i = t, r = setTimeout(() => {
1283
- r = null;
1284
- let e = i;
1285
- i = null, e?.();
1286
- }, e);
1287
- }), s = () => {
1288
- n?.abort(), a(), n = null;
1289
- };
1290
- return {
1291
- abort: s,
1292
- fetch: async (r, i) => {
1293
- s(), n = new AbortController();
1294
- let a = n;
1295
- if (i > 0 && await o(i), n !== a || a.signal.aborted) return { status: "aborted" };
1296
- try {
1297
- let i = await t({
1298
- editor: e,
1299
- query: r,
1300
- signal: a.signal
1301
- });
1302
- return n !== a || a.signal.aborted ? { status: "aborted" } : {
1303
- status: "resolved",
1304
- items: i
1305
- };
1306
- } catch {
1307
- return n !== a || a.signal.aborted ? { status: "aborted" } : { status: "error" };
1308
- }
1309
- }
1310
- };
1311
- }
1312
- function qt({ placement: e, offset: t, flip: n, floatingUi: r }) {
1313
- let i = [Ft({
1314
- mainAxis: t.mainAxis ?? 4,
1315
- crossAxis: t.crossAxis ?? 0
1316
- })];
1317
- return n && i.push(It()), r?.middleware?.length && i.push(...r.middleware), {
1318
- placement: e,
1319
- strategy: r?.strategy ?? "absolute",
1320
- middleware: i
1321
- };
1322
- }
1323
- function Jt(e) {
1324
- if (e instanceof HTMLElement) return e;
1325
- if (typeof e == "string") try {
1326
- let t = document.querySelector(e);
1327
- if (t) return t;
1328
- } catch {
1329
- return document.body;
1330
- }
1331
- return document.body;
1332
- }
1333
- function Yt({ getReferenceRect: e, contextElement: t, config: n, container: r, dismissOnOutsideClick: i, dismiss: a }) {
1334
- return (o, s = {}) => {
1335
- let c = {
1336
- getBoundingClientRect: () => e() ?? new DOMRect(),
1337
- contextElement: t
1338
- }, l = !1, u = !o.isConnected;
1339
- u && Jt(r).appendChild(o), s.onPosition || (o.style.visibility = "hidden", o.style.width = "max-content");
1340
- let d = Pt(c, o, () => {
1341
- Lt(c, o, {
1342
- placement: n.placement,
1343
- strategy: n.strategy,
1344
- middleware: n.middleware
1345
- }).then(({ x: e, y: t, placement: n, strategy: r }) => {
1346
- if (s.onPosition) {
1347
- s.onPosition({
1348
- x: e,
1349
- y: t,
1350
- placement: n,
1351
- strategy: r
1352
- });
1353
- return;
1354
- }
1355
- Object.assign(o.style, {
1356
- position: r,
1357
- left: `${e}px`,
1358
- top: `${t}px`
1359
- }), l || (l = !0, o.style.visibility = "");
1360
- });
1361
- }, s.autoUpdate), f;
1362
- return i && (f = (e) => {
1363
- let n = e.target;
1364
- !(n instanceof Node) || o.contains(n) || t.contains(n) || a();
1365
- }, document.addEventListener("pointerdown", f, !0)), () => {
1366
- d(), f && document.removeEventListener("pointerdown", f, !0), u && o.remove();
1367
- };
1368
- };
1369
- }
1370
- function Xt({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i, debounce: a, initialItems: o, placement: s, offset: c, container: l, flip: u, floatingUi: d, dismissOnOutsideClick: f, command: p, clientRectFor: m, dispatchExit: h }) {
1371
- let g, _ = Kt({
1372
- editor: e,
1373
- items: n
1374
- }), v = qt({
1375
- placement: s,
1376
- offset: c,
1377
- flip: u,
1378
- floatingUi: d
1379
- });
1380
- function y(e, t) {
1381
- var n, i, a;
1382
- switch (e) {
1383
- case "started":
1384
- (n = r?.onStart) == null || n.call(r, t);
1385
- break;
1386
- case "updated":
1387
- (i = r?.onUpdate) == null || i.call(r, t);
1388
- break;
1389
- case "stopped":
1390
- (a = r?.onExit) == null || a.call(r, t);
1391
- break;
1392
- default: break;
1393
- }
1394
- }
1395
- return {
1396
- update: async (n, d) => {
1397
- var b, x;
1398
- let S = t.getState(d), C = t.getState(n.state);
1399
- if (!S || !C) return;
1400
- let w = null, T = S.query !== C.query, ee = S.text !== C.text, E = S.range.from !== C.range.from || S.range.to !== C.range.to, D = T || ee || E;
1401
- if (!S.active && C.active) w = "started";
1402
- else if (S.active && !C.active) w = "stopped";
1403
- else if (C.active && D) w = "updated";
1404
- else return;
1405
- let O = w === "stopped" ? S : C, k = n.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`), A = m(n, k), j = i === 0 || (O.query ? O.query.length >= i : !1), M = (w === "started" || w === "updated") && j;
1406
- if (g = {
1407
- editor: e,
1408
- range: O.range,
1409
- query: O.query || "",
1410
- text: O.text || "",
1411
- items: o ?? [],
1412
- command: (t) => p({
1413
- editor: e,
1414
- range: O.range,
1415
- props: t
1416
- }),
1417
- decorationNode: k,
1418
- clientRect: A,
1419
- loading: M,
1420
- placement: s,
1421
- offset: {
1422
- mainAxis: c.mainAxis ?? 4,
1423
- crossAxis: c.crossAxis ?? 0
1424
- },
1425
- container: l,
1426
- flip: u,
1427
- floatingUi: v,
1428
- mount: Yt({
1429
- getReferenceRect: A,
1430
- contextElement: n.dom,
1431
- config: v,
1432
- container: l,
1433
- dismissOnOutsideClick: f,
1434
- dismiss: () => h(e.view)
1435
- })
1436
- }, w === "started" && ((b = r?.onBeforeStart) == null || b.call(r, g)), w === "updated" && ((x = r?.onBeforeUpdate) == null || x.call(r, g)), w === "started" && y(w, g), w === "started" || w === "updated") if (!M) _.abort(), g = {
1437
- ...g,
1438
- items: o ?? [],
1439
- loading: !1
1440
- };
1441
- else {
1442
- g = {
1443
- ...g,
1444
- items: o ?? [],
1445
- loading: !0
1446
- }, w = "updated", y(w, g);
1447
- let e = await _.fetch(O.query || "", a);
1448
- if (e.status === "aborted") return;
1449
- if (!t.getState(n.state)?.active) {
1450
- _.abort();
1451
- return;
1452
- }
1453
- g = e.status === "resolved" ? {
1454
- ...g,
1455
- items: e.items,
1456
- loading: !1
1457
- } : {
1458
- ...g,
1459
- loading: !1
1460
- };
1461
- }
1462
- if (w === "stopped") {
1463
- _.abort(), y(w, g), g = void 0;
1464
- return;
1465
- }
1466
- w === "updated" && y(w, g);
1467
- },
1468
- destroy: () => {
1469
- var e;
1470
- _.abort(), g && ((e = r?.onExit) == null || e.call(r, g));
1471
- }
1472
- };
1473
- }
1474
- var Zt = new O("suggestion");
1475
- function Qt({ pluginKey: e = Zt, editor: t, char: n = "@", allowSpaces: r = !1, allowToIncludeChar: i = !1, allowedPrefixes: a = [" "], startOfLine: o = !1, decorationTag: s = "span", decorationClass: c = "suggestion", decorationContent: l = "", decorationEmptyClass: u = "is-empty", command: d = () => null, items: f = () => [], minQueryLength: p = 0, debounce: m = 0, initialItems: h, placement: g = "bottom-start", offset: _ = {}, container: v, flip: y = !0, floatingUi: b, dismissOnOutsideClick: x = !0, render: S = () => ({}), allow: C = () => !0, findSuggestionMatch: w = Rt, shouldShow: T, shouldResetDismissed: ee }) {
1476
- let E = S?.(), D = r && !i, O = (n, r) => Vt(t, n, r, e);
1477
- function k(e) {
1478
- return Ht({
1479
- ...e,
1480
- editor: t,
1481
- shouldResetDismissed: ee,
1482
- effectiveAllowSpaces: D
1483
- });
1484
- }
1485
- let A = (t) => Ut({
1486
- view: t,
1487
- pluginKeyRef: e
1488
- });
1489
- return new re({
1490
- key: e,
1491
- view: () => Xt({
1492
- editor: t,
1493
- pluginKey: e,
1494
- items: f,
1495
- renderer: E,
1496
- minQueryLength: p,
1497
- debounce: m,
1498
- initialItems: h,
1499
- placement: g,
1500
- offset: _,
1501
- container: v,
1502
- flip: y,
1503
- floatingUi: b,
1504
- dismissOnOutsideClick: x,
1505
- command: d,
1506
- clientRectFor: O,
1507
- dispatchExit: A
1508
- }),
1509
- state: Gt({
1510
- editor: t,
1511
- char: n,
1512
- effectiveAllowSpaces: D,
1513
- allowToIncludeChar: i,
1514
- allowedPrefixes: a,
1515
- startOfLine: o,
1516
- findSuggestionMatch: w,
1517
- allow: C,
1518
- shouldShow: T,
1519
- shouldKeepDismissed: k,
1520
- pluginKey: e
1521
- }),
1522
- props: Wt({
1523
- pluginKey: e,
1524
- decorationTag: s,
1525
- decorationClass: c,
1526
- decorationContent: l,
1527
- decorationEmptyClass: u,
1528
- renderer: E,
1529
- dispatchExit: A
1530
- })
1531
- });
1532
- }
1533
- var $t = Qt, en = ["id"], tn = {
1534
- key: 0,
1535
- class: "tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]",
1536
- "data-testid": "merge-tag-suggestion-empty"
1537
- }, nn = [
1538
- "id",
1539
- "aria-selected",
1540
- "data-selected",
1541
- "data-merge-tag-value",
1542
- "onMousedown",
1543
- "onMousemove"
1544
- ], rn = { class: "tpl:font-medium" }, an = { class: "tpl:text-[var(--tpl-text-dim)] tpl:font-mono" }, on = /* @__PURE__ */ c({
1545
- __name: "MergeTagSuggestionList",
1546
- props: {
1547
- items: {},
1548
- selectedIndex: {},
1549
- emptyText: {},
1550
- listId: {}
1551
- },
1552
- emits: ["select", "hover"],
1553
- setup(t) {
1554
- let n = t;
1555
- function i(e) {
1556
- return n.listId ? `${n.listId}-opt-${e}` : void 0;
1557
- }
1558
- return (n, a) => (e(), f("div", {
1559
- id: t.listId,
1560
- class: "tpl:min-w-[200px] tpl:max-w-[320px] tpl:max-h-[50vh] tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:py-1 tpl:shadow-lg",
1561
- role: "listbox",
1562
- "data-testid": "merge-tag-suggestion-list"
1563
- }, [t.items.length === 0 ? (e(), f("div", tn, b(t.emptyText), 1)) : m("", !0), (e(!0), f(p, null, r(t.items, (r, a) => (e(), f("button", {
1564
- key: r.value,
1565
- id: i(a),
1566
- type: "button",
1567
- role: "option",
1568
- "aria-selected": a === t.selectedIndex,
1569
- "data-selected": a === t.selectedIndex ? "true" : "false",
1570
- "data-merge-tag-value": r.value,
1571
- class: s(["tpl:flex tpl:w-full tpl:flex-col tpl:items-start tpl:gap-0.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors", a === t.selectedIndex ? "tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]" : "tpl:text-[var(--tpl-text)] hover:tpl:bg-[var(--tpl-bg-hover)]"]),
1572
- onMousedown: l((e) => n.$emit("select", r), ["prevent", "stop"]),
1573
- onMousemove: (e) => a !== t.selectedIndex && n.$emit("hover", a)
1574
- }, [d("span", rn, b(r.label), 1), d("span", an, b(r.value), 1)], 42, nn))), 128))], 8, en));
1575
- }
1576
- }), sn = 10, cn = 0;
1577
- function ln(e, t) {
1578
- let n = t.trim().toLowerCase();
1579
- return n === "" ? e.slice(0, sn) : e.filter((e) => {
1580
- let t = e.label.toLowerCase(), r = e.value.toLowerCase();
1581
- return t.includes(n) || r.includes(n);
1582
- }).slice(0, sn);
1583
- }
1584
- function un(e, t, n, r) {
1585
- return t.length === 0 ? e.key === "Enter" || e.key === "Tab" : e.key === "ArrowDown" ? (n.value = (n.value + 1) % t.length, !0) : e.key === "ArrowUp" ? (n.value = (n.value - 1 + t.length) % t.length, !0) : e.key === "Enter" || e.key === "Tab" ? (r(t[n.value]), !0) : !1;
1586
- }
1587
- function dn(e, t) {
1588
- return () => {
1589
- let n = null, r = null, o = null, s = a([]), c = a(0), l = null, u = `tpl-merge-tag-suggestion-${++cn}`, d = null, f = [], p = null;
1590
- function m() {
1591
- b(d?.() ?? null);
1592
- }
1593
- function g() {
1594
- m(), p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1595
- p = null, m();
1596
- });
1597
- }
1598
- function _(e) {
1599
- let t = [], n = e?.parentElement ?? null;
1600
- for (; n && n !== document.body && n !== document.documentElement;) {
1601
- let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
1602
- /(auto|scroll|overlay)/.test(r) && t.push(n), n = n.parentElement;
1603
- }
1604
- return t;
1605
- }
1606
- function v(e) {
1607
- f = [window, ..._(e)];
1608
- for (let e of f) e.addEventListener("scroll", m, {
1609
- passive: !0,
1610
- capture: !0
1611
- });
1612
- window.addEventListener("resize", m, { passive: !0 });
1613
- }
1614
- function y() {
1615
- for (let e of f) e.removeEventListener("scroll", m, { capture: !0 });
1616
- window.removeEventListener("resize", m), f = [];
1617
- }
1618
- function b(e) {
1619
- if (!r || !e || e.bottom < 0 || e.top > window.innerHeight) return;
1620
- r.style.position = "fixed", r.style.left = `${e.left}px`, r.style.zIndex = "9999", r.style.top = `${e.bottom}px`;
1621
- let t = r.offsetHeight;
1622
- if (t !== 0 && window.innerHeight - e.bottom < t) {
1623
- let n = Math.max(0, e.top - t);
1624
- r.style.top = `${n}px`;
1625
- }
1626
- }
1627
- function x(e, t) {
1628
- let n = t?.closest("[data-tpl-theme]");
1629
- if (!n) return;
1630
- let r = n.getAttribute("data-tpl-theme");
1631
- r && e.setAttribute("data-tpl-theme", r);
1632
- let i = window.getComputedStyle(n);
1633
- for (let t = 0; t < i.length; t++) {
1634
- let n = i[t];
1635
- n.startsWith("--tpl-") && e.style.setProperty(n, i.getPropertyValue(n));
1636
- }
1637
- e.style.fontFamily = i.fontFamily, e.style.fontSize = i.fontSize, e.style.lineHeight = i.lineHeight;
1638
- }
1639
- function S(e) {
1640
- o && (e ? (o.setAttribute("role", "combobox"), o.setAttribute("aria-haspopup", "listbox"), o.setAttribute("aria-expanded", "true"), o.setAttribute("aria-controls", u)) : (o.removeAttribute("aria-expanded"), o.removeAttribute("aria-controls"), o.removeAttribute("aria-activedescendant"), o.removeAttribute("aria-haspopup"), o.removeAttribute("role")));
1641
- }
1642
- function C() {
1643
- if (o) {
1644
- if (s.value.length === 0) {
1645
- o.removeAttribute("aria-activedescendant");
1646
- return;
1647
- }
1648
- o.setAttribute("aria-activedescendant", `${u}-opt-${c.value}`);
1649
- }
1650
- }
1651
- function w(e) {
1652
- l?.(e);
1653
- }
1654
- return {
1655
- onStart: (a) => {
1656
- s.value = a.items, c.value = 0, l = (e) => a.command(e), r = document.createElement("div"), r.setAttribute("data-testid", "merge-tag-suggestion-popup");
1657
- let f = a.editor.view?.dom;
1658
- o = f ?? null, x(r, f ?? null), (t?.value ?? document.body).appendChild(r), n = h({ render() {
1659
- return i(on, {
1660
- items: s.value,
1661
- selectedIndex: c.value,
1662
- emptyText: e,
1663
- listId: u,
1664
- onSelect: (e) => w(e),
1665
- onHover: (e) => {
1666
- c.value = e, C();
1667
- }
1668
- });
1669
- } }), n.mount(r), S(!0), C(), d = a.clientRect ?? null, g(), v(f ?? null);
1670
- },
1671
- onUpdate: (e) => {
1672
- s.value = e.items, c.value >= e.items.length && (c.value = 0), l = (t) => e.command(t), C(), d = e.clientRect ?? null, g();
1673
- },
1674
- onKeyDown: (e) => {
1675
- if (e.event.key === "Escape") return !0;
1676
- let t = un(e.event, s.value, c, w);
1677
- return t && C(), t;
1678
- },
1679
- onExit: () => {
1680
- p !== null && (cancelAnimationFrame(p), p = null), y(), S(!1), n?.unmount(), r?.remove(), n = null, r = null, o = null, l = null, d = null;
1681
- }
1682
- };
1683
- };
1684
- }
1685
- var fn = k.create({
1686
- name: "mergeTagSuggestion",
1687
- addOptions() {
1688
- return {
1689
- mergeTags: [],
1690
- char: "{{",
1691
- emptyText: "No matching merge tags",
1692
- popoverRoot: null
1693
- };
1694
- },
1695
- addProseMirrorPlugins() {
1696
- let e = this.options.mergeTags, t = this.options.emptyText, n = this.options.popoverRoot, r = {
1697
- char: this.options.char,
1698
- allowSpaces: !1,
1699
- startOfLine: !1,
1700
- allowedPrefixes: null,
1701
- items: ({ query: t }) => ln(e, t),
1702
- command: ({ editor: e, range: t, props: n }) => {
1703
- e.chain().focus().insertContentAt(t, {
1704
- type: "mergeTagNode",
1705
- attrs: {
1706
- label: n.label,
1707
- value: n.value
1708
- }
1709
- }).run();
1710
- },
1711
- render: dn(t, n)
1712
- };
1713
- return [$t({
1714
- editor: this.editor,
1715
- ...r
1716
- })];
1717
- }
1718
- });
1719
- //#endregion
1720
- export { se as FontSize, ce as LetterSpacing, le as LineHeight, he as LogicMergeTagNode, ye as MergeTagNode, fn as MergeTagSuggestion, ln as filterMergeTags, un as handleSuggestionKeyDown };