@editora/core 1.0.14 → 1.0.16

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 (73) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-veDC_kx5.mjs → CodePlugin.native-BH-K4xmW.mjs} +1049 -917
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/{documentManager-vQ1VkbUY.mjs → documentManager-BcBIv5P-.mjs} +3 -3
  44. package/dist/editora.min.js +26 -24
  45. package/dist/editora.umd.js +26 -24
  46. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  47. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  48. package/dist/index-B1_vtXRz.mjs +3910 -0
  49. package/dist/index-C6BoNR2t.js +12 -0
  50. package/dist/{index-BslAFzmv.mjs → index-CavM-mEM.mjs} +6391 -6203
  51. package/dist/index.cjs.js +3 -3
  52. package/dist/{index.es-BYD2KEo6.mjs → index.es-BK-4TPv8.mjs} +1562 -1546
  53. package/dist/index.esm.js +17 -14
  54. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-BsnKYYHL.mjs} +4 -3
  55. package/dist/plugin-loader.js +53 -52
  56. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-DhWKBjsL.mjs} +3 -3
  57. package/dist/webcomponent-core.js +2039 -473
  58. package/dist/webcomponent-core.min.css +1 -1
  59. package/dist/webcomponent-core.min.js +100 -70
  60. package/dist/webcomponent.cjs.js +1 -1
  61. package/dist/webcomponent.esm.js +1 -1
  62. package/dist/webcomponent.js +2208 -641
  63. package/dist/webcomponent.min.css +1 -1
  64. package/dist/webcomponent.min.js +1575 -1209
  65. package/index.d.ts +32 -0
  66. package/package.json +10 -3
  67. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  68. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  69. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  70. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  71. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  72. package/dist/index-B9MPiUAR.mjs +0 -2341
  73. package/dist/index-BLm1MtzH.js +0 -10
