@editora/core 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +1 -1
  2. package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
  3. package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
  4. package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
  5. package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
  6. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  7. package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
  8. package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  9. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  10. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  11. package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
  12. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  13. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  14. package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
  15. package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
  16. package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
  17. package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
  18. package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
  19. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  20. package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
  21. package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
  22. package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
  23. package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
  24. package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
  25. package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
  26. package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
  27. package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
  28. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  29. package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
  30. package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
  31. package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  32. package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
  33. package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
  34. package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
  35. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  36. package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
  37. package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
  38. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  39. package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
  40. package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
  41. package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
  42. package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
  43. package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
  44. package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
  45. package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
  46. package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
  47. package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
  48. package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
  49. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  50. package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
  51. package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
  52. package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
  53. package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
  54. package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  55. package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
  56. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  57. package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
  58. package/dist/core.css +1 -0
  59. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  60. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
  61. package/dist/editora.min.js +13 -14
  62. package/dist/editora.umd.js +13 -14
  63. package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
  64. package/dist/index-BslAFzmv.mjs +16544 -0
  65. package/dist/index-CPMGUZfB.js +10 -0
  66. package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
  67. package/dist/index.cjs.js +1 -1
  68. package/dist/index.es-BYD2KEo6.mjs +6666 -0
  69. package/dist/index.esm.js +7 -12
  70. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  71. package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
  72. package/dist/plugin-loader.js +67 -67
  73. package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
  74. package/dist/webcomponent-core.js +131 -168
  75. package/dist/webcomponent-core.min.css +1 -1
  76. package/dist/webcomponent-core.min.js +139 -63
  77. package/dist/webcomponent.cjs.js +1 -1
  78. package/dist/webcomponent.esm.js +1 -1
  79. package/dist/webcomponent.js +191 -228
  80. package/dist/webcomponent.min.css +1 -1
  81. package/dist/webcomponent.min.js +1240 -1344
  82. package/package.json +1 -1
  83. package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
  84. package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
  85. package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
  86. package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
  87. package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
  88. package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
  89. package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
  90. package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
  91. package/dist/MathPlugin.native-735bbac2.mjs +0 -296
  92. package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
  93. package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
  94. package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
  95. package/dist/documentManager-8327fb6e.mjs +0 -9166
  96. package/dist/index-072ef022.js +0 -11
  97. package/dist/index-49d31221.mjs +0 -16860
  98. package/dist/index.es-b47a189f.mjs +0 -5782
  99. package/dist/style.css +0 -1
@@ -1,4 +1,4 @@
1
- const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Te = "__editoraCommandEditorRoot", ve = "rte-translation-workflow-styles", d = "rte-translation-workflow-panel", y = "translation-workflow", $ = "translationWorkflow", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', $e = [
1
+ const S = ".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", y = "translation-workflow", $ = "translationWorkflow", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ee = [
2
2
  "p",
3
3
  "h1",
4
4
  "h2",
@@ -11,7 +11,7 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
11
11
  "th",
12
12
  "blockquote",
13
13
  "figcaption"
14
- ].join(", "), Me = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "Home", "End"]), Ee = [
14
+ ].join(", "), Ce = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "Home", "End"]), Ae = [
15
15
  {
16
16
  locale: "en",
17
17
  label: "English",
@@ -68,7 +68,7 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
68
68
  requireDifferentFromSource: !0,
69
69
  preserveTokens: !0
70
70
  }
71
- ], Oe = {
71
+ ], _e = {
72
72
  panelTitle: "Translation Workflow",
73
73
  panelAriaLabel: "Translation workflow panel",
74
74
  sourceLocaleLabel: "Source Locale",
@@ -98,11 +98,11 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
98
98
  untranslatedMessage: "Segment appears untranslated (same as source).",
99
99
  lengthOutOfRangeMessage: "Translation length is outside expected locale range."
100
100
  }, 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, _e = 0, Ae = 0, Fe = 0, w = null, x = null, N = null, O = null, _ = null, F = null, I = null, W = null;
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
102
  function m(e) {
103
103
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
104
104
  }
