@editora/plugins 1.0.16 → 1.0.18

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 (109) hide show
  1. package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
  2. package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
  3. package/dist/a11y-checker.cjs.js +16 -16
  4. package/dist/a11y-checker.esm.js +79 -75
  5. package/dist/anchor.cjs.js +9 -9
  6. package/dist/anchor.esm.js +61 -60
  7. package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
  8. package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
  9. package/dist/approval-workflow.cjs.js +5 -5
  10. package/dist/approval-workflow.esm.js +105 -104
  11. package/dist/background-color.cjs.js +1 -1
  12. package/dist/background-color.esm.js +1 -1
  13. package/dist/blocks-library.cjs.js +6 -6
  14. package/dist/blocks-library.esm.js +226 -202
  15. package/dist/capitalization.cjs.js +1 -1
  16. package/dist/capitalization.esm.js +9 -4
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +154 -116
  19. package/dist/citations.cjs.js +43 -18
  20. package/dist/citations.esm.js +465 -446
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +21 -20
  23. package/dist/code-sample.cjs.js +85 -66
  24. package/dist/code-sample.esm.js +301 -190
  25. package/dist/code.cjs.js +1 -669
  26. package/dist/code.esm.js +2 -4560
  27. package/dist/collaboration.cjs.js +68 -0
  28. package/dist/collaboration.esm.js +7428 -0
  29. package/dist/comments.cjs.js +11 -11
  30. package/dist/comments.esm.js +284 -237
  31. package/dist/conditional-content.cjs.js +67 -60
  32. package/dist/conditional-content.esm.js +270 -220
  33. package/dist/data-binding.cjs.js +3 -3
  34. package/dist/data-binding.esm.js +28 -27
  35. package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
  36. package/dist/dialogHelpers-zU6zpMIA.js +12 -0
  37. package/dist/document-manager.cjs.js +1 -1
  38. package/dist/document-manager.esm.js +1 -1
  39. package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
  40. package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
  41. package/dist/embed-iframe.cjs.js +37 -17
  42. package/dist/embed-iframe.esm.js +188 -143
  43. package/dist/emojis.cjs.js +13 -10
  44. package/dist/emojis.esm.js +288 -76
  45. package/dist/enterprise.cjs.js +1 -1
  46. package/dist/enterprise.esm.js +9 -7
  47. package/dist/escapeHtml-D2Zh82pD.js +1 -0
  48. package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +48 -41
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +67 -60
  53. package/dist/format-painter.cjs.js +1 -1
  54. package/dist/format-painter.esm.js +2 -1
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +40 -36
  57. package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
  58. package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
  59. package/dist/index-Bm1eqYHh.mjs +194 -0
  60. package/dist/index-CoflqYuK.js +30 -0
  61. package/dist/index-CxhJLMPS.js +221 -0
  62. package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
  63. package/dist/index.cjs.js +1 -1
  64. package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
  65. package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
  66. package/dist/index.esm.js +17 -15
  67. package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
  68. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
  69. package/dist/link.cjs.js +17 -13
  70. package/dist/link.esm.js +138 -69
  71. package/dist/list.cjs.js +1 -1
  72. package/dist/list.esm.js +66 -33
  73. package/dist/math.cjs.js +22 -22
  74. package/dist/math.esm.js +221 -126
  75. package/dist/media-manager.cjs.js +12 -12
  76. package/dist/media-manager.esm.js +55 -50
  77. package/dist/mentions.cjs.js +2 -2
  78. package/dist/mentions.esm.js +17 -12
  79. package/dist/merge-tag.cjs.js +2 -2
  80. package/dist/merge-tag.esm.js +43 -42
  81. package/dist/plugins.css +1 -1
  82. package/dist/preview.cjs.js +3 -3
  83. package/dist/preview.esm.js +30 -27
  84. package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
  85. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
  86. package/dist/slash-commands.cjs.js +13 -7
  87. package/dist/slash-commands.esm.js +90 -79
  88. package/dist/smart-paste.cjs.js +5 -5
  89. package/dist/smart-paste.esm.js +85 -81
  90. package/dist/special-characters.cjs.js +6 -3
  91. package/dist/special-characters.esm.js +72 -25
  92. package/dist/spell-check.cjs.js +8 -8
  93. package/dist/spell-check.esm.js +10189 -295
  94. package/dist/table.cjs.js +166 -13
  95. package/dist/table.esm.js +543 -266
  96. package/dist/template.cjs.js +11 -11
  97. package/dist/template.esm.js +290 -264
  98. package/dist/text-color.cjs.js +1 -1
  99. package/dist/text-color.esm.js +1 -1
  100. package/dist/translation-workflow.cjs.js +4 -4
  101. package/dist/translation-workflow.esm.js +33 -31
  102. package/dist/version-diff.cjs.js +6 -6
  103. package/dist/version-diff.esm.js +40 -40
  104. package/package.json +10 -4
  105. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  106. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  107. package/dist/index-BFsKNTTj.mjs +0 -145
  108. package/dist/index-CvJk4DKa.js +0 -221
  109. package/dist/index-tqLTHcO6.js +0 -1
@@ -69,8 +69,8 @@ function vt() {
69
69
  if (e) return e;
70
70
  const o = t.closest(F);
71
71
  if (o) {
72
- const n = K(o);
73
- if (n) return n;
72
+ const a = K(o);
73
+ if (a) return a;
74
74
  }
75
75
  return null;
76
76
  }
