@editora/plugins 1.0.10 → 1.0.11

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 (138) hide show
  1. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  2. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  3. package/dist/a11y-checker.cjs.js +12 -12
  4. package/dist/a11y-checker.esm.js +80 -98
  5. package/dist/anchor.cjs.js +12 -12
  6. package/dist/anchor.esm.js +115 -128
  7. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  8. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  9. package/dist/approval-workflow.cjs.js +40 -40
  10. package/dist/approval-workflow.esm.js +208 -249
  11. package/dist/background-color.cjs.js +2 -2
  12. package/dist/background-color.esm.js +55 -68
  13. package/dist/blockquote.esm.js +1 -2
  14. package/dist/blocks-library.cjs.js +45 -45
  15. package/dist/blocks-library.esm.js +178 -245
  16. package/dist/capitalization.esm.js +1 -2
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +58 -82
  19. package/dist/citations.cjs.js +37 -37
  20. package/dist/citations.esm.js +439 -512
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +27 -33
  23. package/dist/code-sample.cjs.js +14 -14
  24. package/dist/code-sample.esm.js +82 -93
  25. package/dist/code.cjs.js +32 -32
  26. package/dist/code.esm.js +501 -506
  27. package/dist/comments.cjs.js +6 -6
  28. package/dist/comments.esm.js +116 -158
  29. package/dist/conditional-content.cjs.js +90 -90
  30. package/dist/conditional-content.esm.js +371 -432
  31. package/dist/content-rules.cjs.js +7 -7
  32. package/dist/content-rules.esm.js +105 -159
  33. package/dist/data-binding.cjs.js +46 -46
  34. package/dist/data-binding.esm.js +328 -368
  35. package/dist/direction.esm.js +9 -18
  36. package/dist/doc-schema.cjs.js +29 -29
  37. package/dist/doc-schema.esm.js +240 -308
  38. package/dist/document-manager.cjs.js +1 -1
  39. package/dist/document-manager.esm.js +4 -5
  40. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  41. package/dist/documentManager-Jf0RbSks.js +17 -0
  42. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  43. package/dist/embed-iframe.cjs.js +4 -4
  44. package/dist/embed-iframe.esm.js +73 -81
  45. package/dist/emojis.cjs.js +8 -8
  46. package/dist/emojis.esm.js +65 -77
  47. package/dist/enterprise.cjs.js +1 -1
  48. package/dist/enterprise.esm.js +54 -56
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +39 -47
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +37 -53
  53. package/dist/footnote.cjs.js +2 -2
  54. package/dist/footnote.esm.js +76 -117
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +70 -92
  57. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  58. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  59. package/dist/indent.cjs.js +1 -1
  60. package/dist/indent.esm.js +12 -24
  61. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  62. package/dist/index-CvJk4DKa.js +221 -0
  63. package/dist/index-D3CycEFU.mjs +16543 -0
  64. package/dist/index-tqLTHcO6.js +1 -0
  65. package/dist/index.cjs.js +1 -1
  66. package/dist/index.es-CE_A4QSm.js +5 -0
  67. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  68. package/dist/index.esm.js +125 -128
  69. package/dist/italic.cjs.js +1 -1
  70. package/dist/italic.esm.js +8 -9
  71. package/dist/jspdf.es.min-BoS80556.js +77 -0
  72. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  73. package/dist/line-height.cjs.js +1 -1
  74. package/dist/line-height.esm.js +11 -24
  75. package/dist/link.cjs.js +5 -5
  76. package/dist/link.esm.js +24 -30
  77. package/dist/list.cjs.js +1 -1
  78. package/dist/list.esm.js +20 -25
  79. package/dist/lite.cjs.js +1 -1
  80. package/dist/lite.esm.js +59 -61
  81. package/dist/math.cjs.js +21 -21
  82. package/dist/math.esm.js +139 -146
  83. package/dist/media-manager.cjs.js +31 -31
  84. package/dist/media-manager.esm.js +285 -300
  85. package/dist/mentions.cjs.js +9 -9
  86. package/dist/mentions.esm.js +238 -286
  87. package/dist/merge-tag.cjs.js +2 -2
  88. package/dist/merge-tag.esm.js +177 -216
  89. package/dist/page-break.cjs.js +2 -2
  90. package/dist/page-break.esm.js +33 -49
  91. package/dist/pii-redaction.cjs.js +19 -19
  92. package/dist/pii-redaction.esm.js +393 -463
  93. package/dist/plugins.css +1 -0
  94. package/dist/preview.esm.js +5 -10
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +17 -20
  97. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  98. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  99. package/dist/slash-commands.cjs.js +2 -2
  100. package/dist/slash-commands.esm.js +39 -75
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +280 -336
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +61 -69
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +97 -123
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +14 -19
  109. package/dist/table.cjs.js +4 -4
  110. package/dist/table.esm.js +191 -225
  111. package/dist/template.cjs.js +21 -20
  112. package/dist/template.esm.js +715 -196
  113. package/dist/text-alignment.cjs.js +1 -1
  114. package/dist/text-alignment.esm.js +21 -27
  115. package/dist/text-color.cjs.js +3 -3
  116. package/dist/text-color.esm.js +70 -87
  117. package/dist/track-changes.cjs.js +2 -2
  118. package/dist/track-changes.esm.js +100 -162
  119. package/dist/translation-workflow.cjs.js +74 -74
  120. package/dist/translation-workflow.esm.js +602 -678
  121. package/dist/version-diff.cjs.js +14 -14
  122. package/dist/version-diff.esm.js +128 -157
  123. package/package.json +1 -1
  124. package/dist/_commonjsHelpers-6763f629.js +0 -1
  125. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  126. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  127. package/dist/anchoredPopover-8151d535.js +0 -1
  128. package/dist/documentManager-25b6203c.mjs +0 -9122
  129. package/dist/documentManager-b69e7054.js +0 -17
  130. package/dist/html2canvas.esm-09133e29.js +0 -22
  131. package/dist/index-656d224b.js +0 -231
  132. package/dist/index-6a8c48bb.js +0 -1
  133. package/dist/index-d027b7e2.mjs +0 -16859
  134. package/dist/index.es-730f2d98.mjs +0 -5775
  135. package/dist/index.es-dd40173b.js +0 -18
  136. package/dist/jspdf.es.min-90db2c97.js +0 -243
  137. package/dist/style.css +0 -1
  138. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1,6 +1,6 @@
