@editora/core 1.0.23 → 1.0.24

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 (64) hide show
  1. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  2. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  3. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  4. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  5. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  6. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  7. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  8. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  9. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  10. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  11. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  12. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  13. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  14. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  15. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  16. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  17. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  18. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  19. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  20. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  21. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  22. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  23. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  24. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  25. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  26. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  27. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  28. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  29. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  30. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  31. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  32. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  33. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  34. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  35. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  36. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  37. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  38. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  39. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  40. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  41. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  42. package/dist/editora.min.js +21 -21
  43. package/dist/editora.umd.js +10 -10
  44. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  45. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  46. package/dist/index.cjs.js +1 -1
  47. package/dist/index.esm.js +2 -2
  48. package/dist/katex-DLIObQUm.mjs +11683 -0
  49. package/dist/katex.min--Ws3c9be.mjs +6 -0
  50. package/dist/notify-DCQGpmq-.mjs +60 -0
  51. package/dist/plugin-loader.js +54 -54
  52. package/dist/webcomponent-core.js +305 -234
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +153 -80
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +631 -560
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1677 -1328
  60. package/package.json +1 -1
  61. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  62. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  63. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  64. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,3 +1,4 @@
1
+ import { k as Fe } from "./dialogHelpers-Dzn8DHoF.mjs";
1
2
  const y = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ve = "__editoraCommandEditorRoot", $e = "rte-translation-workflow-styles", d = "rte-translation-workflow-panel", S = "translation-workflow", $ = "translationWorkflow", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ee = [
2
3
  "p",
3
4
  "h1",
@@ -98,14 +99,14 @@ const y = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
98
99
  untranslatedMessage: "Segment appears untranslated (same as source).",
99
100
  lengthOutOfRangeMessage: "Translation length is outside expected locale range."
100
101
  }, u = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new Set();
101
- let ee = 0, Fe = 0, Re = 0, We = 0, w = null, x = null, N = null, O = null, _ = null, F = null, I = null, W = null;
102
+ let ee = 0, We = 0, Re = 0, Ke = 0, w = null, x = null, N = null, O = null, F = null, _ = null, I = null, W = null;
102
103
  function m(e) {
103
104
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
104
105
  }