@@ -104,23 +104,23 @@ function it(t) {
104
104
  function x(t, e = !0) {
105
105
  if (D(), t?.contentElement instanceof HTMLElement) return t.contentElement;
106
106
  if (t?.editorElement instanceof HTMLElement) {
107
- const a = t.editorElement;
108
- if (a.matches(w)) return a;
109
- const l = a.querySelector(w);
107
+ const n = t.editorElement;
108
+ if (n.matches(w)) return n;
109
+ const l = n.querySelector(w);
110
110
  if (l instanceof HTMLElement) return l;
111
111
  }
112
112
  const o = vt();
113
113
  if (o) return o;
114
- const n = window.getSelection();
115
- if (n && n.rangeCount > 0) {
116
- const l = it(n.getRangeAt(0).startContainer)?.closest(w);
114
+ const a = window.getSelection();
115
+ if (a && a.rangeCount > 0) {
116
+ const l = it(a.getRangeAt(0).startContainer)?.closest(w);
117
117
  if (l) return l;
118
118
  }
119
119
  const r = document.activeElement;
120
120
  if (r) {
121
121
  if (r.matches(w)) return r;
122
- const a = r.closest(w);
123
- if (a) return a;
122
+ const n = r.closest(w);
123
+ if (n) return n;
124
124
  }
125
125
  return v && v.isConnected ? v : (v && !v.isConnected && (v = null), e ? document.querySelector(w) : null);
126
126
  }
@@ -139,13 +139,13 @@ function yt() {
139
139
  return !!it(e)?.closest(w);
140
140
  }
141
141
  function C(t, e, o) {
142
- const n = ht(t);
142
+ const a = ht(t);
143
143
  Array.from(
144
- n.querySelectorAll(
144
+ a.querySelectorAll(
145
145
  `.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`
146
146
  )
147
- ).forEach((a) => {
148
- a.classList.toggle("active", o), a.setAttribute("aria-pressed", o ? "true" : "false"), a.setAttribute("data-active", o ? "true" : "false");
147
+ ).forEach((n) => {
148
+ n.classList.toggle("active", o), n.setAttribute("aria-pressed", o ? "true" : "false"), n.setAttribute("data-active", o ? "true" : "false");
149
149
  });
150
150
  }
151
151
  function st(t, e, o) {
@@ -183,8 +183,9 @@ function At(t, e) {
183
183
  return e.labels[o] || t;
184
184
  }
185
185
  function pt(t, e, o) {
186
- if (t.setAttribute("data-approval-status", e.status), t.setAttribute("data-approval-locked", e.locked ? "true" : "false"), t.classList.toggle("rte-approval-locked-editor", e.locked), C(t, "toggleApprovalWorkflowPanel", tt(t)), C(t, "requestApprovalReview", e.status === "review"), C(t, "approveDocument", e.status === "approved"), C(t, "reopenDraft", e.status === "draft"), e.status === "approved" && o.lockOnApproval) {
187
- e.locked || (e.preApprovalContentEditable = t.getAttribute("contenteditable"), e.preApprovalReadonly = t.getAttribute("data-readonly")), t.setAttribute("contenteditable", "false"), t.setAttribute("data-readonly", "true"), e.locked = !0;
186
+ const a = e.locked, r = e.status === "approved" && o.lockOnApproval;
187
+ if (t.setAttribute("data-approval-status", e.status), t.setAttribute("data-approval-locked", r ? "true" : "false"), t.classList.toggle("rte-approval-locked-editor", r), C(t, "toggleApprovalWorkflowPanel", tt(t)), C(t, "requestApprovalReview", e.status === "review"), C(t, "approveDocument", e.status === "approved"), C(t, "reopenDraft", e.status === "draft"), r) {
188
+ a || (e.preApprovalContentEditable = t.getAttribute("contenteditable"), e.preApprovalReadonly = t.getAttribute("data-readonly")), t.setAttribute("contenteditable", "false"), t.setAttribute("data-readonly", "true"), e.locked = !0;
188
189
  return;
189
190
  }
190
191
  e.locked = !1, st(
@@ -230,12 +231,12 @@ function q(t) {
230
231
  if (!e) return;
231
232
  const o = s.get(t) || R;
232
233
  if (!o) return;
233
- const n = f(t, o), r = e.querySelector(".rte-approval-summary"), a = e.querySelector('[data-action="request-review"]'), l = e.querySelector('[data-action="approve"]'), c = e.querySelector('[data-action="reopen-draft"]'), u = e.querySelector(".rte-approval-comments-list"), m = e.querySelector(".rte-approval-signoffs-list");
234
+ const a = f(t, o), r = e.querySelector(".rte-approval-summary"), n = e.querySelector('[data-action="request-review"]'), l = e.querySelector('[data-action="approve"]'), c = e.querySelector('[data-action="reopen-draft"]'), u = e.querySelector(".rte-approval-comments-list"), m = e.querySelector(".rte-approval-signoffs-list");
234
235
  if (r) {
235
- const i = At(n.status, o);
236
- r.textContent = `${o.labels.summaryPrefix}: ${i} | Comments: ${n.comments.length} | Sign-offs: ${n.signoffs.length}${n.locked ? ` | ${o.labels.lockedSuffix}` : ""}`;
236
+ const i = At(a.status, o);
237
+ r.textContent = `${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked ? ` | ${o.labels.lockedSuffix}` : ""}`;
237
238
  }
238
- a && (a.disabled = n.status !== "draft"), l && (l.disabled = n.status === "approved"), c && (c.disabled = n.status === "draft"), u && (n.comments.length === 0 ? u.innerHTML = `<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>` : u.innerHTML = n.comments.slice().reverse().map(
239
+ n && (n.disabled = a.status !== "draft"), l && (l.disabled = a.status === "approved"), c && (c.disabled = a.status === "draft"), u && (a.comments.length === 0 ? u.innerHTML = `<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>` : u.innerHTML = a.comments.slice().reverse().map(
239
240
  (i) => `
240
241
  <li class="rte-approval-item rte-approval-item-${i.kind}" role="listitem">
241
242
  <div class="rte-approval-item-head">
@@ -247,7 +248,7 @@ function q(t) {
247
248
  <p class="rte-approval-item-message">${p(i.message)}</p>
248
249
  </li>
249
250
  `
250
- ).join("")), m && (n.signoffs.length === 0 ? m.innerHTML = `<li class="rte-approval-empty">${p(o.labels.noSignoffsText)}</li>` : m.innerHTML = n.signoffs.slice().reverse().map(
251
+ ).join("")), m && (a.signoffs.length === 0 ? m.innerHTML = `<li class="rte-approval-empty">${p(o.labels.noSignoffsText)}</li>` : m.innerHTML = a.signoffs.slice().reverse().map(
251
252
  (i) => `
252
253
  <li class="rte-approval-item" role="listitem">
253
254
  <div class="rte-approval-item-head">
@@ -264,46 +265,46 @@ function q(t) {
264
265
  function G(t, e, o) {
265
266
  e.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), pt(t, e, o), q(t), St(t, e);
266
267
  }
267
- function nt(t, e, o, n) {
268
+ function nt(t, e, o, a) {
268
269
  t.comments.push({
269
270
  id: Q(),
270
271
  author: o || e.defaultActor,
271
- message: n,
272
+ message: a,
272
273
  kind: "system",
273
274
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
274
275
  }), t.comments = j(t.comments, e.maxHistoryEntries);
275
276
  }
276
- function $(t, e, o, n) {
277
+ function $(t, e, o, a) {
277
278
  const r = f(t, o);
278
279
  if (r.status === e) return !1;
279
- const a = t.innerHTML;
280
- return r.status = e, e === "review" ? nt(r, o, n, "Review requested.") : e === "draft" && nt(r, o, n, "Returned to draft."), G(t, r, o), X(t), J(t, a), !0;
280
+ const n = t.innerHTML;
281
+ return r.status = e, e === "review" ? nt(r, o, a, "Review requested.") : e === "draft" && nt(r, o, a, "Returned to draft."), G(t, r, o), X(t), J(t, n), !0;
281
282
  }
282
- function dt(t, e, o, n) {
283
- const r = n.normalizeText(e);
283
+ function dt(t, e, o, a) {
284
+ const r = a.normalizeText(e);
284
285
  if (!r) return !1;
285
- const a = n.normalizeText(o) || n.defaultActor, l = f(t, n), c = t.innerHTML;
286
+ const n = a.normalizeText(o) || a.defaultActor, l = f(t, a), c = t.innerHTML;
286
287
  return l.comments.push({
287
288
  id: Q(),
288
- author: a,
289
+ author: n,
289
290
  message: r,
290
291
  kind: "comment",
291
292
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
292
- }), l.comments = j(l.comments, n.maxHistoryEntries), G(t, l, n), X(t), J(t, c), !0;
293
+ }), l.comments = j(l.comments, a.maxHistoryEntries), G(t, l, a), X(t), J(t, c), !0;
293
294
  }
294
- function Z(t, e, o, n) {
295
- const r = e.normalizeText(o) || e.defaultActor, a = e.normalizeText(n);
296
- if (e.requireCommentOnApprove && !a) return !1;
295
+ function Z(t, e, o, a) {
296
+ const r = e.normalizeText(o) || e.defaultActor, n = e.normalizeText(a);
297
+ if (e.requireCommentOnApprove && !n) return !1;
297
298
  const l = f(t, e), c = t.innerHTML;
298
299
  return l.status = "approved", l.signoffs.push({
299
300
  id: kt(),
300
301
  author: r,
301
- comment: a || void 0,
302
+ comment: n || void 0,
302
303
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
303
- }), l.signoffs = j(l.signoffs, e.maxHistoryEntries), a && (l.comments.push({
304
+ }), l.signoffs = j(l.signoffs, e.maxHistoryEntries), n && (l.comments.push({
304
305
  id: Q(),
305
306
  author: r,
306
- message: a,
307
+ message: n,
307
308
  kind: "system",
308
309
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
309
310
  }), l.comments = j(l.comments, e.maxHistoryEntries)), G(t, l, e), X(t), J(t, c), !0;
@@ -317,14 +318,14 @@ function Et(t) {
317
318
  }
318
319
  function U(t, e) {
319
320
  if (!e.classList.contains("show")) return;
320
- const n = Y(t).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 420), a = Math.max(10, window.innerWidth - r - 10), l = Math.min(Math.max(10, n.right - r), a), c = Math.max(10, Math.min(window.innerHeight - 10 - 280, n.top + 12));
321
+ const a = Y(t).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 420), n = Math.max(10, window.innerWidth - r - 10), l = Math.min(Math.max(10, a.right - r), n), c = Math.max(10, Math.min(window.innerHeight - 10 - 280, a.top + 12));
321
322
  e.style.width = `${r}px`, e.style.left = `${l}px`, e.style.top = `${c}px`, e.style.maxHeight = `${Math.max(280, window.innerHeight - 24)}px`;
322
323
  }
323
324
  function $t(t) {
324
325
  const e = y.get(t);
325
326
  if (e) return e;
326
- const o = s.get(t) || R || z(), n = `rte-approval-panel-${bt++}`, r = document.createElement("section");
327
- return r.className = d, r.id = n, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", o.labels.panelAriaLabel), r.setAttribute("tabindex", "-1"), r.innerHTML = `
327
+ const o = s.get(t) || R || z(), a = `rte-approval-panel-${bt++}`, r = document.createElement("section");
328
+ return r.className = d, r.id = a, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", o.labels.panelAriaLabel), r.setAttribute("tabindex", "-1"), r.innerHTML = `
328
329
  <header class="rte-approval-header">
329
330
  <h2 class="rte-approval-title">${p(o.labels.panelTitle)}</h2>
330
331
  <button type="button" class="rte-approval-icon-btn" data-action="close" aria-label="${p(
@@ -377,8 +378,8 @@ function $t(t) {
377
378
  <p class="rte-approval-shortcut">${p(o.labels.shortcutText)}</p>
378
379
  <span class="rte-approval-live" aria-live="polite"></span>
379
380
  </div>
380
- `, r.addEventListener("click", (a) => {
381
- const l = a.target;
381
+ `, r.addEventListener("click", (n) => {
382
+ const l = n.target;
382
383
  if (!l) return;
383
384
  const c = l.closest("[data-action]");
384
385
  if (!c) return;
@@ -414,8 +415,8 @@ function $t(t) {
414
415
  E && (E.value = ""), M(r, "Comment added.");
415
416
  return;
416
417
  }
417
- }), r.addEventListener("keydown", (a) => {
418
- a.key === "Escape" && (a.preventDefault(), P(t, !0));
418
+ }), r.addEventListener("keydown", (n) => {
419
+ n.key === "Escape" && (n.preventDefault(), P(t, !0));
419
420
  }), B(r, t), document.body.appendChild(r), y.set(t, r), O.set(t, !1), q(t), r;
420
421
  }
421
422
  function tt(t) {
@@ -424,8 +425,8 @@ function tt(t) {
424
425
  function A(t) {
425
426
  D();
426
427
  const e = $t(t);
427
- y.forEach((o, n) => {
428
- n !== t && P(n, !1);
428
+ y.forEach((o, a) => {
429
+ a !== t && P(a, !1);
429
430
  }), e.classList.add("show"), O.set(t, !0), C(t, "toggleApprovalWorkflowPanel", !0), B(e, t), U(t, e), q(t);
430
431
  }
431
432
  function P(t, e = !1) {
@@ -458,17 +459,17 @@ function Rt(t) {
458
459
  function Mt(t) {
459
460
  R = t, T || (T = (e) => {
460
461
  D();
461
- const n = e.target?.closest(w);
462
- if (!n) return;
463
- v = n;
464
- const r = s.get(n) || t;
465
- s.set(n, r), f(n, r);
466
- const a = y.get(n);
467
- a && (B(a, n), U(n, a));
462
+ const a = e.target?.closest(w);
463
+ if (!a) return;
464
+ v = a;
465
+ const r = s.get(a) || t;
466
+ s.set(a, r), f(a, r);
467
+ const n = y.get(a);
468
+ n && (B(n, a), U(a, n));
468
469
  }, document.addEventListener("focusin", T, !0)), L || (L = (e) => {
469
470
  if (e.defaultPrevented) return;
470
- const o = Ct(e), n = Tt(e), r = Lt(e), a = Rt(e), l = e.key === "Escape";
471
- if (!l && !o && !n && !r && !a)
471
+ const o = Ct(e), a = Tt(e), r = Lt(e), n = Rt(e), l = e.key === "Escape";
472
+ if (!l && !o && !a && !r && !n)
472
473
  return;
473
474
  D();
474
475
  const c = e.target, u = !!c?.closest(`.${d} input, .${d} textarea, .${d} select`);
@@ -488,7 +489,7 @@ function Mt(t) {
488
489
  e.preventDefault(), e.stopPropagation(), ut(i);
489
490
  return;
490
491
  }
491
- if (n) {
492
+ if (a) {
492
493
  e.preventDefault(), e.stopPropagation(), $(i, "review", b, b.defaultActor) && A(i);
493
494
  return;
494
495
  }
@@ -496,7 +497,7 @@ function Mt(t) {
496
497
  e.preventDefault(), e.stopPropagation(), Z(i, b, b.defaultActor, "Approved via keyboard shortcut.") && A(i);
497
498
  return;
498
499
  }
499
- a && (e.preventDefault(), e.stopPropagation(), E.status !== "draft" && $(i, "draft", b, b.defaultActor) && A(i));
500
+ n && (e.preventDefault(), e.stopPropagation(), E.status !== "draft" && $(i, "draft", b, b.defaultActor) && A(i));
500
501
  }
501
502
  }, document.addEventListener("keydown", L, !0)), S || (S = () => {
502
503
  D(), y.forEach((e, o) => {
@@ -954,80 +955,80 @@ const Pt = (t = {}) => {
954
955
  }
955
956
  ],
956
957
  commands: {
957
- approvalWorkflow: (o, n) => {
958
- const r = x(n);
958
+ approvalWorkflow: (o, a) => {
959
+ const r = x(a);
959
960
  if (!r) return !1;
960
- const a = s.get(r) || e;
961
- return s.set(r, a), f(r, a), v = r, A(r), q(r), !0;
961
+ const n = s.get(r) || e;
962
+ return s.set(r, n), f(r, n), v = r, A(r), q(r), !0;
962
963
  },
963
- toggleApprovalWorkflowPanel: (o, n) => {
964
- const r = x(n);
964
+ toggleApprovalWorkflowPanel: (o, a) => {
965
+ const r = x(a);
965
966
  if (!r) return !1;
966
- const a = s.get(r) || e;
967
- return s.set(r, a), f(r, a), v = r, ut(r, typeof o == "boolean" ? o : void 0);
967
+ const n = s.get(r) || e;
968
+ return s.set(r, n), f(r, n), v = r, ut(r, typeof o == "boolean" ? o : void 0);
968
969
  },
969
- requestApprovalReview: (o, n) => {
970
- const r = x(n);
970
+ requestApprovalReview: (o, a) => {
971
+ const r = x(a);
971
972
  if (!r) return !1;
972
- const a = s.get(r) || e;
973
- s.set(r, a), f(r, a);
974
- const l = $(r, "review", a, a.defaultActor);
973
+ const n = s.get(r) || e;
974
+ s.set(r, n), f(r, n);
975
+ const l = $(r, "review", n, n.defaultActor);
975
976
  return A(r), l;
976
977
  },
977
- approveDocument: (o, n) => {
978
- const r = x(n);
978
+ approveDocument: (o, a) => {
979
+ const r = x(a);
979
980
  if (!r) return !1;
980
- const a = s.get(r) || e;
981
- s.set(r, a), f(r, a);
982
- const l = typeof o == "object" && o ? String(o.author || "") : a.defaultActor, c = typeof o == "object" && o ? String(o.comment || "") : typeof o == "string" ? o : "", u = Z(r, a, l, c);
981
+ const n = s.get(r) || e;
982
+ s.set(r, n), f(r, n);
983
+ const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, c = typeof o == "object" && o ? String(o.comment || "") : typeof o == "string" ? o : "", u = Z(r, n, l, c);
983
984
  return u && A(r), u;
984
985
  },
985
- reopenDraft: (o, n) => {
986
- const r = x(n);
986
+ reopenDraft: (o, a) => {
987
+ const r = x(a);
987
988
  if (!r) return !1;
988
- const a = s.get(r) || e;
989
- s.set(r, a), f(r, a);
990
- const l = $(r, "draft", a, a.defaultActor);
989
+ const n = s.get(r) || e;
990
+ s.set(r, n), f(r, n);
991
+ const l = $(r, "draft", n, n.defaultActor);
991
992
  return l && A(r), l;
992
993
  },
993
- addApprovalComment: (o, n) => {
994
- const r = x(n);
994
+ addApprovalComment: (o, a) => {
995
+ const r = x(a);
995
996
  if (!r) return !1;
996
- const a = s.get(r) || e;
997
- s.set(r, a), f(r, a);
998
- const l = typeof o == "object" && o ? String(o.author || "") : a.defaultActor, c = typeof o == "object" && o ? String(o.message || "") : typeof o == "string" ? o : "", u = dt(r, c, l, a);
997
+ const n = s.get(r) || e;
998
+ s.set(r, n), f(r, n);
999
+ const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, c = typeof o == "object" && o ? String(o.message || "") : typeof o == "string" ? o : "", u = dt(r, c, l, n);
999
1000
  return u && A(r), u;
1000
1001
  },
1001
- setApprovalStatus: (o, n) => {
1002
- const r = x(n);
1002
+ setApprovalStatus: (o, a) => {
1003
+ const r = x(a);
1003
1004
  if (!r || !o) return !1;
1004
- const a = lt(o), l = s.get(r) || e;
1005
+ const n = lt(o), l = s.get(r) || e;
1005
1006
  s.set(r, l), f(r, l);
1006
- const c = $(r, a, l, l.defaultActor);
1007
+ const c = $(r, n, l, l.defaultActor);
1007
1008
  return c && A(r), c;
1008
1009
  },
1009
- setApprovalWorkflowOptions: (o, n) => {
1010
- const r = x(n);
1010
+ setApprovalWorkflowOptions: (o, a) => {
1011
+ const r = x(a);
1011
1012
  if (!r || !o || typeof o != "object") return !1;
1012
- const a = s.get(r) || e, l = z({
1013
- ...a,
1013
+ const n = s.get(r) || e, l = z({
1014
+ ...n,
1014
1015
  ...o,
1015
1016
  labels: {
1016
- ...a.labels,
1017
+ ...n.labels,
1017
1018
  ...o.labels || {}
1018
1019
  },
1019
- normalizeText: o.normalizeText || a.normalizeText
1020
+ normalizeText: o.normalizeText || n.normalizeText
1020
1021
  });
1021
1022
  s.set(r, l);
1022
1023
  const c = f(r, l);
1023
1024
  return G(r, c, l), !0;
1024
1025
  },
1025
- getApprovalWorkflowState: (o, n) => {
1026
- const r = x(n);
1026
+ getApprovalWorkflowState: (o, a) => {
1027
+ const r = x(a);
1027
1028
  if (!r) return !1;
1028
- const a = s.get(r) || e;
1029
- s.set(r, a);
1030
- const l = f(r, a), c = ct(l);
1029
+ const n = s.get(r) || e;
1030
+ s.set(r, n);
1031
+ const l = f(r, n), c = ct(l);
1031
1032
  if (typeof o == "function")
1032
1033
  try {
1033
1034
  o(c);
@@ -1053,15 +1054,15 @@ const Pt = (t = {}) => {
1053
1054
  "Mod-Alt-Shift-d": "reopenDraft",
1054
1055
  "Mod-Alt-Shift-D": "reopenDraft"
1055
1056
  },
1056
- init: function(n) {
1057
+ init: function(a) {
1057
1058
  _ += 1;
1058
1059
  const r = this && typeof this.__pluginConfig == "object" ? z({ ...e, ...this.__pluginConfig }) : e;
1059
1060
  Mt(r);
1060
- const a = x(
1061
- n?.editorElement ? { editorElement: n.editorElement } : void 0,
1061
+ const n = x(
1062
+ a?.editorElement ? { editorElement: a.editorElement } : void 0,
1062
1063
  !1
1063
1064
  );
1064
- a && (s.set(a, r), f(a, r), v = a, q(a));
1065
+ n && (s.set(n, r), f(n, r), v = n, q(n));
1065
1066
  },
1066
1067
  destroy: () => {
1067
1068
  _ = Math.max(0, _ - 1), !(_ > 0) && Ht();
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./anchoredPopover-BzqGPOAE.js");let a=null,N=null,g=null,L=null,i="#ffff00";const k='[data-theme="dark"], .dark, .editora-theme-dark',R=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function P(){const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0).startContainer,n=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(n){const o=n.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(o)return o}}const t=document.activeElement;return t?t.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function M(e){const t=window.__editoraLastCommand,c=window.__editoraLastCommandButton;if(t===e&&c&&c.isConnected){const l=window.getComputedStyle(c),s=c.getBoundingClientRect();if(l.display!=="none"&&l.visibility!=="hidden"&&l.pointerEvents!=="none"&&!(s.width===0&&s.height===0))return c}const r=l=>{for(const s of l){const d=window.getComputedStyle(s),p=s.getBoundingClientRect();if(!(d.display==="none"||d.visibility==="hidden"||d.pointerEvents==="none")&&!(p.width===0&&p.height===0))return s}return null},n=P();if(n){const l=Array.from(n.querySelectorAll(`[data-command="${e}"]`)),s=r(l);if(s)return s}const o=Array.from(document.querySelectorAll(`[data-command="${e}"]`));return r(o)}function T(e){if(e?.closest(k))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)}function _(){if(document.getElementById("rte-bg-color-picker-styles"))return;const e=document.createElement("style");e.id="rte-bg-color-picker-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./anchoredPopover-Bg-ey7Yo.js");let a=null,N=null,g=null,L=null,i="#ffff00";const k='[data-theme="dark"], .dark, .editora-theme-dark',R=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function P(){const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0).startContainer,n=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(n){const o=n.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(o)return o}}const t=document.activeElement;return t?t.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function M(e){const t=window.__editoraLastCommand,c=window.__editoraLastCommandButton;if(t===e&&c&&c.isConnected){const l=window.getComputedStyle(c),s=c.getBoundingClientRect();if(l.display!=="none"&&l.visibility!=="hidden"&&l.pointerEvents!=="none"&&!(s.width===0&&s.height===0))return c}const r=l=>{for(const s of l){const d=window.getComputedStyle(s),p=s.getBoundingClientRect();if(!(d.display==="none"||d.visibility==="hidden"||d.pointerEvents==="none")&&!(p.width===0&&p.height===0))return s}return null},n=P();if(n){const l=Array.from(n.querySelectorAll(`[data-command="${e}"]`)),s=r(l);if(s)return s}const o=Array.from(document.querySelectorAll(`[data-command="${e}"]`));return r(o)}function T(e){if(e?.closest(k))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)}function _(){if(document.getElementById("rte-bg-color-picker-styles"))return;const e=document.createElement("style");e.id="rte-bg-color-picker-styles",e.textContent=`
2
2
  .rte-bg-color-picker {
3
3
  position: fixed;
4
4
  background: white;
@@ -1,4 +1,4 @@
1
- import { a as P, b as R } from "./anchoredPopover-Dts0IrgU.mjs";
1
+ import { a as P, b as R } from "./anchoredPopover-D_JbjvdA.mjs";
2
2
  let a = null, N = null, g = null, L = null, i = "#ffff00";
3
3
  const k = '[data-theme="dark"], .dark, .editora-theme-dark', I = [
4
4
  "#000000",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",fe="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",ye="__editoraCommandEditorRoot",he="rte-blocks-library-styles",d="rte-blocks-library-panel",E="blocks-library",C="blocksLibrary",$=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',De=80,Be=new Set(["script","style","meta","link","object","embed","iframe"]),Oe=/^(https?:|mailto:|tel:|#|\/)/i,Ke=/^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,Ne={panelTitle:"Blocks Library",panelAriaLabel:"Blocks library panel",searchLabel:"Search blocks",searchPlaceholder:"Search by name, category, or keyword",categoryLabel:"Category",allCategoriesText:"All categories",recentHeading:"Recent inserts",insertText:"Insert Selected",closeText:"Close",noResultsText:"No matching blocks found.",summaryPrefix:"Blocks",loadingText:"Loading blocks...",loadErrorText:"Unable to load blocks right now.",readonlyMessage:"Editor is read-only. Block insertion is disabled.",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+B (panel), Ctrl/Cmd+Alt+Shift+L (insert last)",helperText:"Use Arrow keys to move through blocks, Enter to insert, Esc to close.",lastInsertedPrefix:"Last inserted",resultsListLabel:"Block results"},b=new WeakMap,J=new WeakMap,w=new WeakMap,I=new WeakMap,O=new WeakMap,j=new WeakMap,W=new WeakMap,z=new WeakMap,q=new WeakMap,te=new WeakMap,x=new Map,U=new WeakMap,oe=new Set;let X=0,je=0,ke=0,M=null,y=null,_=null,P=null,A=null,D=null;function m(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function We(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Fe(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e){const t=e.trim();return t&&(Oe.test(t)||Ke.test(t))?t:""}function xe(e){let t=e;return Be.forEach(r=>{const o=new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`,"gi"),l=new RegExp(`<${r}\\b[^>]*\\/?>`,"gi");t=t.replace(o,"").replace(l,"")}),t=t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("|\')\s*(?:javascript:|vbscript:|data:text\/html)[^"']*\2/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*(?:javascript:|vbscript:|data:text\/html)[^\s>]*/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n,a)=>{const s=typeof n=="string"&&n.length>0?n:a||"",i=ce(s);if(!i)return"";const c=l.startsWith('"')?'"':"'";return` ${o}=${c}${i}${c}`}).replace(/\s(href|src|xlink:href)\s*=\s*([^\s>]+)/gi,(r,o,l)=>{const n=ce(l);return n?` ${o}="${n}"`:""}).replace(/\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n)=>{const a=typeof l=="string"&&l.length>0?l:n||"";if(/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(a))return"";const s=o.startsWith('"')?'"':"'";return` style=${s}${a}${s}`}).trim(),t}function Ge(e){if(!e)return"";if(typeof document>"u")return xe(e);const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.querySelectorAll!="function"?xe(e):(Array.from(r.querySelectorAll("*")).forEach(l=>{const n=l.tagName.toLowerCase();if(Be.has(n)){l.remove();return}Array.from(l.attributes).forEach(s=>{const i=s.name.toLowerCase(),c=s.value;if(i.startsWith("on")){l.removeAttribute(s.name);return}if(i==="style"){/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(c)&&l.removeAttribute(s.name);return}if(i==="href"||i==="src"||i==="xlink:href"){const u=ce(c);if(!u){l.removeAttribute(s.name);return}u!==c&&l.setAttribute(s.name,u)}})}),t.innerHTML.trim())}function ne(e){return e.trim().toLowerCase()}function Ue(e){if(!e)return"";if(typeof document>"u")return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.textContent!="string"?e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim():r.textContent.replace(/\s+/g," ").trim()}function Ce(e,t){if(!Array.isArray(e)||e.length===0)return[];const r=new Set,o=[];return e.forEach(l=>{const n=t.normalizeText(l.label||""),a=t.sanitizeBlockHtml(l.html||"",l).trim();if(!n||!a)return;const s=t.normalizeText(l.category||"General")||"General",i=ne(s);let u=Fe(t.normalizeText(l.id||n))||`block-${ke++}`;for(;r.has(u);)u=`${u}-${ke++}`;r.add(u);const f=(l.tags||[]).map(H=>t.normalizeText(H)).filter(Boolean),g=(l.keywords||[]).map(H=>t.normalizeText(H)).filter(Boolean),h=t.normalizeText(l.description||""),R=Ue(a),V=[n,h,s,...f,...g,R].join(" ").toLowerCase();o.push({id:u,label:n,html:a,description:h,category:s,categoryKey:i,tags:f,keywords:g,previewText:R,searchBlob:V})}),o}function Q(e={}){const t=e.normalizeText||We,r=e.sanitizeBlockHtml||Ge,o={blocks:[],defaultCategory:t(e.defaultCategory||""),maxResults:Math.max(4,Math.min(300,Number(e.maxResults??80))),maxRecentBlocks:Math.max(1,Math.min(20,Number(e.maxRecentBlocks??6))),debounceMs:Math.max(0,Math.min(700,Number(e.debounceMs??90))),cacheTtlMs:Math.max(0,Number(e.cacheTtlMs??6e4)),labels:{...Ne,...e.labels||{}},normalizeText:t,sanitizeBlockHtml:r,getBlocks:typeof e.getBlocks=="function"?e.getBlocks:void 0};return o.blocks=Ce(e.blocks,o),o}function Ve(e){return{blocks:e.blocks.map(t=>({id:t.id,label:t.label,html:t.html,description:t.description||void 0,category:t.category||void 0,tags:t.tags.length?[...t.tags]:void 0,keywords:t.keywords.length?[...t.keywords]:void 0})),defaultCategory:e.defaultCategory,maxResults:e.maxResults,maxRecentBlocks:e.maxRecentBlocks,debounceMs:e.debounceMs,cacheTtlMs:e.cacheTtlMs,labels:{...e.labels},normalizeText:e.normalizeText,sanitizeBlockHtml:e.sanitizeBlockHtml,getBlocks:e.getBlocks}}function le(e){return e.closest(fe)||e}function G(e){if(!e)return null;if(e.matches(v))return e;const t=e.querySelector(v);return t instanceof HTMLElement?t:null}function Ye(){if(typeof window>"u")return null;const e=window[ye];if(!(e instanceof HTMLElement))return null;window[ye]=null;const t=G(e);if(t)return t;const r=e.closest(fe);if(r){const l=G(r);if(l)return l}const o=e.closest(v);return o instanceof HTMLElement?o:null}function Xe(e){const t=e.closest("[data-editora-editor]");if(t&&G(t)===e)return t;let r=e;for(;r;){if(r.matches(fe)&&(r===e||G(r)===e))return r;r=r.parentElement}return le(e)}function $e(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ee(){Array.from(oe).forEach(t=>{t.isConnected||ge(t)})}function S(e,t=!0,r=!0){if(ee(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const a=G(e.editorElement);if(a)return a}const o=Ye();if(o)return o;const l=window.getSelection();if(l&&l.rangeCount>0){const s=$e(l.getRangeAt(0).startContainer)?.closest(v);if(s)return s}const n=document.activeElement;if(n){if(n.matches(v))return n;const a=n.closest(v);if(a)return a}if(r){if(y&&y.isConnected)return y;y&&!y.isConnected&&(y=null)}return t?document.querySelector(v):null}function Ze(e){const t=e.target;if(t){const o=t.closest(v);if(o)return o}const r=window.getSelection();if(r&&r.rangeCount>0){const l=$e(r.getRangeAt(0).startContainer)?.closest(v);if(l)return l}return null}function Z(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Je(e){const t=le(e);if(Z(t))return!0;const r=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Z(r)?!0:Z(document.documentElement)||Z(document.body)}function re(e,t){e.classList.remove("rte-blocks-library-theme-dark"),Je(t)&&e.classList.add("rte-blocks-library-theme-dark")}function Se(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function we(e,t,r){const o=Xe(e);Array.from(o.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(n=>{n.classList.toggle("active",r),n.setAttribute("data-active",r?"true":"false"),n.setAttribute("aria-pressed",r?"true":"false")})}function Ee(e,t){const r=e.querySelector(".rte-blocks-library-live");r&&(r.textContent=t)}function se(e){const t=Re(e);if(t)try{q.set(e,t.cloneRange())}catch{}}function Te(e){const t=q.get(e);if(!t)return null;if(!e.isConnected)return q.delete(e),null;try{const r=t.cloneRange();return e.contains(r.commonAncestorContainer)?r:(q.delete(e),null)}catch{return q.delete(e),null}}function Qe(e){const t=Te(e);return t?(He(e,t),!0):!1}function et(e){if(te.has(e))return;const t=()=>{const r=window.getSelection();if(!r||r.rangeCount===0)return;const o=r.getRangeAt(0);e.contains(o.commonAncestorContainer)&&se(e)};e.addEventListener("keyup",t),e.addEventListener("mouseup",t),e.addEventListener("touchend",t),te.set(e,t)}function tt(e){const t=te.get(e);t&&(e.removeEventListener("keyup",t),e.removeEventListener("mouseup",t),e.removeEventListener("touchend",t),te.delete(e))}function k(e,t){b.has(e)||b.set(e,t),I.has(e)||(I.set(e,t.blocks),O.set(e,Date.now()));let r=w.get(e);return r||(r={query:"",category:t.defaultCategory?ne(t.defaultCategory):"all",selectedBlockId:null,recentBlockIds:[],lastInsertedBlockId:null,loading:!1,loadError:null,totalMatches:0,visibleMatches:0,filterCache:new Map,debounceTimer:null},w.set(e,r)),oe.add(e),et(e),r}function Me(e){const t=w.get(e);!t||t.debounceTimer===null||(window.clearTimeout(t.debounceTimer),t.debounceTimer=null)}function ge(e){Me(e),tt(e),q.delete(e);const t=W.get(e);t&&(t.abort(),W.delete(e)),j.delete(e),z.delete(e),x.get(e)?.remove(),x.delete(e),U.delete(e),b.delete(e),J.delete(e),w.delete(e),I.delete(e),O.delete(e),oe.delete(e),y===e&&(y=null)}function rt(e){for(let t=0;t<e.length;t+=1){const r=e[t];if(!(r.type!=="childList"||r.removedNodes.length===0))for(let o=0;o<r.removedNodes.length;o+=1){const l=r.removedNodes[o];if(l.nodeType!==Node.ELEMENT_NODE)continue;const n=l;if(n.matches?.(v)||n.matches?.(`.${d}`)||n.querySelector?.(v)||n.querySelector?.(`.${d}`))return!0}}return!1}function pe(e){return U.get(e)===!0}function ue(e,t){if(!t.classList.contains("show"))return;const r=le(e).getBoundingClientRect(),o=Math.min(window.innerWidth-20,420),l=Math.max(10,window.innerWidth-o-10),n=Math.min(Math.max(10,r.right-o),l),a=Math.max(10,Math.min(window.innerHeight-10,r.top+12));t.style.width=`${o}px`,t.style.left=`${n}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ae(e){return I.get(e)||b.get(e)?.blocks||[]}function ot(e,t){const r=new Map;ae(e).forEach(l=>{r.has(l.categoryKey)||r.set(l.categoryKey,l.category)});const o=Array.from(r.entries()).sort((l,n)=>l[1].localeCompare(n[1])).map(([l,n])=>({value:l,label:n}));return[{value:"all",label:t.labels.allCategoriesText},...o]}function Ae(e,t){const r=k(e,t),o=ae(e),l=r.query.trim().toLowerCase(),n=r.category||"all",a=`${l}|${n}|${t.maxResults}`,s=r.filterCache.get(a);if(s){const u=new Map(o.map(g=>[g.id,g])),f=s.ids.map(g=>u.get(g)).filter(Boolean);return r.totalMatches=s.total,r.visibleMatches=f.length,f}const i=[];let c=0;for(let u=0;u<o.length;u+=1){const f=o[u];n!=="all"&&f.categoryKey!==n||l&&!f.searchBlob.includes(l)||(c+=1,i.length<t.maxResults&&i.push(f))}if(r.totalMatches=c,r.visibleMatches=i.length,r.filterCache.set(a,{ids:i.map(u=>u.id),total:c}),r.filterCache.size>De){const u=r.filterCache.keys().next().value;typeof u=="string"&&r.filterCache.delete(u)}return i}function nt(e,t){const r=w.get(e);if(!r)return;if(t.length===0){r.selectedBlockId=null;return}t.some(l=>l.id===r.selectedBlockId)||(r.selectedBlockId=t[0].id)}function K(e){const t=w.get(e);we(e,"toggleBlocksLibraryPanel",pe(e)),we(e,"insertLastBlockSnippet",!!t?.lastInsertedBlockId)}function L(e){const t=x.get(e),r=b.get(e)||M,o=w.get(e);if(!t||!r||!o)return;re(t,e);const l=t.querySelector(".rte-blocks-library-title");l&&(l.textContent=r.labels.panelTitle);const n=t.querySelector('[data-action="close"]');n&&(n.setAttribute("aria-label",r.labels.closeText),n.textContent="✕");const a=t.querySelector(".rte-blocks-library-search-label");a&&(a.textContent=r.labels.searchLabel);const s=t.querySelector('[data-field="query"]');s&&(s.setAttribute("placeholder",r.labels.searchPlaceholder),s.value!==o.query&&(s.value=o.query));const i=t.querySelector(".rte-blocks-library-category-label");i&&(i.textContent=r.labels.categoryLabel);const c=t.querySelector('[data-field="category"]');if(c){const B=ot(e,r);c.innerHTML=B.map(p=>`<option value="${m(p.value)}">${m(p.label)}</option>`).join(""),B.some(p=>p.value===o.category)||(o.category="all"),c.value=o.category}const u=t.querySelector(".rte-blocks-library-helper");u&&(u.textContent=r.labels.helperText);const f=t.querySelector('.rte-blocks-library-list[role="listbox"]');f&&f.setAttribute("aria-label",r.labels.resultsListLabel);const g=t.querySelector(".rte-blocks-library-shortcut");g&&(g.textContent=r.labels.shortcutText);const h=t.querySelector('[data-action="insert-selected"]');if(h){h.textContent=r.labels.insertText;const B=!Se(e)&&!!o.selectedBlockId;h.disabled=!B,h.setAttribute("aria-disabled",B?"false":"true")}const R=t.querySelector(".rte-blocks-library-empty"),V=t.querySelector(".rte-blocks-library-list"),H=Ae(e,r);nt(e,H);const Y=t.querySelector(".rte-blocks-library-status");if(Y&&(o.loading?Y.textContent=r.labels.loadingText:o.loadError?Y.textContent=o.loadError:Y.textContent=`${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`),V){const B=new Set(o.recentBlockIds);V.innerHTML=H.map(p=>{const ie=o.selectedBlockId===p.id,_e=p.tags.length?` • ${p.tags.join(", ")}`:"",Pe=B.has(p.id),me=p.previewText.slice(0,180);return`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",fe="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",ye="__editoraCommandEditorRoot",he="rte-blocks-library-styles",d="rte-blocks-library-panel",E="blocks-library",C="blocksLibrary",$=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',De=80,Ce=new Set(["script","style","meta","link","object","embed","iframe"]),Ne=/^(https?:|mailto:|tel:|#|\/)/i,Ke=/^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,je={panelTitle:"Blocks Library",panelAriaLabel:"Blocks library panel",searchLabel:"Search blocks",searchPlaceholder:"Search by name, category, or keyword",categoryLabel:"Category",allCategoriesText:"All categories",recentHeading:"Recent inserts",insertText:"Insert Selected",closeText:"Close",noResultsText:"No matching blocks found.",summaryPrefix:"Blocks",loadingText:"Loading blocks...",loadErrorText:"Unable to load blocks right now.",readonlyMessage:"Editor is read-only. Block insertion is disabled.",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+B (panel), Ctrl/Cmd+Alt+Shift+L (insert last)",helperText:"Use Arrow keys to move through blocks, Enter to insert, Esc to close.",lastInsertedPrefix:"Last inserted",resultsListLabel:"Block results"},b=new WeakMap,J=new WeakMap,w=new WeakMap,I=new WeakMap,D=new WeakMap,j=new WeakMap,W=new WeakMap,z=new WeakMap,q=new WeakMap,te=new WeakMap,x=new Map,U=new WeakMap,oe=new Set;let X=0,We=0,ke=0,M=null,y=null,_=null,P=null,A=null,O=null;function m(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Fe(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Ge(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e){const t=e.trim();return t&&(Ne.test(t)||Ke.test(t))?t:""}function xe(e){let t=e;return Ce.forEach(r=>{const o=new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`,"gi"),l=new RegExp(`<${r}\\b[^>]*\\/?>`,"gi");t=t.replace(o,"").replace(l,"")}),t=t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("|\')\s*(?:javascript:|vbscript:|data:text\/html)[^"']*\2/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*(?:javascript:|vbscript:|data:text\/html)[^\s>]*/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n,a)=>{const s=typeof n=="string"&&n.length>0?n:a||"",i=ce(s);if(!i)return"";const c=l.startsWith('"')?'"':"'";return` ${o}=${c}${i}${c}`}).replace(/\s(href|src|xlink:href)\s*=\s*([^\s>]+)/gi,(r,o,l)=>{const n=ce(l);return n?` ${o}="${n}"`:""}).replace(/\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n)=>{const a=typeof l=="string"&&l.length>0?l:n||"";if(/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(a))return"";const s=o.startsWith('"')?'"':"'";return` style=${s}${a}${s}`}).trim(),t}function Ue(e){if(!e)return"";if(typeof document>"u")return xe(e);const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.querySelectorAll!="function"?xe(e):(Array.from(r.querySelectorAll("*")).forEach(l=>{const n=l.tagName.toLowerCase();if(Ce.has(n)){l.remove();return}Array.from(l.attributes).forEach(s=>{const i=s.name.toLowerCase(),c=s.value;if(i.startsWith("on")){l.removeAttribute(s.name);return}if(i==="style"){/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(c)&&l.removeAttribute(s.name);return}if(i==="href"||i==="src"||i==="xlink:href"){const u=ce(c);if(!u){l.removeAttribute(s.name);return}u!==c&&l.setAttribute(s.name,u)}})}),t.innerHTML.trim())}function ne(e){return e.trim().toLowerCase()}function Ve(e){if(!e)return"";if(typeof document>"u")return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.textContent!="string"?e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim():r.textContent.replace(/\s+/g," ").trim()}function $e(e,t){if(!Array.isArray(e)||e.length===0)return[];const r=new Set,o=[];return e.forEach(l=>{const n=t.normalizeText(l.label||""),a=t.sanitizeBlockHtml(l.html||"",l).trim();if(!n||!a)return;const s=t.normalizeText(l.category||"General")||"General",i=ne(s);let u=Ge(t.normalizeText(l.id||n))||`block-${ke++}`;for(;r.has(u);)u=`${u}-${ke++}`;r.add(u);const f=(l.tags||[]).map(H=>t.normalizeText(H)).filter(Boolean),g=(l.keywords||[]).map(H=>t.normalizeText(H)).filter(Boolean),h=t.normalizeText(l.description||""),R=Ve(a),V=[n,h,s,...f,...g,R].join(" ").toLowerCase();o.push({id:u,label:n,html:a,description:h,category:s,categoryKey:i,tags:f,keywords:g,previewText:R,searchBlob:V})}),o}function Q(e={}){const t=e.normalizeText||Fe,r=e.sanitizeBlockHtml||Ue,o={blocks:[],defaultCategory:t(e.defaultCategory||""),maxResults:Math.max(4,Math.min(300,Number(e.maxResults??80))),maxRecentBlocks:Math.max(1,Math.min(20,Number(e.maxRecentBlocks??6))),debounceMs:Math.max(0,Math.min(700,Number(e.debounceMs??90))),cacheTtlMs:Math.max(0,Number(e.cacheTtlMs??6e4)),labels:{...je,...e.labels||{}},normalizeText:t,sanitizeBlockHtml:r,getBlocks:typeof e.getBlocks=="function"?e.getBlocks:void 0};return o.blocks=$e(e.blocks,o),o}function Ye(e){return{blocks:e.blocks.map(t=>({id:t.id,label:t.label,html:t.html,description:t.description||void 0,category:t.category||void 0,tags:t.tags.length?[...t.tags]:void 0,keywords:t.keywords.length?[...t.keywords]:void 0})),defaultCategory:e.defaultCategory,maxResults:e.maxResults,maxRecentBlocks:e.maxRecentBlocks,debounceMs:e.debounceMs,cacheTtlMs:e.cacheTtlMs,labels:{...e.labels},normalizeText:e.normalizeText,sanitizeBlockHtml:e.sanitizeBlockHtml,getBlocks:e.getBlocks}}function le(e){return e.closest(fe)||e}function G(e){if(!e)return null;if(e.matches(v))return e;const t=e.querySelector(v);return t instanceof HTMLElement?t:null}function Xe(){if(typeof window>"u")return null;const e=window[ye];if(!(e instanceof HTMLElement))return null;window[ye]=null;const t=G(e);if(t)return t;const r=e.closest(fe);if(r){const l=G(r);if(l)return l}const o=e.closest(v);return o instanceof HTMLElement?o:null}function Ze(e){const t=e.closest("[data-editora-editor]");if(t&&G(t)===e)return t;let r=e;for(;r;){if(r.matches(fe)&&(r===e||G(r)===e))return r;r=r.parentElement}return le(e)}function Te(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ee(){Array.from(oe).forEach(t=>{t.isConnected||ge(t)})}function T(e,t=!0,r=!0){if(ee(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const a=G(e.editorElement);if(a)return a}const o=Xe();if(o)return o;const l=window.getSelection();if(l&&l.rangeCount>0){const s=Te(l.getRangeAt(0).startContainer)?.closest(v);if(s)return s}const n=document.activeElement;if(n){if(n.matches(v))return n;const a=n.closest(v);if(a)return a}if(r){if(y&&y.isConnected)return y;y&&!y.isConnected&&(y=null)}return t?document.querySelector(v):null}function Je(e){const t=e.target;if(t){const o=t.closest(v);if(o)return o}const r=window.getSelection();if(r&&r.rangeCount>0){const l=Te(r.getRangeAt(0).startContainer)?.closest(v);if(l)return l}return null}function Z(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Qe(e){const t=le(e);if(Z(t))return!0;const r=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Z(r)?!0:Z(document.documentElement)||Z(document.body)}function re(e,t){e.classList.remove("rte-blocks-library-theme-dark"),Qe(t)&&e.classList.add("rte-blocks-library-theme-dark")}function Se(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function we(e,t,r){const o=Ze(e);Array.from(o.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(n=>{n.classList.toggle("active",r),n.setAttribute("data-active",r?"true":"false"),n.setAttribute("aria-pressed",r?"true":"false")})}function Ee(e,t){const r=e.querySelector(".rte-blocks-library-live");r&&(r.textContent=t)}function se(e){const t=He(e);if(t)try{q.set(e,t.cloneRange())}catch{}}function Me(e){const t=q.get(e);if(!t)return null;if(!e.isConnected)return q.delete(e),null;try{const r=t.cloneRange();return e.contains(r.commonAncestorContainer)?r:(q.delete(e),null)}catch{return q.delete(e),null}}function et(e){const t=Me(e);return t?(ze(e,t),!0):!1}function tt(e){if(te.has(e))return;const t=()=>{const r=window.getSelection();if(!r||r.rangeCount===0)return;const o=r.getRangeAt(0);e.contains(o.commonAncestorContainer)&&se(e)};e.addEventListener("keyup",t),e.addEventListener("mouseup",t),e.addEventListener("touchend",t),te.set(e,t)}function rt(e){const t=te.get(e);t&&(e.removeEventListener("keyup",t),e.removeEventListener("mouseup",t),e.removeEventListener("touchend",t),te.delete(e))}function k(e,t){b.has(e)||b.set(e,t),I.has(e)||(I.set(e,t.blocks),D.set(e,Date.now()));let r=w.get(e);return r||(r={query:"",category:t.defaultCategory?ne(t.defaultCategory):"all",selectedBlockId:null,recentBlockIds:[],lastInsertedBlockId:null,loading:!1,loadError:null,totalMatches:0,visibleMatches:0,filterCache:new Map,debounceTimer:null},w.set(e,r)),oe.add(e),tt(e),r}function Ae(e){const t=w.get(e);!t||t.debounceTimer===null||(window.clearTimeout(t.debounceTimer),t.debounceTimer=null)}function ge(e){Ae(e),rt(e),q.delete(e);const t=W.get(e);t&&(t.abort(),W.delete(e)),j.delete(e),z.delete(e),x.get(e)?.remove(),x.delete(e),U.delete(e),b.delete(e),J.delete(e),w.delete(e),I.delete(e),D.delete(e),oe.delete(e),y===e&&(y=null)}function ot(e){for(let t=0;t<e.length;t+=1){const r=e[t];if(!(r.type!=="childList"||r.removedNodes.length===0))for(let o=0;o<r.removedNodes.length;o+=1){const l=r.removedNodes[o];if(l.nodeType!==Node.ELEMENT_NODE)continue;const n=l;if(n.matches?.(v)||n.matches?.(`.${d}`)||n.querySelector?.(v)||n.querySelector?.(`.${d}`))return!0}}return!1}function pe(e){return U.get(e)===!0}function ue(e,t){if(!t.classList.contains("show"))return;const r=le(e).getBoundingClientRect(),o=Math.min(window.innerWidth-20,420),l=Math.max(10,window.innerWidth-o-10),n=Math.min(Math.max(10,r.right-o),l),a=Math.max(10,Math.min(window.innerHeight-10,r.top+12));t.style.width=`${o}px`,t.style.left=`${n}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ae(e){return I.get(e)||b.get(e)?.blocks||[]}function nt(e,t){const r=new Map;ae(e).forEach(l=>{r.has(l.categoryKey)||r.set(l.categoryKey,l.category)});const o=Array.from(r.entries()).sort((l,n)=>l[1].localeCompare(n[1])).map(([l,n])=>({value:l,label:n}));return[{value:"all",label:t.labels.allCategoriesText},...o]}function Ie(e,t){const r=k(e,t),o=ae(e),l=r.query.trim().toLowerCase(),n=r.category||"all",a=`${l}|${n}|${t.maxResults}`,s=r.filterCache.get(a);if(s){const u=new Map(o.map(g=>[g.id,g])),f=s.ids.map(g=>u.get(g)).filter(Boolean);return r.totalMatches=s.total,r.visibleMatches=f.length,f}const i=[];let c=0;for(let u=0;u<o.length;u+=1){const f=o[u];n!=="all"&&f.categoryKey!==n||l&&!f.searchBlob.includes(l)||(c+=1,i.length<t.maxResults&&i.push(f))}if(r.totalMatches=c,r.visibleMatches=i.length,r.filterCache.set(a,{ids:i.map(u=>u.id),total:c}),r.filterCache.size>De){const u=r.filterCache.keys().next().value;typeof u=="string"&&r.filterCache.delete(u)}return i}function lt(e,t){const r=w.get(e);if(!r)return;if(t.length===0){r.selectedBlockId=null;return}t.some(l=>l.id===r.selectedBlockId)||(r.selectedBlockId=t[0].id)}function N(e){const t=w.get(e);we(e,"toggleBlocksLibraryPanel",pe(e)),we(e,"insertLastBlockSnippet",!!t?.lastInsertedBlockId)}function L(e){const t=x.get(e),r=b.get(e)||M,o=w.get(e);if(!t||!r||!o)return;re(t,e);const l=t.querySelector(".rte-blocks-library-title");l&&(l.textContent=r.labels.panelTitle);const n=t.querySelector('[data-action="close"]');n&&(n.setAttribute("aria-label",r.labels.closeText),n.textContent="✕");const a=t.querySelector(".rte-blocks-library-search-label");a&&(a.textContent=r.labels.searchLabel);const s=t.querySelector('[data-field="query"]');s&&(s.setAttribute("placeholder",r.labels.searchPlaceholder),s.value!==o.query&&(s.value=o.query));const i=t.querySelector(".rte-blocks-library-category-label");i&&(i.textContent=r.labels.categoryLabel);const c=t.querySelector('[data-field="category"]');if(c){const B=nt(e,r);c.innerHTML=B.map(p=>`<option value="${m(p.value)}">${m(p.label)}</option>`).join(""),B.some(p=>p.value===o.category)||(o.category="all"),c.value=o.category}const u=t.querySelector(".rte-blocks-library-helper");u&&(u.textContent=r.labels.helperText);const f=t.querySelector('.rte-blocks-library-list[role="listbox"]');f&&f.setAttribute("aria-label",r.labels.resultsListLabel);const g=t.querySelector(".rte-blocks-library-shortcut");g&&(g.textContent=r.labels.shortcutText);const h=t.querySelector('[data-action="insert-selected"]');if(h){h.textContent=r.labels.insertText;const B=!Se(e)&&!!o.selectedBlockId;h.disabled=!B,h.setAttribute("aria-disabled",B?"false":"true")}const R=t.querySelector(".rte-blocks-library-empty"),V=t.querySelector(".rte-blocks-library-list"),H=Ie(e,r);lt(e,H);const Y=t.querySelector(".rte-blocks-library-status");if(Y&&(o.loading?Y.textContent=r.labels.loadingText:o.loadError?Y.textContent=o.loadError:Y.textContent=`${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`),V){const B=new Set(o.recentBlockIds);V.innerHTML=H.map(p=>{const ie=o.selectedBlockId===p.id,Pe=p.tags.length?` • ${p.tags.join(", ")}`:"",Oe=B.has(p.id),me=p.previewText.slice(0,180);return`
2
2
  <li class="rte-blocks-library-item-wrapper" role="presentation">
3
3
  <button
4
4
  type="button"
@@ -11,14 +11,14 @@
11
11
  >
12
12
  <span class="rte-blocks-library-item-head">
13
13
  <span class="rte-blocks-library-item-label">${m(p.label)}</span>
14
- ${Pe?`<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>`:""}
14
+ ${Oe?`<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>`:""}
15
15
  </span>
16
- <span class="rte-blocks-library-item-meta">${m(p.category)}${m(_e)}</span>
16
+ <span class="rte-blocks-library-item-meta">${m(p.category)}${m(Pe)}</span>
17
17
  ${p.description?`<span class="rte-blocks-library-item-description">${m(p.description)}</span>`:""}
18
18
  ${me?`<span class="rte-blocks-library-item-preview">${m(me)}</span>`:""}
19
19
  </button>
20
20
  </li>
21
- `}).join("")}R&&(R.hidden=H.length>0,R.textContent=r.labels.noResultsText);const N=t.querySelector(".rte-blocks-library-last-inserted");if(N)if(o.lastInsertedBlockId){const B=ae(e).find(p=>p.id===o.lastInsertedBlockId);B?(N.hidden=!1,N.textContent=`${r.labels.lastInsertedPrefix}: ${B.label}`):N.hidden=!0}else N.hidden=!0;t.setAttribute("aria-label",r.labels.panelAriaLabel)}function T(e,t=!1){const r=x.get(e);r&&(r.classList.remove("show"),U.set(e,!1),K(e),t&&(e.focus({preventScroll:!0}),Qe(e)))}function lt(e){e.querySelector(".rte-blocks-library-item.active")?.focus()}function ve(e,t){const r=b.get(e)||M;if(!r)return;const o=w.get(e);if(!o)return;const l=Ae(e,r);if(l.length===0)return;const a=(Math.max(0,l.findIndex(i=>i.id===o.selectedBlockId))+t+l.length)%l.length;o.selectedBlockId=l[a].id,L(e);const s=x.get(e);s&&lt(s)}function de(e){const t=ut(e);se(e),x.forEach((o,l)=>{l!==e&&T(l,!1)}),t.classList.add("show"),U.set(e,!0),L(e),ue(e,t),K(e),t.querySelector('[data-field="query"]')?.focus(),be(e,!1)}function Ie(e,t){const r=pe(e);return(typeof t=="boolean"?t:!r)?de(e):T(e,!1),!0}function Re(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=t.getRangeAt(0);return e.contains(r.commonAncestorContainer)?r:null}function He(e,t){if(!e.isConnected)return;const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function Le(e,t,r){const o=t.cloneRange();if(!e.contains(o.commonAncestorContainer))return!1;o.deleteContents();const l=document.createElement("template");l.innerHTML=r;const n=l.content;if(!n)return!1;const a=n.lastChild;if(o.insertNode(n),a){const s=document.createRange();s.setStartAfter(a),s.collapse(!0),He(e,s)}return se(e),!0}function st(e,t){e.focus({preventScroll:!0});const r=Te(e);if(r&&Le(e,r,t))return!0;try{if(document.execCommand("insertHTML",!1,t))return se(e),!0}catch{}const o=Re(e);return o?Le(e,o,t):!1}function at(e,t){if(t===e.innerHTML)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",e,t,e.innerHTML)}catch{}}function it(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function F(e,t){const r=b.get(e)||M;if(!r)return!1;const o=k(e,r),l=x.get(e);if(Se(e))return l&&Ee(l,r.labels.readonlyMessage),!1;const n=ae(e).find(i=>i.id===t);if(!n)return!1;const a=e.innerHTML;return st(e,n.html)?(o.lastInsertedBlockId=n.id,o.selectedBlockId=n.id,o.recentBlockIds=[n.id,...o.recentBlockIds.filter(i=>i!==n.id)].slice(0,r.maxRecentBlocks),at(e,a),it(e),K(e),e.dispatchEvent(new CustomEvent("editora:blocks-library-insert",{bubbles:!0,detail:{blockId:n.id,label:n.label,category:n.category}})),L(e),l&&Ee(l,`${r.labels.lastInsertedPrefix}: ${n.label}`),!0):!1}function ze(e){const t=w.get(e);return t?.lastInsertedBlockId?F(e,t.lastInsertedBlockId):!1}function ct(e){const t=b.get(e)||M;if(!t)return;const r=w.get(e);if(!r)return;Me(e);const o=()=>{r.debounceTimer=null,r.filterCache.clear(),L(e)};if(t.debounceMs<=0){o();return}r.debounceTimer=window.setTimeout(o,t.debounceMs)}function ut(e){const t=x.get(e);if(t)return t;const r=b.get(e)||M||Q(),o=k(e,r),l=`rte-blocks-library-panel-${je++}`,n=`${l}-query`,a=`${l}-category`,s=document.createElement("section");return s.className=d,s.id=l,s.setAttribute("role","dialog"),s.setAttribute("aria-modal","false"),s.setAttribute("aria-label",r.labels.panelAriaLabel),s.innerHTML=`
21
+ `}).join("")}R&&(R.hidden=H.length>0,R.textContent=r.labels.noResultsText);const K=t.querySelector(".rte-blocks-library-last-inserted");if(K)if(o.lastInsertedBlockId){const B=ae(e).find(p=>p.id===o.lastInsertedBlockId);B?(K.hidden=!1,K.textContent=`${r.labels.lastInsertedPrefix}: ${B.label}`):K.hidden=!0}else K.hidden=!0;t.setAttribute("aria-label",r.labels.panelAriaLabel)}function S(e,t=!1){const r=x.get(e);r&&(r.classList.remove("show"),U.set(e,!1),N(e),t&&(e.focus({preventScroll:!0}),et(e)))}function st(e){e.querySelector(".rte-blocks-library-item.active")?.focus()}function ve(e,t){const r=b.get(e)||M;if(!r)return;const o=w.get(e);if(!o)return;const l=Ie(e,r);if(l.length===0)return;const a=(Math.max(0,l.findIndex(i=>i.id===o.selectedBlockId))+t+l.length)%l.length;o.selectedBlockId=l[a].id,L(e);const s=x.get(e);s&&st(s)}function de(e){const t=bt(e);se(e),x.forEach((o,l)=>{l!==e&&S(l,!1)}),t.classList.add("show"),U.set(e,!0),L(e),ue(e,t),N(e),t.querySelector('[data-field="query"]')?.focus(),be(e,!1)}function Re(e,t){const r=pe(e);return(typeof t=="boolean"?t:!r)?de(e):S(e,!1),!0}function He(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=t.getRangeAt(0);return e.contains(r.commonAncestorContainer)?r:null}function ze(e,t){if(!e.isConnected)return;const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}const at=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function Le(e,t){let r=e;for(;r&&r!==t;){if(r.nodeType===Node.ELEMENT_NODE&&at.has(r.tagName))return r;r=r.parentNode}return null}function Be(e,t,r){const o=t.cloneRange();if(!e.contains(o.commonAncestorContainer))return!1;o.deleteContents();const l=document.createElement("template");l.innerHTML=r;const n=l.content;if(!n)return!1;const a=n.lastChild,s=Le(o.endContainer,e)||Le(o.startContainer,e);if(s&&s.parentNode?s.parentNode.insertBefore(n,s.nextSibling):o.insertNode(n),a){const i=document.createRange();i.setStartAfter(a),i.collapse(!0),ze(e,i)}return se(e),!0}function it(e,t){e.focus({preventScroll:!0});const r=Me(e);if(r&&Be(e,r,t))return!0;try{if(document.execCommand("insertHTML",!1,t))return se(e),!0}catch{}const o=He(e);return o?Be(e,o,t):!1}function ct(e,t){if(t===e.innerHTML)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",e,t,e.innerHTML)}catch{}}function ut(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function F(e,t){const r=b.get(e)||M;if(!r)return!1;const o=k(e,r),l=x.get(e);if(Se(e))return l&&Ee(l,r.labels.readonlyMessage),!1;const n=ae(e).find(i=>i.id===t);if(!n)return!1;const a=e.innerHTML;return it(e,n.html)?(o.lastInsertedBlockId=n.id,o.selectedBlockId=n.id,o.recentBlockIds=[n.id,...o.recentBlockIds.filter(i=>i!==n.id)].slice(0,r.maxRecentBlocks),ct(e,a),ut(e),N(e),e.dispatchEvent(new CustomEvent("editora:blocks-library-insert",{bubbles:!0,detail:{blockId:n.id,label:n.label,category:n.category}})),L(e),l&&Ee(l,`${r.labels.lastInsertedPrefix}: ${n.label}`),!0):!1}function qe(e){const t=w.get(e);return t?.lastInsertedBlockId?F(e,t.lastInsertedBlockId):!1}function dt(e){const t=b.get(e)||M;if(!t)return;const r=w.get(e);if(!r)return;Ae(e);const o=()=>{r.debounceTimer=null,r.filterCache.clear(),L(e)};if(t.debounceMs<=0){o();return}r.debounceTimer=window.setTimeout(o,t.debounceMs)}function bt(e){const t=x.get(e);if(t)return t;const r=b.get(e)||M||Q(),o=k(e,r),l=`rte-blocks-library-panel-${We++}`,n=`${l}-query`,a=`${l}-category`,s=document.createElement("section");return s.className=d,s.id=l,s.setAttribute("role","dialog"),s.setAttribute("aria-modal","false"),s.setAttribute("aria-label",r.labels.panelAriaLabel),s.innerHTML=`
22
22
  <header class="rte-blocks-library-header">
23
23
  <h2 class="rte-blocks-library-title">${m(r.labels.panelTitle)}</h2>
24
24
  <button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${m(r.labels.closeText)}">✕</button>
@@ -41,7 +41,7 @@
41
41
  <p class="rte-blocks-library-shortcut"></p>
42
42
  </div>
43
43
  <div class="rte-blocks-library-live" aria-live="polite" aria-atomic="true"></div>
44
- `,s.addEventListener("click",i=>{const c=i.target,u=c?.closest("[data-action]");if(u){const h=u.getAttribute("data-action");if(h==="close"){T(e,!0);return}if(h==="insert-selected"){if(!o.selectedBlockId)return;F(e,o.selectedBlockId)&&T(e,!0)}return}const f=c?.closest("[data-block-id]");if(!f)return;const g=f.getAttribute("data-block-id");g&&(o.selectedBlockId=g,L(e),i.detail>=2&&F(e,g)&&T(e,!0))}),s.addEventListener("input",i=>{const c=i.target;!(c instanceof HTMLInputElement)||c.getAttribute("data-field")!=="query"||(o.query=r.normalizeText(c.value).toLowerCase(),o.filterCache.clear(),ct(e))}),s.addEventListener("change",i=>{const c=i.target;!(c instanceof HTMLSelectElement)||c.getAttribute("data-field")!=="category"||(o.category=ne(c.value||"all")||"all",o.filterCache.clear(),L(e))}),s.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),T(e,!0);return}if(i.key==="ArrowDown"){i.preventDefault(),ve(e,1);return}if(i.key==="ArrowUp"){i.preventDefault(),ve(e,-1);return}if(i.key==="Enter"){if(!i.target?.matches('[data-field="query"], [data-field="category"], [data-block-id]')||!o.selectedBlockId)return;i.preventDefault(),F(e,o.selectedBlockId)&&T(e,!0)}}),re(s,e),document.body.appendChild(s),x.set(e,s),U.set(e,!1),L(e),s}function dt(e){const t=w.get(e);return{query:t?.query||"",category:t?.category||"all",selectedBlockId:t?.selectedBlockId||null,totalMatches:t?.totalMatches||0,visibleMatches:t?.visibleMatches||0,recentBlockIds:t?.recentBlockIds?[...t.recentBlockIds]:[],lastInsertedBlockId:t?.lastInsertedBlockId||null,loading:t?.loading===!0,loadError:t?.loadError||null}}async function be(e,t){const r=b.get(e)||M;if(!r||typeof r.getBlocks!="function")return;const o=k(e,r),l=O.get(e)||0;if(!t&&r.cacheTtlMs>0&&Date.now()-l<r.cacheTtlMs)return;const n=j.get(e);if(n&&!t)return n;const a=W.get(e);a&&a.abort(),t&&n&&j.delete(e);const s=new AbortController;W.set(e,s);const i=(z.get(e)||0)+1;z.set(e,i),o.loading=!0,o.loadError=null,L(e);const c=Promise.resolve().then(async()=>{const u={editor:e,editorRoot:le(e),signal:s.signal},f=await r.getBlocks?.(u);if(s.signal.aborted||z.get(e)!==i)return;const g=Ce(f||[],r);I.set(e,g),O.set(e,Date.now());const h=w.get(e);h&&(h.loading=!1,h.loadError=null,h.filterCache.clear())}).catch(()=>{if(s.signal.aborted||z.get(e)!==i)return;const u=w.get(e);u&&(u.loading=!1,u.loadError=r.labels.loadErrorText)}).finally(()=>{z.get(e)===i&&(j.delete(e),W.delete(e)),L(e)});return j.set(e,c),c}function qe(e){return typeof e.key=="string"?e.key.toLowerCase():""}function bt(e){const t=qe(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="b"}function ft(e){const t=qe(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="l"}function gt(e){M=e,_||(_=t=>{ee();const o=t.target?.closest(v);if(!o)return;const l=b.get(o)||e;k(o,l),b.set(o,l),y=o,K(o);const n=x.get(o);n&&(re(n,o),ue(o,n),L(o))},document.addEventListener("focusin",_,!0)),P||(P=t=>{if(t.defaultPrevented)return;const r=`.${d} input, .${d} textarea, .${d} select`,o=t.target;if(o?.closest(r)){if(t.key==="Escape"){const a=o.closest(`.${d}`),s=Array.from(x.entries()).find(([,i])=>i===a);s&&(t.preventDefault(),T(s[0],!0))}return}const l=Ze(t);if(!l)return;const n=b.get(l)||M||e;if(k(l,n),b.set(l,n),y=l,t.key==="Escape"&&pe(l)){t.preventDefault(),T(l,!0);return}if(bt(t)){t.preventDefault(),t.stopPropagation(),Ie(l);return}ft(t)&&(t.preventDefault(),t.stopPropagation(),ze(l))},document.addEventListener("keydown",P,!0)),A||(A=()=>{ee(),x.forEach((t,r)=>{!r.isConnected||!t.isConnected||(re(t,r),ue(r,t))})},window.addEventListener("scroll",A,!0),window.addEventListener("resize",A)),!D&&typeof MutationObserver<"u"&&document.body&&(D=new MutationObserver(t=>{rt(t)&&ee()}),D.observe(document.body,{childList:!0,subtree:!0}))}function pt(){_&&(document.removeEventListener("focusin",_,!0),_=null),P&&(document.removeEventListener("keydown",P,!0),P=null),A&&(window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A),A=null),D&&(D.disconnect(),D=null),x.forEach(t=>t.remove()),x.clear(),Array.from(oe).forEach(t=>ge(t)),M=null,y=null}function mt(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=`
44
+ `,s.addEventListener("click",i=>{const c=i.target,u=c?.closest("[data-action]");if(u){const h=u.getAttribute("data-action");if(h==="close"){S(e,!0);return}if(h==="insert-selected"){if(!o.selectedBlockId)return;F(e,o.selectedBlockId)&&S(e,!0)}return}const f=c?.closest("[data-block-id]");if(!f)return;const g=f.getAttribute("data-block-id");g&&(o.selectedBlockId=g,L(e),i.detail>=2&&F(e,g)&&S(e,!0))}),s.addEventListener("input",i=>{const c=i.target;!(c instanceof HTMLInputElement)||c.getAttribute("data-field")!=="query"||(o.query=r.normalizeText(c.value).toLowerCase(),o.filterCache.clear(),dt(e))}),s.addEventListener("change",i=>{const c=i.target;!(c instanceof HTMLSelectElement)||c.getAttribute("data-field")!=="category"||(o.category=ne(c.value||"all")||"all",o.filterCache.clear(),L(e))}),s.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),S(e,!0);return}if(i.key==="ArrowDown"){i.preventDefault(),ve(e,1);return}if(i.key==="ArrowUp"){i.preventDefault(),ve(e,-1);return}if(i.key==="Enter"){if(!i.target?.matches('[data-field="query"], [data-field="category"], [data-block-id]')||!o.selectedBlockId)return;i.preventDefault(),F(e,o.selectedBlockId)&&S(e,!0)}}),re(s,e),document.body.appendChild(s),x.set(e,s),U.set(e,!1),L(e),s}function ft(e){const t=w.get(e);return{query:t?.query||"",category:t?.category||"all",selectedBlockId:t?.selectedBlockId||null,totalMatches:t?.totalMatches||0,visibleMatches:t?.visibleMatches||0,recentBlockIds:t?.recentBlockIds?[...t.recentBlockIds]:[],lastInsertedBlockId:t?.lastInsertedBlockId||null,loading:t?.loading===!0,loadError:t?.loadError||null}}async function be(e,t){const r=b.get(e)||M;if(!r||typeof r.getBlocks!="function")return;const o=k(e,r),l=D.get(e)||0;if(!t&&r.cacheTtlMs>0&&Date.now()-l<r.cacheTtlMs)return;const n=j.get(e);if(n&&!t)return n;const a=W.get(e);a&&a.abort(),t&&n&&j.delete(e);const s=new AbortController;W.set(e,s);const i=(z.get(e)||0)+1;z.set(e,i),o.loading=!0,o.loadError=null,L(e);const c=Promise.resolve().then(async()=>{const u={editor:e,editorRoot:le(e),signal:s.signal},f=await r.getBlocks?.(u);if(s.signal.aborted||z.get(e)!==i)return;const g=$e(f||[],r);I.set(e,g),D.set(e,Date.now());const h=w.get(e);h&&(h.loading=!1,h.loadError=null,h.filterCache.clear())}).catch(()=>{if(s.signal.aborted||z.get(e)!==i)return;const u=w.get(e);u&&(u.loading=!1,u.loadError=r.labels.loadErrorText)}).finally(()=>{z.get(e)===i&&(j.delete(e),W.delete(e)),L(e)});return j.set(e,c),c}function _e(e){return typeof e.key=="string"?e.key.toLowerCase():""}function gt(e){const t=_e(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="b"}function pt(e){const t=_e(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="l"}function mt(e){M=e,_||(_=t=>{ee();const o=t.target?.closest(v);if(!o)return;const l=b.get(o)||e;k(o,l),b.set(o,l),y=o,N(o);const n=x.get(o);n&&(re(n,o),ue(o,n),L(o))},document.addEventListener("focusin",_,!0)),P||(P=t=>{if(t.defaultPrevented)return;const r=`.${d} input, .${d} textarea, .${d} select`,o=t.target;if(o?.closest(r)){if(t.key==="Escape"){const a=o.closest(`.${d}`),s=Array.from(x.entries()).find(([,i])=>i===a);s&&(t.preventDefault(),S(s[0],!0))}return}const l=Je(t);if(!l)return;const n=b.get(l)||M||e;if(k(l,n),b.set(l,n),y=l,t.key==="Escape"&&pe(l)){t.preventDefault(),S(l,!0);return}if(gt(t)){t.preventDefault(),t.stopPropagation(),Re(l);return}pt(t)&&(t.preventDefault(),t.stopPropagation(),qe(l))},document.addEventListener("keydown",P,!0)),A||(A=()=>{ee(),x.forEach((t,r)=>{!r.isConnected||!t.isConnected||(re(t,r),ue(r,t))})},window.addEventListener("scroll",A,!0),window.addEventListener("resize",A)),!O&&typeof MutationObserver<"u"&&document.body&&(O=new MutationObserver(t=>{ot(t)&&ee()}),O.observe(document.body,{childList:!0,subtree:!0}))}function yt(){_&&(document.removeEventListener("focusin",_,!0),_=null),P&&(document.removeEventListener("keydown",P,!0),P=null),A&&(window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A),A=null),O&&(O.disconnect(),O=null),x.forEach(t=>t.remove()),x.clear(),Array.from(oe).forEach(t=>ge(t)),M=null,y=null}function ht(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=`
45
45
  .rte-toolbar-group-items.${E},
46
46
  .editora-toolbar-group-items.${E},
47
47
  .rte-toolbar-group-items.${C},
@@ -439,4 +439,4 @@
439
439
  max-height: calc(100vh - 20px);
440
440
  }
441
441
  }
442
- `,document.head.appendChild(e)}const yt=(e={})=>{const t=Q(e),r=new Set;return mt(),{name:"blocksLibrary",toolbar:[{id:"blocksLibraryGroup",label:"Blocks Library",type:"group",command:"blocksLibrary",items:[{id:"blocksLibraryPanel",label:"Blocks Library Panel",command:"toggleBlocksLibraryPanel",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/></svg>'},{id:"insertLastBlockSnippet",label:"Insert Last Block",command:"insertLastBlockSnippet",shortcut:"Mod-Alt-Shift-l",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 5.5h10a1.5 1.5 0 0 1 1.5 1.5v10A1.5 1.5 0 0 1 17 18.5H7A1.5 1.5 0 0 1 5.5 17V7A1.5 1.5 0 0 1 7 5.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M12 8.5v7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M8.5 12h7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'}]}],commands:{blocksLibrary:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},openBlocksLibraryPanel:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},toggleBlocksLibraryPanel:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,Ie(n,typeof o=="boolean"?o:void 0)},insertBlockSnippet:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a),b.set(n,a);const s=typeof o=="string"?o:o?.id;return s?(y=n,F(n,s)):!1},insertLastBlockSnippet:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,ze(n)},refreshBlocksLibraryData:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),be(n,!0),!0},setBlocksLibraryOptions:(o,l)=>{const n=S(l,!1,!1);if(!n||!o||typeof o!="object")return!1;const a=b.get(n)||t,s=J.get(n)||Ve(a),i={...s,...o,labels:{...s.labels||{},...o.labels||{}},blocks:Array.isArray(o.blocks)?o.blocks:s.blocks,normalizeText:o.normalizeText||a.normalizeText,sanitizeBlockHtml:o.sanitizeBlockHtml||a.sanitizeBlockHtml,getBlocks:o.getBlocks||a.getBlocks},c=Q(i),u=Array.isArray(o.blocks),f=o.getBlocks!==void 0;b.set(n,c),J.set(n,i),(u||f||!I.has(n))&&(I.set(n,c.blocks),O.set(n,f?0:Date.now()));const g=k(n,c);return g.filterCache.clear(),typeof o.defaultCategory=="string"&&(g.category=ne(c.defaultCategory)||"all"),L(n),K(n),f&&be(n,!0),!0},getBlocksLibraryState:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a);const s=dt(n);if(typeof o=="function")try{o(s)}catch{}return n.__blocksLibraryState=s,n.dispatchEvent(new CustomEvent("editora:blocks-library-state",{bubbles:!0,detail:s})),!0}},keymap:{"Mod-Alt-Shift-b":"toggleBlocksLibraryPanel","Mod-Alt-Shift-B":"toggleBlocksLibraryPanel","Mod-Alt-Shift-l":"insertLastBlockSnippet","Mod-Alt-Shift-L":"insertLastBlockSnippet"},init:function(l){X+=1;const n=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,a=Q(n);gt(a);const s=S(l?.editorElement?{editorElement:l.editorElement}:void 0,!1,!1);s&&(y=s,r.add(s),k(s,a),b.set(s,a),J.set(s,n),I.set(s,a.blocks),O.set(s,Date.now()),K(s))},destroy:()=>{r.forEach(o=>ge(o)),r.clear(),X=Math.max(0,X-1),!(X>0)&&pt()}}};exports.BlocksLibraryPlugin=yt;
442
+ `,document.head.appendChild(e)}const kt=(e={})=>{const t=Q(e),r=new Set;return ht(),{name:"blocksLibrary",toolbar:[{id:"blocksLibraryGroup",label:"Blocks Library",type:"group",command:"blocksLibrary",items:[{id:"blocksLibraryPanel",label:"Blocks Library Panel",command:"toggleBlocksLibraryPanel",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/></svg>'},{id:"insertLastBlockSnippet",label:"Insert Last Block",command:"insertLastBlockSnippet",shortcut:"Mod-Alt-Shift-l",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 5.5h10a1.5 1.5 0 0 1 1.5 1.5v10A1.5 1.5 0 0 1 17 18.5H7A1.5 1.5 0 0 1 5.5 17V7A1.5 1.5 0 0 1 7 5.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M12 8.5v7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M8.5 12h7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'}]}],commands:{blocksLibrary:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},openBlocksLibraryPanel:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},toggleBlocksLibraryPanel:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,Re(n,typeof o=="boolean"?o:void 0)},insertBlockSnippet:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a),b.set(n,a);const s=typeof o=="string"?o:o?.id;return s?(y=n,F(n,s)):!1},insertLastBlockSnippet:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,qe(n)},refreshBlocksLibraryData:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),be(n,!0),!0},setBlocksLibraryOptions:(o,l)=>{const n=T(l,!1,!1);if(!n||!o||typeof o!="object")return!1;const a=b.get(n)||t,s=J.get(n)||Ye(a),i={...s,...o,labels:{...s.labels||{},...o.labels||{}},blocks:Array.isArray(o.blocks)?o.blocks:s.blocks,normalizeText:o.normalizeText||a.normalizeText,sanitizeBlockHtml:o.sanitizeBlockHtml||a.sanitizeBlockHtml,getBlocks:o.getBlocks||a.getBlocks},c=Q(i),u=Array.isArray(o.blocks),f=o.getBlocks!==void 0;b.set(n,c),J.set(n,i),(u||f||!I.has(n))&&(I.set(n,c.blocks),D.set(n,f?0:Date.now()));const g=k(n,c);return g.filterCache.clear(),typeof o.defaultCategory=="string"&&(g.category=ne(c.defaultCategory)||"all"),L(n),N(n),f&&be(n,!0),!0},getBlocksLibraryState:(o,l)=>{const n=T(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a);const s=ft(n);if(typeof o=="function")try{o(s)}catch{}return n.__blocksLibraryState=s,n.dispatchEvent(new CustomEvent("editora:blocks-library-state",{bubbles:!0,detail:s})),!0}},keymap:{"Mod-Alt-Shift-b":"toggleBlocksLibraryPanel","Mod-Alt-Shift-B":"toggleBlocksLibraryPanel","Mod-Alt-Shift-l":"insertLastBlockSnippet","Mod-Alt-Shift-L":"insertLastBlockSnippet"},init:function(l){X+=1;const n=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,a=Q(n);mt(a);const s=T(l?.editorElement?{editorElement:l.editorElement}:void 0,!1,!1);s&&(y=s,r.add(s),k(s,a),b.set(s,a),J.set(s,n),I.set(s,a.blocks),D.set(s,Date.now()),N(s))},destroy:()=>{r.forEach(o=>ge(o)),r.clear(),X=Math.max(0,X-1),!(X>0)&&yt()}}};exports.BlocksLibraryPlugin=kt;