1
- const w = ".rte-content, .editora-content", q = '.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)", Le = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", s = "rte-conditional-floating-toolbar", T = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2
- let ae = null, se = 0, G = null, U = null, Y = null, J = null, X = null, Q = null, P = null, y = null, ee = null;
3
- const Re = {
1
+ const L = ".rte-content, .editora-content", H = '.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)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", h = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Ce = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", w = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
2
+ let le = null, se = 0, G = null, U = null, Y = null, J = null, X = null, Q = null, N = null, g = null, ee = null;
3
+ const Pe = {
4
4
  dialogTitleInsert: "Insert Conditional Content",
5
5
  dialogTitleEdit: "Edit Conditional Content",
6
6
  conditionLabel: "Condition",
@@ -17,94 +17,83 @@ const Re = {
17
17
  allAudiencesText: "all audiences",
18
18
  allLocalesText: "all locales"
19
19
  };
20
- function $(e) {
20
+ function y(e) {
21
21
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
22
22
  }
23
- function K(e) {
23
+ function O(e) {
24
24
  return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
25
25
  }
26
- function Ae(e) {
26
+ function Le(e) {
27
27
  return !e || e.length === 0 ? "" : e.join(", ");
28
28
  }
29
29
  function te(e) {
30
30
  return e ? e.map((t) => t.trim()).filter(Boolean) : [];
31
31
  }
32
- function qe(e) {
32
+ function Re(e) {
33
33
  return {
34
- ...Re,
34
+ ...Pe,
35
35
  ...e || {}
36
36
  };
37
37
  }
38
- function H(e) {
38
+ function k(e) {
39
39
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
40
40
  }
41
- function re(e) {
41
+ function ce(e) {
42
42
  return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
43
43
  }
44
44
  function ue(e) {
45
- if (!e)
46
- return !1;
45
+ if (!e) return !1;
47
46
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
48
47
  return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
49
48
  }
50
- function Ke(e) {
51
- const t = re(e);
52
- if (ue(t))
53
- return !0;
49
+ function qe(e) {
50
+ const t = ce(e);
51
+ if (ue(t)) return !0;
54
52
  const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
55
53
  return ue(o) ? !0 : ue(document.documentElement) || ue(document.body);
56
54
  }
57
55
  function fe(e) {
58
- if (!e)
59
- return !1;
56
+ if (!e) return !1;
60
57
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
61
58
  return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
62
59
  }
63
- function _e(e) {
64
- const t = re(e);
65
- if (fe(t))
66
- return !0;
60
+ function Ke(e) {
61
+ const t = ce(e);
62
+ if (fe(t)) return !0;
67
63
  const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
68
64
  return fe(o) ? !0 : fe(document.documentElement) || fe(document.body);
69
65
  }
70
- function ze(e) {
71
- return Ke(e) ? "dark" : _e(e) ? "acme" : "light";
66
+ function Ie(e) {
67
+ return qe(e) ? "dark" : Ke(e) ? "acme" : "light";
72
68
  }
73
69
  function he(e, t) {
74
- const o = ze(t);
70
+ const o = Ie(t);
75
71
  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");
76
72
  }
77
- function S(e, t = !0) {
78
- if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
79
- return e.contentElement;
80
- if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
73
+ function A(e, t = !0) {
74
+ if (e?.contentElement instanceof HTMLElement) return e.contentElement;
75
+ if (e?.editorElement instanceof HTMLElement) {
81
76
  const n = e.editorElement;
82
- if (n.matches(w))
83
- return n;
84
- const a = n.querySelector(w);
85
- if (a instanceof HTMLElement)
86
- return a;
77
+ if (n.matches(L)) return n;
78
+ const a = n.querySelector(L);
79
+ if (a instanceof HTMLElement) return a;
87
80
  }
88
81
  const o = window.getSelection();
89
82
  if (o && o.rangeCount > 0) {
90
- const n = o.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(w);
91
- if (r)
92
- return r;
83
+ const n = o.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(L);
84
+ if (r) return r;
93
85
  }
94
86
  const i = document.activeElement;
95
87
  if (i) {
96
- if (i.matches(w))
97
- return i;
98
- const n = i.closest(w);
99
- if (n)
100
- return n;
88
+ if (i.matches(L)) return i;
89
+ const n = i.closest(L);
90
+ if (n) return n;
101
91
  }
102
- return y && y.isConnected ? y : t ? document.querySelector(w) : null;
92
+ return g && g.isConnected ? g : t ? document.querySelector(L) : null;
103
93
  }
104
- function Se(e) {
94
+ function ke(e) {
105
95
  const t = window.getSelection();
106
- if (!t || t.rangeCount === 0)
107
- return null;
96
+ if (!t || t.rangeCount === 0) return null;
108
97
  const o = t.getRangeAt(0);
109
98
  return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
110
99
  }
@@ -112,12 +101,11 @@ function xe(e, t) {
112
101
  const o = window.getSelection();
113
102
  o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
114
103
  }
115
- function Te(e) {
104
+ function Se(e) {
116
105
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
117
106
  }
118
- function Be(e, t) {
119
- if (t === e.innerHTML)
120
- return;
107
+ function Te(e, t) {
108
+ if (t === e.innerHTML) return;
121
109
  const o = window.execEditorCommand || window.executeEditorCommand;
122
110
  if (typeof o == "function")
123
111
  try {
@@ -136,19 +124,15 @@ function ye(e, t) {
136
124
  return o[i];
137
125
  }, e);
138
126
  }
139
- function Fe(e) {
127
+ function _e(e) {
140
128
  const t = e.trim();
141
129
  if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
142
130
  return t.slice(1, -1);
143
- if (t === "true")
144
- return !0;
145
- if (t === "false")
146
- return !1;
147
- if (t === "null")
148
- return null;
131
+ if (t === "true") return !0;
132
+ if (t === "false") return !1;
133
+ if (t === "null") return null;
149
134
  const o = Number(t);
150
- if (!Number.isNaN(o) && t !== "")
151
- return o;
135
+ if (!Number.isNaN(o) && t !== "") return o;
152
136
  if (t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}"))
153
137
  try {
154
138
  return JSON.parse(t);
@@ -157,10 +141,9 @@ function Fe(e) {
157
141
  }
158
142
  return t;
159
143
  }
160
- function je(e, t) {
144
+ function ze(e, t) {
161
145
  const o = e.trim();
162
- if (!o)
163
- return !0;
146
+ if (!o) return !0;
164
147
  if (o.startsWith("!")) {
165
148
  const E = o.slice(1).trim();
166
149
  return !ye(t, E);
@@ -168,7 +151,7 @@ function je(e, t) {
168
151
  const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
169
152
  if (!i)
170
153
  return !!ye(t, o);
171
- const [, n, a, r] = i, l = ye(t, n), d = Fe(r);
154
+ const [, n, a, r] = i, l = ye(t, n), d = _e(r);
172
155
  switch (a) {
173
156
  case "==":
174
157
  return l == d;
@@ -191,11 +174,10 @@ function je(e, t) {
191
174
  return !1;
192
175
  }
193
176
  }
194
- function Ie() {
195
- if (typeof document > "u" || document.getElementById(Le))
196
- return;
177
+ function Fe() {
178
+ if (typeof document > "u" || document.getElementById(Ce)) return;
197
179
  const e = document.createElement("style");
198
- e.id = Le, e.textContent = `
180
+ e.id = Ce, e.textContent = `
199
181
  .rte-conditional-block {
200
182
  border: 1px solid #dbe3ec;
201
183
  border-radius: 8px;
@@ -431,7 +413,7 @@ function Ie() {
431
413
  background: #1d4ed8;
432
414
  }
433
415
 
434
- .${s} {
416
+ .${u} {
435
417
  position: fixed;
436
418
  z-index: 2147483645;
437
419
  display: none;
@@ -445,11 +427,11 @@ function Ie() {
445
427
  backdrop-filter: blur(6px);
446
428
  }
447
429
 
448
- .${s}.show {
430
+ .${u}.show {
449
431
  display: inline-flex;
450
432
  }
451
433
 
452
- .${s} .rte-conditional-float-btn {
434
+ .${u} .rte-conditional-float-btn {
453
435
  border: 1px solid #cbd5e1;
454
436
  border-radius: 6px;
455
437
  min-height: 30px;
@@ -466,27 +448,27 @@ function Ie() {
466
448
  line-height: 1;
467
449
  }
468
450
 
469
- .${s} .rte-conditional-float-btn:hover {
451
+ .${u} .rte-conditional-float-btn:hover {
470
452
  background: #f8fafc;
471
453
  }
472
454
 
473
- .${s} .rte-conditional-float-btn[data-action="delete"] {
455
+ .${u} .rte-conditional-float-btn[data-action="delete"] {
474
456
  border-color: #fecaca;
475
457
  color: #991b1b;
476
458
  background: #fff5f5;
477
459
  }
478
460
 
479
- .rte-conditional-preview-on ${q} {
461
+ .rte-conditional-preview-on ${H} {
480
462
  border-width: 2px;
481
463
  }
482
464
 
483
- .rte-conditional-preview-on ${q} .rte-conditional-header {
465
+ .rte-conditional-preview-on ${H} .rte-conditional-header {
484
466
  background: #ecfeff;
485
467
  border-color: #bae6fd;
486
468
  }
487
469
 
488
470
  ${b} .rte-conditional-block,
489
- ${h} .rte-conditional-block,
471
+ ${p} .rte-conditional-block,
490
472
  .${c}.rte-conditional-theme-dark .rte-conditional-block {
491
473
  background: #111827;
492
474
  border-color: #334155;
@@ -494,8 +476,8 @@ function Ie() {
494
476
 
495
477
  ${b} .rte-conditional-header,
496
478
  ${b} .rte-conditional-else-label,
497
- ${h} .rte-conditional-header,
498
- ${h} .rte-conditional-else-label,
479
+ ${p} .rte-conditional-header,
480
+ ${p} .rte-conditional-else-label,
499
481
  .${c}.rte-conditional-theme-dark .rte-conditional-header,
500
482
  .${c}.rte-conditional-theme-dark .rte-conditional-else-label {
501
483
  background: #0f172a;
@@ -503,19 +485,19 @@ function Ie() {
503
485
  }
504
486
 
505
487
  ${b} .rte-conditional-summary,
506
- ${h} .rte-conditional-summary,
488
+ ${p} .rte-conditional-summary,
507
489
  .${c}.rte-conditional-theme-dark .rte-conditional-summary {
508
490
  color: #e2e8f0;
509
491
  }
510
492
 
511
493
  ${b} .rte-conditional-meta,
512
- ${h} .rte-conditional-meta,
494
+ ${p} .rte-conditional-meta,
513
495
  .${c}.rte-conditional-theme-dark .rte-conditional-meta {
514
496
  color: #94a3b8;
515
497
  }
516
498
 
517
499
  ${b} .rte-conditional-chip,
518
- ${h} .rte-conditional-chip,
500
+ ${p} .rte-conditional-chip,
519
501
  .${c}.rte-conditional-theme-dark .rte-conditional-chip {
520
502
  background: #1e3a8a;
521
503
  border-color: #3b82f6;
@@ -523,7 +505,7 @@ function Ie() {
523
505
  }
524
506
 
525
507
  ${b} .rte-conditional-chip-else,
526
- ${h} .rte-conditional-chip-else,
508
+ ${p} .rte-conditional-chip-else,
527
509
  .${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
528
510
  background: #7f1d1d;
529
511
  border-color: #ef4444;
@@ -531,14 +513,14 @@ function Ie() {
531
513
  }
532
514
 
533
515
  ${b} .rte-conditional-body,
534
- ${h} .rte-conditional-body,
516
+ ${p} .rte-conditional-body,
535
517
  .${c}.rte-conditional-theme-dark .rte-conditional-body {
536
518
  background: #1f2937;
537
519
  color: #e2e8f0;
538
520
  }
539
521
 
540
522
  ${b} .rte-conditional-dialog,
541
- ${h} .rte-conditional-dialog,
523
+ ${p} .rte-conditional-dialog,
542
524
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog {
543
525
  background: #1f2937;
544
526
  border-color: #334155;
@@ -546,8 +528,8 @@ function Ie() {
546
528
 
547
529
  ${b} .rte-conditional-dialog-header,
548
530
  ${b} .rte-conditional-dialog-footer,
549
- ${h} .rte-conditional-dialog-header,
550
- ${h} .rte-conditional-dialog-footer,
531
+ ${p} .rte-conditional-dialog-header,
532
+ ${p} .rte-conditional-dialog-footer,
551
533
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
552
534
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
553
535
  background: #111827;
@@ -557,9 +539,9 @@ function Ie() {
557
539
  ${b} .rte-conditional-dialog-title,
558
540
  ${b} .rte-conditional-field label,
559
541
  ${b} .rte-conditional-checkbox,
560
- ${h} .rte-conditional-dialog-title,
561
- ${h} .rte-conditional-field label,
562
- ${h} .rte-conditional-checkbox,
542
+ ${p} .rte-conditional-dialog-title,
543
+ ${p} .rte-conditional-field label,
544
+ ${p} .rte-conditional-checkbox,
563
545
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
564
546
  .${c}.rte-conditional-theme-dark .rte-conditional-field label,
565
547
  .${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
@@ -567,15 +549,15 @@ function Ie() {
567
549
  }
568
550
 
569
551
  ${b} .rte-conditional-help,
570
- ${h} .rte-conditional-help,
552
+ ${p} .rte-conditional-help,
571
553
  .${c}.rte-conditional-theme-dark .rte-conditional-help {
572
554
  color: #94a3b8;
573
555
  }
574
556
 
575
557
  ${b} .rte-conditional-field input[type="text"],
576
558
  ${b} .rte-conditional-btn,
577
- ${h} .rte-conditional-field input[type="text"],
578
- ${h} .rte-conditional-btn,
559
+ ${p} .rte-conditional-field input[type="text"],
560
+ ${p} .rte-conditional-btn,
579
561
  .${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
580
562
  .${c}.rte-conditional-theme-dark .rte-conditional-btn {
581
563
  background: #0f172a;
@@ -584,7 +566,7 @@ function Ie() {
584
566
  }
585
567
 
586
568
  ${b} .rte-conditional-btn-primary,
587
- ${h} .rte-conditional-btn-primary,
569
+ ${p} .rte-conditional-btn-primary,
588
570
  .${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
589
571
  border-color: #3b82f6;
590
572
  background: #2563eb;
@@ -593,43 +575,43 @@ function Ie() {
593
575
 
594
576
  ${b} .rte-toolbar-group-items.conditional-content,
595
577
  .${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
596
- ${h} .rte-toolbar-group-items.conditional-content,
578
+ ${p} .rte-toolbar-group-items.conditional-content,
597
579
  ${b} .editora-toolbar-group-items.conditional-content {
598
580
  border-color: #566275;
599
581
  }
600
582
 
601
583
  ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
602
- ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
584
+ ${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
603
585
  ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
604
586
  border-right-color: #566275;
605
587
  }
606
588
 
607
- ${b} .${s},
608
- .${c}.rte-conditional-theme-dark .${s},
609
- .${s}.rte-conditional-theme-dark {
589
+ ${b} .${u},
590
+ .${c}.rte-conditional-theme-dark .${u},
591
+ .${u}.rte-conditional-theme-dark {
610
592
  background: rgba(17, 24, 39, 0.98);
611
593
  border-color: #334155;
612
594
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
613
595
  }
614
596
 
615
- ${b} .${s} .rte-conditional-float-btn,
616
- .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn,
617
- .${s}.rte-conditional-theme-dark .rte-conditional-float-btn {
597
+ ${b} .${u} .rte-conditional-float-btn,
598
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
599
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
618
600
  background: #0f172a;
619
601
  border-color: #475569;
620
602
  color: #e2e8f0;
621
603
  }
622
604
 
623
- ${b} .${s} .rte-conditional-float-btn[data-action="delete"],
624
- .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn[data-action="delete"],
625
- .${s}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
605
+ ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
606
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
607
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
626
608
  border-color: #ef4444;
627
609
  color: #fecaca;
628
610
  background: rgba(127, 29, 29, 0.45);
629
611
  }
630
612
 
631
613
  ${f} .rte-conditional-block,
632
- ${g} .rte-conditional-block,
614
+ ${h} .rte-conditional-block,
633
615
  .${c}.rte-conditional-theme-acme .rte-conditional-block {
634
616
  background: #f8fbff;
635
617
  border-color: #cbd8e8;
@@ -637,8 +619,8 @@ function Ie() {
637
619
 
638
620
  ${f} .rte-conditional-header,
639
621
  ${f} .rte-conditional-else-label,
640
- ${g} .rte-conditional-header,
641
- ${g} .rte-conditional-else-label,
622
+ ${h} .rte-conditional-header,
623
+ ${h} .rte-conditional-else-label,
642
624
  .${c}.rte-conditional-theme-acme .rte-conditional-header,
643
625
  .${c}.rte-conditional-theme-acme .rte-conditional-else-label {
644
626
  background: linear-gradient(180deg, #eef4fb 0%, #e6eef8 100%);
@@ -646,19 +628,19 @@ function Ie() {
646
628
  }
647
629
 
648
630
  ${f} .rte-conditional-summary,
649
- ${g} .rte-conditional-summary,
631
+ ${h} .rte-conditional-summary,
650
632
  .${c}.rte-conditional-theme-acme .rte-conditional-summary {
651
633
  color: #0f172a;
652
634
  }
653
635
 
654
636
  ${f} .rte-conditional-meta,
655
- ${g} .rte-conditional-meta,
637
+ ${h} .rte-conditional-meta,
656
638
  .${c}.rte-conditional-theme-acme .rte-conditional-meta {
657
639
  color: #587089;
658
640
  }
659
641
 
660
642
  ${f} .rte-conditional-chip,
661
- ${g} .rte-conditional-chip,
643
+ ${h} .rte-conditional-chip,
662
644
  .${c}.rte-conditional-theme-acme .rte-conditional-chip {
663
645
  background: #d9f5ee;
664
646
  border-color: #66c6b3;
@@ -666,7 +648,7 @@ function Ie() {
666
648
  }
667
649
 
668
650
  ${f} .rte-conditional-chip-else,
669
- ${g} .rte-conditional-chip-else,
651
+ ${h} .rte-conditional-chip-else,
670
652
  .${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
671
653
  background: #fde8ea;
672
654
  border-color: #f1a7b2;
@@ -674,14 +656,14 @@ function Ie() {
674
656
  }
675
657
 
676
658
  ${f} .rte-conditional-body,
677
- ${g} .rte-conditional-body,
659
+ ${h} .rte-conditional-body,
678
660
  .${c}.rte-conditional-theme-acme .rte-conditional-body {
679
661
  background: #fcfeff;
680
662
  color: #0f172a;
681
663
  }
682
664
 
683
665
  ${f} .rte-conditional-dialog,
684
- ${g} .rte-conditional-dialog,
666
+ ${h} .rte-conditional-dialog,
685
667
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog {
686
668
  background: #ffffff;
687
669
  border-color: #cbd8e8;
@@ -690,8 +672,8 @@ function Ie() {
690
672
 
691
673
  ${f} .rte-conditional-dialog-header,
692
674
  ${f} .rte-conditional-dialog-footer,
693
- ${g} .rte-conditional-dialog-header,
694
- ${g} .rte-conditional-dialog-footer,
675
+ ${h} .rte-conditional-dialog-header,
676
+ ${h} .rte-conditional-dialog-footer,
695
677
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
696
678
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-footer {
697
679
  background: #f3f8fd;
@@ -701,9 +683,9 @@ function Ie() {
701
683
  ${f} .rte-conditional-dialog-title,
702
684
  ${f} .rte-conditional-field label,
703
685
  ${f} .rte-conditional-checkbox,
704
- ${g} .rte-conditional-dialog-title,
705
- ${g} .rte-conditional-field label,
706
- ${g} .rte-conditional-checkbox,
686
+ ${h} .rte-conditional-dialog-title,
687
+ ${h} .rte-conditional-field label,
688
+ ${h} .rte-conditional-checkbox,
707
689
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-title,
708
690
  .${c}.rte-conditional-theme-acme .rte-conditional-field label,
709
691
  .${c}.rte-conditional-theme-acme .rte-conditional-checkbox {
@@ -711,15 +693,15 @@ function Ie() {
711
693
  }
712
694
 
713
695
  ${f} .rte-conditional-help,
714
- ${g} .rte-conditional-help,
696
+ ${h} .rte-conditional-help,
715
697
  .${c}.rte-conditional-theme-acme .rte-conditional-help {
716
698
  color: #5f738d;
717
699
  }
718
700
 
719
701
  ${f} .rte-conditional-field input[type="text"],
720
702
  ${f} .rte-conditional-btn,
721
- ${g} .rte-conditional-field input[type="text"],
722
- ${g} .rte-conditional-btn,
703
+ ${h} .rte-conditional-field input[type="text"],
704
+ ${h} .rte-conditional-btn,
723
705
  .${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
724
706
  .${c}.rte-conditional-theme-acme .rte-conditional-btn {
725
707
  background: #ffffff;
@@ -728,7 +710,7 @@ function Ie() {
728
710
  }
729
711
 
730
712
  ${f} .rte-conditional-btn-primary,
731
- ${g} .rte-conditional-btn-primary,
713
+ ${h} .rte-conditional-btn-primary,
732
714
  .${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
733
715
  border-color: #0f766e;
734
716
  background: #0f766e;
@@ -737,67 +719,67 @@ function Ie() {
737
719
 
738
720
  ${f} .rte-toolbar-group-items.conditional-content,
739
721
  .${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
740
- ${g} .rte-toolbar-group-items.conditional-content,
722
+ ${h} .rte-toolbar-group-items.conditional-content,
741
723
  ${f} .editora-toolbar-group-items.conditional-content {
742
724
  border-color: #bfd0e2;
743
725
  }
744
726
 
745
727
  ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
746
- ${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
728
+ ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
747
729
  ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
748
730
  border-right-color: #bfd0e2;
749
731
  }
750
732
 
751
- ${f} .${s},
752
- .${c}.rte-conditional-theme-acme .${s},
753
- .${s}.rte-conditional-theme-acme {
733
+ ${f} .${u},
734
+ .${c}.rte-conditional-theme-acme .${u},
735
+ .${u}.rte-conditional-theme-acme {
754
736
  background: rgba(255, 255, 255, 0.98);
755
737
  border-color: #bfd0e2;
756
738
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
757
739
  }
758
740
 
759
- ${f} .${s} .rte-conditional-float-btn,
760
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn,
761
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn {
741
+ ${f} .${u} .rte-conditional-float-btn,
742
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
743
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
762
744
  background: #ffffff;
763
745
  border-color: #bfd0e2;
764
746
  color: #1f334a;
765
747
  }
766
748
 
767
- ${f} .${s} .rte-conditional-float-btn:hover,
768
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn:hover,
769
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
749
+ ${f} .${u} .rte-conditional-float-btn:hover,
750
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
751
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
770
752
  background: #eef7f5;
771
753
  color: #0f4f4a;
772
754
  }
773
755
 
774
- ${f} .${s} .rte-conditional-float-btn[data-action="delete"],
775
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn[data-action="delete"],
776
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
756
+ ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
757
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
758
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
777
759
  border-color: #f1a7b2;
778
760
  color: #8b1f2f;
779
761
  background: #fff4f6;
780
762
  }
781
763
  `, document.head.appendChild(e);
782
764
  }
783
- function Ve(e) {
765
+ function je(e) {
784
766
  return {
785
767
  defaultCondition: e.defaultCondition || "",
786
768
  defaultAudience: te(e.defaultAudience || []),
787
769
  defaultLocale: te(e.defaultLocale || []),
788
770
  enableElseByDefault: e.enableElseByDefault === !0,
789
- labels: qe(e.labels),
771
+ labels: Re(e.labels),
790
772
  context: e.context,
791
773
  getContext: e.getContext,
792
774
  currentAudience: e.currentAudience,
793
775
  currentLocale: e.currentLocale,
794
- evaluateCondition: e.evaluateCondition || je
776
+ evaluateCondition: e.evaluateCondition || ze
795
777
  };
796
778
  }
797
- function Me() {
798
- ae && (ae.cleanup(), ae = null);
779
+ function Be() {
780
+ le && (le.cleanup(), le = null);
799
781
  }
800
- function We(e) {
782
+ function Ve(e) {
801
783
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
802
784
  }
803
785
  function oe(e, t) {
@@ -805,12 +787,11 @@ function oe(e, t) {
805
787
  const o = e.querySelector(".rte-conditional-header");
806
788
  o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
807
789
  const i = e.querySelector(".rte-conditional-else-label");
808
- i && i.setAttribute("contenteditable", "false"), Ue(e, !t);
790
+ i && i.setAttribute("contenteditable", "false"), Ge(e, !t);
809
791
  }
810
- function Ze(e) {
792
+ function We(e) {
811
793
  const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
812
- if (!t)
813
- return;
794
+ if (!t) return;
814
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"]');
815
796
  i && o.add(i), o.add(t), n && o.add(n), a && o.add(a), Array.from(e.childNodes).forEach((l) => {
816
797
  if (!(l instanceof HTMLElement && o.has(l))) {
@@ -825,47 +806,46 @@ function Ze(e) {
825
806
  function W(e) {
826
807
  const t = window.getSelection();
827
808
  if (t && t.rangeCount > 0) {
828
- const n = t.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(q);
829
- if (r && e.contains(r))
830
- return r;
809
+ const n = t.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(H);
810
+ if (r && e.contains(r)) return r;
831
811
  }
832
- const o = document.activeElement, i = o == null ? void 0 : o.closest(q);
812
+ const i = document.activeElement?.closest(H);
833
813
  return i && e.contains(i) ? i : null;
834
814
  }
835
815
  function Ee(e, t) {
836
816
  let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
837
817
  o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
838
- <span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
818
+ <span class="rte-conditional-chip rte-conditional-chip-else">${y(t.blockElseLabel)}</span>
839
819
  <span class="rte-conditional-summary">Else branch</span>
840
820
  `, 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));
841
821
  }
842
- function Ge(e, t) {
822
+ function Ze(e, t) {
843
823
  e.setAttribute("data-has-else", t ? "true" : "false");
844
824
  const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
845
825
  o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
846
826
  }
847
- function Ue(e, t) {
827
+ function Ge(e, t) {
848
828
  Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
849
829
  i.setAttribute("contenteditable", t ? "true" : "false");
850
830
  }), e.setAttribute("contenteditable", "false");
851
831
  }
852
832
  function ve(e, t) {
853
- const o = e.getAttribute("data-condition") || "", i = K(e.getAttribute("data-audience")), n = K(e.getAttribute("data-locale"));
833
+ const o = e.getAttribute("data-condition") || "", i = O(e.getAttribute("data-audience")), n = O(e.getAttribute("data-locale"));
854
834
  let a = e.querySelector(".rte-conditional-header");
855
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");
856
836
  const r = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
857
837
  if (a.innerHTML = `
858
- <span class="rte-conditional-chip">${$(t.blockIfLabel)}</span>
859
- <span class="rte-conditional-summary">${$(r)}</span>
860
- <span class="rte-conditional-meta">${$(l)} · ${$(d)}</span>
838
+ <span class="rte-conditional-chip">${y(t.blockIfLabel)}</span>
839
+ <span class="rte-conditional-summary">${y(r)}</span>
840
+ <span class="rte-conditional-meta">${y(l)} · ${y(d)}</span>
861
841
  `, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
862
- const p = document.createElement("div");
863
- p.className = "rte-conditional-body", p.setAttribute("data-slot", "if"), p.innerHTML = "<p><br></p>", e.insertBefore(p, e.children[1] || null);
842
+ const v = document.createElement("div");
843
+ v.className = "rte-conditional-body", v.setAttribute("data-slot", "if"), v.innerHTML = "<p><br></p>", e.insertBefore(v, e.children[1] || null);
864
844
  }
865
- const L = e.getAttribute("data-has-else") === "true";
866
- L && Ee(e, t), Ze(e), Ge(e, L);
845
+ const m = e.getAttribute("data-has-else") === "true";
846
+ m && Ee(e, t), We(e), Ze(e, m);
867
847
  }
868
- function Ne(e, t) {
848
+ function Me(e, t) {
869
849
  const o = document.createElement("section");
870
850
  o.className = "rte-conditional-block", o.setAttribute("data-conditional-content", "true"), o.setAttribute("data-condition", (e.condition || "").trim()), o.setAttribute("data-audience", te(e.audience).join(",")), o.setAttribute("data-locale", te(e.locale).join(",")), o.setAttribute("data-has-else", e.hasElse ? "true" : "false"), o.setAttribute("role", "group"), o.setAttribute("aria-label", "Conditional content block"), o.setAttribute("contenteditable", "false"), o.setAttribute("spellcheck", "false");
871
851
  const i = document.createElement("div");
@@ -873,61 +853,52 @@ function Ne(e, t) {
873
853
  const n = document.createElement("div");
874
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 && Ee(o, t), ve(o, t), oe(o, !1), o;
875
855
  }
876
- function Ye(e, t) {
856
+ function Ue(e, t) {
877
857
  if (t)
878
858
  try {
879
- if (!e.isConnected)
880
- return;
859
+ if (!e.isConnected) return;
881
860
  const o = e.contains(t.startContainer), i = e.contains(t.endContainer);
882
- if (!o || !i)
883
- return;
861
+ if (!o || !i) return;
884
862
  xe(e, t);
885
863
  } catch {
886
864
  }
887
865
  }
888
- function Je(e) {
866
+ function Ye(e) {
889
867
  return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
890
868
  }
891
- function De(e, t, o) {
869
+ function Ne(e, t, o) {
892
870
  let i = null;
893
- if (o)
894
- try {
895
- const r = o.cloneRange();
896
- e.contains(r.commonAncestorContainer) && (i = r);
897
- } catch {
898
- i = null;
899
- }
900
- i || (i = Se(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
871
+ i || (i = ke(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
901
872
  let n = null;
902
873
  i.collapsed || (n = i.extractContents()), i.insertNode(t);
903
874
  const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
904
- a && n && Je(n) && (a.innerHTML = "", a.appendChild(n)), a ? pe(e, a) : pe(e, t), e.normalize();
875
+ a && n && Ye(n) && (a.innerHTML = "", a.appendChild(n)), a ? pe(e, a) : pe(e, t), e.normalize();
905
876
  }
906
- function Xe(e) {
877
+ function Je(e) {
907
878
  return {
908
879
  condition: e.getAttribute("data-condition") || "",
909
- audience: K(e.getAttribute("data-audience")),
910
- locale: K(e.getAttribute("data-locale")),
880
+ audience: O(e.getAttribute("data-audience")),
881
+ locale: O(e.getAttribute("data-locale")),
911
882
  hasElse: e.getAttribute("data-has-else") === "true"
912
883
  };
913
884
  }
914
- function Qe(e, t, o) {
885
+ function Xe(e, t, o) {
915
886
  e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", te(t.audience).join(",")), e.setAttribute("data-locale", te(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && Ee(e, o), ve(e, o), oe(e, e.classList.contains("rte-conditional-preview"));
916
887
  }
917
888
  function ne(e, t) {
918
889
  he(e, e);
919
- const o = Array.from(e.querySelectorAll(q)), i = T.get(e) === !0;
890
+ const o = Array.from(e.querySelectorAll(H)), i = w.get(e) === !0;
920
891
  return o.forEach((n) => {
921
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"), ve(n, t), oe(n, i);
922
893
  }), o;
923
894
  }
924
- async function et(e, t) {
895
+ async function Qe(e, t) {
925
896
  const o = $e.get(e);
926
897
  if (o)
927
898
  return o;
928
899
  if (typeof t.getContext == "function")
929
900
  try {
930
- const i = re(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
901
+ const i = ce(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
931
902
  if (n && typeof n == "object")
932
903
  return n;
933
904
  } catch {
@@ -946,51 +917,49 @@ async function et(e, t) {
946
917
  function be(e) {
947
918
  return Array.isArray(e) ? e.map((t) => t.trim().toLowerCase()).filter(Boolean) : typeof e == "string" ? e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : [];
948
919
  }
949
- function we(e, t) {
920
+ function Ae(e, t) {
950
921
  return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
951
922
  }
952
923
  async function Z(e, t, o) {
953
- var M, le;
954
924
  const i = t.labels, n = ne(e, i);
955
- if (T.set(e, o), He(e, o), re(e).classList.toggle("rte-conditional-preview-on", o), !o) {
956
- n.forEach((m) => {
957
- m.classList.remove("rte-conditional-preview"), oe(m, !1);
958
- const N = m.querySelector('.rte-conditional-body[data-slot="if"]'), D = m.querySelector('.rte-conditional-body[data-slot="else"]'), O = m.querySelector(".rte-conditional-else-label"), C = m.getAttribute("data-has-else") === "true";
959
- N && (N.classList.remove("rte-conditional-hidden"), N.removeAttribute("aria-hidden")), D && (D.classList.toggle("rte-conditional-hidden", !C), D.setAttribute("aria-hidden", C ? "false" : "true")), O && O.classList.toggle("rte-conditional-hidden", !C);
925
+ if (w.set(e, o), De(e, o), ce(e).classList.toggle("rte-conditional-preview-on", o), !o) {
926
+ n.forEach(($) => {
927
+ $.classList.remove("rte-conditional-preview"), oe($, !1);
928
+ const P = $.querySelector('.rte-conditional-body[data-slot="if"]'), T = $.querySelector('.rte-conditional-body[data-slot="else"]'), F = $.querySelector(".rte-conditional-else-label"), B = $.getAttribute("data-has-else") === "true";
929
+ P && (P.classList.remove("rte-conditional-hidden"), P.removeAttribute("aria-hidden")), T && (T.classList.toggle("rte-conditional-hidden", !B), T.setAttribute("aria-hidden", B ? "false" : "true")), F && F.classList.toggle("rte-conditional-hidden", !B);
960
930
  });
961
931
  return;
962
932
  }
963
- const r = await et(e, t), l = be(t.currentAudience), d = be(t.currentLocale), E = be(
964
- r.audience ?? ((M = r.user) == null ? void 0 : M.audience)
965
- ), L = be(
966
- r.locale ?? ((le = r.user) == null ? void 0 : le.locale)
967
- ), p = l.length > 0 ? l : E, B = d.length > 0 ? d : L;
968
- n.forEach((m) => {
969
- const N = m.getAttribute("data-condition") || "", D = K(m.getAttribute("data-audience")).map((v) => v.toLowerCase()), O = K(m.getAttribute("data-locale")).map((v) => v.toLowerCase()), C = m.getAttribute("data-has-else") === "true", ce = t.evaluateCondition(N, r), de = we(D, p), ge = we(O, B), _ = ce && de && ge, V = m.querySelector('.rte-conditional-body[data-slot="if"]'), u = m.querySelector('.rte-conditional-body[data-slot="else"]'), k = m.querySelector(".rte-conditional-else-label");
970
- if (m.classList.add("rte-conditional-preview"), oe(m, !0), V && (V.classList.toggle("rte-conditional-hidden", !_), V.setAttribute("aria-hidden", _ ? "false" : "true")), u) {
971
- const v = C && !_;
972
- u.classList.toggle("rte-conditional-hidden", !v), u.setAttribute("aria-hidden", v ? "false" : "true");
973
- }
974
- if (k) {
975
- const v = C && !_;
976
- k.classList.toggle("rte-conditional-hidden", !v);
933
+ const r = await Qe(e, t), l = be(t.currentAudience), d = be(t.currentLocale), E = be(
934
+ r.audience ?? r.user?.audience
935
+ ), m = be(
936
+ r.locale ?? r.user?.locale
937
+ ), v = l.length > 0 ? l : E, S = d.length > 0 ? d : m;
938
+ n.forEach(($) => {
939
+ const P = $.getAttribute("data-condition") || "", T = O($.getAttribute("data-audience")).map((s) => s.toLowerCase()), F = O($.getAttribute("data-locale")).map((s) => s.toLowerCase()), B = $.getAttribute("data-has-else") === "true", ge = t.evaluateCondition(P, r), M = Ae(T, v), de = Ae(F, S), R = ge && M && de, ie = $.querySelector('.rte-conditional-body[data-slot="if"]'), j = $.querySelector('.rte-conditional-body[data-slot="else"]'), ae = $.querySelector(".rte-conditional-else-label");
940
+ if ($.classList.add("rte-conditional-preview"), oe($, !0), ie && (ie.classList.toggle("rte-conditional-hidden", !R), ie.setAttribute("aria-hidden", R ? "false" : "true")), j) {
941
+ const s = B && !R;
942
+ j.classList.toggle("rte-conditional-hidden", !s), j.setAttribute("aria-hidden", s ? "false" : "true");
943
+ }
944
+ if (ae) {
945
+ const s = B && !R;
946
+ ae.classList.toggle("rte-conditional-hidden", !s);
977
947
  }
978
948
  });
979
949
  }
980
- function He(e, t) {
981
- const o = re(e);
950
+ function De(e, t) {
951
+ const o = ce(e);
982
952
  Array.from(
983
953
  o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
984
954
  ).forEach((n) => {
985
955
  n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
986
956
  });
987
957
  }
988
- function tt(e) {
989
- const t = j.get(e);
990
- if (t && t.isConnected)
991
- return t;
958
+ function et(e) {
959
+ const t = _.get(e);
960
+ if (t && t.isConnected) return t;
992
961
  const o = document.createElement("div");
993
- return o.className = s, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
962
+ return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
994
963
  <button type="button" class="rte-conditional-float-btn" data-action="edit" title="Edit Condition" aria-label="Edit Condition">
995
964
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 17.3V20h2.7l9.7-9.7-2.7-2.7L4 17.3Zm14.7-9.4a1 1 0 0 0 0-1.4l-1.2-1.2a1 1 0 0 0-1.4 0l-1.1 1.1 2.7 2.7 1-1.2Z" fill="currentColor"></path></svg>
996
965
  </button>
@@ -1000,28 +969,25 @@ function tt(e) {
1000
969
  `, o.addEventListener("mousedown", (i) => {
1001
970
  i.preventDefault();
1002
971
  }), o.addEventListener("click", (i) => {
1003
- var d;
1004
- const n = i.target, a = (d = n == null ? void 0 : n.closest("[data-action]")) == null ? void 0 : d.getAttribute("data-action");
1005
- if (!a)
1006
- return;
972
+ const a = i.target?.closest("[data-action]")?.getAttribute("data-action");
973
+ if (!a) return;
1007
974
  const r = x.get(e) || ee;
1008
- if (!r)
1009
- return;
1010
- const l = I.get(e);
975
+ if (!r) return;
976
+ const l = z.get(e);
1011
977
  if (!(!l || !e.contains(l))) {
1012
978
  if (a === "edit") {
1013
- A(e, r, "edit", void 0, l);
979
+ C(e, r, "edit", void 0, l);
1014
980
  return;
1015
981
  }
1016
- a === "delete" && (Pe(e, l), I.set(e, null), F(e));
982
+ a === "delete" && (Oe(e, l), z.set(e, null), I(e));
1017
983
  }
1018
- }), document.body.appendChild(o), j.set(e, o), o;
984
+ }), document.body.appendChild(o), _.set(e, o), o;
1019
985
  }
1020
- function F(e) {
1021
- const t = j.get(e);
986
+ function I(e) {
987
+ const t = _.get(e);
1022
988
  t && t.classList.remove("show");
1023
989
  }
1024
- function Oe(e, t) {
990
+ function He(e, t) {
1025
991
  const o = t.getBoundingClientRect();
1026
992
  e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
1027
993
  const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
@@ -1031,231 +997,215 @@ function Oe(e, t) {
1031
997
  d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
1032
998
  }
1033
999
  function me(e, t) {
1034
- const o = tt(e);
1035
- he(o, e), I.set(e, t), Oe(o, t);
1000
+ const o = et(e);
1001
+ he(o, e), z.set(e, t), He(o, t);
1036
1002
  }
1037
- function R(e) {
1003
+ function D(e) {
1038
1004
  const t = x.get(e) || ee;
1039
- if (!t)
1040
- return;
1005
+ if (!t) return;
1041
1006
  const o = W(e);
1042
- if (!o || !e.contains(o) || H(e)) {
1043
- I.set(e, null), F(e);
1007
+ if (!o || !e.contains(o) || k(e)) {
1008
+ z.set(e, null), I(e);
1044
1009
  return;
1045
1010
  }
1046
1011
  ne(e, t.labels), me(e, o);
1047
1012
  }
1048
- function ot() {
1049
- j.forEach((e, t) => {
1013
+ function tt() {
1014
+ _.forEach((e, t) => {
1050
1015
  if (!t.isConnected || !e.isConnected) {
1051
- e.remove(), j.delete(t), I.delete(t);
1016
+ e.remove(), _.delete(t), z.delete(t);
1052
1017
  return;
1053
1018
  }
1054
- if (!e.classList.contains("show"))
1055
- return;
1019
+ if (!e.classList.contains("show")) return;
1056
1020
  he(e, t);
1057
- const o = I.get(t);
1021
+ const o = z.get(t);
1058
1022
  if (!o || !t.contains(o)) {
1059
- F(t);
1023
+ I(t);
1060
1024
  return;
1061
1025
  }
1062
- Oe(e, o);
1026
+ He(e, o);
1063
1027
  });
1064
1028
  }
1065
- function Pe(e, t) {
1066
- if (!e.contains(t))
1067
- return !1;
1029
+ function Oe(e, t) {
1030
+ if (!e.contains(t)) return !1;
1068
1031
  const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
1069
1032
  t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
1070
1033
  const a = document.createRange();
1071
- return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a), Te(e), Be(e, o), !0;
1034
+ return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a), Se(e), Te(e, o), !0;
1072
1035
  }
1073
- function ke(e, t, o) {
1036
+ function we(e, t, o) {
1074
1037
  const i = e.cloneRange(), n = document.createRange();
1075
1038
  return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
1076
1039
  }
1077
- function A(e, t, o, i, n) {
1078
- Me();
1079
- const a = t.labels, r = o === "insert" ? Se(e) : null, l = document.createElement("div");
1040
+ function C(e, t, o, i, n) {
1041
+ Be();
1042
+ const a = t.labels, r = o === "insert" ? ke(e) : null, l = document.createElement("div");
1080
1043
  l.className = c, he(l, e);
1081
1044
  const d = document.createElement("section");
1082
1045
  d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
1083
- const E = n ? Xe(n) : void 0, L = i || E || {}, p = L.condition ?? t.defaultCondition, B = L.audience ?? t.defaultAudience, M = L.locale ?? t.defaultLocale, le = L.hasElse ?? t.enableElseByDefault;
1046
+ const E = n ? Je(n) : void 0, m = i || E || {}, v = m.condition ?? t.defaultCondition, S = m.audience ?? t.defaultAudience, $ = m.locale ?? t.defaultLocale, P = m.hasElse ?? t.enableElseByDefault;
1084
1047
  d.innerHTML = `
1085
1048
  <header class="rte-conditional-dialog-header">
1086
- <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(
1049
+ <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${y(
1087
1050
  o === "edit" ? a.dialogTitleEdit : a.dialogTitleInsert
1088
1051
  )}</h2>
1089
- <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(a.cancelText)}">✕</button>
1052
+ <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${y(a.cancelText)}">✕</button>
1090
1053
  </header>
1091
1054
  <div class="rte-conditional-dialog-body">
1092
1055
  <div class="rte-conditional-field">
1093
- <label for="rte-conditional-condition">${$(a.conditionLabel)}</label>
1094
- <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(
1095
- p || ""
1096
- )}" placeholder="${$(a.conditionPlaceholder)}" />
1056
+ <label for="rte-conditional-condition">${y(a.conditionLabel)}</label>
1057
+ <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${y(
1058
+ v || ""
1059
+ )}" placeholder="${y(a.conditionPlaceholder)}" />
1097
1060
  </div>
1098
1061
  <div class="rte-conditional-field">
1099
- <label for="rte-conditional-audience">${$(a.audienceLabel)}</label>
1100
- <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(
1101
- Ae(B)
1102
- )}" placeholder="${$(a.audiencePlaceholder)}" />
1062
+ <label for="rte-conditional-audience">${y(a.audienceLabel)}</label>
1063
+ <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${y(
1064
+ Le(S)
1065
+ )}" placeholder="${y(a.audiencePlaceholder)}" />
1103
1066
  </div>
1104
1067
  <div class="rte-conditional-field">
1105
- <label for="rte-conditional-locale">${$(a.localeLabel)}</label>
1106
- <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(
1107
- Ae(M)
1108
- )}" placeholder="${$(a.localePlaceholder)}" />
1068
+ <label for="rte-conditional-locale">${y(a.localeLabel)}</label>
1069
+ <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${y(
1070
+ Le($)
1071
+ )}" placeholder="${y(a.localePlaceholder)}" />
1109
1072
  </div>
1110
1073
  <label class="rte-conditional-checkbox">
1111
- <input class="rte-conditional-input-else" type="checkbox" ${le ? "checked" : ""} />
1112
- <span>${$(a.elseLabel)}</span>
1074
+ <input class="rte-conditional-input-else" type="checkbox" ${P ? "checked" : ""} />
1075
+ <span>${y(a.elseLabel)}</span>
1113
1076
  </label>
1114
1077
  <p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
1115
1078
  </div>
1116
1079
  <footer class="rte-conditional-dialog-footer">
1117
- <button type="button" class="rte-conditional-btn" data-action="cancel">${$(a.cancelText)}</button>
1118
- <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(a.saveText)}</button>
1080
+ <button type="button" class="rte-conditional-btn" data-action="cancel">${y(a.cancelText)}</button>
1081
+ <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${y(a.saveText)}</button>
1119
1082
  </footer>
1120
1083
  `, l.appendChild(d), document.body.appendChild(l);
1121
- const m = d.querySelector(".rte-conditional-input-condition"), N = d.querySelector(".rte-conditional-input-audience"), D = d.querySelector(".rte-conditional-input-locale"), O = d.querySelector(".rte-conditional-input-else"), C = () => {
1122
- l.removeEventListener("click", de), l.removeEventListener("keydown", V, !0), document.removeEventListener("keydown", ce, !0), l.parentNode && l.parentNode.removeChild(l), ae = null, e.focus({ preventScroll: !0 }), R(e);
1123
- }, ce = (u) => {
1124
- u.key === "Escape" && (u.preventDefault(), u.stopPropagation(), C());
1125
- }, de = (u) => {
1126
- u.target === l && C();
1127
- }, ge = (u) => {
1128
- if (u.key !== "Tab")
1129
- return;
1130
- const k = Array.from(
1084
+ const T = d.querySelector(".rte-conditional-input-condition"), F = d.querySelector(".rte-conditional-input-audience"), B = d.querySelector(".rte-conditional-input-locale"), ge = d.querySelector(".rte-conditional-input-else"), M = () => {
1085
+ l.removeEventListener("click", R), l.removeEventListener("keydown", ae, !0), document.removeEventListener("keydown", de, !0), l.parentNode && l.parentNode.removeChild(l), le = null, e.focus({ preventScroll: !0 }), D(e);
1086
+ }, de = (s) => {
1087
+ s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), M());
1088
+ }, R = (s) => {
1089
+ s.target === l && M();
1090
+ }, ie = (s) => {
1091
+ if (s.key !== "Tab") return;
1092
+ const q = Array.from(
1131
1093
  d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
1132
1094
  );
1133
- if (k.length === 0)
1134
- return;
1135
- const v = k[0], ie = k[k.length - 1], z = document.activeElement;
1136
- if (u.shiftKey && z === v) {
1137
- u.preventDefault(), ie.focus();
1095
+ if (q.length === 0) return;
1096
+ const V = q[0], K = q[q.length - 1], re = document.activeElement;
1097
+ if (s.shiftKey && re === V) {
1098
+ s.preventDefault(), K.focus();
1138
1099
  return;
1139
1100
  }
1140
- !u.shiftKey && z === ie && (u.preventDefault(), v.focus());
1141
- }, _ = async () => {
1142
- var ie;
1143
- const u = {
1144
- condition: ((ie = m == null ? void 0 : m.value) == null ? void 0 : ie.trim()) || "",
1145
- audience: K(N == null ? void 0 : N.value),
1146
- locale: K(D == null ? void 0 : D.value),
1147
- hasElse: (O == null ? void 0 : O.checked) || !1
1148
- }, k = e.innerHTML;
1101
+ !s.shiftKey && re === K && (s.preventDefault(), V.focus());
1102
+ }, j = async () => {
1103
+ const s = {
1104
+ condition: T?.value?.trim() || "",
1105
+ audience: O(F?.value),
1106
+ locale: O(B?.value),
1107
+ hasElse: ge?.checked || !1
1108
+ }, q = e.innerHTML;
1149
1109
  if (n)
1150
- Qe(n, u, a), oe(n, T.get(e) === !0);
1110
+ Xe(n, s, a), oe(n, w.get(e) === !0);
1151
1111
  else {
1152
- Ye(e, r);
1153
- const z = Ne(u, a);
1112
+ Ue(e, r);
1113
+ const K = Me(s, a);
1154
1114
  try {
1155
- De(e, z);
1115
+ Ne(e, K);
1156
1116
  } catch {
1157
- e.appendChild(z);
1158
- const Ce = z.querySelector('.rte-conditional-body[data-slot="if"]');
1159
- Ce ? pe(e, Ce) : pe(e, z);
1117
+ e.appendChild(K);
1118
+ const re = K.querySelector('.rte-conditional-body[data-slot="if"]');
1119
+ re ? pe(e, re) : pe(e, K);
1160
1120
  }
1161
1121
  }
1162
- T.get(e) === !0 && await Z(e, t, !0), Te(e), Be(e, k), R(e), C();
1163
- }, V = (u) => {
1164
- if (u.key === "Escape") {
1165
- u.preventDefault(), C();
1122
+ w.get(e) === !0 && await Z(e, t, !0), Se(e), Te(e, q), D(e), M();
1123
+ }, ae = (s) => {
1124
+ if (s.key === "Escape") {
1125
+ s.preventDefault(), M();
1166
1126
  return;
1167
1127
  }
1168
- ge(u), u.key === "Enter" && !u.shiftKey && u.target instanceof HTMLInputElement && (u.preventDefault(), _());
1128
+ ie(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), j());
1169
1129
  };
1170
- d.addEventListener("click", (u) => {
1171
- const v = u.target.getAttribute("data-action");
1172
- if (v === "cancel") {
1173
- C();
1130
+ d.addEventListener("click", (s) => {
1131
+ const V = s.target.getAttribute("data-action");
1132
+ if (V === "cancel") {
1133
+ M();
1174
1134
  return;
1175
1135
  }
1176
- v === "save" && _();
1177
- }), l.addEventListener("click", de), l.addEventListener("keydown", V, !0), document.addEventListener("keydown", ce, !0), ae = { cleanup: C }, m == null || m.focus();
1136
+ V === "save" && j();
1137
+ }), l.addEventListener("click", R), l.addEventListener("keydown", ae, !0), document.addEventListener("keydown", de, !0), le = { cleanup: M }, T?.focus();
1178
1138
  }
1179
- function nt(e) {
1139
+ function ot(e) {
1180
1140
  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");
1181
1141
  return a || r;
1182
1142
  }
1183
- function it(e) {
1143
+ function nt(e) {
1184
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 === "p" || n === "keyp"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
1185
1145
  return a || r;
1186
1146
  }
1187
- function at(e) {
1147
+ function it(e) {
1188
1148
  ee = e, U || (U = (t) => {
1189
- const o = t.target, i = o == null ? void 0 : o.closest(w);
1190
- if (!i)
1191
- return;
1192
- y = i, x.has(i) || x.set(i, e);
1149
+ const i = t.target?.closest(L);
1150
+ if (!i) return;
1151
+ g = i, x.has(i) || x.set(i, e);
1193
1152
  const n = x.get(i) || e;
1194
- ne(i, n.labels), He(i, T.get(i) === !0), R(i);
1153
+ ne(i, n.labels), De(i, w.get(i) === !0), D(i);
1195
1154
  }, document.addEventListener("focusin", U, !0)), G || (G = (t) => {
1196
- var L;
1197
- if (document.querySelector(`.${c}`))
1198
- return;
1155
+ if (document.querySelector(`.${c}`)) return;
1199
1156
  const i = t.target;
1200
- if (!!(i != null && i.closest("input, textarea, select")))
1201
- return;
1202
- const r = (i == null ? void 0 : i.closest(w)) || S(void 0, !1) || y;
1203
- if (!r || H(r))
1204
- return;
1205
- const l = x.get(r) || ee || e, d = document.activeElement, E = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
1157
+ if (!!i?.closest("input, textarea, select")) return;
1158
+ const r = i?.closest(L) || A(void 0, !1) || g;
1159
+ if (!r || k(r)) return;
1160
+ const l = x.get(r) || ee || e, d = document.activeElement, E = i?.closest(".rte-conditional-header") || d?.closest(".rte-conditional-header");
1206
1161
  if (E && (t.key === "Enter" || t.key === " ")) {
1207
- const p = E.closest(q);
1208
- if (p && r.contains(p)) {
1209
- t.preventDefault(), t.stopPropagation(), A(r, l, "edit", void 0, p);
1162
+ const m = E.closest(H);
1163
+ if (m && r.contains(m)) {
1164
+ t.preventDefault(), t.stopPropagation(), C(r, l, "edit", void 0, m);
1210
1165
  return;
1211
1166
  }
1212
1167
  }
1213
- if (nt(t)) {
1168
+ if (ot(t)) {
1214
1169
  t.preventDefault(), t.stopPropagation();
1215
- const p = W(r);
1216
- p ? A(r, l, "edit", void 0, p) : A(r, l, "insert");
1170
+ const m = W(r);
1171
+ m ? C(r, l, "edit", void 0, m) : C(r, l, "insert");
1217
1172
  return;
1218
1173
  }
1219
- if (it(t)) {
1174
+ if (nt(t)) {
1220
1175
  t.preventDefault(), t.stopPropagation();
1221
- const p = T.get(r) !== !0;
1222
- Z(r, l, p), R(r);
1176
+ const m = w.get(r) !== !0;
1177
+ Z(r, l, m), D(r);
1223
1178
  return;
1224
1179
  }
1225
1180
  if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
1226
- const p = window.getSelection();
1227
- if (!p || p.rangeCount === 0)
1228
- return;
1229
- const B = p.getRangeAt(0);
1230
- if (!B.collapsed || !r.contains(B.commonAncestorContainer))
1231
- return;
1232
- const M = (L = We(B.startContainer)) == null ? void 0 : L.closest(".rte-conditional-body");
1233
- if (!M || !r.contains(M))
1234
- return;
1235
- if (t.key === "Backspace" && ke(B, M, "start")) {
1181
+ const m = window.getSelection();
1182
+ if (!m || m.rangeCount === 0) return;
1183
+ const v = m.getRangeAt(0);
1184
+ if (!v.collapsed || !r.contains(v.commonAncestorContainer)) return;
1185
+ const S = Ve(v.startContainer)?.closest(".rte-conditional-body");
1186
+ if (!S || !r.contains(S)) return;
1187
+ if (t.key === "Backspace" && we(v, S, "start")) {
1236
1188
  t.preventDefault();
1237
1189
  return;
1238
1190
  }
1239
- if (t.key === "Delete" && ke(B, M, "end")) {
1191
+ if (t.key === "Delete" && we(v, S, "end")) {
1240
1192
  t.preventDefault();
1241
1193
  return;
1242
1194
  }
1243
1195
  }
1244
1196
  }, document.addEventListener("keydown", G, !0)), J || (J = (t) => {
1245
1197
  const o = t.target;
1246
- if (!o || o.closest(`.${s}`))
1247
- return;
1248
- const i = o.closest(w);
1198
+ if (!o || o.closest(`.${u}`)) return;
1199
+ const i = o.closest(L);
1249
1200
  if (!i) {
1250
- y && F(y);
1201
+ g && I(g);
1251
1202
  return;
1252
1203
  }
1253
- if (H(i))
1254
- return;
1255
- y = i, x.has(i) || x.set(i, e);
1256
- const n = o.closest(q);
1204
+ if (k(i)) return;
1205
+ g = i, x.has(i) || x.set(i, e);
1206
+ const n = o.closest(H);
1257
1207
  if (!n) {
1258
- F(i);
1208
+ I(i);
1259
1209
  return;
1260
1210
  }
1261
1211
  requestAnimationFrame(() => {
@@ -1263,43 +1213,40 @@ function at(e) {
1263
1213
  });
1264
1214
  }, document.addEventListener("mousedown", J, !0)), Y || (Y = (t) => {
1265
1215
  const o = t.target;
1266
- if (!o || o.closest(`.${s}`))
1267
- return;
1268
- const i = o.closest(w);
1216
+ if (!o || o.closest(`.${u}`)) return;
1217
+ const i = o.closest(L);
1269
1218
  if (!i) {
1270
- y && F(y);
1219
+ g && I(g);
1271
1220
  return;
1272
1221
  }
1273
- if (H(i))
1274
- return;
1275
- y = i, x.has(i) || x.set(i, e);
1276
- const n = x.get(i) || e, a = o.closest(q), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1222
+ if (k(i)) return;
1223
+ g = i, x.has(i) || x.set(i, e);
1224
+ const n = x.get(i) || e, a = o.closest(H), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1277
1225
  if (a && r) {
1278
- t.preventDefault(), t.stopPropagation(), A(i, n, "edit", void 0, a), me(i, a);
1226
+ t.preventDefault(), t.stopPropagation(), C(i, n, "edit", void 0, a), me(i, a);
1279
1227
  return;
1280
1228
  }
1281
- a ? me(i, a) : F(i);
1229
+ a ? me(i, a) : I(i);
1282
1230
  }, document.addEventListener("click", Y, !0)), X || (X = () => {
1283
- const t = S(void 0, !1) || y;
1284
- t && t.isConnected && R(t);
1231
+ const t = A(void 0, !1) || g;
1232
+ t && t.isConnected && D(t);
1285
1233
  }, document.addEventListener("selectionchange", X)), Q || (Q = (t) => {
1286
- const o = t.target, i = o == null ? void 0 : o.closest(w);
1287
- if (!i)
1288
- return;
1234
+ const i = t.target?.closest(L);
1235
+ if (!i) return;
1289
1236
  const n = x.get(i) || ee || e;
1290
- ne(i, n.labels), R(i);
1291
- }, document.addEventListener("input", Q, !0)), P || (P = () => {
1292
- ot();
1293
- }, window.addEventListener("scroll", P, !0), window.addEventListener("resize", P));
1237
+ ne(i, n.labels), D(i);
1238
+ }, document.addEventListener("input", Q, !0)), N || (N = () => {
1239
+ tt();
1240
+ }, window.addEventListener("scroll", N, !0), window.addEventListener("resize", N));
1294
1241
  }
1295
- function rt() {
1296
- U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null), P && (window.removeEventListener("scroll", P, !0), window.removeEventListener("resize", P), P = null), j.forEach((e) => {
1242
+ function at() {
1243
+ U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null), N && (window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N), N = null), _.forEach((e) => {
1297
1244
  e.remove();
1298
- }), j.clear(), I.clear(), ee = null, y = null;
1245
+ }), _.clear(), z.clear(), ee = null, g = null;
1299
1246
  }
1300
- const lt = (e = {}) => {
1301
- const t = Ve(e);
1302
- return Ie(), {
1247
+ const rt = (e = {}) => {
1248
+ const t = je(e);
1249
+ return Fe(), {
1303
1250
  name: "conditionalContent",
1304
1251
  toolbar: [
1305
1252
  {
@@ -1327,77 +1274,69 @@ const lt = (e = {}) => {
1327
1274
  ],
1328
1275
  commands: {
1329
1276
  conditionalContent: (o, i) => {
1330
- const n = S(i);
1331
- if (!n || H(n))
1332
- return !1;
1333
- y = n, x.set(n, t), ne(n, t.labels);
1334
- const a = o == null ? void 0 : o.target;
1277
+ const n = A(i);
1278
+ if (!n || k(n)) return !1;
1279
+ g = n, x.set(n, t), ne(n, t.labels);
1280
+ const a = o?.target;
1335
1281
  if (a === "insert")
1336
- return A(n, t, "insert", o), !0;
1282
+ return C(n, t, "insert", o), !0;
1337
1283
  const r = W(n);
1338
- return a === "edit" || r ? !r && a === "edit" ? !1 : (A(n, t, "edit", o, r || void 0), !0) : (A(n, t, "insert", o), !0);
1284
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
1339
1285
  },
1340
1286
  openConditionalDialog: (o, i) => {
1341
- const n = S(i);
1342
- if (!n || H(n))
1343
- return !1;
1344
- y = n, x.set(n, t), ne(n, t.labels);
1345
- const a = o == null ? void 0 : o.target;
1287
+ const n = A(i);
1288
+ if (!n || k(n)) return !1;
1289
+ g = n, x.set(n, t), ne(n, t.labels);
1290
+ const a = o?.target;
1346
1291
  if (a === "insert")
1347
- return A(n, t, "insert", o), !0;
1292
+ return C(n, t, "insert", o), !0;
1348
1293
  const r = W(n);
1349
- return a === "edit" || r ? !r && a === "edit" ? !1 : (A(n, t, "edit", o, r || void 0), !0) : (A(n, t, "insert", o), !0);
1294
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
1350
1295
  },
1351
1296
  conditionalPreview: async (o, i) => {
1352
- const n = S(i);
1353
- if (!n)
1354
- return !1;
1355
- y = n, x.set(n, t);
1356
- const a = typeof o == "boolean" ? o : T.get(n) !== !0;
1357
- return await Z(n, t, a), R(n), !0;
1297
+ const n = A(i);
1298
+ if (!n) return !1;
1299
+ g = n, x.set(n, t);
1300
+ const a = typeof o == "boolean" ? o : w.get(n) !== !0;
1301
+ return await Z(n, t, a), D(n), !0;
1358
1302
  },
1359
1303
  editConditionalBlock: (o, i) => {
1360
- const n = S(i);
1361
- if (!n || H(n))
1362
- return !1;
1363
- y = n, x.set(n, t);
1304
+ const n = A(i);
1305
+ if (!n || k(n)) return !1;
1306
+ g = n, x.set(n, t);
1364
1307
  const a = W(n);
1365
- return a ? (A(n, t, "edit", o, a), !0) : !1;
1308
+ return a ? (C(n, t, "edit", o, a), !0) : !1;
1366
1309
  },
1367
1310
  deleteConditionalBlock: (o, i) => {
1368
- const n = S(i);
1369
- if (!n || H(n))
1370
- return !1;
1311
+ const n = A(i);
1312
+ if (!n || k(n)) return !1;
1371
1313
  const a = W(n);
1372
- if (!a)
1373
- return !1;
1374
- const r = Pe(n, a);
1375
- return r && R(n), r;
1314
+ if (!a) return !1;
1315
+ const r = Oe(n, a);
1316
+ return r && D(n), r;
1376
1317
  },
1377
1318
  insertConditionalBlock: (o, i) => {
1378
- const n = S(i);
1379
- if (!n || H(n))
1380
- return !1;
1381
- y = n, x.set(n, t);
1319
+ const n = A(i);
1320
+ if (!n || k(n)) return !1;
1321
+ g = n, x.set(n, t);
1382
1322
  const a = {
1383
- condition: (o == null ? void 0 : o.condition) ?? t.defaultCondition,
1384
- audience: (o == null ? void 0 : o.audience) ?? t.defaultAudience,
1385
- locale: (o == null ? void 0 : o.locale) ?? t.defaultLocale,
1386
- hasElse: (o == null ? void 0 : o.hasElse) ?? t.enableElseByDefault
1387
- }, r = Ne(a, t.labels);
1388
- return De(n, r), T.get(n) === !0 && Z(n, t, !0), !0;
1323
+ condition: o?.condition ?? t.defaultCondition,
1324
+ audience: o?.audience ?? t.defaultAudience,
1325
+ locale: o?.locale ?? t.defaultLocale,
1326
+ hasElse: o?.hasElse ?? t.enableElseByDefault
1327
+ }, r = Me(a, t.labels);
1328
+ return Ne(n, r), w.get(n) === !0 && Z(n, t, !0), !0;
1389
1329
  },
1390
1330
  toggleConditionalPreview: async (o, i) => {
1391
- const n = S(i);
1392
- if (!n)
1393
- return !1;
1394
- y = n, x.set(n, t);
1395
- const a = typeof o == "boolean" ? o : T.get(n) !== !0;
1331
+ const n = A(i);
1332
+ if (!n) return !1;
1333
+ g = n, x.set(n, t);
1334
+ const a = typeof o == "boolean" ? o : w.get(n) !== !0;
1396
1335
  return await Z(n, t, a), !0;
1397
1336
  },
1398
1337
  setConditionalContext: (o, i) => {
1399
- const n = S(i);
1400
- return n ? (y = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), T.get(n) === !0 && Z(n, t, !0), !0) : !1;
1338
+ const n = A(i);
1339
+ return n ? (g = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), w.get(n) === !0 && Z(n, t, !0), !0) : !1;
1401
1340
  }
1402
1341
  },
1403
1342
  keymap: {
@@ -1409,13 +1348,13 @@ const lt = (e = {}) => {
1409
1348
  F10: "toggleConditionalPreview"
1410
1349
  },
1411
1350
  init: () => {
1412
- se += 1, at(t);
1351
+ se += 1, it(t);
1413
1352
  },
1414
1353
  destroy: () => {
1415
- se = Math.max(0, se - 1), se === 0 && (Me(), rt());
1354
+ se = Math.max(0, se - 1), se === 0 && (Be(), at());
1416
1355
  }
1417
1356
  };
1418
1357
  };
1419
1358
  export {
1420
- lt as ConditionalContentPlugin
1359
+ rt as ConditionalContentPlugin
1421
1360
  };