@@ -1,6 +1,7 @@
1
- const A = ".rte-content, .editora-content", P = '.rte-conditional-block[data-conditional-content="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', f = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', h = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", g = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Se = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", k = /* @__PURE__ */ new WeakMap(), Ce = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2
- let de = null, me = 0, J = null, X = null, Q = null, ee = null, te = null, oe = null, H = null, y = null, ne = null;
3
- const ze = {
1
+ import { i as Ie } from "./dialogHelpers-DBf7WqYH.mjs";
2
+ const w = ".rte-content, .editora-content", A = '.rte-conditional-block[data-conditional-content="true"]', f = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', b = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", g = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Te = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", T = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
3
+ let de = null, me = 0, Y = null, J = null, Q = null, ee = null, te = null, oe = null, O = null, y = null, ne = null;
4
+ const je = {
4
5
  dialogTitleInsert: "Insert Conditional Content",
5
6
  dialogTitleEdit: "Edit Conditional Content",
6
7
  conditionLabel: "Condition",
@@ -20,18 +21,18 @@ const ze = {
20
21
  function $(e) {
21
22
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
22
23
  }
23
- function R(e) {
24
+ function P(e) {
24
25
  return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
25
26
  }
26
- function Te(e) {
27
+ function Se(e) {
27
28
  return !e || e.length === 0 ? "" : e.join(", ");
28
29
  }
29
30
  function ie(e) {
30
31
  return e ? e.map((t) => t.trim()).filter(Boolean) : [];
31
32
  }
32
- function Fe(e) {
33
+ function Ve(e) {
33
34
  return {
34
- ...ze,
35
+ ...je,
35
36
  ...e || {}
36
37
  };
37
38
  }
@@ -46,7 +47,7 @@ function pe(e) {
46
47
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
47
48
  return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
48
49
  }
49
- function je(e) {
50
+ function We(e) {
50
51
  const t = se(e);
51
52
  if (pe(t)) return !0;
52
53
  const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
@@ -57,41 +58,41 @@ function he(e) {
57
58
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
58
59
  return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
59
60
  }
60
- function Ie(e) {
61
+ function Ze(e) {
61
62
  const t = se(e);
62
63
  if (he(t)) return !0;
63
64
  const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
64
65
  return he(o) ? !0 : he(document.documentElement) || he(document.body);
65
66
  }
66
- function Ve(e) {
67
- return je(e) ? "dark" : Ie(e) ? "acme" : "light";
67
+ function Ge(e) {
68
+ return We(e) ? "dark" : Ze(e) ? "acme" : "light";
68
69
  }
69
- function xe(e, t) {
70
- const o = Ve(t);
70
+ function Ee(e, t) {
71
+ const o = Ge(t);
71
72
  e.classList.remove("rte-conditional-theme-dark", "rte-conditional-theme-acme"), o === "dark" ? e.classList.add("rte-conditional-theme-dark") : o === "acme" && e.classList.add("rte-conditional-theme-acme");
72
73
  }
73
- function w(e, t = !0) {
74
+ function k(e, t = !0) {
74
75
  if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
75
76
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
76
77
  const n = e.editorElement;
77
- if (n.matches(A)) return n;
78
- const a = n.querySelector(A);
79
- if (a instanceof HTMLElement) return a;
78
+ if (n.matches(w)) return n;
79
+ const r = n.querySelector(w);
80
+ if (r instanceof HTMLElement) return r;
80
81
  }
81
82
  const o = window.getSelection();
82
83
  if (o && o.rangeCount > 0) {
83
- const n = o.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(A);
84
- if (r) return r;
84
+ const n = o.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, a = r == null ? void 0 : r.closest(w);
85
+ if (a) return a;
85
86
  }
86
87
  const i = document.activeElement;
87
88
  if (i) {
88
- if (i.matches(A)) return i;
89
- const n = i.closest(A);
89
+ if (i.matches(w)) return i;
90
+ const n = i.closest(w);
90
91
  if (n) return n;
91
92
  }
92
- return y && y.isConnected ? y : t ? document.querySelector(A) : null;
93
+ return y && y.isConnected ? y : t ? document.querySelector(w) : null;
93
94
  }
94
- function Ne(e) {
95
+ function Me(e) {
95
96
  const t = window.getSelection();
96
97
  if (!t || t.rangeCount === 0) return null;
97
98
  const o = t.getRangeAt(0);
@@ -104,7 +105,7 @@ function Le(e, t) {
104
105
  function De(e) {
105
106
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
106
107
  }
107
- function He(e, t) {
108
+ function Oe(e, t) {
108
109
  if (t === e.innerHTML) return;
109
110
  const o = window.execEditorCommand || window.executeEditorCommand;
110
111
  if (typeof o == "function")
@@ -117,14 +118,14 @@ function $e(e, t) {
117
118
  const o = document.createRange();
118
119
  o.selectNodeContents(t), o.collapse(!1), Le(e, o);
119
120
  }
120
- function ve(e, t) {
121
+ function Ce(e, t) {
121
122
  if (t)
122
123
  return t.split(".").filter(Boolean).reduce((o, i) => {
123
124
  if (o != null && typeof o == "object")
124
125
  return o[i];
125
126
  }, e);
126
127
  }
127
- function We(e) {
128
+ function Ue(e) {
128
129
  const t = e.trim();
129
130
  if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
130
131
  return t.slice(1, -1);
@@ -141,18 +142,18 @@ function We(e) {
141
142
  }
142
143
  return t;
143
144
  }
144
- function Ze(e, t) {
145
+ function Xe(e, t) {
145
146
  const o = e.trim();
146
147
  if (!o) return !0;
147
148
  if (o.startsWith("!")) {
148
- const x = o.slice(1).trim();
149
- return !ve(t, x);
149
+ const E = o.slice(1).trim();
150
+ return !Ce(t, E);
150
151
  }
151
152
  const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
152
153
  if (!i)
153
- return !!ve(t, o);
154
- const [, n, a, r] = i, l = ve(t, n), d = We(r);
155
- switch (a) {
154
+ return !!Ce(t, o);
155
+ const [, n, r, a] = i, l = Ce(t, n), d = Ue(a);
156
+ switch (r) {
156
157
  case "==":
157
158
  return l == d;
158
159
  case "!=":
@@ -166,18 +167,18 @@ function Ze(e, t) {
166
167
  case "<=":
167
168
  return Number(l) <= Number(d);
168
169
  case "in":
169
- return Array.isArray(d) ? d.some((x) => x == l) : typeof d == "string" ? d.split(",").map((x) => x.trim()).includes(String(l)) : !1;
170
+ return Array.isArray(d) ? d.some((E) => E == l) : typeof d == "string" ? d.split(",").map((E) => E.trim()).includes(String(l)) : !1;
170
171
  case "contains":
171
172
  case "~=":
172
- return Array.isArray(l) ? l.some((x) => String(x).toLowerCase() === String(d).toLowerCase()) : typeof l == "string" ? l.toLowerCase().includes(String(d).toLowerCase()) : !1;
173
+ return Array.isArray(l) ? l.some((E) => String(E).toLowerCase() === String(d).toLowerCase()) : typeof l == "string" ? l.toLowerCase().includes(String(d).toLowerCase()) : !1;
173
174
  default:
174
175
  return !1;
175
176
  }
176
177
  }
177
- function Ge() {
178
- if (typeof document == "undefined" || document.getElementById(Se)) return;
178
+ function Ye() {
179
+ if (typeof document == "undefined" || document.getElementById(Te)) return;
179
180
  const e = document.createElement("style");
180
- e.id = Se, e.textContent = `
181
+ e.id = Te, e.textContent = `
181
182
  .rte-conditional-block {
182
183
  border: 1px solid #dbe3ec;
183
184
  border-radius: 8px;
@@ -458,106 +459,113 @@ function Ge() {
458
459
  background: #fff5f5;
459
460
  }
460
461
 
461
- .rte-conditional-preview-on ${P} {
462
+ .rte-conditional-preview-on ${A} {
462
463
  border-width: 2px;
463
464
  }
464
465
 
465
- .rte-conditional-preview-on ${P} .rte-conditional-header {
466
+ .rte-conditional-preview-on ${A} .rte-conditional-header {
466
467
  background: #ecfeff;
467
468
  border-color: #bae6fd;
468
469
  }
469
470
 
470
- ${b} .rte-conditional-block,
471
- ${h} .rte-conditional-block,
471
+ ${f} .rte-conditional-preview-on ${A} .rte-conditional-header,
472
+ ${p} .rte-conditional-preview-on ${A} .rte-conditional-header,
473
+ .${c}.rte-conditional-theme-dark .rte-conditional-preview-on ${A} .rte-conditional-header {
474
+ background: #0c2b36;
475
+ border-color: #155e75;
476
+ }
477
+
478
+ ${f} .rte-conditional-block,
479
+ ${p} .rte-conditional-block,
472
480
  .${c}.rte-conditional-theme-dark .rte-conditional-block {
473
481
  background: #111827;
474
482
  border-color: #334155;
475
483
  }
476
484
 
477
- ${b} .rte-conditional-header,
478
- ${b} .rte-conditional-else-label,
479
- ${h} .rte-conditional-header,
480
- ${h} .rte-conditional-else-label,
485
+ ${f} .rte-conditional-header,
486
+ ${f} .rte-conditional-else-label,
487
+ ${p} .rte-conditional-header,
488
+ ${p} .rte-conditional-else-label,
481
489
  .${c}.rte-conditional-theme-dark .rte-conditional-header,
482
490
  .${c}.rte-conditional-theme-dark .rte-conditional-else-label {
483
491
  background: #0f172a;
484
492
  border-color: #334155;
485
493
  }
486
494
 
487
- ${b} .rte-conditional-summary,
488
- ${h} .rte-conditional-summary,
495
+ ${f} .rte-conditional-summary,
496
+ ${p} .rte-conditional-summary,
489
497
  .${c}.rte-conditional-theme-dark .rte-conditional-summary {
490
498
  color: #e2e8f0;
491
499
  }
492
500
 
493
- ${b} .rte-conditional-meta,
494
- ${h} .rte-conditional-meta,
501
+ ${f} .rte-conditional-meta,
502
+ ${p} .rte-conditional-meta,
495
503
  .${c}.rte-conditional-theme-dark .rte-conditional-meta {
496
504
  color: #94a3b8;
497
505
  }
498
506
 
499
- ${b} .rte-conditional-chip,
500
- ${h} .rte-conditional-chip,
507
+ ${f} .rte-conditional-chip,
508
+ ${p} .rte-conditional-chip,
501
509
  .${c}.rte-conditional-theme-dark .rte-conditional-chip {
502
510
  background: #1e3a8a;
503
511
  border-color: #3b82f6;
504
512
  color: #dbeafe;
505
513
  }
506
514
 
507
- ${b} .rte-conditional-chip-else,
508
- ${h} .rte-conditional-chip-else,
515
+ ${f} .rte-conditional-chip-else,
516
+ ${p} .rte-conditional-chip-else,
509
517
  .${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
510
518
  background: #7f1d1d;
511
519
  border-color: #ef4444;
512
520
  color: #fee2e2;
513
521
  }
514
522
 
515
- ${b} .rte-conditional-body,
516
- ${h} .rte-conditional-body,
523
+ ${f} .rte-conditional-body,
524
+ ${p} .rte-conditional-body,
517
525
  .${c}.rte-conditional-theme-dark .rte-conditional-body {
518
526
  background: #1f2937;
519
527
  color: #e2e8f0;
520
528
  }
521
529
 
522
- ${b} .rte-conditional-dialog,
523
- ${h} .rte-conditional-dialog,
530
+ ${f} .rte-conditional-dialog,
531
+ ${p} .rte-conditional-dialog,
524
532
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog {
525
533
  background: #1f2937;
526
534
  border-color: #334155;
527
535
  }
528
536
 
529
- ${b} .rte-conditional-dialog-header,
530
- ${b} .rte-conditional-dialog-footer,
531
- ${h} .rte-conditional-dialog-header,
532
- ${h} .rte-conditional-dialog-footer,
537
+ ${f} .rte-conditional-dialog-header,
538
+ ${f} .rte-conditional-dialog-footer,
539
+ ${p} .rte-conditional-dialog-header,
540
+ ${p} .rte-conditional-dialog-footer,
533
541
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
534
542
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
535
543
  background: #111827;
536
544
  border-color: #334155;
537
545
  }
538
546
 
539
- ${b} .rte-conditional-dialog-title,
540
- ${b} .rte-conditional-field label,
541
- ${b} .rte-conditional-checkbox,
542
- ${h} .rte-conditional-dialog-title,
543
- ${h} .rte-conditional-field label,
544
- ${h} .rte-conditional-checkbox,
547
+ ${f} .rte-conditional-dialog-title,
548
+ ${f} .rte-conditional-field label,
549
+ ${f} .rte-conditional-checkbox,
550
+ ${p} .rte-conditional-dialog-title,
551
+ ${p} .rte-conditional-field label,
552
+ ${p} .rte-conditional-checkbox,
545
553
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
546
554
  .${c}.rte-conditional-theme-dark .rte-conditional-field label,
547
555
  .${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
548
556
  color: #e2e8f0;
549
557
  }
550
558
 
551
- ${b} .rte-conditional-help,
552
- ${h} .rte-conditional-help,
559
+ ${f} .rte-conditional-help,
560
+ ${p} .rte-conditional-help,
553
561
  .${c}.rte-conditional-theme-dark .rte-conditional-help {
554
562
  color: #94a3b8;
555
563
  }
556
564
 
557
- ${b} .rte-conditional-field input[type="text"],
558
- ${b} .rte-conditional-btn,
559
- ${h} .rte-conditional-field input[type="text"],
560
- ${h} .rte-conditional-btn,
565
+ ${f} .rte-conditional-field input[type="text"],
566
+ ${f} .rte-conditional-btn,
567
+ ${p} .rte-conditional-field input[type="text"],
568
+ ${p} .rte-conditional-btn,
561
569
  .${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
562
570
  .${c}.rte-conditional-theme-dark .rte-conditional-btn {
563
571
  background: #0f172a;
@@ -565,28 +573,28 @@ function Ge() {
565
573
  color: #e2e8f0;
566
574
  }
567
575
 
568
- ${b} .rte-conditional-btn-primary,
569
- ${h} .rte-conditional-btn-primary,
576
+ ${f} .rte-conditional-btn-primary,
577
+ ${p} .rte-conditional-btn-primary,
570
578
  .${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
571
579
  border-color: #3b82f6;
572
580
  background: #2563eb;
573
581
  color: #ffffff;
574
582
  }
575
583
 
576
- ${b} .rte-toolbar-group-items.conditional-content,
584
+ ${f} .rte-toolbar-group-items.conditional-content,
577
585
  .${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
578
- ${h} .rte-toolbar-group-items.conditional-content,
579
- ${b} .editora-toolbar-group-items.conditional-content {
586
+ ${p} .rte-toolbar-group-items.conditional-content,
587
+ ${f} .editora-toolbar-group-items.conditional-content {
580
588
  border-color: #566275;
581
589
  }
582
590
 
583
- ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
584
- ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
585
- ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
591
+ ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
592
+ ${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
593
+ ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
586
594
  border-right-color: #566275;
587
595
  }
588
596
 
589
- ${b} .${u},
597
+ ${f} .${u},
590
598
  .${c}.rte-conditional-theme-dark .${u},
591
599
  .${u}.rte-conditional-theme-dark {
592
600
  background: rgba(17, 24, 39, 0.98);
@@ -594,7 +602,7 @@ function Ge() {
594
602
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
595
603
  }
596
604
 
597
- ${b} .${u} .rte-conditional-float-btn,
605
+ ${f} .${u} .rte-conditional-float-btn,
598
606
  .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
599
607
  .${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
600
608
  background: #0f172a;
@@ -602,7 +610,7 @@ function Ge() {
602
610
  color: #e2e8f0;
603
611
  }
604
612
 
605
- ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
613
+ ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
606
614
  .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
607
615
  .${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
608
616
  border-color: #ef4444;
@@ -610,15 +618,15 @@ function Ge() {
610
618
  background: rgba(127, 29, 29, 0.45);
611
619
  }
612
620
 
613
- ${f} .rte-conditional-block,
621
+ ${b} .rte-conditional-block,
614
622
  ${g} .rte-conditional-block,
615
623
  .${c}.rte-conditional-theme-acme .rte-conditional-block {
616
624
  background: #f8fbff;
617
625
  border-color: #cbd8e8;
618
626
  }
619
627
 
620
- ${f} .rte-conditional-header,
621
- ${f} .rte-conditional-else-label,
628
+ ${b} .rte-conditional-header,
629
+ ${b} .rte-conditional-else-label,
622
630
  ${g} .rte-conditional-header,
623
631
  ${g} .rte-conditional-else-label,
624
632
  .${c}.rte-conditional-theme-acme .rte-conditional-header,
@@ -627,19 +635,19 @@ function Ge() {
627
635
  border-color: #cbd8e8;
628
636
  }
629
637
 
630
- ${f} .rte-conditional-summary,
638
+ ${b} .rte-conditional-summary,
631
639
  ${g} .rte-conditional-summary,
632
640
  .${c}.rte-conditional-theme-acme .rte-conditional-summary {
633
641
  color: #0f172a;
634
642
  }
635
643
 
636
- ${f} .rte-conditional-meta,
644
+ ${b} .rte-conditional-meta,
637
645
  ${g} .rte-conditional-meta,
638
646
  .${c}.rte-conditional-theme-acme .rte-conditional-meta {
639
647
  color: #587089;
640
648
  }
641
649
 
642
- ${f} .rte-conditional-chip,
650
+ ${b} .rte-conditional-chip,
643
651
  ${g} .rte-conditional-chip,
644
652
  .${c}.rte-conditional-theme-acme .rte-conditional-chip {
645
653
  background: #d9f5ee;
@@ -647,7 +655,7 @@ function Ge() {
647
655
  color: #0f4f4a;
648
656
  }
649
657
 
650
- ${f} .rte-conditional-chip-else,
658
+ ${b} .rte-conditional-chip-else,
651
659
  ${g} .rte-conditional-chip-else,
652
660
  .${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
653
661
  background: #fde8ea;
@@ -655,14 +663,14 @@ function Ge() {
655
663
  color: #8b1f2f;
656
664
  }
657
665
 
658
- ${f} .rte-conditional-body,
666
+ ${b} .rte-conditional-body,
659
667
  ${g} .rte-conditional-body,
660
668
  .${c}.rte-conditional-theme-acme .rte-conditional-body {
661
669
  background: #fcfeff;
662
670
  color: #0f172a;
663
671
  }
664
672
 
665
- ${f} .rte-conditional-dialog,
673
+ ${b} .rte-conditional-dialog,
666
674
  ${g} .rte-conditional-dialog,
667
675
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog {
668
676
  background: #ffffff;
@@ -670,8 +678,8 @@ function Ge() {
670
678
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
671
679
  }
672
680
 
673
- ${f} .rte-conditional-dialog-header,
674
- ${f} .rte-conditional-dialog-footer,
681
+ ${b} .rte-conditional-dialog-header,
682
+ ${b} .rte-conditional-dialog-footer,
675
683
  ${g} .rte-conditional-dialog-header,
676
684
  ${g} .rte-conditional-dialog-footer,
677
685
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
@@ -680,9 +688,9 @@ function Ge() {
680
688
  border-color: #d8e4f1;
681
689
  }
682
690
 
683
- ${f} .rte-conditional-dialog-title,
684
- ${f} .rte-conditional-field label,
685
- ${f} .rte-conditional-checkbox,
691
+ ${b} .rte-conditional-dialog-title,
692
+ ${b} .rte-conditional-field label,
693
+ ${b} .rte-conditional-checkbox,
686
694
  ${g} .rte-conditional-dialog-title,
687
695
  ${g} .rte-conditional-field label,
688
696
  ${g} .rte-conditional-checkbox,
@@ -692,14 +700,14 @@ function Ge() {
692
700
  color: #1f334a;
693
701
  }
694
702
 
695
- ${f} .rte-conditional-help,
703
+ ${b} .rte-conditional-help,
696
704
  ${g} .rte-conditional-help,
697
705
  .${c}.rte-conditional-theme-acme .rte-conditional-help {
698
706
  color: #5f738d;
699
707
  }
700
708
 
701
- ${f} .rte-conditional-field input[type="text"],
702
- ${f} .rte-conditional-btn,
709
+ ${b} .rte-conditional-field input[type="text"],
710
+ ${b} .rte-conditional-btn,
703
711
  ${g} .rte-conditional-field input[type="text"],
704
712
  ${g} .rte-conditional-btn,
705
713
  .${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
@@ -709,7 +717,7 @@ function Ge() {
709
717
  color: #0f172a;
710
718
  }
711
719
 
712
- ${f} .rte-conditional-btn-primary,
720
+ ${b} .rte-conditional-btn-primary,
713
721
  ${g} .rte-conditional-btn-primary,
714
722
  .${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
715
723
  border-color: #0f766e;
@@ -717,20 +725,20 @@ function Ge() {
717
725
  color: #ffffff;
718
726
  }
719
727
 
720
- ${f} .rte-toolbar-group-items.conditional-content,
728
+ ${b} .rte-toolbar-group-items.conditional-content,
721
729
  .${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
722
730
  ${g} .rte-toolbar-group-items.conditional-content,
723
- ${f} .editora-toolbar-group-items.conditional-content {
731
+ ${b} .editora-toolbar-group-items.conditional-content {
724
732
  border-color: #bfd0e2;
725
733
  }
726
734
 
727
- ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
735
+ ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
728
736
  ${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
729
- ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
737
+ ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
730
738
  border-right-color: #bfd0e2;
731
739
  }
732
740
 
733
- ${f} .${u},
741
+ ${b} .${u},
734
742
  .${c}.rte-conditional-theme-acme .${u},
735
743
  .${u}.rte-conditional-theme-acme {
736
744
  background: rgba(255, 255, 255, 0.98);
@@ -738,7 +746,7 @@ function Ge() {
738
746
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
739
747
  }
740
748
 
741
- ${f} .${u} .rte-conditional-float-btn,
749
+ ${b} .${u} .rte-conditional-float-btn,
742
750
  .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
743
751
  .${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
744
752
  background: #ffffff;
@@ -746,14 +754,14 @@ function Ge() {
746
754
  color: #1f334a;
747
755
  }
748
756
 
749
- ${f} .${u} .rte-conditional-float-btn:hover,
757
+ ${b} .${u} .rte-conditional-float-btn:hover,
750
758
  .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
751
759
  .${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
752
760
  background: #eef7f5;
753
761
  color: #0f4f4a;
754
762
  }
755
763
 
756
- ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
764
+ ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
757
765
  .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
758
766
  .${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
759
767
  border-color: #f1a7b2;
@@ -762,38 +770,38 @@ function Ge() {
762
770
  }
763
771
  `, document.head.appendChild(e);
764
772
  }
765
- function Ue(e) {
773
+ function Je(e) {
766
774
  return {
767
775
  defaultCondition: e.defaultCondition || "",
768
776
  defaultAudience: ie(e.defaultAudience || []),
769
777
  defaultLocale: ie(e.defaultLocale || []),
770
778
  enableElseByDefault: e.enableElseByDefault === !0,
771
- labels: Fe(e.labels),
779
+ labels: Ve(e.labels),
772
780
  context: e.context,
773
781
  getContext: e.getContext,
774
782
  currentAudience: e.currentAudience,
775
783
  currentLocale: e.currentLocale,
776
- evaluateCondition: e.evaluateCondition || Ze
784
+ evaluateCondition: e.evaluateCondition || Xe
777
785
  };
778
786
  }
779
- function Oe() {
787
+ function Re() {
780
788
  de && (de.cleanup(), de = null);
781
789
  }
782
- function Ye(e) {
790
+ function Qe(e) {
783
791
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
784
792
  }
785
- function ae(e, t) {
793
+ function re(e, t) {
786
794
  e.setAttribute("contenteditable", "false"), e.setAttribute("spellcheck", "false");
787
795
  const o = e.querySelector(".rte-conditional-header");
788
796
  o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
789
797
  const i = e.querySelector(".rte-conditional-else-label");
790
- i && i.setAttribute("contenteditable", "false"), Qe(e, !t);
798
+ i && i.setAttribute("contenteditable", "false"), ot(e, !t);
791
799
  }
792
- function Je(e) {
800
+ function et(e) {
793
801
  const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
794
802
  if (!t) return;
795
- const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"), a = e.querySelector('.rte-conditional-body[data-slot="else"]');
796
- i && o.add(i), o.add(t), n && o.add(n), a && o.add(a), Array.from(e.childNodes).forEach((l) => {
803
+ const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"), r = e.querySelector('.rte-conditional-body[data-slot="else"]');
804
+ i && o.add(i), o.add(t), n && o.add(n), r && o.add(r), Array.from(e.childNodes).forEach((l) => {
797
805
  if (!(l instanceof HTMLElement && o.has(l))) {
798
806
  if (l.nodeType === Node.TEXT_NODE && !(l.textContent || "").trim()) {
799
807
  l.remove();
@@ -806,44 +814,44 @@ function Je(e) {
806
814
  function U(e) {
807
815
  const t = window.getSelection();
808
816
  if (t && t.rangeCount > 0) {
809
- const n = t.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(P);
810
- if (r && e.contains(r)) return r;
817
+ const n = t.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, a = r == null ? void 0 : r.closest(A);
818
+ if (a && e.contains(a)) return a;
811
819
  }
812
- const o = document.activeElement, i = o == null ? void 0 : o.closest(P);
820
+ const o = document.activeElement, i = o == null ? void 0 : o.closest(A);
813
821
  return i && e.contains(i) ? i : null;
814
822
  }
815
- function Ae(e, t) {
823
+ function we(e, t) {
816
824
  let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
817
825
  o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
818
826
  <span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
819
827
  <span class="rte-conditional-summary">Else branch</span>
820
828
  `, e.appendChild(o)), i || (i = document.createElement("div"), i.className = "rte-conditional-body rte-conditional-else-body", i.setAttribute("data-slot", "else"), i.innerHTML = "<p><br></p>", e.appendChild(i));
821
829
  }
822
- function Xe(e, t) {
830
+ function tt(e, t) {
823
831
  e.setAttribute("data-has-else", t ? "true" : "false");
824
832
  const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
825
833
  o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
826
834
  }
827
- function Qe(e, t) {
835
+ function ot(e, t) {
828
836
  Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
829
837
  i.setAttribute("contenteditable", t ? "true" : "false");
830
838
  }), e.setAttribute("contenteditable", "false");
831
839
  }
832
- function we(e, t) {
833
- const o = e.getAttribute("data-condition") || "", i = R(e.getAttribute("data-audience")), n = R(e.getAttribute("data-locale"));
834
- let a = e.querySelector(".rte-conditional-header");
835
- a || (a = document.createElement("div"), a.className = "rte-conditional-header", e.prepend(a)), a.setAttribute("contenteditable", "false"), a.setAttribute("tabindex", "0"), a.setAttribute("role", "button"), a.setAttribute("aria-label", "Edit conditional rule");
836
- const r = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
837
- if (a.innerHTML = `
840
+ function Ae(e, t) {
841
+ const o = e.getAttribute("data-condition") || "", i = P(e.getAttribute("data-audience")), n = P(e.getAttribute("data-locale"));
842
+ let r = e.querySelector(".rte-conditional-header");
843
+ r || (r = document.createElement("div"), r.className = "rte-conditional-header", e.prepend(r)), r.setAttribute("contenteditable", "false"), r.setAttribute("tabindex", "0"), r.setAttribute("role", "button"), r.setAttribute("aria-label", "Edit conditional rule");
844
+ const a = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
845
+ if (r.innerHTML = `
838
846
  <span class="rte-conditional-chip">${$(t.blockIfLabel)}</span>
839
- <span class="rte-conditional-summary">${$(r)}</span>
847
+ <span class="rte-conditional-summary">${$(a)}</span>
840
848
  <span class="rte-conditional-meta">${$(l)} · ${$(d)}</span>
841
849
  `, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
842
850
  const m = document.createElement("div");
843
851
  m.className = "rte-conditional-body", m.setAttribute("data-slot", "if"), m.innerHTML = "<p><br></p>", e.insertBefore(m, e.children[1] || null);
844
852
  }
845
- const v = e.getAttribute("data-has-else") === "true";
846
- v && Ae(e, t), Je(e), Xe(e, v);
853
+ const C = e.getAttribute("data-has-else") === "true";
854
+ C && we(e, t), et(e), tt(e, C);
847
855
  }
848
856
  function Pe(e, t) {
849
857
  const o = document.createElement("section");
@@ -851,9 +859,9 @@ function Pe(e, t) {
851
859
  const i = document.createElement("div");
852
860
  i.className = "rte-conditional-header", i.setAttribute("contenteditable", "false");
853
861
  const n = document.createElement("div");
854
- return n.className = "rte-conditional-body", n.setAttribute("data-slot", "if"), n.innerHTML = "<p><br></p>", o.appendChild(i), o.appendChild(n), e.hasElse && Ae(o, t), we(o, t), ae(o, !1), o;
862
+ return n.className = "rte-conditional-body", n.setAttribute("data-slot", "if"), n.innerHTML = "<p><br></p>", o.appendChild(i), o.appendChild(n), e.hasElse && we(o, t), Ae(o, t), re(o, !1), o;
855
863
  }
856
- function et(e, t) {
864
+ function nt(e, t) {
857
865
  if (t)
858
866
  try {
859
867
  if (!e.isConnected) return;
@@ -863,37 +871,79 @@ function et(e, t) {
863
871
  } catch (o) {
864
872
  }
865
873
  }
866
- function tt(e) {
874
+ function it(e) {
867
875
  return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
868
876
  }
869
- function Re(e, t, o) {
877
+ const qe = /* @__PURE__ */ new Set([
878
+ "P",
879
+ "DIV",
880
+ "UL",
881
+ "OL",
882
+ "LI",
883
+ "BLOCKQUOTE",
884
+ "H1",
885
+ "H2",
886
+ "H3",
887
+ "H4",
888
+ "H5",
889
+ "H6",
890
+ "TABLE",
891
+ "PRE",
892
+ "FIGURE",
893
+ "SECTION",
894
+ "ARTICLE",
895
+ "HEADER",
896
+ "FOOTER"
897
+ ]);
898
+ function Be(e, t) {
899
+ let o = e;
900
+ for (; o && o !== t; ) {
901
+ if (o.nodeType === Node.ELEMENT_NODE && qe.has(o.tagName))
902
+ return o;
903
+ o = o.parentNode;
904
+ }
905
+ return null;
906
+ }
907
+ function rt(e) {
908
+ let t = null;
909
+ Array.from(e.childNodes).forEach((o) => {
910
+ if (o.nodeType === Node.ELEMENT_NODE && qe.has(o.tagName)) {
911
+ t = null;
912
+ return;
913
+ }
914
+ o.nodeType === Node.TEXT_NODE && !(o.textContent || "").trim() || (t || (t = document.createElement("p"), e.insertBefore(t, o)), t.appendChild(o));
915
+ });
916
+ }
917
+ function Ke(e, t, o) {
870
918
  let i = null;
871
- i || (i = Ne(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
919
+ i || (i = Me(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
872
920
  let n = null;
873
- i.collapsed || (n = i.extractContents()), i.insertNode(t);
921
+ i.collapsed || (n = i.extractContents());
922
+ const r = Be(i.endContainer, e) || Be(i.startContainer, e);
923
+ r && r.parentNode ? r.parentNode.insertBefore(t, r.nextSibling) : i.insertNode(t);
874
924
  const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
875
- a && n && tt(n) && (a.innerHTML = "", a.appendChild(n)), a ? $e(e, a) : $e(e, t), e.normalize();
925
+ a && n && it(n) && (a.innerHTML = "", a.appendChild(n)), rt(e), a ? $e(e, a) : $e(e, t), e.normalize();
876
926
  }
877
- function ot(e) {
927
+ function at(e) {
878
928
  return {
879
929
  condition: e.getAttribute("data-condition") || "",
880
- audience: R(e.getAttribute("data-audience")),
881
- locale: R(e.getAttribute("data-locale")),
930
+ audience: P(e.getAttribute("data-audience")),
931
+ locale: P(e.getAttribute("data-locale")),
882
932
  hasElse: e.getAttribute("data-has-else") === "true"
883
933
  };
884
934
  }
885
- function nt(e, t, o) {
886
- e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", ie(t.audience).join(",")), e.setAttribute("data-locale", ie(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && Ae(e, o), we(e, o), ae(e, e.classList.contains("rte-conditional-preview"));
935
+ function lt(e, t, o) {
936
+ e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", ie(t.audience).join(",")), e.setAttribute("data-locale", ie(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && we(e, o), Ae(e, o), re(e, e.classList.contains("rte-conditional-preview"));
887
937
  }
888
- function re(e, t) {
889
- xe(e, e);
890
- const o = Array.from(e.querySelectorAll(P)), i = k.get(e) === !0;
938
+ function ae(e, t) {
939
+ Ee(e, e);
940
+ const o = Array.from(e.querySelectorAll(A)), i = T.get(e) === !0;
891
941
  return o.forEach((n) => {
892
- n.classList.add("rte-conditional-block"), n.setAttribute("data-conditional-content", "true"), n.hasAttribute("data-condition") || n.setAttribute("data-condition", ""), n.hasAttribute("data-audience") || n.setAttribute("data-audience", ""), n.hasAttribute("data-locale") || n.setAttribute("data-locale", ""), n.hasAttribute("data-has-else") || n.setAttribute("data-has-else", "false"), n.setAttribute("role", "group"), n.setAttribute("aria-label", "Conditional content block"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"), we(n, t), ae(n, i);
942
+ n.classList.add("rte-conditional-block"), n.setAttribute("data-conditional-content", "true"), n.hasAttribute("data-condition") || n.setAttribute("data-condition", ""), n.hasAttribute("data-audience") || n.setAttribute("data-audience", ""), n.hasAttribute("data-locale") || n.setAttribute("data-locale", ""), n.hasAttribute("data-has-else") || n.setAttribute("data-has-else", "false"), n.setAttribute("role", "group"), n.setAttribute("aria-label", "Conditional content block"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"), Ae(n, t), re(n, i);
893
943
  }), o;
894
944
  }
895
- async function it(e, t) {
896
- const o = Ce.get(e);
945
+ async function ct(e, t) {
946
+ const o = ve.get(e);
897
947
  if (o)
898
948
  return o;
899
949
  if (typeof t.getContext == "function")
@@ -917,38 +967,38 @@ async function it(e, t) {
917
967
  function ge(e) {
918
968
  return Array.isArray(e) ? e.map((t) => t.trim().toLowerCase()).filter(Boolean) : typeof e == "string" ? e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : [];
919
969
  }
920
- function Be(e, t) {
970
+ function Ne(e, t) {
921
971
  return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
922
972
  }
923
- async function Y(e, t, o) {
924
- var T, ue, B, V;
925
- const i = t.labels, n = re(e, i);
926
- if (k.set(e, o), qe(e, o), se(e).classList.toggle("rte-conditional-preview-on", o), !o) {
927
- n.forEach((p) => {
928
- p.classList.remove("rte-conditional-preview"), ae(p, !1);
929
- const M = p.querySelector('.rte-conditional-body[data-slot="if"]'), C = p.querySelector('.rte-conditional-body[data-slot="else"]'), q = p.querySelector(".rte-conditional-else-label"), N = p.getAttribute("data-has-else") === "true";
930
- M && (M.classList.remove("rte-conditional-hidden"), M.removeAttribute("aria-hidden")), C && (C.classList.toggle("rte-conditional-hidden", !N), C.setAttribute("aria-hidden", N ? "false" : "true")), q && q.classList.toggle("rte-conditional-hidden", !N);
973
+ async function X(e, t, o) {
974
+ var B, ue, N, V;
975
+ const i = t.labels, n = ae(e, i);
976
+ if (T.set(e, o), _e(e, o), se(e).classList.toggle("rte-conditional-preview-on", o), !o) {
977
+ n.forEach((h) => {
978
+ h.classList.remove("rte-conditional-preview"), re(h, !1);
979
+ const H = h.querySelector('.rte-conditional-body[data-slot="if"]'), v = h.querySelector('.rte-conditional-body[data-slot="else"]'), q = h.querySelector(".rte-conditional-else-label"), M = h.getAttribute("data-has-else") === "true";
980
+ H && (H.classList.remove("rte-conditional-hidden"), H.removeAttribute("aria-hidden")), v && (v.classList.toggle("rte-conditional-hidden", !M), v.setAttribute("aria-hidden", M ? "false" : "true")), q && q.classList.toggle("rte-conditional-hidden", !M);
931
981
  });
932
982
  return;
933
983
  }
934
- const r = await it(e, t), l = ge(t.currentAudience), d = ge(t.currentLocale), x = ge(
935
- (ue = r.audience) != null ? ue : (T = r.user) == null ? void 0 : T.audience
936
- ), v = ge(
937
- (V = r.locale) != null ? V : (B = r.user) == null ? void 0 : B.locale
938
- ), m = l.length > 0 ? l : x, S = d.length > 0 ? d : v;
939
- n.forEach((p) => {
940
- const M = p.getAttribute("data-condition") || "", C = R(p.getAttribute("data-audience")).map((s) => s.toLowerCase()), q = R(p.getAttribute("data-locale")).map((s) => s.toLowerCase()), N = p.getAttribute("data-has-else") === "true", Ee = t.evaluateCondition(M, r), fe = Be(C, m), be = Be(q, S), K = Ee && fe && be, W = p.querySelector('.rte-conditional-body[data-slot="if"]'), Z = p.querySelector('.rte-conditional-body[data-slot="else"]'), le = p.querySelector(".rte-conditional-else-label");
941
- if (p.classList.add("rte-conditional-preview"), ae(p, !0), W && (W.classList.toggle("rte-conditional-hidden", !K), W.setAttribute("aria-hidden", K ? "false" : "true")), Z) {
942
- const s = N && !K;
984
+ const a = await ct(e, t), l = ge(t.currentAudience), d = ge(t.currentLocale), E = ge(
985
+ (ue = a.audience) != null ? ue : (B = a.user) == null ? void 0 : B.audience
986
+ ), C = ge(
987
+ (V = a.locale) != null ? V : (N = a.user) == null ? void 0 : N.locale
988
+ ), m = l.length > 0 ? l : E, S = d.length > 0 ? d : C;
989
+ n.forEach((h) => {
990
+ const H = h.getAttribute("data-condition") || "", v = P(h.getAttribute("data-audience")).map((s) => s.toLowerCase()), q = P(h.getAttribute("data-locale")).map((s) => s.toLowerCase()), M = h.getAttribute("data-has-else") === "true", xe = t.evaluateCondition(H, a), fe = Ne(v, m), be = Ne(q, S), K = xe && fe && be, W = h.querySelector('.rte-conditional-body[data-slot="if"]'), Z = h.querySelector('.rte-conditional-body[data-slot="else"]'), le = h.querySelector(".rte-conditional-else-label");
991
+ if (h.classList.add("rte-conditional-preview"), re(h, !0), W && (W.classList.toggle("rte-conditional-hidden", !K), W.setAttribute("aria-hidden", K ? "false" : "true")), Z) {
992
+ const s = M && !K;
943
993
  Z.classList.toggle("rte-conditional-hidden", !s), Z.setAttribute("aria-hidden", s ? "false" : "true");
944
994
  }
945
995
  if (le) {
946
- const s = N && !K;
996
+ const s = M && !K;
947
997
  le.classList.toggle("rte-conditional-hidden", !s);
948
998
  }
949
999
  });
950
1000
  }
951
- function qe(e, t) {
1001
+ function _e(e, t) {
952
1002
  const o = se(e);
953
1003
  Array.from(
954
1004
  o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
@@ -956,8 +1006,8 @@ function qe(e, t) {
956
1006
  n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
957
1007
  });
958
1008
  }
959
- function at(e) {
960
- const t = j.get(e);
1009
+ function dt(e) {
1010
+ const t = I.get(e);
961
1011
  if (t && t.isConnected) return t;
962
1012
  const o = document.createElement("div");
963
1013
  return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
@@ -971,246 +1021,246 @@ function at(e) {
971
1021
  i.preventDefault();
972
1022
  }), o.addEventListener("click", (i) => {
973
1023
  var d;
974
- const n = i.target, a = (d = n == null ? void 0 : n.closest("[data-action]")) == null ? void 0 : d.getAttribute("data-action");
975
- if (!a) return;
976
- const r = E.get(e) || ne;
1024
+ const n = i.target, r = (d = n == null ? void 0 : n.closest("[data-action]")) == null ? void 0 : d.getAttribute("data-action");
977
1025
  if (!r) return;
978
- const l = I.get(e);
1026
+ const a = x.get(e) || ne;
1027
+ if (!a) return;
1028
+ const l = j.get(e);
979
1029
  if (!(!l || !e.contains(l))) {
980
- if (a === "edit") {
981
- L(e, r, "edit", void 0, l);
1030
+ if (r === "edit") {
1031
+ L(e, a, "edit", void 0, l);
982
1032
  return;
983
1033
  }
984
- a === "delete" && (_e(e, l), I.set(e, null), F(e));
1034
+ r === "delete" && (ze(e, l), j.set(e, null), z(e));
985
1035
  }
986
- }), document.body.appendChild(o), j.set(e, o), o;
1036
+ }), document.body.appendChild(o), I.set(e, o), o;
987
1037
  }
988
- function F(e) {
989
- const t = j.get(e);
1038
+ function z(e) {
1039
+ const t = I.get(e);
990
1040
  t && t.classList.remove("show");
991
1041
  }
992
- function Ke(e, t) {
1042
+ function Fe(e, t) {
993
1043
  const o = t.getBoundingClientRect();
994
1044
  e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
995
- const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
1045
+ const i = e.getBoundingClientRect(), n = 8, r = window.innerWidth, a = window.innerHeight;
996
1046
  let l = o.top - i.height - n;
997
- l < n && (l = o.bottom + n), l = Math.min(l, r - i.height - n);
1047
+ l < n && (l = o.bottom + n), l = Math.min(l, a - i.height - n);
998
1048
  let d = o.right - i.width;
999
- d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
1049
+ d = Math.max(n, Math.min(d, r - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
1000
1050
  }
1001
1051
  function ye(e, t) {
1002
- const o = at(e);
1003
- xe(o, e), I.set(e, t), Ke(o, t);
1052
+ const o = dt(e);
1053
+ Ee(o, e), j.set(e, t), Fe(o, t);
1004
1054
  }
1005
- function O(e) {
1006
- const t = E.get(e) || ne;
1055
+ function R(e) {
1056
+ const t = x.get(e) || ne;
1007
1057
  if (!t) return;
1008
1058
  const o = U(e);
1009
1059
  if (!o || !e.contains(o) || D(e)) {
1010
- I.set(e, null), F(e);
1060
+ j.set(e, null), z(e);
1011
1061
  return;
1012
1062
  }
1013
- re(e, t.labels), ye(e, o);
1063
+ ae(e, t.labels), ye(e, o);
1014
1064
  }
1015
- function rt() {
1016
- j.forEach((e, t) => {
1065
+ function st() {
1066
+ I.forEach((e, t) => {
1017
1067
  if (!t.isConnected || !e.isConnected) {
1018
- e.remove(), j.delete(t), I.delete(t);
1068
+ e.remove(), I.delete(t), j.delete(t);
1019
1069
  return;
1020
1070
  }
1021
1071
  if (!e.classList.contains("show")) return;
1022
- xe(e, t);
1023
- const o = I.get(t);
1072
+ Ee(e, t);
1073
+ const o = j.get(t);
1024
1074
  if (!o || !t.contains(o)) {
1025
- F(t);
1075
+ z(t);
1026
1076
  return;
1027
1077
  }
1028
- Ke(e, o);
1078
+ Fe(e, o);
1029
1079
  });
1030
1080
  }
1031
- function _e(e, t) {
1081
+ function ze(e, t) {
1032
1082
  if (!e.contains(t)) return !1;
1033
1083
  const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
1034
1084
  t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
1035
- const a = document.createRange();
1036
- return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), Le(e, a), De(e), He(e, o), !0;
1085
+ const r = document.createRange();
1086
+ return n && e.contains(n) ? r.setStartBefore(n) : (r.selectNodeContents(e), r.collapse(!1)), r.collapse(!0), Le(e, r), De(e), Oe(e, o), !0;
1037
1087
  }
1038
- function Me(e, t, o) {
1088
+ function He(e, t, o) {
1039
1089
  const i = e.cloneRange(), n = document.createRange();
1040
1090
  return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
1041
1091
  }
1042
1092
  function L(e, t, o, i, n) {
1043
1093
  var K, W, Z, le;
1044
- Oe();
1045
- const a = t.labels, r = o === "insert" ? Ne(e) : null, l = document.createElement("div");
1046
- l.className = c, xe(l, e);
1094
+ Re();
1095
+ const r = t.labels, a = o === "insert" ? Me(e) : null, l = document.createElement("div");
1096
+ Ie(l), l.className = c, Ee(l, e);
1047
1097
  const d = document.createElement("section");
1048
1098
  d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
1049
- const x = n ? ot(n) : void 0, v = i || x || {}, m = (K = v.condition) != null ? K : t.defaultCondition, S = (W = v.audience) != null ? W : t.defaultAudience, T = (Z = v.locale) != null ? Z : t.defaultLocale, ue = (le = v.hasElse) != null ? le : t.enableElseByDefault;
1099
+ const E = n ? at(n) : void 0, C = i || E || {}, m = (K = C.condition) != null ? K : t.defaultCondition, S = (W = C.audience) != null ? W : t.defaultAudience, B = (Z = C.locale) != null ? Z : t.defaultLocale, ue = (le = C.hasElse) != null ? le : t.enableElseByDefault;
1050
1100
  d.innerHTML = `
1051
1101
  <header class="rte-conditional-dialog-header">
1052
1102
  <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(
1053
- o === "edit" ? a.dialogTitleEdit : a.dialogTitleInsert
1103
+ o === "edit" ? r.dialogTitleEdit : r.dialogTitleInsert
1054
1104
  )}</h2>
1055
- <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(a.cancelText)}">✕</button>
1105
+ <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(r.cancelText)}">✕</button>
1056
1106
  </header>
1057
1107
  <div class="rte-conditional-dialog-body">
1058
1108
  <div class="rte-conditional-field">
1059
- <label for="rte-conditional-condition">${$(a.conditionLabel)}</label>
1109
+ <label for="rte-conditional-condition">${$(r.conditionLabel)}</label>
1060
1110
  <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(
1061
1111
  m || ""
1062
- )}" placeholder="${$(a.conditionPlaceholder)}" />
1112
+ )}" placeholder="${$(r.conditionPlaceholder)}" />
1063
1113
  </div>
1064
1114
  <div class="rte-conditional-field">
1065
- <label for="rte-conditional-audience">${$(a.audienceLabel)}</label>
1115
+ <label for="rte-conditional-audience">${$(r.audienceLabel)}</label>
1066
1116
  <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(
1067
- Te(S)
1068
- )}" placeholder="${$(a.audiencePlaceholder)}" />
1117
+ Se(S)
1118
+ )}" placeholder="${$(r.audiencePlaceholder)}" />
1069
1119
  </div>
1070
1120
  <div class="rte-conditional-field">
1071
- <label for="rte-conditional-locale">${$(a.localeLabel)}</label>
1121
+ <label for="rte-conditional-locale">${$(r.localeLabel)}</label>
1072
1122
  <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(
1073
- Te(T)
1074
- )}" placeholder="${$(a.localePlaceholder)}" />
1123
+ Se(B)
1124
+ )}" placeholder="${$(r.localePlaceholder)}" />
1075
1125
  </div>
1076
1126
  <label class="rte-conditional-checkbox">
1077
1127
  <input class="rte-conditional-input-else" type="checkbox" ${ue ? "checked" : ""} />
1078
- <span>${$(a.elseLabel)}</span>
1128
+ <span>${$(r.elseLabel)}</span>
1079
1129
  </label>
1080
1130
  <p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
1081
1131
  </div>
1082
1132
  <footer class="rte-conditional-dialog-footer">
1083
- <button type="button" class="rte-conditional-btn" data-action="cancel">${$(a.cancelText)}</button>
1084
- <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(a.saveText)}</button>
1133
+ <button type="button" class="rte-conditional-btn" data-action="cancel">${$(r.cancelText)}</button>
1134
+ <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(r.saveText)}</button>
1085
1135
  </footer>
1086
1136
  `, l.appendChild(d), document.body.appendChild(l);
1087
- const B = d.querySelector(".rte-conditional-input-condition"), V = d.querySelector(".rte-conditional-input-audience"), p = d.querySelector(".rte-conditional-input-locale"), M = d.querySelector(".rte-conditional-input-else"), C = () => {
1088
- l.removeEventListener("click", N), l.removeEventListener("keydown", be, !0), document.removeEventListener("keydown", q, !0), l.parentNode && l.parentNode.removeChild(l), de = null, e.focus({ preventScroll: !0 }), O(e);
1137
+ const N = d.querySelector(".rte-conditional-input-condition"), V = d.querySelector(".rte-conditional-input-audience"), h = d.querySelector(".rte-conditional-input-locale"), H = d.querySelector(".rte-conditional-input-else"), v = () => {
1138
+ l.removeEventListener("click", M), l.removeEventListener("keydown", be, !0), document.removeEventListener("keydown", q, !0), l.parentNode && l.parentNode.removeChild(l), de = null, e.focus({ preventScroll: !0 }), R(e);
1089
1139
  }, q = (s) => {
1090
- s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), C());
1091
- }, N = (s) => {
1092
- s.target === l && C();
1093
- }, Ee = (s) => {
1140
+ s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), v());
1141
+ }, M = (s) => {
1142
+ s.target === l && v();
1143
+ }, xe = (s) => {
1094
1144
  if (s.key !== "Tab") return;
1095
1145
  const _ = Array.from(
1096
1146
  d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
1097
1147
  );
1098
1148
  if (_.length === 0) return;
1099
- const G = _[0], ce = _[_.length - 1], z = document.activeElement;
1100
- if (s.shiftKey && z === G) {
1149
+ const G = _[0], ce = _[_.length - 1], F = document.activeElement;
1150
+ if (s.shiftKey && F === G) {
1101
1151
  s.preventDefault(), ce.focus();
1102
1152
  return;
1103
1153
  }
1104
- !s.shiftKey && z === ce && (s.preventDefault(), G.focus());
1154
+ !s.shiftKey && F === ce && (s.preventDefault(), G.focus());
1105
1155
  }, fe = async () => {
1106
1156
  var ce;
1107
1157
  const s = {
1108
- condition: ((ce = B == null ? void 0 : B.value) == null ? void 0 : ce.trim()) || "",
1109
- audience: R(V == null ? void 0 : V.value),
1110
- locale: R(p == null ? void 0 : p.value),
1111
- hasElse: (M == null ? void 0 : M.checked) || !1
1158
+ condition: ((ce = N == null ? void 0 : N.value) == null ? void 0 : ce.trim()) || "",
1159
+ audience: P(V == null ? void 0 : V.value),
1160
+ locale: P(h == null ? void 0 : h.value),
1161
+ hasElse: (H == null ? void 0 : H.checked) || !1
1112
1162
  }, _ = e.innerHTML;
1113
1163
  if (n)
1114
- nt(n, s, a), ae(n, k.get(e) === !0);
1164
+ lt(n, s, r), re(n, T.get(e) === !0);
1115
1165
  else {
1116
- et(e, r);
1117
- const z = Pe(s, a);
1166
+ nt(e, a);
1167
+ const F = Pe(s, r);
1118
1168
  try {
1119
- Re(e, z);
1120
- } catch (ut) {
1121
- e.appendChild(z);
1122
- const ke = z.querySelector('.rte-conditional-body[data-slot="if"]');
1123
- ke ? $e(e, ke) : $e(e, z);
1169
+ Ke(e, F);
1170
+ } catch (pt) {
1171
+ e.appendChild(F);
1172
+ const ke = F.querySelector('.rte-conditional-body[data-slot="if"]');
1173
+ ke ? $e(e, ke) : $e(e, F);
1124
1174
  }
1125
1175
  }
1126
- k.get(e) === !0 && await Y(e, t, !0), De(e), He(e, _), O(e), C();
1176
+ T.get(e) === !0 && await X(e, t, !0), De(e), Oe(e, _), R(e), v();
1127
1177
  }, be = (s) => {
1128
1178
  if (s.key === "Escape") {
1129
- s.preventDefault(), C();
1179
+ s.preventDefault(), v();
1130
1180
  return;
1131
1181
  }
1132
- Ee(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), fe());
1182
+ xe(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), fe());
1133
1183
  };
1134
1184
  d.addEventListener("click", (s) => {
1135
1185
  const G = s.target.getAttribute("data-action");
1136
1186
  if (G === "cancel") {
1137
- C();
1187
+ v();
1138
1188
  return;
1139
1189
  }
1140
1190
  G === "save" && fe();
1141
- }), l.addEventListener("click", N), l.addEventListener("keydown", be, !0), document.addEventListener("keydown", q, !0), de = { cleanup: C }, B == null || B.focus();
1191
+ }), l.addEventListener("click", M), l.addEventListener("keydown", be, !0), document.addEventListener("keydown", q, !0), de = { cleanup: v }, N == null || N.focus();
1142
1192
  }
1143
- function lt(e) {
1144
- const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "c" || n === "keyc"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f9" || n === "f9");
1145
- return a || r;
1193
+ function ut(e) {
1194
+ const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", r = t && e.altKey && e.shiftKey && (i === "c" || n === "keyc"), a = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f9" || n === "f9");
1195
+ return r || a;
1146
1196
  }
1147
- function ct(e) {
1148
- const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "p" || n === "keyp"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
1149
- return a || r;
1197
+ function ft(e) {
1198
+ const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", r = t && e.altKey && e.shiftKey && (i === "p" || n === "keyp"), a = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
1199
+ return r || a;
1150
1200
  }
1151
- function dt(e) {
1152
- ne = e, X || (X = (t) => {
1153
- const o = t.target, i = o == null ? void 0 : o.closest(A);
1201
+ function bt(e) {
1202
+ ne = e, J || (J = (t) => {
1203
+ const o = t.target, i = o == null ? void 0 : o.closest(w);
1154
1204
  if (!i) return;
1155
- y = i, E.has(i) || E.set(i, e);
1156
- const n = E.get(i) || e;
1157
- re(i, n.labels), qe(i, k.get(i) === !0), O(i);
1158
- }, document.addEventListener("focusin", X, !0)), J || (J = (t) => {
1159
- var v;
1205
+ y = i, x.has(i) || x.set(i, e);
1206
+ const n = x.get(i) || e;
1207
+ ae(i, n.labels), _e(i, T.get(i) === !0), R(i);
1208
+ }, document.addEventListener("focusin", J, !0)), Y || (Y = (t) => {
1209
+ var C;
1160
1210
  if (document.querySelector(`.${c}`)) return;
1161
1211
  const i = t.target;
1162
1212
  if (!!(i != null && i.closest("input, textarea, select"))) return;
1163
- const r = (i == null ? void 0 : i.closest(A)) || w(void 0, !1) || y;
1164
- if (!r || D(r)) return;
1165
- const l = E.get(r) || ne || e, d = document.activeElement, x = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
1166
- if (x && (t.key === "Enter" || t.key === " ")) {
1167
- const m = x.closest(P);
1168
- if (m && r.contains(m)) {
1169
- t.preventDefault(), t.stopPropagation(), L(r, l, "edit", void 0, m);
1213
+ const a = (i == null ? void 0 : i.closest(w)) || k(void 0, !1) || y;
1214
+ if (!a || D(a)) return;
1215
+ const l = x.get(a) || ne || e, d = document.activeElement, E = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
1216
+ if (E && (t.key === "Enter" || t.key === " ")) {
1217
+ const m = E.closest(A);
1218
+ if (m && a.contains(m)) {
1219
+ t.preventDefault(), t.stopPropagation(), L(a, l, "edit", void 0, m);
1170
1220
  return;
1171
1221
  }
1172
1222
  }
1173
- if (lt(t)) {
1223
+ if (ut(t)) {
1174
1224
  t.preventDefault(), t.stopPropagation();
1175
- const m = U(r);
1176
- m ? L(r, l, "edit", void 0, m) : L(r, l, "insert");
1225
+ const m = U(a);
1226
+ m ? L(a, l, "edit", void 0, m) : L(a, l, "insert");
1177
1227
  return;
1178
1228
  }
1179
- if (ct(t)) {
1229
+ if (ft(t)) {
1180
1230
  t.preventDefault(), t.stopPropagation();
1181
- const m = k.get(r) !== !0;
1182
- Y(r, l, m), O(r);
1231
+ const m = T.get(a) !== !0;
1232
+ X(a, l, m), R(a);
1183
1233
  return;
1184
1234
  }
1185
1235
  if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
1186
1236
  const m = window.getSelection();
1187
1237
  if (!m || m.rangeCount === 0) return;
1188
1238
  const S = m.getRangeAt(0);
1189
- if (!S.collapsed || !r.contains(S.commonAncestorContainer)) return;
1190
- const T = (v = Ye(S.startContainer)) == null ? void 0 : v.closest(".rte-conditional-body");
1191
- if (!T || !r.contains(T)) return;
1192
- if (t.key === "Backspace" && Me(S, T, "start")) {
1239
+ if (!S.collapsed || !a.contains(S.commonAncestorContainer)) return;
1240
+ const B = (C = Qe(S.startContainer)) == null ? void 0 : C.closest(".rte-conditional-body");
1241
+ if (!B || !a.contains(B)) return;
1242
+ if (t.key === "Backspace" && He(S, B, "start")) {
1193
1243
  t.preventDefault();
1194
1244
  return;
1195
1245
  }
1196
- if (t.key === "Delete" && Me(S, T, "end")) {
1246
+ if (t.key === "Delete" && He(S, B, "end")) {
1197
1247
  t.preventDefault();
1198
1248
  return;
1199
1249
  }
1200
1250
  }
1201
- }, document.addEventListener("keydown", J, !0)), ee || (ee = (t) => {
1251
+ }, document.addEventListener("keydown", Y, !0)), ee || (ee = (t) => {
1202
1252
  const o = t.target;
1203
1253
  if (!o || o.closest(`.${u}`)) return;
1204
- const i = o.closest(A);
1254
+ const i = o.closest(w);
1205
1255
  if (!i) {
1206
- y && F(y);
1256
+ y && z(y);
1207
1257
  return;
1208
1258
  }
1209
1259
  if (D(i)) return;
1210
- y = i, E.has(i) || E.set(i, e);
1211
- const n = o.closest(P);
1260
+ y = i, x.has(i) || x.set(i, e);
1261
+ const n = o.closest(A);
1212
1262
  if (!n) {
1213
- F(i);
1263
+ z(i);
1214
1264
  return;
1215
1265
  }
1216
1266
  requestAnimationFrame(() => {
@@ -1219,39 +1269,39 @@ function dt(e) {
1219
1269
  }, document.addEventListener("mousedown", ee, !0)), Q || (Q = (t) => {
1220
1270
  const o = t.target;
1221
1271
  if (!o || o.closest(`.${u}`)) return;
1222
- const i = o.closest(A);
1272
+ const i = o.closest(w);
1223
1273
  if (!i) {
1224
- y && F(y);
1274
+ y && z(y);
1225
1275
  return;
1226
1276
  }
1227
1277
  if (D(i)) return;
1228
- y = i, E.has(i) || E.set(i, e);
1229
- const n = E.get(i) || e, a = o.closest(P), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1230
- if (a && r) {
1231
- t.preventDefault(), t.stopPropagation(), L(i, n, "edit", void 0, a), ye(i, a);
1278
+ y = i, x.has(i) || x.set(i, e);
1279
+ const n = x.get(i) || e, r = o.closest(A), a = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1280
+ if (r && a) {
1281
+ t.preventDefault(), t.stopPropagation(), L(i, n, "edit", void 0, r), ye(i, r);
1232
1282
  return;
1233
1283
  }
1234
- a ? ye(i, a) : F(i);
1284
+ r ? ye(i, r) : z(i);
1235
1285
  }, document.addEventListener("click", Q, !0)), te || (te = () => {
1236
- const t = w(void 0, !1) || y;
1237
- t && t.isConnected && O(t);
1286
+ const t = k(void 0, !1) || y;
1287
+ t && t.isConnected && R(t);
1238
1288
  }, document.addEventListener("selectionchange", te)), oe || (oe = (t) => {
1239
- const o = t.target, i = o == null ? void 0 : o.closest(A);
1289
+ const o = t.target, i = o == null ? void 0 : o.closest(w);
1240
1290
  if (!i) return;
1241
- const n = E.get(i) || ne || e;
1242
- re(i, n.labels), O(i);
1243
- }, document.addEventListener("input", oe, !0)), H || (H = () => {
1244
- rt();
1245
- }, window.addEventListener("scroll", H, !0), window.addEventListener("resize", H));
1291
+ const n = x.get(i) || ne || e;
1292
+ ae(i, n.labels), R(i);
1293
+ }, document.addEventListener("input", oe, !0)), O || (O = () => {
1294
+ st();
1295
+ }, window.addEventListener("scroll", O, !0), window.addEventListener("resize", O));
1246
1296
  }
1247
- function st() {
1248
- X && (document.removeEventListener("focusin", X, !0), X = null), J && (document.removeEventListener("keydown", J, !0), J = null), Q && (document.removeEventListener("click", Q, !0), Q = null), ee && (document.removeEventListener("mousedown", ee, !0), ee = null), te && (document.removeEventListener("selectionchange", te), te = null), oe && (document.removeEventListener("input", oe, !0), oe = null), H && (window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", H), H = null), j.forEach((e) => {
1297
+ function mt() {
1298
+ J && (document.removeEventListener("focusin", J, !0), J = null), Y && (document.removeEventListener("keydown", Y, !0), Y = null), Q && (document.removeEventListener("click", Q, !0), Q = null), ee && (document.removeEventListener("mousedown", ee, !0), ee = null), te && (document.removeEventListener("selectionchange", te), te = null), oe && (document.removeEventListener("input", oe, !0), oe = null), O && (window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), O = null), I.forEach((e) => {
1249
1299
  e.remove();
1250
- }), j.clear(), I.clear(), ne = null, y = null;
1300
+ }), I.clear(), j.clear(), ne = null, y = null;
1251
1301
  }
1252
- const ft = (e = {}) => {
1253
- const t = Ue(e);
1254
- return Ge(), {
1302
+ const gt = (e = {}) => {
1303
+ const t = Je(e);
1304
+ return Ye(), {
1255
1305
  name: "conditionalContent",
1256
1306
  toolbar: [
1257
1307
  {
@@ -1279,70 +1329,70 @@ const ft = (e = {}) => {
1279
1329
  ],
1280
1330
  commands: {
1281
1331
  conditionalContent: (o, i) => {
1282
- const n = w(i);
1332
+ const n = k(i);
1283
1333
  if (!n || D(n)) return !1;
1284
- y = n, E.set(n, t), re(n, t.labels);
1285
- const a = o == null ? void 0 : o.target;
1286
- if (a === "insert")
1334
+ y = n, x.set(n, t), ae(n, t.labels);
1335
+ const r = o == null ? void 0 : o.target;
1336
+ if (r === "insert")
1287
1337
  return L(n, t, "insert", o), !0;
1288
- const r = U(n);
1289
- return a === "edit" || r ? !r && a === "edit" ? !1 : (L(n, t, "edit", o, r || void 0), !0) : (L(n, t, "insert", o), !0);
1338
+ const a = U(n);
1339
+ return r === "edit" || a ? !a && r === "edit" ? !1 : (L(n, t, "edit", o, a || void 0), !0) : (L(n, t, "insert", o), !0);
1290
1340
  },
1291
1341
  openConditionalDialog: (o, i) => {
1292
- const n = w(i);
1342
+ const n = k(i);
1293
1343
  if (!n || D(n)) return !1;
1294
- y = n, E.set(n, t), re(n, t.labels);
1295
- const a = o == null ? void 0 : o.target;
1296
- if (a === "insert")
1344
+ y = n, x.set(n, t), ae(n, t.labels);
1345
+ const r = o == null ? void 0 : o.target;
1346
+ if (r === "insert")
1297
1347
  return L(n, t, "insert", o), !0;
1298
- const r = U(n);
1299
- return a === "edit" || r ? !r && a === "edit" ? !1 : (L(n, t, "edit", o, r || void 0), !0) : (L(n, t, "insert", o), !0);
1348
+ const a = U(n);
1349
+ return r === "edit" || a ? !a && r === "edit" ? !1 : (L(n, t, "edit", o, a || void 0), !0) : (L(n, t, "insert", o), !0);
1300
1350
  },
1301
1351
  conditionalPreview: async (o, i) => {
1302
- const n = w(i);
1352
+ const n = k(i);
1303
1353
  if (!n) return !1;
1304
- y = n, E.set(n, t);
1305
- const a = typeof o == "boolean" ? o : k.get(n) !== !0;
1306
- return await Y(n, t, a), O(n), !0;
1354
+ y = n, x.set(n, t);
1355
+ const r = typeof o == "boolean" ? o : T.get(n) !== !0;
1356
+ return await X(n, t, r), R(n), !0;
1307
1357
  },
1308
1358
  editConditionalBlock: (o, i) => {
1309
- const n = w(i);
1359
+ const n = k(i);
1310
1360
  if (!n || D(n)) return !1;
1311
- y = n, E.set(n, t);
1312
- const a = U(n);
1313
- return a ? (L(n, t, "edit", o, a), !0) : !1;
1361
+ y = n, x.set(n, t);
1362
+ const r = U(n);
1363
+ return r ? (L(n, t, "edit", o, r), !0) : !1;
1314
1364
  },
1315
1365
  deleteConditionalBlock: (o, i) => {
1316
- const n = w(i);
1366
+ const n = k(i);
1317
1367
  if (!n || D(n)) return !1;
1318
- const a = U(n);
1319
- if (!a) return !1;
1320
- const r = _e(n, a);
1321
- return r && O(n), r;
1368
+ const r = U(n);
1369
+ if (!r) return !1;
1370
+ const a = ze(n, r);
1371
+ return a && R(n), a;
1322
1372
  },
1323
1373
  insertConditionalBlock: (o, i) => {
1324
- var d, x, v, m;
1325
- const n = w(i);
1374
+ var d, E, C, m;
1375
+ const n = k(i);
1326
1376
  if (!n || D(n)) return !1;
1327
- y = n, E.set(n, t);
1328
- const a = {
1377
+ y = n, x.set(n, t);
1378
+ const r = {
1329
1379
  condition: (d = o == null ? void 0 : o.condition) != null ? d : t.defaultCondition,
1330
- audience: (x = o == null ? void 0 : o.audience) != null ? x : t.defaultAudience,
1331
- locale: (v = o == null ? void 0 : o.locale) != null ? v : t.defaultLocale,
1380
+ audience: (E = o == null ? void 0 : o.audience) != null ? E : t.defaultAudience,
1381
+ locale: (C = o == null ? void 0 : o.locale) != null ? C : t.defaultLocale,
1332
1382
  hasElse: (m = o == null ? void 0 : o.hasElse) != null ? m : t.enableElseByDefault
1333
- }, r = Pe(a, t.labels);
1334
- return Re(n, r), k.get(n) === !0 && Y(n, t, !0), !0;
1383
+ }, a = Pe(r, t.labels);
1384
+ return Ke(n, a), T.get(n) === !0 && X(n, t, !0), !0;
1335
1385
  },
1336
1386
  toggleConditionalPreview: async (o, i) => {
1337
- const n = w(i);
1387
+ const n = k(i);
1338
1388
  if (!n) return !1;
1339
- y = n, E.set(n, t);
1340
- const a = typeof o == "boolean" ? o : k.get(n) !== !0;
1341
- return await Y(n, t, a), !0;
1389
+ y = n, x.set(n, t);
1390
+ const r = typeof o == "boolean" ? o : T.get(n) !== !0;
1391
+ return await X(n, t, r), !0;
1342
1392
  },
1343
1393
  setConditionalContext: (o, i) => {
1344
- const n = w(i);
1345
- return n ? (y = n, !o || typeof o != "object" ? Ce.delete(n) : Ce.set(n, o), k.get(n) === !0 && Y(n, t, !0), !0) : !1;
1394
+ const n = k(i);
1395
+ return n ? (y = n, !o || typeof o != "object" ? ve.delete(n) : ve.set(n, o), T.get(n) === !0 && X(n, t, !0), !0) : !1;
1346
1396
  }
1347
1397
  },
1348
1398
  keymap: {
@@ -1354,14 +1404,14 @@ const ft = (e = {}) => {
1354
1404
  F10: "toggleConditionalPreview"
1355
1405
  },
1356
1406
  init: () => {
1357
- me += 1, dt(t);
1407
+ me += 1, bt(t);
1358
1408
  },
1359
1409
  destroy: () => {
1360
- me = Math.max(0, me - 1), me === 0 && (Oe(), st());
1410
+ me = Math.max(0, me - 1), me === 0 && (Re(), mt());
1361
1411
  }
1362
1412
  };
1363
1413
  };
1364
1414
  export {
1365
- ft as ConditionalContentPlugin
1415
+ gt as ConditionalContentPlugin
1366
1416
  };
1367
- //# sourceMappingURL=ConditionalContentPlugin.native-CfhY46rU.mjs.map
1417
+ //# sourceMappingURL=ConditionalContentPlugin.native-Bf7XgRSW.mjs.map