105
- function Ke(e) {
106
+ function Ve(e) {
106
107
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
107
108
  }
108
- function B(e, n, t) {
109
+ function q(e, n, t) {
109
110
  return Number.isFinite(e) ? Math.max(n, Math.min(t, e)) : n;
110
111
  }
111
112
  function A(e) {
@@ -114,24 +115,24 @@ function A(e) {
114
115
  function j(e) {
115
116
  return e.trim().toLowerCase();
116
117
  }
117
- function Ve(e) {
118
+ function je(e) {
118
119
  return e.replace(/"/g, "&quot;");
119
120
  }
120
- function je(e, n = 120) {
121
+ function Ue(e, n = 120) {
121
122
  return e.length <= n ? e : `${e.slice(0, Math.max(0, n - 1)).trimEnd()}…`;
122
123
  }
123
124
  function Ie(e) {
124
125
  const n = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
125
126
  return !n || n.length === 0 ? [] : n.map((t) => t.trim()).filter(Boolean);
126
127
  }
127
- function Ue(e, n) {
128
+ function Ge(e, n) {
128
129
  const t = Ie(e).sort(), r = Ie(n).sort();
129
130
  if (t.length !== r.length) return !1;
130
131
  for (let a = 0; a < t.length; a += 1)
131
132
  if (t[a] !== r[a]) return !1;
132
133
  return !0;
133
134
  }
134
- function Ge(e, n) {
135
+ function Ye(e, n) {
135
136
  const t = Array.isArray(n) && n.length > 0 ? n : Ae, r = [], a = /* @__PURE__ */ new Set();
136
137
  return t.forEach((o) => {
137
138
  var i, c;
@@ -141,8 +142,8 @@ function Ge(e, n) {
141
142
  a.has(s) || (a.add(s), r.push({
142
143
  locale: s,
143
144
  label: (o.label || l).trim() || l,
144
- minLengthRatio: B(Number((i = o.minLengthRatio) != null ? i : 0.5), 0.1, 3),
145
- maxLengthRatio: B(Number((c = o.maxLengthRatio) != null ? c : 1.8), 0.2, 4),
145
+ minLengthRatio: q(Number((i = o.minLengthRatio) != null ? i : 0.5), 0.1, 3),
146
+ maxLengthRatio: q(Number((c = o.maxLengthRatio) != null ? c : 1.8), 0.2, 4),
146
147
  requireDifferentFromSource: o.requireDifferentFromSource !== !1,
147
148
  preserveTokens: o.preserveTokens !== !1
148
149
  }));
@@ -164,23 +165,23 @@ function Ge(e, n) {
164
165
  }
165
166
  function ae(e = {}) {
166
167
  var s, i, c, g;
167
- const n = e.normalizeText || Ke, t = A(e.sourceLocale || "en-US"), r = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
168
+ const n = e.normalizeText || Ve, t = A(e.sourceLocale || "en-US"), r = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
168
169
  (Array.isArray(e.locales) ? e.locales : []).forEach((p) => {
169
170
  if (typeof p != "string") return;
170
171
  const v = A(p);
171
172
  a.add(v);
172
173
  });
173
- const o = Array.from(a), l = Ge(o, e.localeRules);
174
+ const o = Array.from(a), l = Ye(o, e.localeRules);
174
175
  return {
175
176
  sourceLocale: t,
176
177
  targetLocale: r,
177
178
  locales: o,
178
179
  localeRules: l,
179
180
  enableRealtime: e.enableRealtime !== !1,
180
- debounceMs: B(Number((s = e.debounceMs) != null ? s : 260), 60, 2e3),
181
- maxIssues: B(Number((i = e.maxIssues) != null ? i : 120), 5, 1e3),
182
- maxSegments: B(Number((c = e.maxSegments) != null ? c : 600), 20, 3e3),
183
- minSourceLengthForRatio: B(Number((g = e.minSourceLengthForRatio) != null ? g : 8), 2, 100),
181
+ debounceMs: q(Number((s = e.debounceMs) != null ? s : 260), 60, 2e3),
182
+ maxIssues: q(Number((i = e.maxIssues) != null ? i : 120), 5, 1e3),
183
+ maxSegments: q(Number((c = e.maxSegments) != null ? c : 600), 20, 3e3),
184
+ minSourceLengthForRatio: q(Number((g = e.minSourceLengthForRatio) != null ? g : 8), 2, 100),
184
185
  segmentSelector: (e.segmentSelector || Ee).trim() || Ee,
185
186
  labels: {
186
187
  ..._e,
@@ -189,7 +190,7 @@ function ae(e = {}) {
189
190
  normalizeText: n
190
191
  };
191
192
  }
192
- function Ye(e) {
193
+ function Ze(e) {
193
194
  return {
194
195
  sourceLocale: e.sourceLocale,
195
196
  targetLocale: e.targetLocale,
@@ -221,7 +222,7 @@ function U(e) {
221
222
  const n = e.querySelector(y);
222
223
  return n instanceof HTMLElement ? n : null;
223
224
  }
224
- function Ze() {
225
+ function Je() {
225
226
  if (typeof window == "undefined") return null;
226
227
  const e = window[ve];
227
228
  if (!(e instanceof HTMLElement)) return null;
@@ -236,7 +237,7 @@ function Ze() {
236
237
  const r = e.closest(y);
237
238
  return r instanceof HTMLElement ? r : null;
238
239
  }
239
- function Je(e) {
240
+ function Qe(e) {
240
241
  const n = e.closest("[data-editora-editor]");
241
242
  if (n && U(n) === e)
242
243
  return n;
@@ -254,16 +255,16 @@ function He(e) {
254
255
  function te(e) {
255
256
  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;
256
257
  }
257
- function Qe(e) {
258
+ function Xe(e) {
258
259
  const n = we(e);
259
260
  if (te(n)) return !0;
260
261
  const t = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
261
262
  return te(t) ? !0 : te(document.documentElement) || te(document.body);
262
263
  }
263
264
  function ge(e, n) {
264
- e.classList.remove("rte-translation-workflow-theme-dark"), Qe(n) && e.classList.add("rte-translation-workflow-theme-dark");
265
+ e.classList.remove("rte-translation-workflow-theme-dark"), Xe(n) && e.classList.add("rte-translation-workflow-theme-dark");
265
266
  }
266
- function Xe(e) {
267
+ function et(e) {
267
268
  var n, t, r, a;
268
269
  for (let o = 0; o < e.length; o += 1) {
269
270
  const l = e[o];
@@ -290,7 +291,7 @@ function T(e, n = !0, t = !0) {
290
291
  const i = U(e.editorElement);
291
292
  if (i) return i;
292
293
  }
293
- const r = Ze();
294
+ const r = Je();
294
295
  if (r) return r;
295
296
  const a = window.getSelection();
296
297
  if (a && a.rangeCount > 0) {
@@ -311,7 +312,7 @@ function T(e, n = !0, t = !0) {
311
312
  const l = document.querySelector(y);
312
313
  return l instanceof HTMLElement ? l : null;
313
314
  }
314
- function et(e) {
315
+ function tt(e) {
315
316
  const n = e.target;
316
317
  if (n) {
317
318
  const r = n.closest(`.${d}`);
@@ -335,7 +336,7 @@ function et(e) {
335
336
  return null;
336
337
  }
337
338
  function fe(e, n, t) {
338
- const r = Je(e);
339
+ const r = Qe(e);
339
340
  Array.from(
340
341
  r.querySelectorAll(
341
342
  `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
@@ -348,7 +349,7 @@ function xe(e) {
348
349
  const n = se.get(e);
349
350
  typeof n == "number" && (window.clearTimeout(n), se.delete(e));
350
351
  }
351
- function tt(e, n) {
352
+ function nt(e, n) {
352
353
  const t = j(n), r = e.localeRules.find((l) => j(l.locale) === t);
353
354
  if (r) return r;
354
355
  const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
@@ -361,7 +362,7 @@ function tt(e, n) {
361
362
  preserveTokens: !0
362
363
  };
363
364
  }
364
- function nt(e) {
365
+ function rt(e) {
365
366
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
366
367
  }
367
368
  function ne(e, n, t, r = {}) {
@@ -386,15 +387,15 @@ function ce(e, n) {
386
387
  e.removeAttribute("data-translation-prev-contenteditable"), t === null || t === "inherit" || t === "" ? e.removeAttribute("contenteditable") : e.setAttribute("contenteditable", t);
387
388
  }
388
389
  function ue(e, n) {
389
- return e.querySelector(`[data-translation-segment-id="${Ve(n)}"]`);
390
+ return e.querySelector(`[data-translation-segment-id="${je(n)}"]`);
390
391
  }
391
- function qe(e) {
392
+ function Pe(e) {
392
393
  const n = window.getSelection();
393
394
  if (!n || n.rangeCount === 0) return null;
394
395
  const t = He(n.getRangeAt(0).startContainer);
395
396
  return !t || !e.contains(t) ? null : t.closest("[data-translation-segment-id]");
396
397
  }
397
- function rt(e, n) {
398
+ function ot(e, n) {
398
399
  const t = Array.from(e.querySelectorAll(n));
399
400
  if (t.length <= 1) return t;
400
401
  const r = new Set(t);
@@ -408,11 +409,11 @@ function rt(e, n) {
408
409
  return !0;
409
410
  });
410
411
  }
411
- function ot(e, n, t) {
412
+ function at(e, n, t) {
412
413
  let r = (t || "").trim();
413
414
  if (!r || n.has(r)) {
414
415
  do
415
- r = `translation-segment-${Fe++}`;
416
+ r = `translation-segment-${We++}`;
416
417
  while (n.has(r));
417
418
  e.setAttribute("data-translation-segment-id", r);
418
419
  }
@@ -435,9 +436,9 @@ function me(e, n) {
435
436
  }
436
437
  function M(e, n, t) {
437
438
  var l;
438
- const r = rt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
439
+ const r = ot(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
439
440
  for (let s = 0; s < r.length && !(a.length >= n.maxSegments); s += 1) {
440
- const i = r[s], c = ot(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), p = i.getAttribute("data-translation-locked") === "true", v = g || p;
441
+ const i = r[s], c = at(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), p = i.getAttribute("data-translation-locked") === "true", v = g || p;
441
442
  if (v)
442
443
  if (t.lockedSegmentIds.add(c), ce(i, !0), !t.lockedHtmlBySegmentId.has(c))
443
444
  t.lockedHtmlBySegmentId.set(c, i.innerHTML);
@@ -503,15 +504,15 @@ function be(e, n) {
503
504
  const t = we(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 520), a = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, t.right - r), a), l = Math.max(10, Math.min(window.innerHeight - 10, t.top + 12));
504
505
  n.style.width = `${r}px`, n.style.left = `${o}px`, n.style.top = `${l}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
505
506
  }
506
- function P(e, n) {
507
+ function B(e, n) {
507
508
  const t = e.querySelector(".rte-translation-live");
508
509
  t && (t.textContent = n);
509
510
  }
510
- function at(e, n) {
511
+ function lt(e, n) {
511
512
  return `${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`;
512
513
  }
513
- function lt(e, n, t) {
514
- const r = [], a = tt(t, n.targetLocale);
514
+ function st(e, n, t) {
515
+ const r = [], a = nt(t, n.targetLocale);
515
516
  for (let o = 0; o < e.length && !(r.length >= t.maxIssues); o += 1) {
516
517
  const l = e[o], s = t.normalizeText(l.sourceText || ""), i = t.normalizeText(l.text || "");
517
518
  if (!i) {
@@ -525,7 +526,7 @@ function lt(e, n, t) {
525
526
  );
526
527
  continue;
527
528
  }
528
- if (a.preserveTokens && s && !Ue(s, i) && (r.push(
529
+ if (a.preserveTokens && s && !Ge(s, i) && (r.push(
529
530
  ne("token-mismatch", "error", t.labels.tokenMismatchMessage, {
530
531
  segmentId: l.id,
531
532
  sourceText: s,
@@ -555,7 +556,7 @@ function lt(e, n, t) {
555
556
  }
556
557
  return r;
557
558
  }
558
- function Be(e) {
559
+ function qe(e) {
559
560
  const n = u.get(e) || w, t = D.get(e);
560
561
  return {
561
562
  sourceLocale: (t == null ? void 0 : t.sourceLocale) || (n == null ? void 0 : n.sourceLocale) || "en-US",
@@ -580,7 +581,7 @@ function E(e) {
580
581
  const n = D.get(e), t = n && n.selectedSegmentId ? n.segments.find((r) => r.id === n.selectedSegmentId) : null;
581
582
  fe(e, "toggleTranslationWorkflowPanel", Se(e)), fe(e, "toggleTranslationRealtime", (n == null ? void 0 : n.realtimeEnabled) === !0), fe(e, "toggleTranslationSegmentLock", (t == null ? void 0 : t.locked) === !0);
582
583
  }
583
- function st(e, n) {
584
+ function it(e, n) {
584
585
  const t = ue(e, n);
585
586
  if (!t) return;
586
587
  try {
@@ -621,8 +622,8 @@ function R(e) {
621
622
  C && (C.textContent = t.labels.captureSourceText);
622
623
  const K = n.querySelector('[data-action="toggle-realtime"]');
623
624
  K && (K.textContent = r.realtimeEnabled ? t.labels.realtimeOnText : t.labels.realtimeOffText, K.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
624
- const H = n.querySelector('[data-action="lock-selected"]'), q = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
625
- H && (H.textContent = q != null && q.locked ? t.labels.unlockSelectedText : t.labels.lockSelectedText, H.disabled = !q, H.setAttribute("aria-pressed", q != null && q.locked ? "true" : "false"));
625
+ const H = n.querySelector('[data-action="lock-selected"]'), P = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
626
+ H && (H.textContent = P != null && P.locked ? t.labels.unlockSelectedText : t.labels.lockSelectedText, H.disabled = !P, H.setAttribute("aria-pressed", P != null && P.locked ? "true" : "false"));
626
627
  const Te = n.querySelector('[data-action="close"]');
627
628
  Te && Te.setAttribute("aria-label", t.labels.closeText);
628
629
  const J = n.querySelector(".rte-translation-issues"), V = n.querySelector(".rte-translation-empty");
@@ -635,22 +636,24 @@ function R(e) {
635
636
  </li>
636
637
  `).join("")));
637
638
  const de = n.querySelector(".rte-translation-segments");
638
- de && (de.setAttribute("aria-label", t.labels.segmentsLabel), de.innerHTML = r.segments.map((f) => {
639
- const z = f.id === r.selectedSegmentId ? "selected" : "", Oe = f.locked ? "locked" : "";
640
- return `
641
- <li class="rte-translation-segment-item ${z} ${Oe}" role="option" aria-selected="${f.id === r.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
642
- <button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
643
- f.id
644
- )}" title="${m(f.text)}">
639
+ de && (de.setAttribute("aria-label", t.labels.segmentsLabel), Fe(n, () => {
640
+ de.innerHTML = r.segments.map((f) => {
641
+ const z = f.id === r.selectedSegmentId ? "selected" : "", Oe = f.locked ? "locked" : "";
642
+ return `
643
+ <li class="rte-translation-segment-item ${z} ${Oe}" data-segment-id="${m(f.id)}">
644
+ <button type="button" class="rte-translation-segment-select" data-action="select-segment"${f.id === r.selectedSegmentId ? ' aria-current="true"' : ""} data-segment-id="${m(
645
+ f.id
646
+ )}" title="${m(f.text)}">
645
647
  <span class="rte-translation-segment-meta">#${f.index + 1} • ${m(f.tagName)}</span>
646
- <span class="rte-translation-segment-text">${m(je(f.text, 110))}</span>
648
+ <span class="rte-translation-segment-text">${m(Ue(f.text, 110))}</span>
647
649
  </button>
648
650
  <button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
649
- f.id
650
- )}" aria-label="${f.locked ? t.labels.unlockSegmentAriaLabel : t.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
651
+ f.id
652
+ )}" aria-label="${f.locked ? t.labels.unlockSegmentAriaLabel : t.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
651
653
  </li>
652
654
  `;
653
- }).join(""));
655
+ }).join("");
656
+ }));
654
657
  const Q = n.querySelector(".rte-translation-source-preview"), X = n.querySelector(".rte-translation-target-preview");
655
658
  if (Q || X) {
656
659
  const f = r.selectedSegmentId && r.segments.find((z) => z.id === r.selectedSegmentId) || null;
@@ -658,7 +661,7 @@ function R(e) {
658
661
  }
659
662
  n.setAttribute("aria-label", t.labels.panelAriaLabel);
660
663
  }
661
- function Pe(e) {
664
+ function Be(e) {
662
665
  const n = u.get(e) || w;
663
666
  if (!n) return;
664
667
  xe(e);
@@ -672,23 +675,23 @@ function L(e, n, t) {
672
675
  if (!r) return [];
673
676
  const a = b(e, r), o = me(e, a);
674
677
  a.segments = M(e, r, a);
675
- const l = at(e, a);
678
+ const l = lt(e, a);
676
679
  if (!t && a.snapshot === l)
677
680
  return a.issues;
678
- a.issues = lt(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
681
+ a.issues = st(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
679
682
  new CustomEvent("editora:translation-workflow-validation", {
680
683
  bubbles: !0,
681
684
  detail: {
682
685
  reason: n,
683
- state: Be(e)
686
+ state: qe(e)
684
687
  }
685
688
  })
686
689
  );
687
690
  const s = h.get(e);
688
691
  if (s) {
689
692
  if (o)
690
- return P(s, r.labels.readonlySegmentMessage), a.issues;
691
- P(
693
+ return B(s, r.labels.readonlySegmentMessage), a.issues;
694
+ B(
692
695
  s,
693
696
  a.issues.length === 0 ? r.labels.noIssuesText : `${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} detected.`
694
697
  );
@@ -703,7 +706,7 @@ function De(e) {
703
706
  t.sourceTextBySegmentId.set(o.id, o.text);
704
707
  }), t.snapshot = "", L(e, "capture-source", !0);
705
708
  const a = h.get(e);
706
- return a && P(a, n.labels.sourceCapturedMessage), e.dispatchEvent(
709
+ return a && B(a, n.labels.sourceCapturedMessage), e.dispatchEvent(
707
710
  new CustomEvent("editora:translation-source-captured", {
708
711
  bubbles: !0,
709
712
  detail: {
@@ -715,12 +718,12 @@ function De(e) {
715
718
  }
716
719
  function ie(e, n, t) {
717
720
  var c, g;
718
- if (nt(e)) return !1;
721
+ if (rt(e)) return !1;
719
722
  const r = u.get(e) || w;
720
723
  if (!r) return !1;
721
724
  const a = b(e, r);
722
725
  a.segments = M(e, r, a);
723
- const o = ((c = qe(e)) == null ? void 0 : c.getAttribute("data-translation-segment-id")) || null, l = n || o || a.selectedSegmentId || ((g = a.segments[0]) == null ? void 0 : g.id) || null;
726
+ const o = ((c = Pe(e)) == null ? void 0 : c.getAttribute("data-translation-segment-id")) || null, l = n || o || a.selectedSegmentId || ((g = a.segments[0]) == null ? void 0 : g.id) || null;
724
727
  if (!l) return !1;
725
728
  const s = ue(e, l);
726
729
  if (!s) return !1;
@@ -739,13 +742,13 @@ function ze(e, n) {
739
742
  const t = u.get(e) || w;
740
743
  if (!t) return !1;
741
744
  const r = b(e, t), a = typeof n == "boolean" ? n : !r.realtimeEnabled;
742
- return r.realtimeEnabled = a, a ? Pe(e) : xe(e), R(e), E(e), !0;
745
+ return r.realtimeEnabled = a, a ? Be(e) : xe(e), R(e), E(e), !0;
743
746
  }
744
747
  function pe(e, n, t = !0) {
745
748
  const r = u.get(e) || w;
746
749
  if (!r) return !1;
747
750
  const a = b(e, r);
748
- return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t && st(e, n), !0) : !1;
751
+ return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t && it(e, n), !0) : !1;
749
752
  }
750
753
  function re(e, n) {
751
754
  const t = u.get(e) || w;
@@ -757,7 +760,7 @@ function re(e, n) {
757
760
  r.segments.findIndex((s) => s.id === r.selectedSegmentId)
758
761
  );
759
762
  let o = a;
760
- n === "start" ? o = 0 : n === "end" ? o = r.segments.length - 1 : o = B(a + n, 0, r.segments.length - 1);
763
+ n === "start" ? o = 0 : n === "end" ? o = r.segments.length - 1 : o = q(a + n, 0, r.segments.length - 1);
761
764
  const l = r.segments[o];
762
765
  return l ? pe(e, l.id, !0) : !1;
763
766
  }
@@ -766,7 +769,7 @@ function G(e, n = !1) {
766
769
  t && (t.classList.remove("show"), Y.set(e, !1), E(e), n && e.focus({ preventScroll: !0 }));
767
770
  }
768
771
  function he(e) {
769
- const n = ft(e);
772
+ const n = gt(e);
770
773
  h.forEach((r, a) => {
771
774
  a !== e && G(a, !1);
772
775
  }), n.classList.add("show"), Y.set(e, !0), L(e, "panel-open", !1), R(e), be(e, n), E(e);
@@ -780,30 +783,30 @@ function Ne(e, n) {
780
783
  function Le(e) {
781
784
  return typeof e.key == "string" ? e.key.toLowerCase() : "";
782
785
  }
783
- function it(e) {
786
+ function ct(e) {
784
787
  const n = Le(e);
785
788
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
786
789
  }
787
- function ct(e) {
790
+ function ut(e) {
788
791
  const n = Le(e);
789
792
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
790
793
  }
791
- function ut(e) {
794
+ function dt(e) {
792
795
  const n = Le(e);
793
796
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
794
797
  }
795
- function dt(e) {
798
+ function ft(e) {
796
799
  return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
797
800
  }
798
801
  function Me(e) {
799
802
  return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
800
803
  }
801
- function ft(e) {
804
+ function gt(e) {
802
805
  const n = h.get(e);
803
806
  if (n) return n;
804
807
  const t = u.get(e) || w || ae();
805
808
  b(e, t);
806
- const r = `rte-translation-workflow-panel-${We++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
809
+ const r = `rte-translation-workflow-panel-${Ke++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
807
810
  return l.className = d, l.id = r, l.setAttribute("role", "dialog"), l.setAttribute("aria-modal", "false"), l.setAttribute("aria-label", t.labels.panelAriaLabel), l.innerHTML = `
808
811
  <header class="rte-translation-header">
809
812
  <h2 class="rte-translation-title">${m(t.labels.panelTitle)}</h2>
@@ -834,7 +837,7 @@ function ft(e) {
834
837
  <div class="rte-translation-grid">
835
838
  <section class="rte-translation-segments-wrap" aria-label="${m(t.labels.segmentsLabel)}">
836
839
  <h3 class="rte-translation-subtitle">${m(t.labels.segmentsLabel)}</h3>
837
- <ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(
840
+ <ul class="rte-translation-segments" aria-label="${m(
838
841
  t.labels.segmentsLabel
839
842
  )}"></ul>
840
843
  </section>
@@ -918,7 +921,7 @@ function ft(e) {
918
921
  !(i != null && i.closest(".rte-translation-segments")) || !Ce.has(s.key) || (s.preventDefault(), s.key === "ArrowUp" ? re(e, -1) : s.key === "ArrowDown" ? re(e, 1) : s.key === "Home" ? re(e, "start") : s.key === "End" && re(e, "end"));
919
922
  }), ge(l, e), document.body.appendChild(l), h.set(e, l), Y.set(e, !1), R(e), l;
920
923
  }
921
- function gt(e) {
924
+ function mt(e) {
922
925
  w = e, N || (N = (n) => {
923
926
  var i;
924
927
  le();
@@ -926,7 +929,7 @@ function gt(e) {
926
929
  if (!r) return;
927
930
  const a = u.get(r) || e, o = b(r, a);
928
931
  u.set(r, a), x = r;
929
- const l = ((i = qe(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
932
+ const l = ((i = Pe(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
930
933
  l && (o.selectedSegmentId = l), E(r);
931
934
  const s = h.get(r);
932
935
  s && (ge(s, r), be(r, s), R(r));
@@ -939,38 +942,38 @@ function gt(e) {
939
942
  if (o.segments = M(r, a, o), !o.realtimeEnabled) {
940
943
  if (l) {
941
944
  const s = h.get(r);
942
- s && P(s, a.labels.readonlySegmentMessage);
945
+ s && B(s, a.labels.readonlySegmentMessage);
943
946
  }
944
947
  R(r), E(r);
945
948
  return;
946
949
  }
947
- Pe(r);
948
- }, document.addEventListener("input", O, !0)), _ || (_ = (n) => {
950
+ Be(r);
951
+ }, document.addEventListener("input", O, !0)), F || (F = (n) => {
949
952
  const t = n, r = t.target, a = r == null ? void 0 : r.closest(y);
950
953
  if (!a) return;
951
954
  const o = Me(r);
952
955
  if (!o || !a.contains(o)) return;
953
956
  t.preventDefault();
954
957
  const l = h.get(a), s = u.get(a) || w;
955
- l && s && P(l, s.labels.readonlySegmentMessage);
956
- }, document.addEventListener("beforeinput", _, !0)), F || (F = (n) => {
958
+ l && s && B(l, s.labels.readonlySegmentMessage);
959
+ }, document.addEventListener("beforeinput", F, !0)), _ || (_ = (n) => {
957
960
  if (n.defaultPrevented) return;
958
961
  const t = n.target;
959
962
  if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Ce.has(n.key)) return;
960
- const a = n.key === "Escape", o = it(n), l = ct(n), s = ut(n), i = Me(t);
963
+ const a = n.key === "Escape", o = ct(n), l = ut(n), s = dt(n), i = Me(t);
961
964
  if (!a && !o && !l && !s && !i)
962
965
  return;
963
- const c = et(n);
966
+ const c = tt(n);
964
967
  if (!c) return;
965
968
  const g = u.get(c) || w || e;
966
969
  if (b(c, g), u.set(c, g), x = c, a && Se(c)) {
967
970
  n.preventDefault(), G(c, !0);
968
971
  return;
969
972
  }
970
- if (i && c.contains(i) && dt(n)) {
973
+ if (i && c.contains(i) && ft(n)) {
971
974
  n.preventDefault();
972
975
  const p = h.get(c);
973
- p && P(p, g.labels.readonlySegmentMessage);
976
+ p && B(p, g.labels.readonlySegmentMessage);
974
977
  return;
975
978
  }
976
979
  if (o) {
@@ -982,17 +985,17 @@ function gt(e) {
982
985
  return;
983
986
  }
984
987
  s && (n.preventDefault(), n.stopPropagation(), ie(c));
985
- }, document.addEventListener("keydown", F, !0)), I || (I = () => {
988
+ }, document.addEventListener("keydown", _, !0)), I || (I = () => {
986
989
  le(), h.forEach((n, t) => {
987
990
  !t.isConnected || !n.isConnected || (ge(n, t), be(t, n));
988
991
  });
989
992
  }, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !W && typeof MutationObserver != "undefined" && document.body && (W = new MutationObserver((n) => {
990
- Xe(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
993
+ et(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
991
994
  const a = D.get(r);
992
995
  if (!a || a.lockedSegmentIds.size === 0 || !me(r, a)) return;
993
996
  a.snapshot = "";
994
997
  const l = u.get(r) || w, s = h.get(r);
995
- s && l && P(s, l.labels.readonlySegmentMessage), l && (a.segments = M(r, l, a), R(r), E(r));
998
+ s && l && B(s, l.labels.readonlySegmentMessage), l && (a.segments = M(r, l, a), R(r), E(r));
996
999
  });
997
1000
  }), W.observe(document.body, {
998
1001
  childList: !0,
@@ -1000,10 +1003,10 @@ function gt(e) {
1000
1003
  characterData: !0
1001
1004
  }));
1002
1005
  }
1003
- function mt() {
1004
- N && (document.removeEventListener("focusin", N, !0), N = null), O && (document.removeEventListener("input", O, !0), O = null), _ && (document.removeEventListener("beforeinput", _, !0), _ = null), F && (document.removeEventListener("keydown", F, !0), F = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), W && (W.disconnect(), W = null), h.forEach((n) => n.remove()), h.clear(), Array.from(Z).forEach((n) => ye(n)), w = null, x = null;
1005
- }
1006
1006
  function bt() {
1007
+ N && (document.removeEventListener("focusin", N, !0), N = null), O && (document.removeEventListener("input", O, !0), O = null), F && (document.removeEventListener("beforeinput", F, !0), F = null), _ && (document.removeEventListener("keydown", _, !0), _ = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), W && (W.disconnect(), W = null), h.forEach((n) => n.remove()), h.clear(), Array.from(Z).forEach((n) => ye(n)), w = null, x = null;
1008
+ }
1009
+ function pt() {
1007
1010
  if (typeof document == "undefined" || document.getElementById($e)) return;
1008
1011
  const e = document.createElement("style");
1009
1012
  e.id = $e, e.textContent = `
@@ -1571,9 +1574,9 @@ function bt() {
1571
1574
  }
1572
1575
  `, document.head.appendChild(e);
1573
1576
  }
1574
- const pt = (e = {}) => {
1577
+ const kt = (e = {}) => {
1575
1578
  const n = ae(e), t = /* @__PURE__ */ new Set();
1576
- return bt(), {
1579
+ return pt(), {
1577
1580
  name: "translationWorkflow",
1578
1581
  toolbar: [
1579
1582
  {
@@ -1666,7 +1669,7 @@ const pt = (e = {}) => {
1666
1669
  setTranslationWorkflowOptions: (r, a) => {
1667
1670
  const o = T(a, !1, !1);
1668
1671
  if (!o || !r || typeof r != "object") return !1;
1669
- const l = u.get(o) || n, s = oe.get(o) || Ye(l), i = {
1672
+ const l = u.get(o) || n, s = oe.get(o) || Ze(l), i = {
1670
1673
  ...s,
1671
1674
  ...r,
1672
1675
  labels: {
@@ -1686,7 +1689,7 @@ const pt = (e = {}) => {
1686
1689
  if (!o) return !1;
1687
1690
  const l = u.get(o) || n;
1688
1691
  b(o, l);
1689
- const s = Be(o);
1692
+ const s = qe(o);
1690
1693
  if (typeof r == "function")
1691
1694
  try {
1692
1695
  r(s);
@@ -1711,7 +1714,7 @@ const pt = (e = {}) => {
1711
1714
  init: function(a) {
1712
1715
  ee += 1;
1713
1716
  const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = ae(o);
1714
- gt(l);
1717
+ mt(l);
1715
1718
  const s = T(
1716
1719
  a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
1717
1720
  !1,
@@ -1723,11 +1726,11 @@ const pt = (e = {}) => {
1723
1726
  u.set(s, l), oe.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
1724
1727
  },
1725
1728
  destroy: () => {
1726
- t.forEach((r) => ye(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && mt();
1729
+ t.forEach((r) => ye(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && bt();
1727
1730
  }
1728
1731
  };
1729
1732
  };
1730
1733
  export {
1731
- pt as TranslationWorkflowPlugin
1734
+ kt as TranslationWorkflowPlugin
1732
1735
  };
1733
- //# sourceMappingURL=TranslationWorkflowPlugin.native-CZtG--06.mjs.map
1736
+ //# sourceMappingURL=TranslationWorkflowPlugin.native-BGXVJD9f.mjs.map