105
- function We(e) {
105
+ function Ke(e) {
106
106
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
107
107
  }
108
108
  function B(e, n, t) {
@@ -114,32 +114,29 @@ function A(e) {
114
114
  function j(e) {
115
115
  return e.trim().toLowerCase();
116
116
  }
117
- function Ke(e) {
117
+ function Ve(e) {
118
118
  return e.replace(/"/g, "&quot;");
119
119
  }
120
- function Ve(e, n = 120) {
120
+ function je(e, n = 120) {
121
121
  return e.length <= n ? e : `${e.slice(0, Math.max(0, n - 1)).trimEnd()}…`;
122
122
  }
123
- function Re(e) {
123
+ function Ie(e) {
124
124
  const n = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
125
125
  return !n || n.length === 0 ? [] : n.map((t) => t.trim()).filter(Boolean);
126
126
  }
127
- function je(e, n) {
128
- const t = Re(e).sort(), r = Re(n).sort();
129
- if (t.length !== r.length)
130
- return !1;
127
+ function Ue(e, n) {
128
+ const t = Ie(e).sort(), r = Ie(n).sort();
129
+ if (t.length !== r.length) return !1;
131
130
  for (let a = 0; a < t.length; a += 1)
132
- if (t[a] !== r[a])
133
- return !1;
131
+ if (t[a] !== r[a]) return !1;
134
132
  return !0;
135
133
  }
136
- function Ue(e, n) {
137
- const t = Array.isArray(n) && n.length > 0 ? n : Ee, r = [], a = /* @__PURE__ */ new Set();
134
+ function Ge(e, n) {
135
+ const t = Array.isArray(n) && n.length > 0 ? n : Ae, r = [], a = /* @__PURE__ */ new Set();
138
136
  return t.forEach((o) => {
139
137
  var i, c;
140
138
  const l = j(o.locale || "");
141
- if (!l)
142
- return;
139
+ if (!l) return;
143
140
  const s = l;
144
141
  a.has(s) || (a.add(s), r.push({
145
142
  locale: s,
@@ -151,9 +148,8 @@ function Ue(e, n) {
151
148
  }));
152
149
  }), e.forEach((o) => {
153
150
  const l = j(o);
154
- if (a.has(l))
155
- return;
156
- const s = Ee.find((i) => l.startsWith(i.locale));
151
+ if (a.has(l)) return;
152
+ const s = Ae.find((i) => l.startsWith(i.locale));
157
153
  r.push(
158
154
  s ? { ...s, locale: l, label: o } : {
159
155
  locale: l,
@@ -168,14 +164,13 @@ function Ue(e, n) {
168
164
  }
169
165
  function ae(e = {}) {
170
166
  var s, i, c, g;
171
- const n = e.normalizeText || We, t = A(e.sourceLocale || "en-US"), r = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
167
+ const n = e.normalizeText || Ke, t = A(e.sourceLocale || "en-US"), r = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
172
168
  (Array.isArray(e.locales) ? e.locales : []).forEach((p) => {
173
- if (typeof p != "string")
174
- return;
175
- const T = A(p);
176
- T && a.add(T);
169
+ if (typeof p != "string") return;
170
+ const v = A(p);
171
+ a.add(v);
177
172
  });
178
- const o = Array.from(a), l = Ue(o, e.localeRules);
173
+ const o = Array.from(a), l = Ge(o, e.localeRules);
179
174
  return {
180
175
  sourceLocale: t,
181
176
  targetLocale: r,
@@ -186,15 +181,15 @@ function ae(e = {}) {
186
181
  maxIssues: B(Number((i = e.maxIssues) != null ? i : 120), 5, 1e3),
187
182
  maxSegments: B(Number((c = e.maxSegments) != null ? c : 600), 20, 3e3),
188
183
  minSourceLengthForRatio: B(Number((g = e.minSourceLengthForRatio) != null ? g : 8), 2, 100),
189
- segmentSelector: (e.segmentSelector || $e).trim() || $e,
184
+ segmentSelector: (e.segmentSelector || Ee).trim() || Ee,
190
185
  labels: {
191
- ...Oe,
186
+ ..._e,
192
187
  ...e.labels || {}
193
188
  },
194
189
  normalizeText: n
195
190
  };
196
191
  }
197
- function Ge(e) {
192
+ function Ye(e) {
198
193
  return {
199
194
  sourceLocale: e.sourceLocale,
200
195
  targetLocale: e.targetLocale,
@@ -221,33 +216,27 @@ function we(e) {
221
216
  return e.closest(ke) || e;
222
217
  }
223
218
  function U(e) {
224
- if (!e)
225
- return null;
226
- if (e.matches(S))
227
- return e;
219
+ if (!e) return null;
220
+ if (e.matches(S)) return e;
228
221
  const n = e.querySelector(S);
229
222
  return n instanceof HTMLElement ? n : null;
230
223
  }
231
- function Ye() {
232
- if (typeof window == "undefined")
233
- return null;
234
- const e = window[Te];
235
- if (!(e instanceof HTMLElement))
236
- return null;
237
- window[Te] = null;
224
+ function Ze() {
225
+ if (typeof window == "undefined") return null;
226
+ const e = window[ve];
227
+ if (!(e instanceof HTMLElement)) return null;
228
+ window[ve] = null;
238
229
  const n = U(e);
239
- if (n)
240
- return n;
230
+ if (n) return n;
241
231
  const t = e.closest(ke);
242
232
  if (t) {
243
233
  const a = U(t);
244
- if (a)
245
- return a;
234
+ if (a) return a;
246
235
  }
247
236
  const r = e.closest(S);
248
237
  return r instanceof HTMLElement ? r : null;
249
238
  }
250
- function Ze(e) {
239
+ function Je(e) {
251
240
  const n = e.closest("[data-editora-editor]");
252
241
  if (n && U(n) === e)
253
242
  return n;
@@ -259,31 +248,29 @@ function Ze(e) {
259
248
  }
260
249
  return we(e);
261
250
  }
262
- function Ce(e) {
251
+ function He(e) {
263
252
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
264
253
  }
265
254
  function te(e) {
266
255
  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;
267
256
  }
268
- function Je(e) {
257
+ function Qe(e) {
269
258
  const n = we(e);
270
- if (te(n))
271
- return !0;
259
+ if (te(n)) return !0;
272
260
  const t = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
273
261
  return te(t) ? !0 : te(document.documentElement) || te(document.body);
274
262
  }
275
263
  function ge(e, n) {
276
- e.classList.remove("rte-translation-workflow-theme-dark"), Je(n) && e.classList.add("rte-translation-workflow-theme-dark");
264
+ e.classList.remove("rte-translation-workflow-theme-dark"), Qe(n) && e.classList.add("rte-translation-workflow-theme-dark");
277
265
  }
278
- function Qe(e) {
266
+ function Xe(e) {
279
267
  var n, t, r, a;
280
268
  for (let o = 0; o < e.length; o += 1) {
281
269
  const l = e[o];
282
270
  if (!(l.type !== "childList" || l.removedNodes.length === 0))
283
271
  for (let s = 0; s < l.removedNodes.length; s += 1) {
284
272
  const i = l.removedNodes[s];
285
- if (i.nodeType !== Node.ELEMENT_NODE)
286
- continue;
273
+ if (i.nodeType !== Node.ELEMENT_NODE) continue;
287
274
  const c = i;
288
275
  if ((n = c.matches) != null && n.call(c, S) || (t = c.matches) != null && t.call(c, `.${d}`) || (r = c.querySelector) != null && r.call(c, S) || (a = c.querySelector) != null && a.call(c, `.${d}`))
289
276
  return !0;
@@ -296,70 +283,59 @@ function le() {
296
283
  n.isConnected || Se(n);
297
284
  });
298
285
  }
299
- function v(e, n = !0, t = !0) {
286
+ function T(e, n = !0, t = !0) {
300
287
  var s;
301
- if (le(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
302
- return e.contentElement;
288
+ if (le(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
303
289
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
304
290
  const i = U(e.editorElement);
305
- if (i)
306
- return i;
291
+ if (i) return i;
307
292
  }
308
- const r = Ye();
309
- if (r)
310
- return r;
293
+ const r = Ze();
294
+ if (r) return r;
311
295
  const a = window.getSelection();
312
296
  if (a && a.rangeCount > 0) {
313
- const i = (s = Ce(a.getRangeAt(0).startContainer)) == null ? void 0 : s.closest(
297
+ const i = (s = He(a.getRangeAt(0).startContainer)) == null ? void 0 : s.closest(
314
298
  S
315
299
  );
316
- if (i)
317
- return i;
300
+ if (i) return i;
318
301
  }
319
302
  const o = document.activeElement;
320
303
  if (o) {
321
- if (o.matches(S))
322
- return o;
304
+ if (o.matches(S)) return o;
323
305
  const i = o.closest(S);
324
- if (i)
325
- return i;
306
+ if (i) return i;
326
307
  }
327
308
  if (t && x && x.isConnected)
328
309
  return x;
329
- if (!n)
330
- return null;
310
+ if (!n) return null;
331
311
  const l = document.querySelector(S);
332
312
  return l instanceof HTMLElement ? l : null;
333
313
  }
334
- function Xe(e) {
314
+ function et(e) {
335
315
  const n = e.target;
336
316
  if (n) {
337
317
  const r = n.closest(`.${d}`);
338
318
  if (r) {
339
319
  const o = Array.from(h.entries()).find(([, l]) => l === r);
340
- if (o)
341
- return o[0];
320
+ if (o) return o[0];
342
321
  }
343
322
  const a = n.closest(S);
344
- if (a)
345
- return a;
323
+ if (a) return a;
346
324
  }
347
325
  const t = document.activeElement;
348
326
  if (t) {
349
327
  const r = t.closest(`.${d}`);
350
328
  if (r) {
351
329
  const o = Array.from(h.entries()).find(([, l]) => l === r);
352
- if (o)
353
- return o[0];
330
+ if (o) return o[0];
354
331
  }
355
332
  const a = t.closest(S);
356
- if (a)
357
- return a;
333
+ if (a) return a;
358
334
  }
359
335
  return null;
360
336
  }
361
337
  function fe(e, n, t) {
362
- const r = Ze(e);
338
+ const r = Je(e);
363
339
  Array.from(
364
340
  r.querySelectorAll(
365
341
  `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
@@ -372,10 +348,9 @@ function xe(e) {
372
348
  const n = se.get(e);
373
349
  typeof n == "number" && (window.clearTimeout(n), se.delete(e));
374
350
  }
375
- function et(e, n) {
351
+ function tt(e, n) {
376
352
  const t = j(n), r = e.localeRules.find((l) => j(l.locale) === t);
377
- if (r)
378
- return r;
353
+ if (r) return r;
379
354
  const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
380
355
  return o || {
381
356
  locale: t,
@@ -387,8 +362,8 @@ function et(e, n) {
387
362
  };
388
363
  }
389
364
  function ne(e, n, t, r = {}) {
390
- return Ae += 1, {
391
- id: `translation-workflow-issue-${Ae}`,
365
+ return Re += 1, {
366
+ id: `translation-workflow-issue-${Re}`,
392
367
  type: e,
393
368
  severity: n,
394
369
  message: t,
@@ -410,19 +385,17 @@ function ce(e, n) {
410
385
  e.setAttribute("contenteditable", "true");
411
386
  }
412
387
  function ue(e, n) {
413
- return e.querySelector(`[data-translation-segment-id="${Ke(n)}"]`);
388
+ return e.querySelector(`[data-translation-segment-id="${Ve(n)}"]`);
414
389
  }
415
- function He(e) {
390
+ function qe(e) {
416
391
  const n = window.getSelection();
417
- if (!n || n.rangeCount === 0)
418
- return null;
419
- const t = Ce(n.getRangeAt(0).startContainer);
392
+ if (!n || n.rangeCount === 0) return null;
393
+ const t = He(n.getRangeAt(0).startContainer);
420
394
  return !t || !e.contains(t) ? null : t.closest("[data-translation-segment-id]");
421
395
  }
422
- function tt(e, n) {
396
+ function nt(e, n) {
423
397
  const t = Array.from(e.querySelectorAll(n));
424
- if (t.length <= 1)
425
- return t;
398
+ if (t.length <= 1) return t;
426
399
  const r = new Set(t);
427
400
  return t.filter((a) => {
428
401
  let o = a.parentElement;
@@ -434,24 +407,22 @@ function tt(e, n) {
434
407
  return !0;
435
408
  });
436
409
  }
437
- function nt(e, n, t) {
410
+ function rt(e, n, t) {
438
411
  let r = (t || "").trim();
439
412
  if (!r || n.has(r)) {
440
413
  do
441
- r = `translation-segment-${_e++}`;
414
+ r = `translation-segment-${Fe++}`;
442
415
  while (n.has(r));
443
416
  e.setAttribute("data-translation-segment-id", r);
444
417
  }
445
418
  return r;
446
419
  }
447
420
  function me(e, n) {
448
- if (n.lockedSegmentIds.size === 0)
449
- return !1;
421
+ if (n.lockedSegmentIds.size === 0) return !1;
450
422
  let t = !1;
451
423
  return n.lockedSegmentIds.forEach((r) => {
452
424
  const a = ue(e, r);
453
- if (!a)
454
- return;
425
+ if (!a) return;
455
426
  ce(a, !0);
456
427
  const o = n.lockedHtmlBySegmentId.get(r);
457
428
  if (typeof o == "string") {
@@ -463,10 +434,10 @@ function me(e, n) {
463
434
  }
464
435
  function M(e, n, t) {
465
436
  var l;
466
- const r = tt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
437
+ const r = nt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
467
438
  for (let s = 0; s < r.length && !(a.length >= n.maxSegments); s += 1) {
468
- const i = r[s], c = nt(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), p = i.getAttribute("data-translation-locked") === "true", T = g || p;
469
- if (T)
439
+ const i = r[s], c = rt(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), p = i.getAttribute("data-translation-locked") === "true", v = g || p;
440
+ if (v)
470
441
  if (t.lockedSegmentIds.add(c), ce(i, !0), !t.lockedHtmlBySegmentId.has(c))
471
442
  t.lockedHtmlBySegmentId.set(c, i.innerHTML);
472
443
  else {
@@ -476,8 +447,7 @@ function M(e, n, t) {
476
447
  else
477
448
  t.lockedHtmlBySegmentId.delete(c);
478
449
  const C = n.normalizeText(i.textContent || "");
479
- if (!C)
480
- continue;
450
+ if (!C) continue;
481
451
  t.sourceTextBySegmentId.has(c) || t.sourceTextBySegmentId.set(c, C);
482
452
  const K = t.sourceTextBySegmentId.get(c) || C;
483
453
  a.push({
@@ -486,7 +456,7 @@ function M(e, n, t) {
486
456
  index: a.length,
487
457
  text: C,
488
458
  sourceText: K,
489
- locked: T
459
+ locked: v
490
460
  }), o.add(c);
491
461
  }
492
462
  return Array.from(t.sourceTextBySegmentId.keys()).forEach((s) => {
@@ -528,8 +498,7 @@ function ye(e) {
528
498
  return Y.get(e) === !0;
529
499
  }
530
500
  function be(e, n) {
531
- if (!n.classList.contains("show"))
532
- return;
501
+ if (!n.classList.contains("show")) return;
533
502
  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));
534
503
  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`;
535
504
  }
@@ -537,11 +506,11 @@ function P(e, n) {
537
506
  const t = e.querySelector(".rte-translation-live");
538
507
  t && (t.textContent = n);
539
508
  }
540
- function rt(e, n) {
509
+ function ot(e, n) {
541
510
  return `${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`;
542
511
  }
543
- function ot(e, n, t) {
544
- const r = [], a = et(t, n.targetLocale);
512
+ function at(e, n, t) {
513
+ const r = [], a = tt(t, n.targetLocale);
545
514
  for (let o = 0; o < e.length && !(r.length >= t.maxIssues); o += 1) {
546
515
  const l = e[o], s = t.normalizeText(l.sourceText || ""), i = t.normalizeText(l.text || "");
547
516
  if (!i) {
@@ -555,7 +524,7 @@ function ot(e, n, t) {
555
524
  );
556
525
  continue;
557
526
  }
558
- if (a.preserveTokens && s && !je(s, i) && (r.push(
527
+ if (a.preserveTokens && s && !Ue(s, i) && (r.push(
559
528
  ne("token-mismatch", "error", t.labels.tokenMismatchMessage, {
560
529
  segmentId: l.id,
561
530
  sourceText: s,
@@ -585,7 +554,7 @@ function ot(e, n, t) {
585
554
  }
586
555
  return r;
587
556
  }
588
- function qe(e) {
557
+ function Be(e) {
589
558
  const n = u.get(e) || w, t = D.get(e);
590
559
  return {
591
560
  sourceLocale: (t == null ? void 0 : t.sourceLocale) || (n == null ? void 0 : n.sourceLocale) || "en-US",
@@ -610,10 +579,9 @@ function E(e) {
610
579
  const n = D.get(e), t = n && n.selectedSegmentId ? n.segments.find((r) => r.id === n.selectedSegmentId) : null;
611
580
  fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime", (n == null ? void 0 : n.realtimeEnabled) === !0), fe(e, "toggleTranslationSegmentLock", (t == null ? void 0 : t.locked) === !0);
612
581
  }
613
- function at(e, n) {
582
+ function lt(e, n) {
614
583
  const t = ue(e, n);
615
- if (!t)
616
- return;
584
+ if (!t) return;
617
585
  try {
618
586
  t.scrollIntoView({ block: "nearest", inline: "nearest" });
619
587
  } catch (a) {
@@ -628,11 +596,9 @@ function at(e, n) {
628
596
  }
629
597
  function R(e) {
630
598
  const n = h.get(e);
631
- if (!n)
632
- return;
599
+ if (!n) return;
633
600
  const t = u.get(e) || w;
634
- if (!t)
635
- return;
601
+ if (!t) return;
636
602
  const r = b(e, t), a = n.querySelector(".rte-translation-source-label");
637
603
  a && (a.textContent = t.labels.sourceLocaleLabel);
638
604
  const o = n.querySelector(".rte-translation-target-label");
@@ -648,16 +614,16 @@ function R(e) {
648
614
  g && (g.textContent = t.labels.helperText);
649
615
  const p = n.querySelector(".rte-translation-shortcut");
650
616
  p && (p.textContent = t.labels.shortcutText);
651
- const T = n.querySelector('[data-action="run-validation"]');
652
- T && (T.textContent = t.labels.validateText);
617
+ const v = n.querySelector('[data-action="run-validation"]');
618
+ v && (v.textContent = t.labels.validateText);
653
619
  const C = n.querySelector('[data-action="capture-source"]');
654
620
  C && (C.textContent = t.labels.captureSourceText);
655
621
  const K = n.querySelector('[data-action="toggle-realtime"]');
656
622
  K && (K.textContent = r.realtimeEnabled ? t.labels.realtimeOnText : t.labels.realtimeOffText, K.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
657
623
  const H = n.querySelector('[data-action="lock-selected"]'), q = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
658
624
  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"));
659
- const Le = n.querySelector('[data-action="close"]');
660
- Le && Le.setAttribute("aria-label", t.labels.closeText);
625
+ const Te = n.querySelector('[data-action="close"]');
626
+ Te && Te.setAttribute("aria-label", t.labels.closeText);
661
627
  const J = n.querySelector(".rte-translation-issues"), V = n.querySelector(".rte-translation-empty");
662
628
  J && (J.setAttribute("aria-label", t.labels.issuesLabel), r.issues.length === 0 ? (J.innerHTML = "", V && (V.hidden = !1, V.textContent = t.labels.noIssuesText)) : (V && (V.hidden = !0), J.innerHTML = r.issues.map((f) => `
663
629
  <li class="rte-translation-issue ${f.severity === "error" ? "error" : f.severity === "warning" ? "warning" : "info"}" role="listitem" data-segment-id="${m(
@@ -669,14 +635,14 @@ function R(e) {
669
635
  `).join("")));
670
636
  const de = n.querySelector(".rte-translation-segments");
671
637
  de && (de.setAttribute("aria-label", t.labels.segmentsLabel), de.innerHTML = r.segments.map((f) => {
672
- const z = f.id === r.selectedSegmentId ? "selected" : "", Ne = f.locked ? "locked" : "";
638
+ const z = f.id === r.selectedSegmentId ? "selected" : "", Oe = f.locked ? "locked" : "";
673
639
  return `
674
- <li class="rte-translation-segment-item ${z} ${Ne}" role="option" aria-selected="${f.id === r.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
640
+ <li class="rte-translation-segment-item ${z} ${Oe}" role="option" aria-selected="${f.id === r.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
675
641
  <button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
676
642
  f.id
677
643
  )}" title="${m(f.text)}">
678
644
  <span class="rte-translation-segment-meta">#${f.index + 1} • ${m(f.tagName)}</span>
679
- <span class="rte-translation-segment-text">${m(Ve(f.text, 110))}</span>
645
+ <span class="rte-translation-segment-text">${m(je(f.text, 110))}</span>
680
646
  </button>
681
647
  <button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
682
648
  f.id
@@ -691,10 +657,9 @@ function R(e) {
691
657
  }
692
658
  n.setAttribute("aria-label", t.labels.panelAriaLabel);
693
659
  }
694
- function Be(e) {
660
+ function Pe(e) {
695
661
  const n = u.get(e) || w;
696
- if (!n)
697
- return;
662
+ if (!n) return;
698
663
  xe(e);
699
664
  const t = window.setTimeout(() => {
700
665
  se.delete(e), L(e, "realtime", !1);
@@ -703,19 +668,18 @@ function Be(e) {
703
668
  }
704
669
  function L(e, n, t) {
705
670
  const r = u.get(e) || w;
706
- if (!r)
707
- return [];
671
+ if (!r) return [];
708
672
  const a = b(e, r), o = me(e, a);
709
673
  a.segments = M(e, r, a);
710
- const l = rt(e, a);
674
+ const l = ot(e, a);
711
675
  if (!t && a.snapshot === l)
712
676
  return a.issues;
713
- a.issues = ot(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
677
+ a.issues = at(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
714
678
  new CustomEvent("editora:translation-workflow-validation", {
715
679
  bubbles: !0,
716
680
  detail: {
717
681
  reason: n,
718
- state: qe(e)
682
+ state: Be(e)
719
683
  }
720
684
  })
721
685
  );
@@ -730,10 +694,9 @@ function L(e, n, t) {
730
694
  }
731
695
  return a.issues;
732
696
  }
733
- function Pe(e) {
697
+ function De(e) {
734
698
  const n = u.get(e) || w;
735
- if (!n)
736
- return !1;
699
+ if (!n) return !1;
737
700
  const t = b(e, n), r = M(e, n, t);
738
701
  r.forEach((o) => {
739
702
  t.sourceTextBySegmentId.set(o.id, o.text);
@@ -752,16 +715,13 @@ function Pe(e) {
752
715
  function ie(e, n, t) {
753
716
  var c, g;
754
717
  const r = u.get(e) || w;
755
- if (!r)
756
- return !1;
718
+ if (!r) return !1;
757
719
  const a = b(e, r);
758
720
  a.segments = M(e, r, a);
759
- const o = ((c = He(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;
760
- if (!l)
761
- return !1;
721
+ 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;
722
+ if (!l) return !1;
762
723
  const s = ue(e, l);
763
- if (!s)
764
- return !1;
724
+ if (!s) return !1;
765
725
  const i = typeof t == "boolean" ? t : !a.lockedSegmentIds.has(l);
766
726
  return i ? (a.lockedSegmentIds.add(l), a.lockedHtmlBySegmentId.set(l, s.innerHTML)) : (a.lockedSegmentIds.delete(l), a.lockedHtmlBySegmentId.delete(l)), ce(s, i), a.selectedSegmentId = l, a.snapshot = "", L(e, "lock-segment", !0), e.dispatchEvent(
767
727
  new CustomEvent("editora:translation-segment-lock", {
@@ -773,27 +733,23 @@ function ie(e, n, t) {
773
733
  })
774
734
  ), !0;
775
735
  }
776
- function De(e, n) {
736
+ function ze(e, n) {
777
737
  const t = u.get(e) || w;
778
- if (!t)
779
- return !1;
738
+ if (!t) return !1;
780
739
  const r = b(e, t), a = typeof n == "boolean" ? n : !r.realtimeEnabled;
781
- return r.realtimeEnabled = a, a ? Be(e) : xe(e), R(e), E(e), !0;
740
+ return r.realtimeEnabled = a, a ? Pe(e) : xe(e), R(e), E(e), !0;
782
741
  }
783
742
  function pe(e, n, t = !0) {
784
743
  const r = u.get(e) || w;
785
- if (!r)
786
- return !1;
744
+ if (!r) return !1;
787
745
  const a = b(e, r);
788
- return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t && at(e, n), !0) : !1;
746
+ return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t && lt(e, n), !0) : !1;
789
747
  }
790
748
  function re(e, n) {
791
749
  const t = u.get(e) || w;
792
- if (!t)
793
- return !1;
750
+ if (!t) return !1;
794
751
  const r = b(e, t);
795
- if (r.segments = M(e, t, r), r.segments.length === 0)
796
- return !1;
752
+ if (r.segments = M(e, t, r), r.segments.length === 0) return !1;
797
753
  const a = Math.max(
798
754
  0,
799
755
  r.segments.findIndex((s) => s.id === r.selectedSegmentId)
@@ -808,42 +764,44 @@ function G(e, n = !1) {
808
764
  t && (t.classList.remove("show"), Y.set(e, !1), E(e), n && e.focus({ preventScroll: !0 }));
809
765
  }
810
766
  function he(e) {
811
- const n = ut(e);
767
+ const n = dt(e);
812
768
  h.forEach((r, a) => {
813
769
  a !== e && G(a, !1);
814
770
  }), n.classList.add("show"), Y.set(e, !0), L(e, "panel-open", !1), R(e), be(e, n), E(e);
815
771
  const t = n.querySelector('[data-field="target-locale"]');
816
772
  t == null || t.focus();
817
773
  }
818
- function ze(e, n) {
774
+ function Ne(e, n) {
819
775
  const t = ye(e);
820
776
  return (typeof n == "boolean" ? n : !t) ? he(e) : G(e, !1), !0;
821
777
  }
822
- function lt(e) {
823
- const n = e.key.toLowerCase();
824
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
778
+ function Le(e) {
779
+ return typeof e.key == "string" ? e.key.toLowerCase() : "";
825
780
  }
826
781
  function st(e) {
827
- const n = e.key.toLowerCase();
828
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
782
+ const n = Le(e);
783
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
829
784
  }
830
785
  function it(e) {
831
- const n = e.key.toLowerCase();
832
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
786
+ const n = Le(e);
787
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
833
788
  }
834
789
  function ct(e) {
790
+ const n = Le(e);
791
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
792
+ }
793
+ function ut(e) {
835
794
  return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
836
795
  }
837
- function Ie(e) {
796
+ function Me(e) {
838
797
  return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
839
798
  }
840
- function ut(e) {
799
+ function dt(e) {
841
800
  const n = h.get(e);
842
- if (n)
843
- return n;
801
+ if (n) return n;
844
802
  const t = u.get(e) || w || ae();
845
803
  b(e, t);
846
- const r = `rte-translation-workflow-panel-${Fe++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
804
+ const r = `rte-translation-workflow-panel-${We++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
847
805
  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 = `
848
806
  <header class="rte-translation-header">
849
807
  <h2 class="rte-translation-title">${m(t.labels.panelTitle)}</h2>
@@ -901,12 +859,11 @@ function ut(e) {
901
859
  <div class="rte-translation-live" aria-live="polite" aria-atomic="true"></div>
902
860
  `, l.addEventListener("click", (s) => {
903
861
  const i = s.target;
904
- if (!i)
905
- return;
862
+ if (!i) return;
906
863
  const c = i.closest("[data-action]");
907
864
  if (!c) {
908
- const p = i.closest(".rte-translation-issue[data-segment-id]"), T = (p == null ? void 0 : p.getAttribute("data-segment-id")) || "";
909
- T && pe(e, T, !0);
865
+ const p = i.closest(".rte-translation-issue[data-segment-id]"), v = (p == null ? void 0 : p.getAttribute("data-segment-id")) || "";
866
+ v && pe(e, v, !0);
910
867
  return;
911
868
  }
912
869
  const g = c.getAttribute("data-action");
@@ -919,7 +876,7 @@ function ut(e) {
919
876
  return;
920
877
  }
921
878
  if (g === "capture-source") {
922
- Pe(e);
879
+ De(e);
923
880
  return;
924
881
  }
925
882
  if (g === "lock-selected") {
@@ -927,7 +884,7 @@ function ut(e) {
927
884
  return;
928
885
  }
929
886
  if (g === "toggle-realtime") {
930
- De(e);
887
+ ze(e);
931
888
  return;
932
889
  }
933
890
  if (g === "select-segment") {
@@ -941,11 +898,9 @@ function ut(e) {
941
898
  }
942
899
  }), l.addEventListener("change", (s) => {
943
900
  const i = s.target;
944
- if (!(i instanceof HTMLSelectElement))
945
- return;
901
+ if (!(i instanceof HTMLSelectElement)) return;
946
902
  const c = u.get(e) || w;
947
- if (!c)
948
- return;
903
+ if (!c) return;
949
904
  const g = b(e, c);
950
905
  if (i.getAttribute("data-field") === "source-locale") {
951
906
  g.sourceLocale = A(i.value), g.snapshot = "", L(e, "source-locale-change", !0);
@@ -958,29 +913,26 @@ function ut(e) {
958
913
  s.preventDefault(), G(e, !0);
959
914
  return;
960
915
  }
961
- !(i != null && i.closest(".rte-translation-segments")) || !Me.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"));
916
+ !(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"));
962
917
  }), ge(l, e), document.body.appendChild(l), h.set(e, l), Y.set(e, !1), R(e), l;
963
918
  }
964
- function dt(e) {
919
+ function ft(e) {
965
920
  w = e, N || (N = (n) => {
966
921
  var i;
967
922
  le();
968
923
  const t = n.target, r = t == null ? void 0 : t.closest(S);
969
- if (!r)
970
- return;
924
+ if (!r) return;
971
925
  const a = u.get(r) || e, o = b(r, a);
972
926
  u.set(r, a), x = r;
973
- const l = ((i = He(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
927
+ const l = ((i = qe(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
974
928
  l && (o.selectedSegmentId = l), E(r);
975
929
  const s = h.get(r);
976
930
  s && (ge(s, r), be(r, s), R(r));
977
931
  }, document.addEventListener("focusin", N, !0)), O || (O = (n) => {
978
932
  const t = n.target, r = t == null ? void 0 : t.closest(S);
979
- if (!r)
980
- return;
933
+ if (!r) return;
981
934
  const a = u.get(r) || w;
982
- if (!a)
983
- return;
935
+ if (!a) return;
984
936
  const o = b(r, a), l = me(r, o);
985
937
  if (o.segments = M(r, a, o), !o.realtimeEnabled) {
986
938
  if (l) {
@@ -990,42 +942,37 @@ function dt(e) {
990
942
  R(r), E(r);
991
943
  return;
992
944
  }
993
- Be(r);
945
+ Pe(r);
994
946
  }, document.addEventListener("input", O, !0)), _ || (_ = (n) => {
995
947
  const t = n, r = t.target, a = r == null ? void 0 : r.closest(S);
996
- if (!a)
997
- return;
998
- const o = Ie(r);
999
- if (!o || !a.contains(o))
1000
- return;
948
+ if (!a) return;
949
+ const o = Me(r);
950
+ if (!o || !a.contains(o)) return;
1001
951
  t.preventDefault();
1002
952
  const l = h.get(a), s = u.get(a) || w;
1003
953
  l && s && P(l, s.labels.readonlySegmentMessage);
1004
954
  }, document.addEventListener("beforeinput", _, !0)), F || (F = (n) => {
1005
- if (n.defaultPrevented)
1006
- return;
955
+ if (n.defaultPrevented) return;
1007
956
  const t = n.target;
1008
- if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Me.has(n.key))
1009
- return;
1010
- const a = n.key === "Escape", o = lt(n), l = st(n), s = it(n), i = Ie(t);
957
+ if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Ce.has(n.key)) return;
958
+ const a = n.key === "Escape", o = st(n), l = it(n), s = ct(n), i = Me(t);
1011
959
  if (!a && !o && !l && !s && !i)
1012
960
  return;
1013
- const c = Xe(n);
1014
- if (!c)
1015
- return;
961
+ const c = et(n);
962
+ if (!c) return;
1016
963
  const g = u.get(c) || w || e;
1017
964
  if (b(c, g), u.set(c, g), x = c, a && ye(c)) {
1018
965
  n.preventDefault(), G(c, !0);
1019
966
  return;
1020
967
  }
1021
- if (i && c.contains(i) && ct(n)) {
968
+ if (i && c.contains(i) && ut(n)) {
1022
969
  n.preventDefault();
1023
970
  const p = h.get(c);
1024
971
  p && P(p, g.labels.readonlySegmentMessage);
1025
972
  return;
1026
973
  }
1027
974
  if (o) {
1028
- n.preventDefault(), n.stopPropagation(), ze(c);
975
+ n.preventDefault(), n.stopPropagation(), Ne(c);
1029
976
  return;
1030
977
  }
1031
978
  if (l) {
@@ -1038,10 +985,9 @@ function dt(e) {
1038
985
  !t.isConnected || !n.isConnected || (ge(n, t), be(t, n));
1039
986
  });
1040
987
  }, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !W && typeof MutationObserver != "undefined" && document.body && (W = new MutationObserver((n) => {
1041
- Qe(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
988
+ Xe(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
1042
989
  const a = D.get(r);
1043
- if (!a || a.lockedSegmentIds.size === 0 || !me(r, a))
1044
- return;
990
+ if (!a || a.lockedSegmentIds.size === 0 || !me(r, a)) return;
1045
991
  a.snapshot = "";
1046
992
  const l = u.get(r) || w, s = h.get(r);
1047
993
  s && l && P(s, l.labels.readonlySegmentMessage), l && (a.segments = M(r, l, a), R(r), E(r));
@@ -1052,14 +998,13 @@ function dt(e) {
1052
998
  characterData: !0
1053
999
  }));
1054
1000
  }
1055
- function ft() {
1001
+ function gt() {
1056
1002
  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) => Se(n)), w = null, x = null;
1057
1003
  }
1058
- function gt() {
1059
- if (typeof document == "undefined" || document.getElementById(ve))
1060
- return;
1004
+ function mt() {
1005
+ if (typeof document == "undefined" || document.getElementById($e)) return;
1061
1006
  const e = document.createElement("style");
1062
- e.id = ve, e.textContent = `
1007
+ e.id = $e, e.textContent = `
1063
1008
  .rte-toolbar-group-items.${y},
1064
1009
  .editora-toolbar-group-items.${y},
1065
1010
  .rte-toolbar-group-items.${$},
@@ -1624,9 +1569,9 @@ function gt() {
1624
1569
  }
1625
1570
  `, document.head.appendChild(e);
1626
1571
  }
1627
- const mt = (e = {}) => {
1572
+ const bt = (e = {}) => {
1628
1573
  const n = ae(e), t = /* @__PURE__ */ new Set();
1629
- return gt(), {
1574
+ return mt(), {
1630
1575
  name: "translationWorkflow",
1631
1576
  toolbar: [
1632
1577
  {
@@ -1667,68 +1612,59 @@ const mt = (e = {}) => {
1667
1612
  ],
1668
1613
  commands: {
1669
1614
  translationWorkflow: (r, a) => {
1670
- const o = v(a, !1, !1);
1671
- if (!o)
1672
- return !1;
1615
+ const o = T(a, !1, !1);
1616
+ if (!o) return !1;
1673
1617
  const l = u.get(o) || n;
1674
1618
  return b(o, l), u.set(o, l), x = o, he(o), !0;
1675
1619
  },
1676
1620
  openTranslationWorkflowPanel: (r, a) => {
1677
- const o = v(a, !1, !1);
1678
- if (!o)
1679
- return !1;
1621
+ const o = T(a, !1, !1);
1622
+ if (!o) return !1;
1680
1623
  const l = u.get(o) || n;
1681
1624
  return b(o, l), u.set(o, l), x = o, he(o), !0;
1682
1625
  },
1683
1626
  toggleTranslationWorkflowPanel: (r, a) => {
1684
- const o = v(a, !1, !1);
1685
- if (!o)
1686
- return !1;
1627
+ const o = T(a, !1, !1);
1628
+ if (!o) return !1;
1687
1629
  const l = u.get(o) || n;
1688
- return b(o, l), u.set(o, l), x = o, ze(o, typeof r == "boolean" ? r : void 0);
1630
+ return b(o, l), u.set(o, l), x = o, Ne(o, typeof r == "boolean" ? r : void 0);
1689
1631
  },
1690
1632
  runTranslationLocaleValidation: (r, a) => {
1691
- const o = v(a, !1, !1);
1692
- if (!o)
1693
- return !1;
1633
+ const o = T(a, !1, !1);
1634
+ if (!o) return !1;
1694
1635
  const l = u.get(o) || n;
1695
1636
  return b(o, l), u.set(o, l), x = o, L(o, "command", !0), !0;
1696
1637
  },
1697
1638
  toggleTranslationRealtime: (r, a) => {
1698
- const o = v(a, !1, !1);
1699
- if (!o)
1700
- return !1;
1639
+ const o = T(a, !1, !1);
1640
+ if (!o) return !1;
1701
1641
  const l = u.get(o) || n;
1702
- return b(o, l), u.set(o, l), x = o, De(o, typeof r == "boolean" ? r : void 0);
1642
+ return b(o, l), u.set(o, l), x = o, ze(o, typeof r == "boolean" ? r : void 0);
1703
1643
  },
1704
1644
  toggleTranslationSegmentLock: (r, a) => {
1705
- const o = v(a, !1, !1);
1706
- if (!o)
1707
- return !1;
1645
+ const o = T(a, !1, !1);
1646
+ if (!o) return !1;
1708
1647
  const l = u.get(o) || n;
1709
1648
  b(o, l), u.set(o, l), x = o;
1710
1649
  const s = typeof r == "boolean" ? r : r == null ? void 0 : r.locked, i = typeof r == "object" ? r == null ? void 0 : r.segmentId : void 0;
1711
1650
  return ie(o, i, s);
1712
1651
  },
1713
1652
  setTranslationLocales: (r, a) => {
1714
- const o = v(a, !1, !1);
1715
- if (!o || !r || typeof r != "object")
1716
- return !1;
1653
+ const o = T(a, !1, !1);
1654
+ if (!o || !r || typeof r != "object") return !1;
1717
1655
  const l = u.get(o) || n, s = b(o, l);
1718
1656
  return u.set(o, l), typeof r.sourceLocale == "string" && r.sourceLocale.trim() && (s.sourceLocale = A(r.sourceLocale)), typeof r.targetLocale == "string" && r.targetLocale.trim() && (s.targetLocale = A(r.targetLocale)), s.snapshot = "", L(o, "set-locales", !0), !0;
1719
1657
  },
1720
1658
  captureTranslationSourceSnapshot: (r, a) => {
1721
- const o = v(a, !1, !1);
1722
- if (!o)
1723
- return !1;
1659
+ const o = T(a, !1, !1);
1660
+ if (!o) return !1;
1724
1661
  const l = u.get(o) || n;
1725
- return b(o, l), u.set(o, l), x = o, Pe(o);
1662
+ return b(o, l), u.set(o, l), x = o, De(o);
1726
1663
  },
1727
1664
  setTranslationWorkflowOptions: (r, a) => {
1728
- const o = v(a, !1, !1);
1729
- if (!o || !r || typeof r != "object")
1730
- return !1;
1731
- const l = u.get(o) || n, s = oe.get(o) || Ge(l), i = {
1665
+ const o = T(a, !1, !1);
1666
+ if (!o || !r || typeof r != "object") return !1;
1667
+ const l = u.get(o) || n, s = oe.get(o) || Ye(l), i = {
1732
1668
  ...s,
1733
1669
  ...r,
1734
1670
  labels: {
@@ -1744,12 +1680,11 @@ const mt = (e = {}) => {
1744
1680
  return typeof r.enableRealtime == "boolean" && (g.realtimeEnabled = r.enableRealtime), typeof r.sourceLocale == "string" && r.sourceLocale.trim() && (g.sourceLocale = A(r.sourceLocale)), typeof r.targetLocale == "string" && r.targetLocale.trim() && (g.targetLocale = A(r.targetLocale)), g.snapshot = "", L(o, "set-options", !0), R(o), E(o), !0;
1745
1681
  },
1746
1682
  getTranslationWorkflowState: (r, a) => {
1747
- const o = v(a, !1, !1);
1748
- if (!o)
1749
- return !1;
1683
+ const o = T(a, !1, !1);
1684
+ if (!o) return !1;
1750
1685
  const l = u.get(o) || n;
1751
1686
  b(o, l);
1752
- const s = qe(o);
1687
+ const s = Be(o);
1753
1688
  if (typeof r == "function")
1754
1689
  try {
1755
1690
  r(s);
@@ -1774,24 +1709,23 @@ const mt = (e = {}) => {
1774
1709
  init: function(a) {
1775
1710
  ee += 1;
1776
1711
  const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = ae(o);
1777
- dt(l);
1778
- const s = v(
1712
+ ft(l);
1713
+ const s = T(
1779
1714
  a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
1780
1715
  !1,
1781
1716
  !1
1782
1717
  );
1783
- if (!s)
1784
- return;
1718
+ if (!s) return;
1785
1719
  x = s, t.add(s);
1786
1720
  const i = b(s, l);
1787
1721
  u.set(s, l), oe.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
1788
1722
  },
1789
1723
  destroy: () => {
1790
- t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && ft();
1724
+ t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && gt();
1791
1725
  }
1792
1726
  };
1793
1727
  };
1794
1728
  export {
1795
- mt as TranslationWorkflowPlugin
1729
+ bt as TranslationWorkflowPlugin
1796
1730
  };
1797
- //# sourceMappingURL=TranslationWorkflowPlugin.native-4e711b1e.mjs.map
1731
+ //# sourceMappingURL=TranslationWorkflowPlugin.native-DdF16tgT.mjs.map