@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,956 @@
1
+ const S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding="true"]', ot = "rte-data-binding-styles", p = "rte-data-binding-dialog-overlay", b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pt = {
2
+ dialogTitleInsert: "Insert Data Binding",
3
+ dialogTitleEdit: "Edit Data Binding",
4
+ keyLabel: "Data Key",
5
+ keyPlaceholder: "user.firstName",
6
+ fallbackLabel: "Fallback Text",
7
+ fallbackPlaceholder: "Guest",
8
+ formatLabel: "Format",
9
+ currencyLabel: "Currency",
10
+ currencyPlaceholder: "USD",
11
+ saveText: "Save",
12
+ cancelText: "Cancel",
13
+ previewOnText: "Preview On",
14
+ previewOffText: "Preview Off",
15
+ tokenAriaPrefix: "Data binding token"
16
+ }, v = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
17
+ let K = null, k = null, z = 0, O = null, M = null, B = null, V = null;
18
+ function yt(t) {
19
+ return {
20
+ ...pt,
21
+ ...t || {}
22
+ };
23
+ }
24
+ function dt(t = {}) {
25
+ var e;
26
+ const a = (t.locale || (typeof navigator != "undefined" ? navigator.language : "en-US")).trim() || "en-US";
27
+ return {
28
+ data: t.data,
29
+ getData: t.getData,
30
+ api: t.api,
31
+ cacheTtlMs: Math.max(0, Number((e = t.cacheTtlMs) != null ? e : 3e4)),
32
+ labels: yt(t.labels),
33
+ defaultFormat: t.defaultFormat || "text",
34
+ defaultFallback: t.defaultFallback || "",
35
+ locale: a,
36
+ numberFormatOptions: t.numberFormatOptions || {},
37
+ dateFormatOptions: t.dateFormatOptions || { year: "numeric", month: "short", day: "2-digit" }
38
+ };
39
+ }
40
+ function h(t) {
41
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
42
+ }
43
+ function lt(t) {
44
+ return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
45
+ }
46
+ function q(t) {
47
+ return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
48
+ }
49
+ function _(t) {
50
+ return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
51
+ }
52
+ function ht(t) {
53
+ const a = q(t);
54
+ if (_(a))
55
+ return !0;
56
+ const e = a.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
57
+ return _(e) ? !0 : _(document.documentElement) || _(document.body);
58
+ }
59
+ function A(t, a = !0) {
60
+ if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
61
+ return t.contentElement;
62
+ if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
63
+ const n = t.editorElement;
64
+ if (n.matches(S))
65
+ return n;
66
+ const i = n.querySelector(S);
67
+ if (i instanceof HTMLElement)
68
+ return i;
69
+ }
70
+ const e = window.getSelection();
71
+ if (e && e.rangeCount > 0) {
72
+ const n = e.getRangeAt(0).startContainer, i = lt(n), o = i == null ? void 0 : i.closest(S);
73
+ if (o)
74
+ return o;
75
+ }
76
+ const r = document.activeElement;
77
+ if (r) {
78
+ if (r.matches(S))
79
+ return r;
80
+ const n = r.closest(S);
81
+ if (n)
82
+ return n;
83
+ }
84
+ return k && k.isConnected ? k : a ? document.querySelector(S) : null;
85
+ }
86
+ function H(t) {
87
+ return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
88
+ }
89
+ function st(t) {
90
+ const a = window.getSelection();
91
+ if (!a || a.rangeCount === 0)
92
+ return null;
93
+ const e = a.getRangeAt(0);
94
+ return t.contains(e.commonAncestorContainer) ? e.cloneRange() : null;
95
+ }
96
+ function ct(t, a) {
97
+ const e = window.getSelection();
98
+ e && (e.removeAllRanges(), e.addRange(a), t.focus({ preventScroll: !0 }));
99
+ }
100
+ function kt(t, a) {
101
+ const e = (a || "").trim();
102
+ if (e)
103
+ return e.split(".").filter(Boolean).reduce((r, n) => {
104
+ if (!(r == null || typeof r != "object"))
105
+ return r[n];
106
+ }, t);
107
+ }
108
+ function vt() {
109
+ if (typeof document == "undefined" || document.getElementById(ot))
110
+ return;
111
+ const t = document.createElement("style");
112
+ t.id = ot, t.textContent = `
113
+ .rte-data-binding {
114
+ display: inline-flex;
115
+ align-items: center;
116
+ max-width: 100%;
117
+ gap: 5px;
118
+ padding: 2px 8px 2px 7px;
119
+ border-radius: 999px;
120
+ border: 1px dashed #8b5cf6;
121
+ background: linear-gradient(180deg, #f9f7ff 0%, #f1edff 100%);
122
+ color: #4c1d95;
123
+ font-size: 0.88em;
124
+ font-weight: 600;
125
+ line-height: 1.3;
126
+ vertical-align: baseline;
127
+ white-space: nowrap;
128
+ overflow: hidden;
129
+ text-overflow: ellipsis;
130
+ user-select: all;
131
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
132
+ cursor: pointer;
133
+ }
134
+
135
+ .rte-data-binding::before {
136
+ content: '{}';
137
+ display: inline-flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ min-width: 14px;
141
+ height: 14px;
142
+ border-radius: 999px;
143
+ background: rgba(139, 92, 246, 0.16);
144
+ color: #5b21b6;
145
+ font-size: 10px;
146
+ font-weight: 700;
147
+ line-height: 1;
148
+ letter-spacing: -0.2px;
149
+ flex: 0 0 auto;
150
+ }
151
+
152
+ .rte-data-binding.rte-data-binding-preview {
153
+ border-style: solid;
154
+ background: #ecfdf5;
155
+ border-color: #34d399;
156
+ color: #065f46;
157
+ user-select: text;
158
+ }
159
+
160
+ .rte-data-binding.rte-data-binding-preview::before {
161
+ content: '=';
162
+ background: rgba(16, 185, 129, 0.15);
163
+ color: #047857;
164
+ letter-spacing: 0;
165
+ }
166
+
167
+ .rte-data-binding.rte-data-binding-missing {
168
+ border-style: dashed;
169
+ border-color: #f87171;
170
+ background: #fef2f2;
171
+ color: #991b1b;
172
+ }
173
+
174
+ .rte-data-binding-dialog-overlay {
175
+ position: fixed;
176
+ inset: 0;
177
+ z-index: 2147483646;
178
+ background: rgba(15, 23, 42, 0.54);
179
+ display: flex;
180
+ align-items: center;
181
+ justify-content: center;
182
+ padding: 20px;
183
+ }
184
+
185
+ .rte-data-binding-dialog {
186
+ width: min(560px, 96vw);
187
+ max-height: min(86vh, 720px);
188
+ border: 1px solid #dbe3ec;
189
+ border-radius: 8px;
190
+ background: #ffffff;
191
+ box-shadow: 0 24px 50px rgba(15, 23, 42, 0.26);
192
+ display: flex;
193
+ flex-direction: column;
194
+ overflow: hidden;
195
+ }
196
+
197
+ .rte-data-binding-header,
198
+ .rte-data-binding-footer {
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: space-between;
202
+ gap: 10px;
203
+ padding: 12px 14px;
204
+ background: #f8fafc;
205
+ border-bottom: 1px solid #e2e8f0;
206
+ }
207
+
208
+ .rte-data-binding-footer {
209
+ justify-content: flex-end;
210
+ border-bottom: 0;
211
+ border-top: 1px solid #e2e8f0;
212
+ }
213
+
214
+ .rte-data-binding-title {
215
+ margin: 0;
216
+ font-size: 16px;
217
+ font-weight: 700;
218
+ color: #0f172a;
219
+ }
220
+
221
+ .rte-data-binding-body {
222
+ padding: 14px;
223
+ overflow: auto;
224
+ display: grid;
225
+ gap: 12px;
226
+ grid-template-columns: 1fr;
227
+ }
228
+
229
+ .rte-data-binding-field {
230
+ display: grid;
231
+ gap: 6px;
232
+ }
233
+
234
+ .rte-data-binding-field label {
235
+ font-size: 12px;
236
+ font-weight: 600;
237
+ color: #334155;
238
+ }
239
+
240
+ .rte-data-binding-field input,
241
+ .rte-data-binding-field select {
242
+ width: 100%;
243
+ min-height: 36px;
244
+ border: 1px solid #cbd5e1;
245
+ border-radius: 6px;
246
+ padding: 8px 10px;
247
+ font-size: 13px;
248
+ line-height: 1.4;
249
+ color: #0f172a;
250
+ background: #ffffff;
251
+ box-sizing: border-box;
252
+ }
253
+
254
+ .rte-data-binding-help {
255
+ margin: 0;
256
+ font-size: 12px;
257
+ color: #64748b;
258
+ }
259
+
260
+ .rte-data-binding-btn {
261
+ border: 1px solid #cbd5e1;
262
+ border-radius: 6px;
263
+ min-height: 34px;
264
+ padding: 6px 12px;
265
+ background: #ffffff;
266
+ color: #0f172a;
267
+ font-size: 13px;
268
+ cursor: pointer;
269
+ }
270
+
271
+ .rte-data-binding-btn-primary {
272
+ background: #2563eb;
273
+ border-color: #2563eb;
274
+ color: #ffffff;
275
+ }
276
+
277
+ .rte-data-binding-btn-primary:hover {
278
+ background: #1d4ed8;
279
+ }
280
+
281
+ .rte-toolbar-group-items.data-binding,
282
+ .editora-toolbar-group-items.data-binding {
283
+ display: flex;
284
+ border: 1px solid #cbd5e1;
285
+ border-radius: 6px;
286
+ overflow: hidden;
287
+ background: #ffffff;
288
+ }
289
+
290
+ .rte-toolbar-group-items.data-binding .rte-toolbar-item,
291
+ .editora-toolbar-group-items.data-binding .editora-toolbar-item {
292
+ display: flex;
293
+ }
294
+
295
+ .rte-toolbar-group-items.data-binding .rte-toolbar-button,
296
+ .editora-toolbar-group-items.data-binding .editora-toolbar-button {
297
+ border: 0;
298
+ border-radius: 0;
299
+ border-right: 1px solid #cbd5e1;
300
+ }
301
+
302
+ .rte-toolbar-group-items.data-binding .rte-toolbar-item:last-child .rte-toolbar-button,
303
+ .editora-toolbar-group-items.data-binding .editora-toolbar-item:last-child .editora-toolbar-button {
304
+ border-right: 0;
305
+ }
306
+
307
+ .rte-data-binding-btn:focus-visible,
308
+ .rte-data-binding-field input:focus-visible,
309
+ .rte-data-binding-field select:focus-visible {
310
+ outline: none;
311
+ border-color: #3b82f6;
312
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
313
+ }
314
+
315
+ ${b} .rte-data-binding,
316
+ .${p}.rte-data-binding-theme-dark .rte-data-binding {
317
+ background: linear-gradient(180deg, #3b0764 0%, #2e1065 100%);
318
+ border-color: #a78bfa;
319
+ color: #ede9fe;
320
+ }
321
+
322
+ ${b} .rte-data-binding::before,
323
+ .${p}.rte-data-binding-theme-dark .rte-data-binding::before {
324
+ background: rgba(167, 139, 250, 0.22);
325
+ color: #ddd6fe;
326
+ }
327
+
328
+ ${b} .rte-data-binding.rte-data-binding-preview,
329
+ .${p}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-preview {
330
+ background: #064e3b;
331
+ border-color: #10b981;
332
+ color: #d1fae5;
333
+ }
334
+
335
+ ${b} .rte-data-binding.rte-data-binding-missing,
336
+ .${p}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-missing {
337
+ background: #7f1d1d;
338
+ border-color: #ef4444;
339
+ color: #fee2e2;
340
+ }
341
+
342
+ ${b} .rte-toolbar-group-items.data-binding,
343
+ ${b} .editora-toolbar-group-items.data-binding {
344
+ display: flex;
345
+ border: 1px solid #566275;
346
+ border-radius: 6px;
347
+ overflow: hidden;
348
+ }
349
+
350
+ ${b} .rte-toolbar-group-items.data-binding .rte-toolbar-button,
351
+ ${b} .editora-toolbar-group-items.data-binding .editora-toolbar-button {
352
+ border-right-color: #566275;
353
+ }
354
+
355
+ ${b} .rte-data-binding-dialog,
356
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-dialog {
357
+ background: #1f2937;
358
+ border-color: #334155;
359
+ }
360
+
361
+ ${b} .rte-data-binding-header,
362
+ ${b} .rte-data-binding-footer,
363
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-header,
364
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-footer {
365
+ background: #111827;
366
+ border-color: #334155;
367
+ }
368
+
369
+ ${b} .rte-data-binding-title,
370
+ ${b} .rte-data-binding-field label,
371
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-title,
372
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-field label {
373
+ color: #e2e8f0;
374
+ }
375
+
376
+ ${b} .rte-data-binding-help,
377
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-help {
378
+ color: #94a3b8;
379
+ }
380
+
381
+ ${b} .rte-data-binding-field input,
382
+ ${b} .rte-data-binding-field select,
383
+ ${b} .rte-data-binding-btn,
384
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-field input,
385
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-field select,
386
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-btn {
387
+ background: #0f172a;
388
+ border-color: #475569;
389
+ color: #e2e8f0;
390
+ }
391
+
392
+ ${b} .rte-data-binding-btn-primary,
393
+ .${p}.rte-data-binding-theme-dark .rte-data-binding-btn-primary {
394
+ background: #2563eb;
395
+ border-color: #2563eb;
396
+ color: #ffffff;
397
+ }
398
+ `, document.head.appendChild(t);
399
+ }
400
+ function Y(t) {
401
+ t.dispatchEvent(new Event("input", { bubbles: !0 }));
402
+ }
403
+ function Q(t, a) {
404
+ if (a === t.innerHTML)
405
+ return;
406
+ const e = window.execEditorCommand || window.executeEditorCommand;
407
+ if (typeof e == "function")
408
+ try {
409
+ e("recordDomTransaction", t, a, t.innerHTML);
410
+ } catch (r) {
411
+ }
412
+ }
413
+ function j(t, a) {
414
+ var e, r;
415
+ return {
416
+ key: String(t.key || "").trim(),
417
+ fallback: String((r = (e = t.fallback) != null ? e : a.defaultFallback) != null ? r : ""),
418
+ format: t.format || a.defaultFormat || "text",
419
+ currency: String(t.currency || "USD").trim().toUpperCase() || "USD"
420
+ };
421
+ }
422
+ function ut(t) {
423
+ return `{{${t.key}}}`;
424
+ }
425
+ function ft(t, a) {
426
+ const e = document.createElement("span");
427
+ return e.className = "rte-data-binding", e.setAttribute("data-binding", "true"), e.setAttribute("data-binding-key", t.key), e.setAttribute("data-binding-fallback", t.fallback || ""), e.setAttribute("data-binding-format", t.format || "text"), e.setAttribute("data-binding-currency", t.currency || "USD"), e.setAttribute("contenteditable", "false"), e.setAttribute("spellcheck", "false"), e.setAttribute("draggable", "false"), e.setAttribute("tabindex", "0"), e.setAttribute("role", "button"), e.setAttribute("aria-label", `${a.tokenAriaPrefix}: ${t.key}. Press Enter to edit.`), e.textContent = ut(t), e;
428
+ }
429
+ function W(t, a) {
430
+ return j(
431
+ {
432
+ key: t.getAttribute("data-binding-key") || "",
433
+ fallback: t.getAttribute("data-binding-fallback") || a.defaultFallback,
434
+ format: t.getAttribute("data-binding-format") || a.defaultFormat,
435
+ currency: t.getAttribute("data-binding-currency") || "USD"
436
+ },
437
+ a
438
+ );
439
+ }
440
+ function tt(t, a, e) {
441
+ t.classList.add("rte-data-binding"), t.setAttribute("data-binding", "true"), t.setAttribute("data-binding-key", a.key), t.setAttribute("data-binding-fallback", a.fallback || ""), t.setAttribute("data-binding-format", a.format || "text"), t.setAttribute("data-binding-currency", a.currency || "USD"), t.setAttribute("contenteditable", "false"), t.setAttribute("spellcheck", "false"), t.setAttribute("draggable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "button"), t.setAttribute("aria-label", `${e.tokenAriaPrefix}: ${a.key}. Press Enter to edit.`);
442
+ }
443
+ function G(t, a) {
444
+ const e = Array.from(t.querySelectorAll(P));
445
+ return e.forEach((r) => {
446
+ const n = W(r, a);
447
+ tt(r, n, a.labels);
448
+ }), e;
449
+ }
450
+ function X(t) {
451
+ const a = window.getSelection();
452
+ if (a && a.rangeCount > 0) {
453
+ const n = a.getRangeAt(0).startContainer, i = lt(n), o = i == null ? void 0 : i.closest(P);
454
+ if (o && t.contains(o))
455
+ return o;
456
+ }
457
+ const e = document.activeElement, r = e == null ? void 0 : e.closest(P);
458
+ return r && t.contains(r) ? r : null;
459
+ }
460
+ function bt() {
461
+ K && (K.cleanup(), K = null);
462
+ }
463
+ function et(t, a, e) {
464
+ const r = q(t);
465
+ Array.from(r.querySelectorAll('[data-command="toggleDataBindingPreview"]')).forEach((i) => {
466
+ if (i.setAttribute("data-active", a ? "true" : "false"), i.classList.toggle("active", a), i.setAttribute("aria-pressed", a ? "true" : "false"), e) {
467
+ const o = a ? e.labels.previewOnText : e.labels.previewOffText;
468
+ i.setAttribute("title", o), i.setAttribute("aria-label", o);
469
+ }
470
+ });
471
+ }
472
+ function xt(t, a, e) {
473
+ const r = a.format || "text";
474
+ if (t == null)
475
+ return a.fallback || "";
476
+ if (r === "json") {
477
+ if (typeof t == "string")
478
+ return t;
479
+ try {
480
+ return JSON.stringify(t);
481
+ } catch (n) {
482
+ return String(t);
483
+ }
484
+ }
485
+ if (r === "date") {
486
+ const n = t instanceof Date ? t : new Date(String(t));
487
+ if (Number.isNaN(n.getTime()))
488
+ return String(t);
489
+ try {
490
+ return new Intl.DateTimeFormat(e.locale, e.dateFormatOptions).format(n);
491
+ } catch (i) {
492
+ return n.toISOString();
493
+ }
494
+ }
495
+ if (r === "number" || r === "currency") {
496
+ const n = typeof t == "number" ? t : Number(t);
497
+ if (!Number.isFinite(n))
498
+ return String(t);
499
+ const i = { ...e.numberFormatOptions };
500
+ if (r === "currency") {
501
+ const o = (a.currency || "USD").toUpperCase();
502
+ Object.assign(i, { style: "currency", currency: o });
503
+ }
504
+ try {
505
+ return new Intl.NumberFormat(e.locale, i).format(n);
506
+ } catch (o) {
507
+ return String(n);
508
+ }
509
+ }
510
+ return String(t);
511
+ }
512
+ function C(t, a, e, r) {
513
+ const n = W(t, a), i = n.key;
514
+ if (t.classList.remove("rte-data-binding-preview", "rte-data-binding-missing"), !e) {
515
+ t.textContent = ut(n), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i}. Press Enter to edit.`);
516
+ return;
517
+ }
518
+ const o = kt(r, i), l = o == null, d = l ? n.fallback || "" : xt(o, n, a);
519
+ t.textContent = d || n.fallback || "", t.classList.add("rte-data-binding-preview"), l && !(n.fallback || "").trim() && t.classList.add("rte-data-binding-missing"), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i} = ${t.textContent || ""}. Press Enter to edit.`);
520
+ }
521
+ function w(t) {
522
+ return typeof t == "object" && t !== null && !Array.isArray(t);
523
+ }
524
+ function wt(t, a) {
525
+ return a ? a.split(".").filter(Boolean).reduce((e, r) => {
526
+ if (!(!w(e) && !Array.isArray(e)))
527
+ return e[r];
528
+ }, t) : t;
529
+ }
530
+ function Et(t, a, e) {
531
+ const r = a.api, n = q(t), i = { editor: t, editorRoot: n, signal: e };
532
+ if (r.buildRequest) {
533
+ const m = r.buildRequest(i);
534
+ return { url: m.url, init: { ...m.init || {}, signal: e } };
535
+ }
536
+ const o = (r.method || "GET").toUpperCase(), l = typeof r.headers == "function" ? r.headers(i) : r.headers || {}, d = typeof r.params == "function" ? r.params(i) : r.params, u = new URL(r.url, window.location.origin);
537
+ d && Object.entries(d).forEach(([m, f]) => {
538
+ f != null && u.searchParams.set(m, String(f));
539
+ });
540
+ const s = {
541
+ method: o,
542
+ headers: { ...l },
543
+ credentials: r.credentials,
544
+ mode: r.mode,
545
+ cache: r.cache,
546
+ signal: e
547
+ };
548
+ if (o !== "GET" && o !== "HEAD") {
549
+ const m = typeof r.body == "function" ? r.body(i) : r.body;
550
+ if (m != null)
551
+ if (w(m)) {
552
+ s.body = JSON.stringify(m);
553
+ const f = s.headers;
554
+ !f["Content-Type"] && !f["content-type"] && (f["Content-Type"] = "application/json");
555
+ } else
556
+ s.body = m;
557
+ }
558
+ return { url: u.toString(), init: s };
559
+ }
560
+ async function Dt(t, a) {
561
+ var d, u;
562
+ const e = a.api;
563
+ if (!e)
564
+ return {};
565
+ const r = new AbortController(), n = q(t), i = { editor: t, editorRoot: n, signal: r.signal }, o = Math.max(0, Number((d = e.timeoutMs) != null ? d : 1e4));
566
+ let l = null;
567
+ o > 0 && (l = window.setTimeout(() => r.abort(), o));
568
+ try {
569
+ const { url: s, init: m } = Et(t, a, r.signal), f = await fetch(s, { ...m, signal: r.signal });
570
+ if (!f.ok)
571
+ throw new Error(`Data binding API request failed: ${f.status}`);
572
+ const $ = (e.responseType || "json") === "text" ? await f.text() : await f.json();
573
+ if (e.transformResponse) {
574
+ const F = e.transformResponse($, i);
575
+ return w(F) ? F : {};
576
+ }
577
+ const x = wt($, e.responsePath);
578
+ return w(x) ? x : w($) ? $ : { value: x };
579
+ } catch (s) {
580
+ return (s == null ? void 0 : s.name) !== "AbortError" && ((u = e.onError) == null || u.call(e, s, i)), {};
581
+ } finally {
582
+ l !== null && window.clearTimeout(l);
583
+ }
584
+ }
585
+ async function U(t, a) {
586
+ const e = J.get(t);
587
+ if (e)
588
+ return e;
589
+ const r = R.get(t), n = Date.now();
590
+ if (r && n - r.timestamp <= a.cacheTtlMs)
591
+ return r.data;
592
+ const i = I.get(t);
593
+ if (i)
594
+ return i;
595
+ const o = (async () => {
596
+ try {
597
+ if (typeof a.getData == "function") {
598
+ const d = await Promise.resolve(a.getData({ editor: t, editorRoot: q(t) }));
599
+ if (w(d))
600
+ return d;
601
+ }
602
+ if (a.api) {
603
+ const d = await Dt(t, a);
604
+ if (w(d))
605
+ return d;
606
+ }
607
+ if (typeof a.data == "function") {
608
+ const d = await Promise.resolve(a.data());
609
+ if (w(d))
610
+ return d;
611
+ }
612
+ return w(a.data) ? a.data : {};
613
+ } finally {
614
+ I.delete(t);
615
+ }
616
+ })();
617
+ I.set(t, o);
618
+ const l = await o;
619
+ return R.set(t, { timestamp: n, data: l }), l;
620
+ }
621
+ async function Z(t, a, e) {
622
+ const r = G(t, a);
623
+ if (v.set(t, e), et(t, e, a), !e) {
624
+ r.forEach((i) => C(i, a, !1));
625
+ return;
626
+ }
627
+ const n = await U(t, a);
628
+ r.forEach((i) => C(i, a, !0, n));
629
+ }
630
+ function gt(t, a) {
631
+ let e = st(t);
632
+ e || (e = document.createRange(), e.selectNodeContents(t), e.collapse(!1)), e.collapsed || e.deleteContents(), e.insertNode(a);
633
+ const r = document.createTextNode(" ");
634
+ a.after(r);
635
+ const n = document.createRange();
636
+ n.setStart(r, 1), n.collapse(!0), ct(t, n), t.normalize();
637
+ }
638
+ function At(t) {
639
+ const a = t.metaKey || t.ctrlKey, e = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && e === "d", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f7";
640
+ return r || n;
641
+ }
642
+ function St(t) {
643
+ const a = t.metaKey || t.ctrlKey, e = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && e === "b", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f8";
644
+ return r || n;
645
+ }
646
+ function L(t, a, e, r, n) {
647
+ bt();
648
+ const i = e === "insert" ? st(t) : null, o = a.labels, l = n ? W(n, a) : j(r || {}, a), d = document.createElement("div");
649
+ d.className = p, ht(t) && d.classList.add("rte-data-binding-theme-dark");
650
+ const u = document.createElement("section");
651
+ u.className = "rte-data-binding-dialog", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-labelledby", "rte-data-binding-dialog-title"), u.innerHTML = `
652
+ <header class="rte-data-binding-header">
653
+ <h2 id="rte-data-binding-dialog-title" class="rte-data-binding-title">${h(
654
+ e === "edit" ? o.dialogTitleEdit : o.dialogTitleInsert
655
+ )}</h2>
656
+ <button type="button" class="rte-data-binding-btn" data-action="cancel" aria-label="${h(o.cancelText)}">✕</button>
657
+ </header>
658
+ <div class="rte-data-binding-body">
659
+ <div class="rte-data-binding-field">
660
+ <label for="rte-data-binding-key">${h(o.keyLabel)}</label>
661
+ <input id="rte-data-binding-key" class="rte-data-binding-key" type="text" value="${h(l.key)}" placeholder="${h(
662
+ o.keyPlaceholder
663
+ )}" />
664
+ </div>
665
+ <div class="rte-data-binding-field">
666
+ <label for="rte-data-binding-fallback">${h(o.fallbackLabel)}</label>
667
+ <input id="rte-data-binding-fallback" class="rte-data-binding-fallback" type="text" value="${h(
668
+ l.fallback || ""
669
+ )}" placeholder="${h(o.fallbackPlaceholder)}" />
670
+ </div>
671
+ <div class="rte-data-binding-field">
672
+ <label for="rte-data-binding-format">${h(o.formatLabel)}</label>
673
+ <select id="rte-data-binding-format" class="rte-data-binding-format">
674
+ <option value="text" ${l.format === "text" ? "selected" : ""}>Text</option>
675
+ <option value="number" ${l.format === "number" ? "selected" : ""}>Number</option>
676
+ <option value="currency" ${l.format === "currency" ? "selected" : ""}>Currency</option>
677
+ <option value="date" ${l.format === "date" ? "selected" : ""}>Date</option>
678
+ <option value="json" ${l.format === "json" ? "selected" : ""}>JSON</option>
679
+ </select>
680
+ </div>
681
+ <div class="rte-data-binding-field">
682
+ <label for="rte-data-binding-currency">${h(o.currencyLabel)}</label>
683
+ <input id="rte-data-binding-currency" class="rte-data-binding-currency" type="text" maxlength="3" value="${h(
684
+ l.currency || "USD"
685
+ )}" placeholder="${h(o.currencyPlaceholder)}" />
686
+ </div>
687
+ <p class="rte-data-binding-help">Use dot paths like <code>user.name</code> or <code>order.total</code>.</p>
688
+ </div>
689
+ <footer class="rte-data-binding-footer">
690
+ <button type="button" class="rte-data-binding-btn" data-action="cancel">${h(o.cancelText)}</button>
691
+ <button type="button" class="rte-data-binding-btn rte-data-binding-btn-primary" data-action="save">${h(o.saveText)}</button>
692
+ </footer>
693
+ `, d.appendChild(u), document.body.appendChild(d);
694
+ const s = u.querySelector(".rte-data-binding-key"), m = u.querySelector(".rte-data-binding-fallback"), f = u.querySelector(".rte-data-binding-format"), T = u.querySelector(".rte-data-binding-currency"), $ = () => {
695
+ const c = (f == null ? void 0 : f.value) === "currency", y = T == null ? void 0 : T.closest(".rte-data-binding-field");
696
+ y && (y.style.display = c ? "grid" : "none");
697
+ };
698
+ $(), f == null || f.addEventListener("change", $);
699
+ const x = () => {
700
+ d.removeEventListener("click", nt), d.removeEventListener("keydown", rt, !0), document.removeEventListener("keydown", F, !0), d.parentNode && d.parentNode.removeChild(d), K = null, t.focus({ preventScroll: !0 });
701
+ }, F = (c) => {
702
+ c.key === "Escape" && (c.preventDefault(), c.stopPropagation(), x());
703
+ }, nt = (c) => {
704
+ c.target === d && x();
705
+ }, mt = (c) => {
706
+ if (c.key !== "Tab")
707
+ return;
708
+ const y = Array.from(
709
+ u.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
710
+ );
711
+ if (y.length === 0)
712
+ return;
713
+ const E = y[0], D = y[y.length - 1], N = document.activeElement;
714
+ if (c.shiftKey && N === E) {
715
+ c.preventDefault(), D.focus();
716
+ return;
717
+ }
718
+ !c.shiftKey && N === D && (c.preventDefault(), E.focus());
719
+ }, at = async () => {
720
+ const c = ((s == null ? void 0 : s.value) || "").trim();
721
+ if (!c) {
722
+ s == null || s.focus();
723
+ return;
724
+ }
725
+ const y = j(
726
+ {
727
+ key: c,
728
+ fallback: ((m == null ? void 0 : m.value) || "").trim(),
729
+ format: (f == null ? void 0 : f.value) || a.defaultFormat,
730
+ currency: ((T == null ? void 0 : T.value) || "USD").trim().toUpperCase()
731
+ },
732
+ a
733
+ ), E = t.innerHTML;
734
+ if (n) {
735
+ tt(n, y, o);
736
+ const D = v.get(t) === !0, N = D ? await U(t, a) : void 0;
737
+ C(n, a, D, N);
738
+ } else {
739
+ if (i)
740
+ try {
741
+ ct(t, i);
742
+ } catch (it) {
743
+ }
744
+ const D = ft(y, o);
745
+ if (gt(t, D), v.get(t) === !0) {
746
+ const it = await U(t, a);
747
+ C(D, a, !0, it);
748
+ }
749
+ }
750
+ Y(t), Q(t, E), x();
751
+ }, rt = (c) => {
752
+ if (c.key === "Escape") {
753
+ c.preventDefault(), x();
754
+ return;
755
+ }
756
+ mt(c), c.key === "Enter" && !c.shiftKey && c.target instanceof HTMLInputElement && (c.preventDefault(), at());
757
+ };
758
+ u.addEventListener("click", (c) => {
759
+ const y = c.target, E = y == null ? void 0 : y.getAttribute("data-action");
760
+ if (E) {
761
+ if (E === "cancel") {
762
+ x();
763
+ return;
764
+ }
765
+ E === "save" && at();
766
+ }
767
+ }), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", F, !0), K = { cleanup: x }, s == null || s.focus();
768
+ }
769
+ function Tt(t) {
770
+ V = t, M || (M = (a) => {
771
+ const e = a.target, r = e == null ? void 0 : e.closest(S);
772
+ if (!r)
773
+ return;
774
+ k = r, g.has(r) || g.set(r, t);
775
+ const n = g.get(r) || t;
776
+ G(r, n);
777
+ const i = v.get(r) === !0;
778
+ et(r, i, n), i || Array.from(r.querySelectorAll(P)).forEach((l) => C(l, n, !1));
779
+ }, document.addEventListener("focusin", M, !0)), O || (O = (a) => {
780
+ if (document.querySelector(`.${p}`))
781
+ return;
782
+ const e = a.target;
783
+ if (e != null && e.closest("input, textarea, select"))
784
+ return;
785
+ const r = A(void 0, !1);
786
+ if (!r || H(r))
787
+ return;
788
+ const n = g.get(r) || V || t, i = e == null ? void 0 : e.closest(P);
789
+ if (i && (a.key === "Enter" || a.key === " ")) {
790
+ a.preventDefault(), a.stopPropagation(), k = r, L(r, n, "edit", void 0, i);
791
+ return;
792
+ }
793
+ if (At(a)) {
794
+ a.preventDefault(), a.stopPropagation();
795
+ const o = X(r);
796
+ o ? L(r, n, "edit", void 0, o) : L(r, n, "insert");
797
+ return;
798
+ }
799
+ if (St(a)) {
800
+ a.preventDefault(), a.stopPropagation();
801
+ const o = v.get(r) !== !0;
802
+ Z(r, n, o);
803
+ }
804
+ }, document.addEventListener("keydown", O, !0)), B || (B = (a) => {
805
+ if (document.querySelector(`.${p}`) || a.defaultPrevented || a.button !== 0 || a.metaKey || a.ctrlKey || a.altKey || a.shiftKey)
806
+ return;
807
+ const e = a.target, r = e == null ? void 0 : e.closest(P);
808
+ if (!r)
809
+ return;
810
+ const n = r.closest(S);
811
+ if (!n || H(n))
812
+ return;
813
+ const i = g.get(n) || V || t;
814
+ g.set(n, i), k = n, a.preventDefault(), a.stopPropagation(), r.focus({ preventScroll: !0 }), L(n, i, "edit", void 0, r);
815
+ }, document.addEventListener("click", B, !0));
816
+ }
817
+ function $t() {
818
+ M && (document.removeEventListener("focusin", M, !0), M = null), O && (document.removeEventListener("keydown", O, !0), O = null), B && (document.removeEventListener("click", B, !0), B = null), V = null, k = null;
819
+ }
820
+ const Lt = (t = {}) => {
821
+ const a = dt(t);
822
+ return vt(), {
823
+ name: "dataBinding",
824
+ toolbar: [
825
+ {
826
+ id: "dataBindingTools",
827
+ label: "Data Binding",
828
+ type: "group",
829
+ command: "openDataBindingDialog",
830
+ items: [
831
+ {
832
+ id: "dataBinding",
833
+ label: "Data Binding",
834
+ command: "openDataBindingDialog",
835
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 4a3 3 0 0 0-3 3v3h2V7a1 1 0 0 1 1-1h3V4H7Zm10 0h-3v2h3a1 1 0 0 1 1 1v3h2V7a3 3 0 0 0-3-3ZM4 14v3a3 3 0 0 0 3 3h3v-2H7a1 1 0 0 1-1-1v-3H4Zm14 0v3a1 1 0 0 1-1 1h-3v2h3a3 3 0 0 0 3-3v-3h-2ZM8.5 12a1.5 1.5 0 1 1 0-3h7a1.5 1.5 0 0 1 0 3h-7Zm0 4a1.5 1.5 0 1 1 0-3h4a1.5 1.5 0 0 1 0 3h-4Z" fill="currentColor"></path></svg>'
836
+ },
837
+ {
838
+ id: "dataBindingPreview",
839
+ label: "Data Preview",
840
+ command: "toggleDataBindingPreview",
841
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3c-4.4 0-8 1.3-8 3v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6c0-1.7-3.6-3-8-3Zm0 2c3.9 0 6 .9 6 1s-2.1 1-6 1-6-.9-6-1 2.1-1 6-1Zm0 4c3 0 5.6-.5 7-1.3V11c0 .9-2.7 2-7 2s-7-1.1-7-2V7.7C6.4 8.5 9 9 12 9Zm0 6c-4.3 0-7-1.1-7-2v3c0 .9 2.7 2 7 2s7-1.1 7-2v-3c0 .9-2.7 2-7 2Z" fill="currentColor"></path><path d="M16.5 9.4a1 1 0 0 1 1.4 0l1.1 1.1 1.8-1.8a1 1 0 1 1 1.4 1.4l-2.5 2.5a1 1 0 0 1-1.4 0l-1.8-1.8a1 1 0 0 1 0-1.4Z" fill="currentColor"></path></svg>'
842
+ }
843
+ ]
844
+ }
845
+ ],
846
+ commands: {
847
+ openDataBindingDialog: (e, r) => {
848
+ const n = A(r);
849
+ if (!n || H(n))
850
+ return !1;
851
+ k = n;
852
+ const i = g.get(n) || a;
853
+ g.set(n, i), G(n, i);
854
+ const o = e == null ? void 0 : e.target;
855
+ if (o === "insert")
856
+ return L(n, i, "insert", e), !0;
857
+ const l = X(n);
858
+ return o === "edit" || l ? !l && o === "edit" ? !1 : (L(n, i, "edit", e, l || void 0), !0) : (L(n, i, "insert", e), !0);
859
+ },
860
+ insertDataBindingToken: async (e, r) => {
861
+ const n = A(r);
862
+ if (!n || H(n))
863
+ return !1;
864
+ k = n;
865
+ const i = g.get(n) || a;
866
+ g.set(n, i);
867
+ const o = j(e || {}, i);
868
+ if (!o.key)
869
+ return !1;
870
+ const l = n.innerHTML, d = ft(o, i.labels);
871
+ if (gt(n, d), v.get(n) === !0) {
872
+ const s = await U(n, i);
873
+ C(d, i, !0, s);
874
+ }
875
+ return Y(n), Q(n, l), !0;
876
+ },
877
+ editDataBindingToken: async (e, r) => {
878
+ const n = A(r);
879
+ if (!n || H(n))
880
+ return !1;
881
+ k = n;
882
+ const i = g.get(n) || a;
883
+ g.set(n, i);
884
+ const o = X(n);
885
+ if (!o)
886
+ return !1;
887
+ const l = W(o, i), d = j({ ...l, ...e || {} }, i);
888
+ if (!d.key)
889
+ return !1;
890
+ const u = n.innerHTML;
891
+ tt(o, d, i.labels);
892
+ const s = v.get(n) === !0, m = s ? await U(n, i) : void 0;
893
+ return C(o, i, s, m), Y(n), Q(n, u), !0;
894
+ },
895
+ toggleDataBindingPreview: async (e, r) => {
896
+ const n = A(r);
897
+ if (!n)
898
+ return !1;
899
+ k = n;
900
+ const i = g.get(n) || a;
901
+ g.set(n, i);
902
+ const o = typeof e == "boolean" ? e : v.get(n) !== !0;
903
+ return await Z(n, i, o), !0;
904
+ },
905
+ setDataBindingData: async (e, r) => {
906
+ const n = A(r);
907
+ if (!n)
908
+ return !1;
909
+ if (k = n, e && typeof e == "object" ? (J.set(n, e), R.set(n, { timestamp: Date.now(), data: e })) : (J.delete(n), R.delete(n)), v.get(n) === !0) {
910
+ const i = g.get(n) || a;
911
+ await Z(n, i, !0);
912
+ }
913
+ return !0;
914
+ },
915
+ refreshDataBindings: async (e, r) => {
916
+ const n = A(r);
917
+ if (!n)
918
+ return !1;
919
+ k = n, R.delete(n);
920
+ const i = g.get(n) || a;
921
+ g.set(n, i);
922
+ const o = v.get(n) === !0;
923
+ return await Z(n, i, o), !0;
924
+ }
925
+ },
926
+ keymap: {
927
+ "Mod-Alt-Shift-d": "openDataBindingDialog",
928
+ "Mod-Alt-Shift-D": "openDataBindingDialog",
929
+ "Mod-Alt-Shift-b": "toggleDataBindingPreview",
930
+ "Mod-Alt-Shift-B": "toggleDataBindingPreview",
931
+ F7: "openDataBindingDialog",
932
+ F8: "toggleDataBindingPreview"
933
+ },
934
+ init: function(r) {
935
+ z += 1;
936
+ const n = this && typeof this.__pluginConfig == "object" ? dt({ ...a, ...this.__pluginConfig }) : a;
937
+ Tt(n);
938
+ const i = A(
939
+ r && r.editorElement ? { editorElement: r.editorElement } : void 0,
940
+ !1
941
+ );
942
+ if (i) {
943
+ k = i, g.set(i, n), G(i, n);
944
+ const o = v.get(i) === !0;
945
+ et(i, o, n);
946
+ }
947
+ },
948
+ destroy: () => {
949
+ z = Math.max(0, z - 1), z === 0 && (bt(), $t());
950
+ }
951
+ };
952
+ };
953
+ export {
954
+ Lt as DataBindingPlugin
955
+ };
956
+ //# sourceMappingURL=DataBindingPlugin.native-427e9d75.mjs.map