@editora/plugins 1.0.9 → 1.0.10

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 (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1,4 +1,4 @@
1
- const S = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", fe = "__editoraCommandEditorRoot", he = "rte-doc-schema-styles", m = "rte-doc-schema-panel", v = "document-schema", T = "doc-schema", H = "docSchema", E = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Me = {
1
+ const S = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", fe = "__editoraCommandEditorRoot", he = "rte-doc-schema-styles", m = "rte-doc-schema-panel", E = "document-schema", T = "doc-schema", R = "docSchema", v = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Me = {
2
2
  panelTitle: "Document Schema",
3
3
  panelAriaLabel: "Document schema panel",
4
4
  schemaLabel: "Schema",
@@ -21,7 +21,7 @@ const S = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-ed
21
21
  unknownHeadingMessage: "Heading is not part of selected schema",
22
22
  insertedSummaryPrefix: "Inserted missing sections"
23
23
  }, u = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new Set();
24
- let W = 0, Ae = 0, ge = 0, w = null, p = null, q = null, z = null, B = null, R = null, K = null;
24
+ let W = 0, Ae = 0, ge = 0, w = null, p = null, q = null, z = null, B = null, H = null, K = null;
25
25
  function M(e) {
26
26
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
27
27
  }
@@ -31,7 +31,7 @@ function Le(e) {
31
31
  function P(e, t, n) {
32
32
  return Number.isFinite(e) ? Math.max(t, Math.min(n, e)) : t;
33
33
  }
34
- function xe(e) {
34
+ function ye(e) {
35
35
  return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
36
36
  }
37
37
  function ce(e, t) {
@@ -87,47 +87,51 @@ function pe() {
87
87
  }
88
88
  function Oe(e, t, n) {
89
89
  const r = n(e.title || "");
90
- if (!r) return null;
91
- const s = xe(n(e.id || r)) || `section-${t + 1}`, o = P(Number(e.minOccurrences ?? 1), 0, 20), a = Math.max(1, o), c = P(Number(e.maxOccurrences ?? a), o, 40), i = n(e.placeholder || ""), l = Array.isArray(e.aliases) ? e.aliases.map((y) => n(y)).filter(Boolean) : [], d = [r, ...l].map((y) => ce(y, n)).filter(Boolean);
90
+ if (!r)
91
+ return null;
92
+ const s = ye(n(e.id || r)) || `section-${t + 1}`, o = P(Number(e.minOccurrences ?? 1), 0, 20), a = Math.max(1, o), l = P(Number(e.maxOccurrences ?? a), o, 40), c = n(e.placeholder || ""), i = Array.isArray(e.aliases) ? e.aliases.map((x) => n(x)).filter(Boolean) : [], d = [r, ...i].map((x) => ce(x, n)).filter(Boolean);
92
93
  return {
93
94
  id: s,
94
95
  title: r,
95
96
  minOccurrences: o,
96
- maxOccurrences: c,
97
- placeholder: i,
97
+ maxOccurrences: l,
98
+ placeholder: c,
98
99
  matchKeys: Array.from(new Set(d))
99
100
  };
100
101
  }
101
102
  function Se(e, t) {
102
103
  const n = Array.isArray(e) && e.length > 0 ? e : pe(), r = [], s = /* @__PURE__ */ new Set();
103
104
  return n.forEach((o, a) => {
104
- const c = t(o.label || "");
105
- if (!c) return;
106
- const i = xe(t(o.id || c)) || `schema-${a + 1}`;
107
- let l = i, d = 1;
108
- for (; s.has(l); )
109
- l = `${i}-${d++}`;
110
- s.add(l);
111
- const y = Array.isArray(o.sections) ? o.sections : [], f = [], k = /* @__PURE__ */ new Set();
112
- if (y.forEach(($, h) => {
113
- const x = Oe($, h, t);
114
- if (!x) return;
115
- let N = x.id, Ie = 1;
105
+ const l = t(o.label || "");
106
+ if (!l)
107
+ return;
108
+ const c = ye(t(o.id || l)) || `schema-${a + 1}`;
109
+ let i = c, d = 1;
110
+ for (; s.has(i); )
111
+ i = `${c}-${d++}`;
112
+ s.add(i);
113
+ const x = Array.isArray(o.sections) ? o.sections : [], f = [], k = /* @__PURE__ */ new Set();
114
+ if (x.forEach(($, h) => {
115
+ const y = Oe($, h, t);
116
+ if (!y)
117
+ return;
118
+ let N = y.id, Ie = 1;
116
119
  for (; k.has(N); )
117
- N = `${x.id}-${Ie++}`;
120
+ N = `${y.id}-${Ie++}`;
118
121
  k.add(N), f.push({
119
- ...x,
122
+ ...y,
120
123
  id: N
121
124
  });
122
- }), f.length === 0) return;
125
+ }), f.length === 0)
126
+ return;
123
127
  const O = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
124
128
  f.forEach(($, h) => {
125
- A.set($.id, h), $.matchKeys.forEach((x) => {
126
- O.has(x) || O.set(x, $);
129
+ A.set($.id, h), $.matchKeys.forEach((y) => {
130
+ O.has(y) || O.set(y, $);
127
131
  });
128
132
  }), r.push({
129
- id: l,
130
- label: c,
133
+ id: i,
134
+ label: l,
131
135
  description: t(o.description || ""),
132
136
  strictOrder: o.strictOrder !== !1,
133
137
  allowUnknownHeadings: !!o.allowUnknownHeadings,
@@ -138,7 +142,8 @@ function Se(e, t) {
138
142
  }), r.length > 0 ? r : Se(pe(), t);
139
143
  }
140
144
  function Z(e = {}) {
141
- const t = e.normalizeText || Le, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((o) => o.id === r) ? r : n[0]?.id || null;
145
+ var o;
146
+ const t = e.normalizeText || Le, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((a) => a.id === r) ? r : ((o = n[0]) == null ? void 0 : o.id) || null;
142
147
  return {
143
148
  schemas: n,
144
149
  defaultSchemaId: s,
@@ -152,7 +157,7 @@ function Z(e = {}) {
152
157
  normalizeText: t
153
158
  };
154
159
  }
155
- function He(e) {
160
+ function Re(e) {
156
161
  return {
157
162
  schemas: e.schemas.map((t) => ({
158
163
  id: t.id,
@@ -180,22 +185,28 @@ function le(e) {
180
185
  return e.closest(ie) || e;
181
186
  }
182
187
  function U(e) {
183
- if (!e) return null;
184
- if (e.matches(S)) return e;
188
+ if (!e)
189
+ return null;
190
+ if (e.matches(S))
191
+ return e;
185
192
  const t = e.querySelector(S);
186
193
  return t instanceof HTMLElement ? t : null;
187
194
  }
188
- function Re() {
189
- if (typeof window > "u") return null;
195
+ function He() {
196
+ if (typeof window > "u")
197
+ return null;
190
198
  const e = window[fe];
191
- if (!(e instanceof HTMLElement)) return null;
199
+ if (!(e instanceof HTMLElement))
200
+ return null;
192
201
  window[fe] = null;
193
202
  const t = U(e);
194
- if (t) return t;
203
+ if (t)
204
+ return t;
195
205
  const n = e.closest(ie);
196
206
  if (n) {
197
207
  const s = U(n);
198
- if (s) return s;
208
+ if (s)
209
+ return s;
199
210
  }
200
211
  const r = e.closest(S);
201
212
  return r instanceof HTMLElement ? r : null;
@@ -212,7 +223,7 @@ function De(e) {
212
223
  }
213
224
  return le(e);
214
225
  }
215
- function ye(e) {
226
+ function xe(e) {
216
227
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
217
228
  }
218
229
  function Y(e) {
@@ -220,7 +231,8 @@ function Y(e) {
220
231
  }
221
232
  function Ne(e) {
222
233
  const t = le(e);
223
- if (Y(t)) return !0;
234
+ if (Y(t))
235
+ return !0;
224
236
  const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
225
237
  return Y(n) ? !0 : Y(document.documentElement) || Y(document.body);
226
238
  }
@@ -228,14 +240,16 @@ function oe(e, t) {
228
240
  e.classList.remove("rte-doc-schema-theme-dark"), Ne(t) && e.classList.add("rte-doc-schema-theme-dark");
229
241
  }
230
242
  function Pe(e) {
231
- for (let t = 0; t < e.length; t += 1) {
232
- const n = e[t];
233
- if (!(n.type !== "childList" || n.removedNodes.length === 0))
234
- for (let r = 0; r < n.removedNodes.length; r += 1) {
235
- const s = n.removedNodes[r];
236
- if (s.nodeType !== Node.ELEMENT_NODE) continue;
237
- const o = s;
238
- if (o.matches?.(S) || o.matches?.(`.${m}`) || o.querySelector?.(S) || o.querySelector?.(`.${m}`))
243
+ var t, n, r, s;
244
+ for (let o = 0; o < e.length; o += 1) {
245
+ const a = e[o];
246
+ if (!(a.type !== "childList" || a.removedNodes.length === 0))
247
+ for (let l = 0; l < a.removedNodes.length; l += 1) {
248
+ const c = a.removedNodes[l];
249
+ if (c.nodeType !== Node.ELEMENT_NODE)
250
+ continue;
251
+ const i = c;
252
+ if ((t = i.matches) != null && t.call(i, S) || (n = i.matches) != null && n.call(i, `.${m}`) || (r = i.querySelector) != null && r.call(i, S) || (s = i.querySelector) != null && s.call(i, `.${m}`))
239
253
  return !0;
240
254
  }
241
255
  }
@@ -247,29 +261,37 @@ function Q() {
247
261
  });
248
262
  }
249
263
  function I(e, t = !0, n = !0) {
250
- if (Q(), e?.contentElement instanceof HTMLElement) return e.contentElement;
251
- if (e?.editorElement instanceof HTMLElement) {
264
+ var l;
265
+ if (Q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
266
+ return e.contentElement;
267
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
252
268
  const c = U(e.editorElement);
253
- if (c) return c;
269
+ if (c)
270
+ return c;
254
271
  }
255
- const r = Re();
256
- if (r) return r;
272
+ const r = He();
273
+ if (r)
274
+ return r;
257
275
  const s = window.getSelection();
258
276
  if (s && s.rangeCount > 0) {
259
- const c = ye(s.getRangeAt(0).startContainer)?.closest(
277
+ const c = (l = xe(s.getRangeAt(0).startContainer)) == null ? void 0 : l.closest(
260
278
  S
261
279
  );
262
- if (c) return c;
280
+ if (c)
281
+ return c;
263
282
  }
264
283
  const o = document.activeElement;
265
284
  if (o) {
266
- if (o.matches(S)) return o;
285
+ if (o.matches(S))
286
+ return o;
267
287
  const c = o.closest(S);
268
- if (c) return c;
288
+ if (c)
289
+ return c;
269
290
  }
270
291
  if (n && p && p.isConnected)
271
292
  return p;
272
- if (!t) return null;
293
+ if (!t)
294
+ return null;
273
295
  const a = document.querySelector(S);
274
296
  return a instanceof HTMLElement ? a : null;
275
297
  }
@@ -279,20 +301,24 @@ function _e(e) {
279
301
  const r = t.closest(`.${m}`);
280
302
  if (r) {
281
303
  const o = Array.from(b.entries()).find(([, a]) => a === r);
282
- if (o) return o[0];
304
+ if (o)
305
+ return o[0];
283
306
  }
284
307
  const s = t.closest(S);
285
- if (s) return s;
308
+ if (s)
309
+ return s;
286
310
  }
287
311
  const n = document.activeElement;
288
312
  if (n) {
289
313
  const r = n.closest(`.${m}`);
290
314
  if (r) {
291
315
  const o = Array.from(b.entries()).find(([, a]) => a === r);
292
- if (o) return o[0];
316
+ if (o)
317
+ return o[0];
293
318
  }
294
319
  const s = n.closest(S);
295
- if (s) return s;
320
+ if (s)
321
+ return s;
296
322
  }
297
323
  return null;
298
324
  }
@@ -314,7 +340,8 @@ function L(e, t) {
314
340
  return t && e.schemas.find((n) => n.id === t) || null;
315
341
  }
316
342
  function re(e) {
317
- return e.defaultSchemaId || e.schemas[0]?.id || null;
343
+ var t;
344
+ return e.defaultSchemaId || ((t = e.schemas[0]) == null ? void 0 : t.id) || null;
318
345
  }
319
346
  function g(e, t) {
320
347
  u.has(e) || u.set(e, t);
@@ -331,16 +358,18 @@ function g(e, t) {
331
358
  }, j.set(e, n)), (!n.activeSchemaId || !L(t, n.activeSchemaId)) && (n.activeSchemaId = re(t)), ne.add(e), n;
332
359
  }
333
360
  function ue(e) {
334
- de(e), b.get(e)?.remove(), b.delete(e), F.delete(e), u.delete(e), X.delete(e), j.delete(e), ne.delete(e), p === e && (p = null);
361
+ var t;
362
+ de(e), (t = b.get(e)) == null || t.remove(), b.delete(e), F.delete(e), u.delete(e), X.delete(e), j.delete(e), ne.delete(e), p === e && (p = null);
335
363
  }
336
364
  function me(e) {
337
365
  return F.get(e) === !0;
338
366
  }
339
- function ve(e) {
367
+ function Ee(e) {
340
368
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
341
369
  }
342
370
  function se(e, t) {
343
- if (!t.classList.contains("show")) return;
371
+ if (!t.classList.contains("show"))
372
+ return;
344
373
  const n = le(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 440), s = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, n.right - r), s), a = Math.max(10, Math.min(window.innerHeight - 10, n.top + 12));
345
374
  t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${a}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
346
375
  }
@@ -352,52 +381,58 @@ function qe(e, t) {
352
381
  const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), r = [];
353
382
  return n.forEach((s, o) => {
354
383
  const a = t(s.textContent || "");
355
- if (!a) return;
356
- const c = Number(s.tagName.slice(1)) || 0, i = ce(a, t);
384
+ if (!a)
385
+ return;
386
+ const l = Number(s.tagName.slice(1)) || 0, c = ce(a, t);
357
387
  r.push({
358
388
  text: a,
359
- key: i,
389
+ key: c,
360
390
  index: o,
361
- level: c
391
+ level: l
362
392
  });
363
393
  }), r;
364
394
  }
365
- function Ee(e, t, n) {
395
+ function ve(e, t, n) {
366
396
  const r = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), s = [];
367
397
  return r.forEach((o) => {
368
398
  const a = n(o.textContent || "");
369
- if (!a) return;
370
- const c = ce(a, n), i = c && t.matchKeyToSection.get(c) || null, l = i ? t.orderBySectionId.get(i.id) ?? null : null, d = P(Number(o.tagName.slice(1)) || 0, 1, 6);
399
+ if (!a)
400
+ return;
401
+ const l = ce(a, n), c = l && t.matchKeyToSection.get(l) || null, i = c ? t.orderBySectionId.get(c.id) ?? null : null, d = P(Number(o.tagName.slice(1)) || 0, 1, 6);
371
402
  s.push({
372
403
  element: o,
373
404
  level: d,
374
- section: i,
375
- order: l
405
+ section: c,
406
+ order: i
376
407
  });
377
408
  }), s;
378
409
  }
379
410
  function ze(e, t = 2) {
380
- const n = e.filter((i) => i.section).map((i) => i.level), r = n.length > 0 ? n : e.map((i) => i.level);
381
- if (r.length === 0) return t;
411
+ const n = e.filter((c) => c.section).map((c) => c.level), r = n.length > 0 ? n : e.map((c) => c.level);
412
+ if (r.length === 0)
413
+ return t;
382
414
  const s = /* @__PURE__ */ new Map();
383
- r.forEach((i, l) => {
384
- s.has(i) || s.set(i, { count: 0, firstIndex: l });
385
- const d = s.get(i);
415
+ r.forEach((c, i) => {
416
+ s.has(c) || s.set(c, { count: 0, firstIndex: i });
417
+ const d = s.get(c);
386
418
  d.count += 1;
387
419
  });
388
- let o = t, a = -1, c = Number.MAX_SAFE_INTEGER;
389
- return s.forEach((i, l) => {
390
- (i.count > a || i.count === a && i.firstIndex < c || i.count === a && i.firstIndex === c && l < o) && (o = l, a = i.count, c = i.firstIndex);
420
+ let o = t, a = -1, l = Number.MAX_SAFE_INTEGER;
421
+ return s.forEach((c, i) => {
422
+ (c.count > a || c.count === a && c.firstIndex < l || c.count === a && c.firstIndex === l && i < o) && (o = i, a = c.count, l = c.firstIndex);
391
423
  }), P(o, 1, 6);
392
424
  }
393
425
  function Be(e) {
426
+ var o;
394
427
  const t = window.getSelection();
395
- if (!t || t.rangeCount === 0) return null;
428
+ if (!t || t.rangeCount === 0)
429
+ return null;
396
430
  const n = t.getRangeAt(0);
397
- if (ye(n.startContainer)?.closest(S) !== e) return null;
431
+ if (((o = xe(n.startContainer)) == null ? void 0 : o.closest(S)) !== e)
432
+ return null;
398
433
  if (n.startContainer.nodeType === Node.ELEMENT_NODE) {
399
- const o = n.startContainer, a = o.childNodes[n.startOffset] || null;
400
- return { parent: o, referenceNode: a };
434
+ const a = n.startContainer, l = a.childNodes[n.startOffset] || null;
435
+ return { parent: a, referenceNode: l };
401
436
  }
402
437
  const s = n.startContainer.parentNode;
403
438
  return s ? {
@@ -406,7 +441,8 @@ function Be(e) {
406
441
  } : null;
407
442
  }
408
443
  function Ke(e, t, n, r) {
409
- const s = Ee(e, n, r), o = n.orderBySectionId.get(t.id);
444
+ var c;
445
+ const s = ve(e, n, r), o = n.orderBySectionId.get(t.id);
410
446
  if (typeof o != "number" || s.length === 0)
411
447
  return { parent: e, referenceNode: null };
412
448
  const a = s.find((i) => typeof i.order == "number" && i.order > o);
@@ -415,15 +451,15 @@ function Ke(e, t, n, r) {
415
451
  parent: a.element.parentNode,
416
452
  referenceNode: a.element
417
453
  };
418
- let c = -1;
454
+ let l = -1;
419
455
  for (let i = 0; i < s.length; i += 1) {
420
- const l = s[i];
421
- typeof l.order == "number" && l.order < o && (c = i);
456
+ const d = s[i];
457
+ typeof d.order == "number" && d.order < o && (l = i);
422
458
  }
423
- if (c >= 0) {
424
- const i = s[c + 1]?.element || null;
459
+ if (l >= 0) {
460
+ const i = ((c = s[l + 1]) == null ? void 0 : c.element) || null;
425
461
  return {
426
- parent: i?.parentNode || s[c].element.parentNode || e,
462
+ parent: (i == null ? void 0 : i.parentNode) || s[l].element.parentNode || e,
427
463
  referenceNode: i
428
464
  };
429
465
  }
@@ -432,8 +468,8 @@ function Ke(e, t, n, r) {
432
468
  function Ve(e, t, n, r) {
433
469
  const s = e.ownerDocument || document, o = `h${P(r, 1, 6)}`, a = s.createElement(o);
434
470
  a.setAttribute("data-doc-schema-section", t.id), a.textContent = t.title;
435
- const c = s.createElement("p");
436
- return c.textContent = t.placeholder || n.labels.defaultPlaceholderText, [a, c];
471
+ const l = s.createElement("p");
472
+ return l.textContent = t.placeholder || n.labels.defaultPlaceholderText, [a, l];
437
473
  }
438
474
  function V(e, t, n, r = {}) {
439
475
  return ge += 1, {
@@ -449,58 +485,59 @@ function J(e, t, n) {
449
485
  }
450
486
  function je(e, t, n) {
451
487
  const r = qe(e, n.normalizeText), s = [], o = /* @__PURE__ */ new Map(), a = [];
452
- for (let i = 0; i < r.length && !(s.length >= n.maxIssues); i += 1) {
453
- const l = r[i];
454
- if (!l.key) continue;
455
- const d = t.matchKeyToSection.get(l.key);
488
+ for (let c = 0; c < r.length && !(s.length >= n.maxIssues); c += 1) {
489
+ const i = r[c];
490
+ if (!i.key)
491
+ continue;
492
+ const d = t.matchKeyToSection.get(i.key);
456
493
  if (d) {
457
- o.set(d.id, (o.get(d.id) || 0) + 1), a.push({ section: d, heading: l });
494
+ o.set(d.id, (o.get(d.id) || 0) + 1), a.push({ section: d, heading: i });
458
495
  continue;
459
496
  }
460
497
  t.allowUnknownHeadings || s.push(
461
498
  V(
462
499
  "unknown-heading",
463
500
  "warning",
464
- J(n.labels.unknownHeadingMessage, null, l.text),
501
+ J(n.labels.unknownHeadingMessage, null, i.text),
465
502
  {
466
- headingText: l.text,
503
+ headingText: i.text,
467
504
  suggestion: "Map this heading to a schema alias or remove it from strict structure mode."
468
505
  }
469
506
  )
470
507
  );
471
508
  }
472
- let c = 0;
473
- for (let i = 0; i < t.sections.length && !(s.length >= n.maxIssues); i += 1) {
474
- const l = t.sections[i], d = o.get(l.id) || 0;
475
- d < l.minOccurrences && (c += 1, s.push(
509
+ let l = 0;
510
+ for (let c = 0; c < t.sections.length && !(s.length >= n.maxIssues); c += 1) {
511
+ const i = t.sections[c], d = o.get(i.id) || 0;
512
+ d < i.minOccurrences && (l += 1, s.push(
476
513
  V(
477
514
  "missing-section",
478
515
  "error",
479
- J(n.labels.missingSectionMessage, l.title, null),
516
+ J(n.labels.missingSectionMessage, i.title, null),
480
517
  {
481
- sectionId: l.id,
482
- sectionTitle: l.title,
483
- suggestion: `Add heading "${l.title}" to satisfy schema requirements.`
518
+ sectionId: i.id,
519
+ sectionTitle: i.title,
520
+ suggestion: `Add heading "${i.title}" to satisfy schema requirements.`
484
521
  }
485
522
  )
486
- )), d > l.maxOccurrences && s.length < n.maxIssues && s.push(
523
+ )), d > i.maxOccurrences && s.length < n.maxIssues && s.push(
487
524
  V(
488
525
  "duplicate-section",
489
526
  "warning",
490
- J(n.labels.duplicateSectionMessage, l.title, null),
527
+ J(n.labels.duplicateSectionMessage, i.title, null),
491
528
  {
492
- sectionId: l.id,
493
- sectionTitle: l.title,
494
- suggestion: `Keep at most ${l.maxOccurrences} instance(s) of "${l.title}".`
529
+ sectionId: i.id,
530
+ sectionTitle: i.title,
531
+ suggestion: `Keep at most ${i.maxOccurrences} instance(s) of "${i.title}".`
495
532
  }
496
533
  )
497
534
  );
498
535
  }
499
536
  if (t.strictOrder && s.length < n.maxIssues) {
500
- let i = -1;
501
- for (let l = 0; l < a.length && !(s.length >= n.maxIssues); l += 1) {
502
- const d = a[l], y = t.orderBySectionId.get(d.section.id) ?? l;
503
- y < i ? s.push(
537
+ let c = -1;
538
+ for (let i = 0; i < a.length && !(s.length >= n.maxIssues); i += 1) {
539
+ const d = a[i], x = t.orderBySectionId.get(d.section.id) ?? i;
540
+ x < c ? s.push(
504
541
  V(
505
542
  "out-of-order",
506
543
  "warning",
@@ -512,63 +549,65 @@ function je(e, t, n) {
512
549
  suggestion: `Move "${d.section.title}" after earlier required sections.`
513
550
  }
514
551
  )
515
- ) : i = y;
552
+ ) : c = x;
516
553
  }
517
554
  }
518
555
  return {
519
556
  issues: s,
520
557
  headingCount: r.length,
521
558
  recognizedHeadingCount: a.length,
522
- missingCount: c
559
+ missingCount: l
523
560
  };
524
561
  }
525
562
  function we(e) {
526
- const t = u.get(e) || w, n = j.get(e), r = t ? L(t, n?.activeSchemaId || null) : null;
563
+ const t = u.get(e) || w, n = j.get(e), r = t ? L(t, (n == null ? void 0 : n.activeSchemaId) || null) : null;
527
564
  return {
528
- activeSchemaId: n?.activeSchemaId || null,
529
- activeSchemaLabel: r?.label || null,
530
- realtimeEnabled: n?.realtimeEnabled === !0,
531
- issues: n?.issues ? n.issues.map((s) => ({ ...s })) : [],
532
- headingCount: n?.headingCount || 0,
533
- recognizedHeadingCount: n?.recognizedHeadingCount || 0,
534
- missingCount: n?.missingCount || 0,
535
- lastRunAt: n?.lastRunAt || null
565
+ activeSchemaId: (n == null ? void 0 : n.activeSchemaId) || null,
566
+ activeSchemaLabel: (r == null ? void 0 : r.label) || null,
567
+ realtimeEnabled: (n == null ? void 0 : n.realtimeEnabled) === !0,
568
+ issues: n != null && n.issues ? n.issues.map((s) => ({ ...s })) : [],
569
+ headingCount: (n == null ? void 0 : n.headingCount) || 0,
570
+ recognizedHeadingCount: (n == null ? void 0 : n.recognizedHeadingCount) || 0,
571
+ missingCount: (n == null ? void 0 : n.missingCount) || 0,
572
+ lastRunAt: (n == null ? void 0 : n.lastRunAt) || null
536
573
  };
537
574
  }
538
575
  function D(e) {
539
576
  const t = j.get(e);
540
- be(e, "toggleDocSchemaPanel", me(e)), be(e, "toggleDocSchemaRealtime", t?.realtimeEnabled === !0);
577
+ be(e, "toggleDocSchemaPanel", me(e)), be(e, "toggleDocSchemaRealtime", (t == null ? void 0 : t.realtimeEnabled) === !0);
541
578
  }
542
579
  function _(e) {
543
580
  const t = b.get(e);
544
- if (!t) return;
581
+ if (!t)
582
+ return;
545
583
  const n = u.get(e) || w;
546
- if (!n) return;
584
+ if (!n)
585
+ return;
547
586
  const r = g(e, n), s = L(n, r.activeSchemaId), o = t.querySelector(".rte-doc-schema-label");
548
587
  o && (o.textContent = n.labels.schemaLabel);
549
588
  const a = t.querySelector('[data-field="schema"]');
550
589
  a && (a.innerHTML = n.schemas.map((h) => `<option value="${M(h.id)}">${M(h.label)}</option>`).join(""), a.value = r.activeSchemaId || "");
551
- const c = t.querySelector(".rte-doc-schema-description");
552
- if (c) {
553
- const h = s?.description || "";
554
- c.textContent = h ? `${n.labels.schemaDescriptionPrefix}: ${h}` : "", c.hidden = !h;
590
+ const l = t.querySelector(".rte-doc-schema-description");
591
+ if (l) {
592
+ const h = (s == null ? void 0 : s.description) || "";
593
+ l.textContent = h ? `${n.labels.schemaDescriptionPrefix}: ${h}` : "", l.hidden = !h;
555
594
  }
556
- const i = t.querySelector(".rte-doc-schema-summary");
557
- if (i) {
558
- const h = s?.label || "N/A", x = r.issues.length;
559
- i.textContent = `${n.labels.summaryPrefix}: ${h} • ${x} issue${x === 1 ? "" : "s"}`;
595
+ const c = t.querySelector(".rte-doc-schema-summary");
596
+ if (c) {
597
+ const h = (s == null ? void 0 : s.label) || "N/A", y = r.issues.length;
598
+ c.textContent = `${n.labels.summaryPrefix}: ${h} • ${y} issue${y === 1 ? "" : "s"}`;
560
599
  }
561
- const l = t.querySelector(".rte-doc-schema-helper");
562
- l && (l.textContent = n.labels.helperText);
600
+ const i = t.querySelector(".rte-doc-schema-helper");
601
+ i && (i.textContent = n.labels.helperText);
563
602
  const d = t.querySelector(".rte-doc-schema-shortcut");
564
603
  d && (d.textContent = n.labels.shortcutText);
565
- const y = t.querySelector('[data-action="run-validation"]');
566
- y && (y.textContent = n.labels.validateText);
604
+ const x = t.querySelector('[data-action="run-validation"]');
605
+ x && (x.textContent = n.labels.validateText);
567
606
  const f = t.querySelector('[data-action="insert-missing"]');
568
607
  if (f) {
569
608
  f.textContent = n.labels.insertMissingText;
570
- const h = r.issues.some((x) => x.type === "missing-section");
571
- f.disabled = !h || ve(e);
609
+ const h = r.issues.some((y) => y.type === "missing-section");
610
+ f.disabled = !h || Ee(e);
572
611
  }
573
612
  const k = t.querySelector('[data-action="toggle-realtime"]');
574
613
  k && (k.textContent = r.realtimeEnabled ? n.labels.realtimeOnText : n.labels.realtimeOffText, k.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
@@ -576,9 +615,9 @@ function _(e) {
576
615
  O && O.setAttribute("aria-label", n.labels.closeText);
577
616
  const A = t.querySelector(".rte-doc-schema-issues"), $ = t.querySelector(".rte-doc-schema-empty");
578
617
  A && (A.setAttribute("aria-label", n.labels.issueListLabel), r.issues.length === 0 ? (A.innerHTML = "", $ && ($.hidden = !1, $.textContent = n.labels.noIssuesText)) : ($ && ($.hidden = !0), A.innerHTML = r.issues.map((h) => {
579
- const x = h.severity === "error" ? "error" : h.severity === "warning" ? "warning" : "info", N = h.sectionTitle || h.headingText || "";
618
+ const y = h.severity === "error" ? "error" : h.severity === "warning" ? "warning" : "info", N = h.sectionTitle || h.headingText || "";
580
619
  return `
581
- <li class="rte-doc-schema-issue ${x}" role="listitem">
620
+ <li class="rte-doc-schema-issue ${y}" role="listitem">
582
621
  <p class="rte-doc-schema-issue-message">${M(h.message)}${N ? `: <strong>${M(N)}</strong>` : ""}</p>
583
622
  ${h.suggestion ? `<p class="rte-doc-schema-issue-suggestion">${M(h.suggestion)}</p>` : ""}
584
623
  </li>
@@ -593,14 +632,17 @@ function ae(e) {
593
632
  const t = Fe(e);
594
633
  b.forEach((r, s) => {
595
634
  s !== e && G(s, !1);
596
- }), t.classList.add("show"), F.set(e, !0), _(e), se(e, t), D(e), t.querySelector('[data-field="schema"]')?.focus(), C(e, "panel-open", !1);
635
+ }), t.classList.add("show"), F.set(e, !0), _(e), se(e, t), D(e);
636
+ const n = t.querySelector('[data-field="schema"]');
637
+ n == null || n.focus(), C(e, "panel-open", !1);
597
638
  }
598
639
  function ke(e, t) {
599
640
  const n = me(e);
600
641
  return (typeof t == "boolean" ? t : !n) ? ae(e) : G(e, !1), !0;
601
642
  }
602
643
  function Ue(e, t) {
603
- if (t === e.innerHTML) return;
644
+ if (t === e.innerHTML)
645
+ return;
604
646
  const n = window.execEditorCommand || window.executeEditorCommand;
605
647
  if (typeof n == "function")
606
648
  try {
@@ -613,19 +655,20 @@ function Ge(e) {
613
655
  }
614
656
  function C(e, t, n) {
615
657
  const r = u.get(e) || w;
616
- if (!r) return [];
658
+ if (!r)
659
+ return [];
617
660
  const s = g(e, r), o = b.get(e), a = e.innerHTML;
618
661
  if (!n && s.snapshot === a)
619
662
  return s.issues;
620
- const c = L(r, s.activeSchemaId);
621
- if (!c)
663
+ const l = L(r, s.activeSchemaId);
664
+ if (!l)
622
665
  return s.issues = [
623
666
  V("missing-section", "error", "No active schema is configured for this editor.", {
624
667
  suggestion: "Set `defaultSchemaId` or update schema options."
625
668
  })
626
669
  ], s.headingCount = 0, s.recognizedHeadingCount = 0, s.missingCount = 1, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), s.issues;
627
- const i = je(e, c, r);
628
- return s.issues = i.issues, s.headingCount = i.headingCount, s.recognizedHeadingCount = i.recognizedHeadingCount, s.missingCount = i.missingCount, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), e.dispatchEvent(
670
+ const c = je(e, l, r);
671
+ return s.issues = c.issues, s.headingCount = c.headingCount, s.recognizedHeadingCount = c.recognizedHeadingCount, s.missingCount = c.missingCount, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), e.dispatchEvent(
629
672
  new CustomEvent("editora:doc-schema-validation", {
630
673
  bubbles: !0,
631
674
  detail: {
@@ -635,12 +678,13 @@ function C(e, t, n) {
635
678
  })
636
679
  ), o && ee(
637
680
  o,
638
- i.issues.length === 0 ? r.labels.noIssuesText : `${i.issues.length} issue${i.issues.length === 1 ? "" : "s"} detected.`
681
+ c.issues.length === 0 ? r.labels.noIssuesText : `${c.issues.length} issue${c.issues.length === 1 ? "" : "s"} detected.`
639
682
  ), s.issues;
640
683
  }
641
684
  function $e(e) {
642
685
  const t = u.get(e) || w;
643
- if (!t) return;
686
+ if (!t)
687
+ return;
644
688
  de(e);
645
689
  const n = window.setTimeout(() => {
646
690
  te.delete(e), C(e, "realtime", !1);
@@ -649,18 +693,21 @@ function $e(e) {
649
693
  }
650
694
  function Ce(e, t) {
651
695
  const n = u.get(e) || w;
652
- if (!n) return !1;
696
+ if (!n)
697
+ return !1;
653
698
  const r = g(e, n), s = typeof t == "boolean" ? t : !r.realtimeEnabled;
654
699
  return r.realtimeEnabled = s, s ? $e(e) : de(e), _(e), D(e), !0;
655
700
  }
656
701
  function Te(e) {
657
702
  const t = u.get(e) || w;
658
- if (!t) return !1;
703
+ if (!t)
704
+ return !1;
659
705
  const n = g(e, t), r = b.get(e);
660
- if (ve(e))
706
+ if (Ee(e))
661
707
  return r && ee(r, t.labels.readonlyMessage), !1;
662
708
  const s = L(t, n.activeSchemaId);
663
- if (!s) return !1;
709
+ if (!s)
710
+ return !1;
664
711
  C(e, "insert-missing-pre", !0);
665
712
  const o = Array.from(
666
713
  new Set(
@@ -669,12 +716,12 @@ function Te(e) {
669
716
  ), a = s.sections.filter((f) => o.includes(f.id));
670
717
  if (a.length === 0)
671
718
  return r && ee(r, t.labels.noIssuesText), !1;
672
- const c = e.innerHTML, i = Ee(e, s, t.normalizeText), l = ze(i, 2), d = Be(e);
719
+ const l = e.innerHTML, c = ve(e, s, t.normalizeText), i = ze(c, 2), d = Be(e);
673
720
  a.forEach((f) => {
674
- const k = s.strictOrder ? Ke(e, f, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = Ve(e, f, t, l);
721
+ const k = s.strictOrder ? Ke(e, f, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = Ve(e, f, t, i);
675
722
  k.parent.insertBefore(O, k.referenceNode), k.parent.insertBefore(A, k.referenceNode);
676
- }), Ue(e, c), Ge(e), C(e, "insert-missing-post", !0);
677
- const y = a.map((f) => f.title).join(", ");
723
+ }), Ue(e, l), Ge(e), C(e, "insert-missing-post", !0);
724
+ const x = a.map((f) => f.title).join(", ");
678
725
  return e.dispatchEvent(
679
726
  new CustomEvent("editora:doc-schema-insert-missing", {
680
727
  bubbles: !0,
@@ -683,11 +730,12 @@ function Te(e) {
683
730
  sectionIds: a.map((f) => f.id)
684
731
  }
685
732
  })
686
- ), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${y}`), !0;
733
+ ), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${x}`), !0;
687
734
  }
688
735
  function Fe(e) {
689
736
  const t = b.get(e);
690
- if (t) return t;
737
+ if (t)
738
+ return t;
691
739
  const n = u.get(e) || w || Z();
692
740
  g(e, n);
693
741
  const r = `rte-doc-schema-panel-${Ae++}`, s = `${r}-schema`, o = document.createElement("section");
@@ -717,29 +765,32 @@ function Fe(e) {
717
765
  </div>
718
766
  <div class="rte-doc-schema-live" aria-live="polite" aria-atomic="true"></div>
719
767
  `, o.addEventListener("click", (a) => {
720
- const i = a.target?.closest("[data-action]");
721
- if (!i) return;
722
- const l = i.getAttribute("data-action");
723
- if (l === "close") {
768
+ const l = a.target, c = l == null ? void 0 : l.closest("[data-action]");
769
+ if (!c)
770
+ return;
771
+ const i = c.getAttribute("data-action");
772
+ if (i === "close") {
724
773
  G(e, !0);
725
774
  return;
726
775
  }
727
- if (l === "run-validation") {
776
+ if (i === "run-validation") {
728
777
  C(e, "panel-button", !0);
729
778
  return;
730
779
  }
731
- if (l === "insert-missing") {
780
+ if (i === "insert-missing") {
732
781
  Te(e);
733
782
  return;
734
783
  }
735
- l === "toggle-realtime" && Ce(e);
784
+ i === "toggle-realtime" && Ce(e);
736
785
  }), o.addEventListener("change", (a) => {
737
- const c = a.target;
738
- if (!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "schema") return;
739
- const i = u.get(e) || w;
740
- if (!i) return;
741
- const l = g(e, i), d = c.value;
742
- L(i, d) && (l.activeSchemaId = d, l.snapshot = "", C(e, "schema-change", !0));
786
+ const l = a.target;
787
+ if (!(l instanceof HTMLSelectElement) || l.getAttribute("data-field") !== "schema")
788
+ return;
789
+ const c = u.get(e) || w;
790
+ if (!c)
791
+ return;
792
+ const i = g(e, c), d = l.value;
793
+ L(c, d) && (i.activeSchemaId = d, i.snapshot = "", C(e, "schema-change", !0));
743
794
  }), o.addEventListener("keydown", (a) => {
744
795
  a.key === "Escape" && (a.preventDefault(), G(e, !0));
745
796
  }), oe(o, e), document.body.appendChild(o), b.set(e, o), F.set(e, !1), _(e), o;
@@ -755,21 +806,28 @@ function Ye(e) {
755
806
  function Je(e) {
756
807
  w = e, q || (q = (t) => {
757
808
  Q();
758
- const r = t.target?.closest(S);
759
- if (!r) return;
809
+ const n = t.target, r = n == null ? void 0 : n.closest(S);
810
+ if (!r)
811
+ return;
760
812
  const s = u.get(r) || e;
761
813
  g(r, s), u.set(r, s), p = r, D(r);
762
814
  const o = b.get(r);
763
815
  o && (oe(o, r), se(r, o), _(r));
764
816
  }, document.addEventListener("focusin", q, !0)), z || (z = (t) => {
765
- const r = t.target?.closest(S);
766
- if (!r) return;
817
+ const n = t.target, r = n == null ? void 0 : n.closest(S);
818
+ if (!r)
819
+ return;
767
820
  const s = u.get(r) || w;
768
821
  !s || !g(r, s).realtimeEnabled || $e(r);
769
822
  }, document.addEventListener("input", z, !0)), B || (B = (t) => {
770
- if (t.defaultPrevented || t.target?.closest(`.${m}`) && t.key !== "Escape") return;
823
+ if (t.defaultPrevented)
824
+ return;
825
+ const n = t.target;
826
+ if (n != null && n.closest(`.${m}`) && t.key !== "Escape")
827
+ return;
771
828
  const r = _e(t);
772
- if (!r) return;
829
+ if (!r)
830
+ return;
773
831
  const s = u.get(r) || w || e;
774
832
  if (g(r, s), u.set(r, s), p = r, t.key === "Escape" && me(r)) {
775
833
  t.preventDefault(), G(r, !0);
@@ -780,11 +838,11 @@ function Je(e) {
780
838
  return;
781
839
  }
782
840
  Ye(t) && (t.preventDefault(), t.stopPropagation(), C(r, "shortcut", !0));
783
- }, document.addEventListener("keydown", B, !0)), R || (R = () => {
841
+ }, document.addEventListener("keydown", B, !0)), H || (H = () => {
784
842
  Q(), b.forEach((t, n) => {
785
843
  !n.isConnected || !t.isConnected || (oe(t, n), se(n, t));
786
844
  });
787
- }, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !K && typeof MutationObserver < "u" && document.body && (K = new MutationObserver((t) => {
845
+ }, window.addEventListener("scroll", H, !0), window.addEventListener("resize", H)), !K && typeof MutationObserver < "u" && document.body && (K = new MutationObserver((t) => {
788
846
  Pe(t) && Q();
789
847
  }), K.observe(document.body, {
790
848
  childList: !0,
@@ -792,65 +850,66 @@ function Je(e) {
792
850
  }));
793
851
  }
794
852
  function Xe() {
795
- q && (document.removeEventListener("focusin", q, !0), q = null), z && (document.removeEventListener("input", z, !0), z = null), B && (document.removeEventListener("keydown", B, !0), B = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), K && (K.disconnect(), K = null), b.forEach((t) => t.remove()), b.clear(), Array.from(ne).forEach((t) => ue(t)), w = null, p = null;
853
+ q && (document.removeEventListener("focusin", q, !0), q = null), z && (document.removeEventListener("input", z, !0), z = null), B && (document.removeEventListener("keydown", B, !0), B = null), H && (window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", H), H = null), K && (K.disconnect(), K = null), b.forEach((t) => t.remove()), b.clear(), Array.from(ne).forEach((t) => ue(t)), w = null, p = null;
796
854
  }
797
855
  function Ze() {
798
- if (typeof document > "u" || document.getElementById(he)) return;
856
+ if (typeof document > "u" || document.getElementById(he))
857
+ return;
799
858
  const e = document.createElement("style");
800
859
  e.id = he, e.textContent = `
801
- .rte-toolbar-group-items.${v},
802
- .editora-toolbar-group-items.${v},
860
+ .rte-toolbar-group-items.${E},
861
+ .editora-toolbar-group-items.${E},
803
862
  .rte-toolbar-group-items.${T},
804
863
  .editora-toolbar-group-items.${T},
805
- .rte-toolbar-group-items.${H},
806
- .editora-toolbar-group-items.${H} {
864
+ .rte-toolbar-group-items.${R},
865
+ .editora-toolbar-group-items.${R} {
807
866
  display: flex;
808
867
  border: 1px solid #cbd5e1;
809
868
  border-radius: 4px;
810
869
  background: #ffffff;
811
870
  }
812
871
 
813
- .rte-toolbar-group-items.${v} .rte-toolbar-button,
814
- .editora-toolbar-group-items.${v} .editora-toolbar-button,
872
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
873
+ .editora-toolbar-group-items.${E} .editora-toolbar-button,
815
874
  .rte-toolbar-group-items.${T} .rte-toolbar-button,
816
875
  .editora-toolbar-group-items.${T} .editora-toolbar-button,
817
- .rte-toolbar-group-items.${H} .rte-toolbar-button,
818
- .editora-toolbar-group-items.${H} .editora-toolbar-button {
876
+ .rte-toolbar-group-items.${R} .rte-toolbar-button,
877
+ .editora-toolbar-group-items.${R} .editora-toolbar-button {
819
878
  border: none;
820
879
  border-right: 1px solid #cbd5e1;
821
880
  border-radius: 0;
822
881
  }
823
882
 
824
- .rte-toolbar-group-items.${v} .rte-toolbar-item:last-child .rte-toolbar-button,
825
- .editora-toolbar-group-items.${v} .editora-toolbar-item:last-child .editora-toolbar-button,
883
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
884
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
826
885
  .rte-toolbar-group-items.${T} .rte-toolbar-item:last-child .rte-toolbar-button,
827
886
  .editora-toolbar-group-items.${T} .editora-toolbar-item:last-child .editora-toolbar-button,
828
- .rte-toolbar-group-items.${H} .rte-toolbar-item:last-child .rte-toolbar-button,
829
- .editora-toolbar-group-items.${H} .editora-toolbar-item:last-child .editora-toolbar-button {
887
+ .rte-toolbar-group-items.${R} .rte-toolbar-item:last-child .rte-toolbar-button,
888
+ .editora-toolbar-group-items.${R} .editora-toolbar-item:last-child .editora-toolbar-button {
830
889
  border-right: none;
831
890
  }
832
891
 
833
- ${E} .rte-toolbar-group-items.${v},
834
- ${E} .editora-toolbar-group-items.${v},
835
- ${E} .rte-toolbar-group-items.${T},
836
- ${E} .editora-toolbar-group-items.${T},
837
- ${E} .rte-toolbar-group-items.${H},
838
- ${E} .editora-toolbar-group-items.${H} {
892
+ ${v} .rte-toolbar-group-items.${E},
893
+ ${v} .editora-toolbar-group-items.${E},
894
+ ${v} .rte-toolbar-group-items.${T},
895
+ ${v} .editora-toolbar-group-items.${T},
896
+ ${v} .rte-toolbar-group-items.${R},
897
+ ${v} .editora-toolbar-group-items.${R} {
839
898
  border-color: #566275;
840
899
  }
841
900
  .rte-toolbar-button[data-command="toggleDocSchemaRealtime"].active,
842
901
  .editora-toolbar-button[data-command="toggleDocSchemaRealtime"].active {
843
902
  background-color: #ccc;
844
903
  }
845
- ${E} .rte-toolbar-group-items.${v} .rte-toolbar-button svg,
846
- ${E} .editora-toolbar-group-items.${v} .editora-toolbar-button svg,
847
- ${E} .rte-toolbar-group-items.${T} .rte-toolbar-button svg,
848
- ${E} .editora-toolbar-group-items.${T} .editora-toolbar-button svg
904
+ ${v} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
905
+ ${v} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
906
+ ${v} .rte-toolbar-group-items.${T} .rte-toolbar-button svg,
907
+ ${v} .editora-toolbar-group-items.${T} .editora-toolbar-button svg
849
908
  {
850
909
  fill: none;
851
910
  }
852
- ${E} .rte-toolbar-group-items.${v} .rte-toolbar-button,
853
- ${E} .editora-toolbar-group-items.${v} .editora-toolbar-button
911
+ ${v} .rte-toolbar-group-items.${E} .rte-toolbar-button,
912
+ ${v} .editora-toolbar-group-items.${E} .editora-toolbar-button
854
913
  {
855
914
  border-color: #566275;
856
915
  }
@@ -1205,80 +1264,89 @@ const Qe = (e = {}) => {
1205
1264
  commands: {
1206
1265
  docSchema: (r, s) => {
1207
1266
  const o = I(s, !1, !1);
1208
- if (!o) return !1;
1267
+ if (!o)
1268
+ return !1;
1209
1269
  const a = u.get(o) || t;
1210
1270
  return g(o, a), u.set(o, a), p = o, ae(o), !0;
1211
1271
  },
1212
1272
  openDocSchemaPanel: (r, s) => {
1213
1273
  const o = I(s, !1, !1);
1214
- if (!o) return !1;
1274
+ if (!o)
1275
+ return !1;
1215
1276
  const a = u.get(o) || t;
1216
1277
  return g(o, a), u.set(o, a), p = o, ae(o), !0;
1217
1278
  },
1218
1279
  toggleDocSchemaPanel: (r, s) => {
1219
1280
  const o = I(s, !1, !1);
1220
- if (!o) return !1;
1281
+ if (!o)
1282
+ return !1;
1221
1283
  const a = u.get(o) || t;
1222
1284
  return g(o, a), u.set(o, a), p = o, ke(o, typeof r == "boolean" ? r : void 0);
1223
1285
  },
1224
1286
  runDocSchemaValidation: (r, s) => {
1225
1287
  const o = I(s, !1, !1);
1226
- if (!o) return !1;
1288
+ if (!o)
1289
+ return !1;
1227
1290
  const a = u.get(o) || t;
1228
1291
  return g(o, a), u.set(o, a), p = o, C(o, "command", !0), !0;
1229
1292
  },
1230
1293
  insertMissingDocSchemaSections: (r, s) => {
1231
1294
  const o = I(s, !1, !1);
1232
- if (!o) return !1;
1295
+ if (!o)
1296
+ return !1;
1233
1297
  const a = u.get(o) || t;
1234
1298
  return g(o, a), u.set(o, a), p = o, Te(o);
1235
1299
  },
1236
1300
  toggleDocSchemaRealtime: (r, s) => {
1237
1301
  const o = I(s, !1, !1);
1238
- if (!o) return !1;
1302
+ if (!o)
1303
+ return !1;
1239
1304
  const a = u.get(o) || t;
1240
1305
  return g(o, a), u.set(o, a), p = o, Ce(o, typeof r == "boolean" ? r : void 0);
1241
1306
  },
1242
1307
  setDocSchemaMode: (r, s) => {
1243
1308
  const o = I(s, !1, !1);
1244
- if (!o) return !1;
1245
- const a = u.get(o) || t, c = g(o, a);
1309
+ if (!o)
1310
+ return !1;
1311
+ const a = u.get(o) || t, l = g(o, a);
1246
1312
  u.set(o, a);
1247
- const i = typeof r == "string" ? r : r?.schemaId || r?.id;
1248
- return !i || !L(a, i) ? !1 : (c.activeSchemaId = i, c.snapshot = "", C(o, "set-mode", !0), !0);
1313
+ const c = typeof r == "string" ? r : (r == null ? void 0 : r.schemaId) || (r == null ? void 0 : r.id);
1314
+ return !c || !L(a, c) ? !1 : (l.activeSchemaId = c, l.snapshot = "", C(o, "set-mode", !0), !0);
1249
1315
  },
1250
1316
  setDocSchemaOptions: (r, s) => {
1251
1317
  const o = I(s, !1, !1);
1252
- if (!o || !r || typeof r != "object") return !1;
1253
- const a = u.get(o) || t, c = X.get(o) || He(a), i = {
1254
- ...c,
1318
+ if (!o || !r || typeof r != "object")
1319
+ return !1;
1320
+ const a = u.get(o) || t, l = X.get(o) || Re(a), c = {
1321
+ ...l,
1255
1322
  ...r,
1256
1323
  labels: {
1257
- ...c.labels || {},
1324
+ ...l.labels || {},
1258
1325
  ...r.labels || {}
1259
1326
  },
1260
- schemas: Array.isArray(r.schemas) ? r.schemas : c.schemas,
1327
+ schemas: Array.isArray(r.schemas) ? r.schemas : l.schemas,
1261
1328
  normalizeText: r.normalizeText || a.normalizeText
1262
- }, l = Z(i);
1263
- u.set(o, l), X.set(o, i);
1264
- const d = g(o, l);
1265
- return typeof r.enableRealtime == "boolean" && (d.realtimeEnabled = r.enableRealtime), (!d.activeSchemaId || !L(l, d.activeSchemaId)) && (d.activeSchemaId = re(l)), typeof r.defaultSchemaId == "string" && L(l, r.defaultSchemaId) && (d.activeSchemaId = r.defaultSchemaId), d.snapshot = "", C(o, "set-options", !0), _(o), D(o), !0;
1329
+ }, i = Z(c);
1330
+ u.set(o, i), X.set(o, c);
1331
+ const d = g(o, i);
1332
+ return typeof r.enableRealtime == "boolean" && (d.realtimeEnabled = r.enableRealtime), (!d.activeSchemaId || !L(i, d.activeSchemaId)) && (d.activeSchemaId = re(i)), typeof r.defaultSchemaId == "string" && L(i, r.defaultSchemaId) && (d.activeSchemaId = r.defaultSchemaId), d.snapshot = "", C(o, "set-options", !0), _(o), D(o), !0;
1266
1333
  },
1267
1334
  getDocSchemaState: (r, s) => {
1268
1335
  const o = I(s, !1, !1);
1269
- if (!o) return !1;
1336
+ if (!o)
1337
+ return !1;
1270
1338
  const a = u.get(o) || t;
1271
1339
  g(o, a);
1272
- const c = we(o);
1340
+ const l = we(o);
1273
1341
  if (typeof r == "function")
1274
1342
  try {
1275
- r(c);
1343
+ r(l);
1276
1344
  } catch {
1277
1345
  }
1278
- return o.__docSchemaState = c, o.dispatchEvent(
1346
+ return o.__docSchemaState = l, o.dispatchEvent(
1279
1347
  new CustomEvent("editora:doc-schema-state", {
1280
1348
  bubbles: !0,
1281
- detail: c
1349
+ detail: l
1282
1350
  })
1283
1351
  ), !0;
1284
1352
  }
@@ -1293,12 +1361,12 @@ const Qe = (e = {}) => {
1293
1361
  W += 1;
1294
1362
  const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Z(o);
1295
1363
  Je(a);
1296
- const c = I(
1297
- s?.editorElement ? { editorElement: s.editorElement } : void 0,
1364
+ const l = I(
1365
+ s != null && s.editorElement ? { editorElement: s.editorElement } : void 0,
1298
1366
  !1,
1299
1367
  !1
1300
1368
  );
1301
- c && (p = c, n.add(c), g(c, a), u.set(c, a), X.set(c, o), D(c), C(c, "init", !0));
1369
+ l && (p = l, n.add(l), g(l, a), u.set(l, a), X.set(l, o), D(l), C(l, "init", !0));
1302
1370
  },
1303
1371
  destroy: () => {
1304
1372
  n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) && Xe();