@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,1797 @@
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 = [
2
+ "p",
3
+ "h1",
4
+ "h2",
5
+ "h3",
6
+ "h4",
7
+ "h5",
8
+ "h6",
9
+ "li",
10
+ "td",
11
+ "th",
12
+ "blockquote",
13
+ "figcaption"
14
+ ].join(", "), Me = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "Home", "End"]), Ee = [
15
+ {
16
+ locale: "en",
17
+ label: "English",
18
+ minLengthRatio: 0.6,
19
+ maxLengthRatio: 1.4,
20
+ requireDifferentFromSource: !1,
21
+ preserveTokens: !0
22
+ },
23
+ {
24
+ locale: "fr",
25
+ label: "French",
26
+ minLengthRatio: 0.75,
27
+ maxLengthRatio: 1.7,
28
+ requireDifferentFromSource: !0,
29
+ preserveTokens: !0
30
+ },
31
+ {
32
+ locale: "de",
33
+ label: "German",
34
+ minLengthRatio: 0.8,
35
+ maxLengthRatio: 1.9,
36
+ requireDifferentFromSource: !0,
37
+ preserveTokens: !0
38
+ },
39
+ {
40
+ locale: "es",
41
+ label: "Spanish",
42
+ minLengthRatio: 0.7,
43
+ maxLengthRatio: 1.7,
44
+ requireDifferentFromSource: !0,
45
+ preserveTokens: !0
46
+ },
47
+ {
48
+ locale: "it",
49
+ label: "Italian",
50
+ minLengthRatio: 0.7,
51
+ maxLengthRatio: 1.7,
52
+ requireDifferentFromSource: !0,
53
+ preserveTokens: !0
54
+ },
55
+ {
56
+ locale: "ja",
57
+ label: "Japanese",
58
+ minLengthRatio: 0.45,
59
+ maxLengthRatio: 1.2,
60
+ requireDifferentFromSource: !0,
61
+ preserveTokens: !0
62
+ },
63
+ {
64
+ locale: "zh",
65
+ label: "Chinese",
66
+ minLengthRatio: 0.4,
67
+ maxLengthRatio: 1.2,
68
+ requireDifferentFromSource: !0,
69
+ preserveTokens: !0
70
+ }
71
+ ], Oe = {
72
+ panelTitle: "Translation Workflow",
73
+ panelAriaLabel: "Translation workflow panel",
74
+ sourceLocaleLabel: "Source Locale",
75
+ targetLocaleLabel: "Target Locale",
76
+ validateText: "Validate Locale",
77
+ captureSourceText: "Capture Source",
78
+ lockSelectedText: "Lock Selected",
79
+ unlockSelectedText: "Unlock Selected",
80
+ lockSegmentAriaLabel: "Lock segment",
81
+ unlockSegmentAriaLabel: "Unlock segment",
82
+ realtimeOnText: "Realtime On",
83
+ realtimeOffText: "Realtime Off",
84
+ closeText: "Close",
85
+ summaryPrefix: "Locale QA",
86
+ noIssuesText: "No locale validation issues.",
87
+ issuesLabel: "Locale issues",
88
+ segmentsLabel: "Segments",
89
+ sourcePreviewLabel: "Source",
90
+ targetPreviewLabel: "Target",
91
+ helperText: "Select segments, lock finalized ones, and run locale validation before handoff.",
92
+ shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+L (panel), Ctrl/Cmd+Alt+Shift+V (validate), Ctrl/Cmd+Alt+Shift+K (lock segment)",
93
+ readonlySegmentMessage: "This segment is locked. Unlock before editing.",
94
+ sourceCapturedMessage: "Source snapshot captured from current content.",
95
+ selectedSegmentPrefix: "Selected Segment",
96
+ missingTargetMessage: "Segment is empty in target locale.",
97
+ tokenMismatchMessage: "Tokens/placeholders do not match source segment.",
98
+ untranslatedMessage: "Segment appears untranslated (same as source).",
99
+ lengthOutOfRangeMessage: "Translation length is outside expected locale range."
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;
102
+ function m(e) {
103
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
104
+ }
105
+ function We(e) {
106
+ return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
107
+ }
108
+ function B(e, n, t) {
109
+ return Number.isFinite(e) ? Math.max(n, Math.min(t, e)) : n;
110
+ }
111
+ function A(e) {
112
+ return (e || "").trim() || "en-US";
113
+ }
114
+ function j(e) {
115
+ return e.trim().toLowerCase();
116
+ }
117
+ function Ke(e) {
118
+ return e.replace(/"/g, "&quot;");
119
+ }
120
+ function Ve(e, n = 120) {
121
+ return e.length <= n ? e : `${e.slice(0, Math.max(0, n - 1)).trimEnd()}…`;
122
+ }
123
+ function Re(e) {
124
+ const n = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
125
+ return !n || n.length === 0 ? [] : n.map((t) => t.trim()).filter(Boolean);
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;
131
+ for (let a = 0; a < t.length; a += 1)
132
+ if (t[a] !== r[a])
133
+ return !1;
134
+ return !0;
135
+ }
136
+ function Ue(e, n) {
137
+ const t = Array.isArray(n) && n.length > 0 ? n : Ee, r = [], a = /* @__PURE__ */ new Set();
138
+ return t.forEach((o) => {
139
+ var i, c;
140
+ const l = j(o.locale || "");
141
+ if (!l)
142
+ return;
143
+ const s = l;
144
+ a.has(s) || (a.add(s), r.push({
145
+ locale: s,
146
+ label: (o.label || l).trim() || l,
147
+ minLengthRatio: B(Number((i = o.minLengthRatio) != null ? i : 0.5), 0.1, 3),
148
+ maxLengthRatio: B(Number((c = o.maxLengthRatio) != null ? c : 1.8), 0.2, 4),
149
+ requireDifferentFromSource: o.requireDifferentFromSource !== !1,
150
+ preserveTokens: o.preserveTokens !== !1
151
+ }));
152
+ }), e.forEach((o) => {
153
+ const l = j(o);
154
+ if (a.has(l))
155
+ return;
156
+ const s = Ee.find((i) => l.startsWith(i.locale));
157
+ r.push(
158
+ s ? { ...s, locale: l, label: o } : {
159
+ locale: l,
160
+ label: o,
161
+ minLengthRatio: 0.5,
162
+ maxLengthRatio: 1.8,
163
+ requireDifferentFromSource: !0,
164
+ preserveTokens: !0
165
+ }
166
+ );
167
+ }), r;
168
+ }
169
+ function ae(e = {}) {
170
+ 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]);
172
+ (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);
177
+ });
178
+ const o = Array.from(a), l = Ue(o, e.localeRules);
179
+ return {
180
+ sourceLocale: t,
181
+ targetLocale: r,
182
+ locales: o,
183
+ localeRules: l,
184
+ enableRealtime: e.enableRealtime !== !1,
185
+ debounceMs: B(Number((s = e.debounceMs) != null ? s : 260), 60, 2e3),
186
+ maxIssues: B(Number((i = e.maxIssues) != null ? i : 120), 5, 1e3),
187
+ maxSegments: B(Number((c = e.maxSegments) != null ? c : 600), 20, 3e3),
188
+ minSourceLengthForRatio: B(Number((g = e.minSourceLengthForRatio) != null ? g : 8), 2, 100),
189
+ segmentSelector: (e.segmentSelector || $e).trim() || $e,
190
+ labels: {
191
+ ...Oe,
192
+ ...e.labels || {}
193
+ },
194
+ normalizeText: n
195
+ };
196
+ }
197
+ function Ge(e) {
198
+ return {
199
+ sourceLocale: e.sourceLocale,
200
+ targetLocale: e.targetLocale,
201
+ locales: [...e.locales],
202
+ localeRules: e.localeRules.map((n) => ({
203
+ locale: n.locale,
204
+ label: n.label,
205
+ minLengthRatio: n.minLengthRatio,
206
+ maxLengthRatio: n.maxLengthRatio,
207
+ requireDifferentFromSource: n.requireDifferentFromSource,
208
+ preserveTokens: n.preserveTokens
209
+ })),
210
+ enableRealtime: e.enableRealtime,
211
+ debounceMs: e.debounceMs,
212
+ maxIssues: e.maxIssues,
213
+ maxSegments: e.maxSegments,
214
+ minSourceLengthForRatio: e.minSourceLengthForRatio,
215
+ segmentSelector: e.segmentSelector,
216
+ labels: { ...e.labels },
217
+ normalizeText: e.normalizeText
218
+ };
219
+ }
220
+ function we(e) {
221
+ return e.closest(ke) || e;
222
+ }
223
+ function U(e) {
224
+ if (!e)
225
+ return null;
226
+ if (e.matches(S))
227
+ return e;
228
+ const n = e.querySelector(S);
229
+ return n instanceof HTMLElement ? n : null;
230
+ }
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;
238
+ const n = U(e);
239
+ if (n)
240
+ return n;
241
+ const t = e.closest(ke);
242
+ if (t) {
243
+ const a = U(t);
244
+ if (a)
245
+ return a;
246
+ }
247
+ const r = e.closest(S);
248
+ return r instanceof HTMLElement ? r : null;
249
+ }
250
+ function Ze(e) {
251
+ const n = e.closest("[data-editora-editor]");
252
+ if (n && U(n) === e)
253
+ return n;
254
+ let t = e;
255
+ for (; t; ) {
256
+ if (t.matches(ke) && (t === e || U(t) === e))
257
+ return t;
258
+ t = t.parentElement;
259
+ }
260
+ return we(e);
261
+ }
262
+ function Ce(e) {
263
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
264
+ }
265
+ function te(e) {
266
+ 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
+ }
268
+ function Je(e) {
269
+ const n = we(e);
270
+ if (te(n))
271
+ return !0;
272
+ const t = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
273
+ return te(t) ? !0 : te(document.documentElement) || te(document.body);
274
+ }
275
+ function ge(e, n) {
276
+ e.classList.remove("rte-translation-workflow-theme-dark"), Je(n) && e.classList.add("rte-translation-workflow-theme-dark");
277
+ }
278
+ function Qe(e) {
279
+ var n, t, r, a;
280
+ for (let o = 0; o < e.length; o += 1) {
281
+ const l = e[o];
282
+ if (!(l.type !== "childList" || l.removedNodes.length === 0))
283
+ for (let s = 0; s < l.removedNodes.length; s += 1) {
284
+ const i = l.removedNodes[s];
285
+ if (i.nodeType !== Node.ELEMENT_NODE)
286
+ continue;
287
+ const c = i;
288
+ 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
+ return !0;
290
+ }
291
+ }
292
+ return !1;
293
+ }
294
+ function le() {
295
+ Array.from(Z).forEach((n) => {
296
+ n.isConnected || Se(n);
297
+ });
298
+ }
299
+ function v(e, n = !0, t = !0) {
300
+ var s;
301
+ if (le(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
302
+ return e.contentElement;
303
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
304
+ const i = U(e.editorElement);
305
+ if (i)
306
+ return i;
307
+ }
308
+ const r = Ye();
309
+ if (r)
310
+ return r;
311
+ const a = window.getSelection();
312
+ if (a && a.rangeCount > 0) {
313
+ const i = (s = Ce(a.getRangeAt(0).startContainer)) == null ? void 0 : s.closest(
314
+ S
315
+ );
316
+ if (i)
317
+ return i;
318
+ }
319
+ const o = document.activeElement;
320
+ if (o) {
321
+ if (o.matches(S))
322
+ return o;
323
+ const i = o.closest(S);
324
+ if (i)
325
+ return i;
326
+ }
327
+ if (t && x && x.isConnected)
328
+ return x;
329
+ if (!n)
330
+ return null;
331
+ const l = document.querySelector(S);
332
+ return l instanceof HTMLElement ? l : null;
333
+ }
334
+ function Xe(e) {
335
+ const n = e.target;
336
+ if (n) {
337
+ const r = n.closest(`.${d}`);
338
+ if (r) {
339
+ const o = Array.from(h.entries()).find(([, l]) => l === r);
340
+ if (o)
341
+ return o[0];
342
+ }
343
+ const a = n.closest(S);
344
+ if (a)
345
+ return a;
346
+ }
347
+ const t = document.activeElement;
348
+ if (t) {
349
+ const r = t.closest(`.${d}`);
350
+ if (r) {
351
+ const o = Array.from(h.entries()).find(([, l]) => l === r);
352
+ if (o)
353
+ return o[0];
354
+ }
355
+ const a = t.closest(S);
356
+ if (a)
357
+ return a;
358
+ }
359
+ return null;
360
+ }
361
+ function fe(e, n, t) {
362
+ const r = Ze(e);
363
+ Array.from(
364
+ r.querySelectorAll(
365
+ `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
366
+ )
367
+ ).forEach((o) => {
368
+ o.classList.toggle("active", t), o.setAttribute("data-active", t ? "true" : "false"), o.setAttribute("aria-pressed", t ? "true" : "false");
369
+ });
370
+ }
371
+ function xe(e) {
372
+ const n = se.get(e);
373
+ typeof n == "number" && (window.clearTimeout(n), se.delete(e));
374
+ }
375
+ function et(e, n) {
376
+ const t = j(n), r = e.localeRules.find((l) => j(l.locale) === t);
377
+ if (r)
378
+ return r;
379
+ const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
380
+ return o || {
381
+ locale: t,
382
+ label: n,
383
+ minLengthRatio: 0.5,
384
+ maxLengthRatio: 1.8,
385
+ requireDifferentFromSource: !0,
386
+ preserveTokens: !0
387
+ };
388
+ }
389
+ function ne(e, n, t, r = {}) {
390
+ return Ae += 1, {
391
+ id: `translation-workflow-issue-${Ae}`,
392
+ type: e,
393
+ severity: n,
394
+ message: t,
395
+ ...r
396
+ };
397
+ }
398
+ function ce(e, n) {
399
+ if (n) {
400
+ e.hasAttribute("data-translation-prev-contenteditable") || e.setAttribute(
401
+ "data-translation-prev-contenteditable",
402
+ e.hasAttribute("contenteditable") && e.getAttribute("contenteditable") || "inherit"
403
+ ), e.setAttribute("data-translation-locked", "true"), e.setAttribute("contenteditable", "false"), e.setAttribute("aria-readonly", "true"), e.classList.add("rte-translation-segment-locked");
404
+ return;
405
+ }
406
+ if (e.removeAttribute("data-translation-locked"), e.removeAttribute("aria-readonly"), e.classList.remove("rte-translation-segment-locked"), e.hasAttribute("data-translation-prev-contenteditable")) {
407
+ const t = e.getAttribute("data-translation-prev-contenteditable") || "";
408
+ t === "inherit" ? e.setAttribute("contenteditable", "true") : e.setAttribute("contenteditable", t), e.removeAttribute("data-translation-prev-contenteditable");
409
+ } else
410
+ e.setAttribute("contenteditable", "true");
411
+ }
412
+ function ue(e, n) {
413
+ return e.querySelector(`[data-translation-segment-id="${Ke(n)}"]`);
414
+ }
415
+ function He(e) {
416
+ const n = window.getSelection();
417
+ if (!n || n.rangeCount === 0)
418
+ return null;
419
+ const t = Ce(n.getRangeAt(0).startContainer);
420
+ return !t || !e.contains(t) ? null : t.closest("[data-translation-segment-id]");
421
+ }
422
+ function tt(e, n) {
423
+ const t = Array.from(e.querySelectorAll(n));
424
+ if (t.length <= 1)
425
+ return t;
426
+ const r = new Set(t);
427
+ return t.filter((a) => {
428
+ let o = a.parentElement;
429
+ for (; o && o !== e; ) {
430
+ if (r.has(o))
431
+ return !1;
432
+ o = o.parentElement;
433
+ }
434
+ return !0;
435
+ });
436
+ }
437
+ function nt(e, n, t) {
438
+ let r = (t || "").trim();
439
+ if (!r || n.has(r)) {
440
+ do
441
+ r = `translation-segment-${_e++}`;
442
+ while (n.has(r));
443
+ e.setAttribute("data-translation-segment-id", r);
444
+ }
445
+ return r;
446
+ }
447
+ function me(e, n) {
448
+ if (n.lockedSegmentIds.size === 0)
449
+ return !1;
450
+ let t = !1;
451
+ return n.lockedSegmentIds.forEach((r) => {
452
+ const a = ue(e, r);
453
+ if (!a)
454
+ return;
455
+ ce(a, !0);
456
+ const o = n.lockedHtmlBySegmentId.get(r);
457
+ if (typeof o == "string") {
458
+ a.innerHTML !== o && (a.innerHTML = o, t = !0);
459
+ return;
460
+ }
461
+ n.lockedHtmlBySegmentId.set(r, a.innerHTML);
462
+ }), t;
463
+ }
464
+ function M(e, n, t) {
465
+ var l;
466
+ const r = tt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
467
+ 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)
470
+ if (t.lockedSegmentIds.add(c), ce(i, !0), !t.lockedHtmlBySegmentId.has(c))
471
+ t.lockedHtmlBySegmentId.set(c, i.innerHTML);
472
+ else {
473
+ const H = t.lockedHtmlBySegmentId.get(c) || "";
474
+ i.innerHTML !== H && (i.innerHTML = H);
475
+ }
476
+ else
477
+ t.lockedHtmlBySegmentId.delete(c);
478
+ const C = n.normalizeText(i.textContent || "");
479
+ if (!C)
480
+ continue;
481
+ t.sourceTextBySegmentId.has(c) || t.sourceTextBySegmentId.set(c, C);
482
+ const K = t.sourceTextBySegmentId.get(c) || C;
483
+ a.push({
484
+ id: c,
485
+ tagName: i.tagName.toLowerCase(),
486
+ index: a.length,
487
+ text: C,
488
+ sourceText: K,
489
+ locked: T
490
+ }), o.add(c);
491
+ }
492
+ return Array.from(t.sourceTextBySegmentId.keys()).forEach((s) => {
493
+ o.has(s) || t.sourceTextBySegmentId.delete(s);
494
+ }), Array.from(t.lockedSegmentIds.keys()).forEach((s) => {
495
+ o.has(s) || t.lockedSegmentIds.delete(s);
496
+ }), Array.from(t.lockedHtmlBySegmentId.keys()).forEach((s) => {
497
+ (!o.has(s) || !t.lockedSegmentIds.has(s)) && t.lockedHtmlBySegmentId.delete(s);
498
+ }), (!t.selectedSegmentId || !a.some((s) => s.id === t.selectedSegmentId)) && (t.selectedSegmentId = ((l = a[0]) == null ? void 0 : l.id) || null), a;
499
+ }
500
+ function b(e, n) {
501
+ u.has(e) || u.set(e, n);
502
+ let t = D.get(e);
503
+ return t || (t = {
504
+ sourceLocale: n.sourceLocale,
505
+ targetLocale: n.targetLocale,
506
+ selectedSegmentId: null,
507
+ realtimeEnabled: n.enableRealtime,
508
+ segments: [],
509
+ issues: [],
510
+ sourceTextBySegmentId: /* @__PURE__ */ new Map(),
511
+ lockedSegmentIds: /* @__PURE__ */ new Set(),
512
+ lockedHtmlBySegmentId: /* @__PURE__ */ new Map(),
513
+ snapshot: "",
514
+ lastRunAt: null
515
+ }, D.set(e, t)), Z.add(e), t;
516
+ }
517
+ function Se(e) {
518
+ xe(e);
519
+ const n = h.get(e);
520
+ n && n.remove(), h.delete(e), Y.delete(e);
521
+ const t = D.get(e);
522
+ t && (t.lockedSegmentIds.forEach((r) => {
523
+ const a = ue(e, r);
524
+ a && ce(a, !1);
525
+ }), t.lockedHtmlBySegmentId.clear()), u.delete(e), oe.delete(e), D.delete(e), Z.delete(e), x === e && (x = null);
526
+ }
527
+ function ye(e) {
528
+ return Y.get(e) === !0;
529
+ }
530
+ function be(e, n) {
531
+ if (!n.classList.contains("show"))
532
+ return;
533
+ 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
+ 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
+ }
536
+ function P(e, n) {
537
+ const t = e.querySelector(".rte-translation-live");
538
+ t && (t.textContent = n);
539
+ }
540
+ function rt(e, n) {
541
+ return `${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`;
542
+ }
543
+ function ot(e, n, t) {
544
+ const r = [], a = et(t, n.targetLocale);
545
+ for (let o = 0; o < e.length && !(r.length >= t.maxIssues); o += 1) {
546
+ const l = e[o], s = t.normalizeText(l.sourceText || ""), i = t.normalizeText(l.text || "");
547
+ if (!i) {
548
+ r.push(
549
+ ne("missing-target", "error", t.labels.missingTargetMessage, {
550
+ segmentId: l.id,
551
+ sourceText: s,
552
+ targetText: i,
553
+ suggestion: "Provide translated content for this segment before export."
554
+ })
555
+ );
556
+ continue;
557
+ }
558
+ if (a.preserveTokens && s && !je(s, i) && (r.push(
559
+ ne("token-mismatch", "error", t.labels.tokenMismatchMessage, {
560
+ segmentId: l.id,
561
+ sourceText: s,
562
+ targetText: i,
563
+ suggestion: "Preserve placeholders/tokens exactly (for example {{name}}, %ID%, ${value})."
564
+ })
565
+ ), r.length >= t.maxIssues) || a.requireDifferentFromSource && s && t.normalizeText(s) === t.normalizeText(i) && (r.push(
566
+ ne("untranslated", "warning", t.labels.untranslatedMessage, {
567
+ segmentId: l.id,
568
+ sourceText: s,
569
+ targetText: i,
570
+ suggestion: "Translate the segment or mark it intentionally unchanged."
571
+ })
572
+ ), r.length >= t.maxIssues))
573
+ break;
574
+ if (s.length >= t.minSourceLengthForRatio) {
575
+ const c = i.length / Math.max(1, s.length);
576
+ (c < a.minLengthRatio || c > a.maxLengthRatio) && r.push(
577
+ ne("length-out-of-range", "warning", t.labels.lengthOutOfRangeMessage, {
578
+ segmentId: l.id,
579
+ sourceText: s,
580
+ targetText: i,
581
+ suggestion: `Expected ratio for ${a.label}: ${a.minLengthRatio.toFixed(2)} - ${a.maxLengthRatio.toFixed(2)}.`
582
+ })
583
+ );
584
+ }
585
+ }
586
+ return r;
587
+ }
588
+ function qe(e) {
589
+ const n = u.get(e) || w, t = D.get(e);
590
+ return {
591
+ sourceLocale: (t == null ? void 0 : t.sourceLocale) || (n == null ? void 0 : n.sourceLocale) || "en-US",
592
+ targetLocale: (t == null ? void 0 : t.targetLocale) || (n == null ? void 0 : n.targetLocale) || "fr-FR",
593
+ realtimeEnabled: (t == null ? void 0 : t.realtimeEnabled) === !0,
594
+ selectedSegmentId: (t == null ? void 0 : t.selectedSegmentId) || null,
595
+ segmentCount: (t == null ? void 0 : t.segments.length) || 0,
596
+ lockedSegmentCount: t ? t.segments.filter((r) => r.locked).length : 0,
597
+ issues: t != null && t.issues ? t.issues.map((r) => ({ ...r })) : [],
598
+ segments: (t == null ? void 0 : t.segments.map((r) => ({
599
+ id: r.id,
600
+ tagName: r.tagName,
601
+ index: r.index,
602
+ sourceLength: r.sourceText.length,
603
+ targetLength: r.text.length,
604
+ locked: r.locked
605
+ }))) || [],
606
+ lastRunAt: (t == null ? void 0 : t.lastRunAt) || null
607
+ };
608
+ }
609
+ function E(e) {
610
+ const n = D.get(e), t = n && n.selectedSegmentId ? n.segments.find((r) => r.id === n.selectedSegmentId) : null;
611
+ 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
+ }
613
+ function at(e, n) {
614
+ const t = ue(e, n);
615
+ if (!t)
616
+ return;
617
+ try {
618
+ t.scrollIntoView({ block: "nearest", inline: "nearest" });
619
+ } catch (a) {
620
+ }
621
+ const r = window.getSelection();
622
+ if (!(!r || typeof document.createRange != "function"))
623
+ try {
624
+ const a = document.createRange();
625
+ a.selectNodeContents(t), a.collapse(!0), r.removeAllRanges(), r.addRange(a), e.focus({ preventScroll: !0 });
626
+ } catch (a) {
627
+ }
628
+ }
629
+ function R(e) {
630
+ const n = h.get(e);
631
+ if (!n)
632
+ return;
633
+ const t = u.get(e) || w;
634
+ if (!t)
635
+ return;
636
+ const r = b(e, t), a = n.querySelector(".rte-translation-source-label");
637
+ a && (a.textContent = t.labels.sourceLocaleLabel);
638
+ const o = n.querySelector(".rte-translation-target-label");
639
+ o && (o.textContent = t.labels.targetLocaleLabel);
640
+ const l = n.querySelector('[data-field="source-locale"]'), s = n.querySelector('[data-field="target-locale"]'), i = t.locales.map((f) => `<option value="${m(f)}">${m(f)}</option>`).join("");
641
+ l && (l.innerHTML = i, l.value = r.sourceLocale), s && (s.innerHTML = i, s.value = r.targetLocale);
642
+ const c = n.querySelector(".rte-translation-summary");
643
+ if (c) {
644
+ const f = r.issues.length, z = r.selectedSegmentId ? ` • ${t.labels.selectedSegmentPrefix}: ${r.selectedSegmentId}` : "";
645
+ c.textContent = `${t.labels.summaryPrefix}: ${r.sourceLocale} → ${r.targetLocale} • ${f} issue${f === 1 ? "" : "s"}${z}`;
646
+ }
647
+ const g = n.querySelector(".rte-translation-helper");
648
+ g && (g.textContent = t.labels.helperText);
649
+ const p = n.querySelector(".rte-translation-shortcut");
650
+ p && (p.textContent = t.labels.shortcutText);
651
+ const T = n.querySelector('[data-action="run-validation"]');
652
+ T && (T.textContent = t.labels.validateText);
653
+ const C = n.querySelector('[data-action="capture-source"]');
654
+ C && (C.textContent = t.labels.captureSourceText);
655
+ const K = n.querySelector('[data-action="toggle-realtime"]');
656
+ K && (K.textContent = r.realtimeEnabled ? t.labels.realtimeOnText : t.labels.realtimeOffText, K.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
657
+ const H = n.querySelector('[data-action="lock-selected"]'), q = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
658
+ 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);
661
+ const J = n.querySelector(".rte-translation-issues"), V = n.querySelector(".rte-translation-empty");
662
+ 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
+ <li class="rte-translation-issue ${f.severity === "error" ? "error" : f.severity === "warning" ? "warning" : "info"}" role="listitem" data-segment-id="${m(
664
+ f.segmentId || ""
665
+ )}">
666
+ <p class="rte-translation-issue-message">${m(f.message)}</p>
667
+ ${f.suggestion ? `<p class="rte-translation-issue-suggestion">${m(f.suggestion)}</p>` : ""}
668
+ </li>
669
+ `).join("")));
670
+ const de = n.querySelector(".rte-translation-segments");
671
+ 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" : "";
673
+ 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)}">
675
+ <button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
676
+ f.id
677
+ )}" title="${m(f.text)}">
678
+ <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>
680
+ </button>
681
+ <button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
682
+ f.id
683
+ )}" aria-label="${f.locked ? t.labels.unlockSegmentAriaLabel : t.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
684
+ </li>
685
+ `;
686
+ }).join(""));
687
+ const Q = n.querySelector(".rte-translation-source-preview"), X = n.querySelector(".rte-translation-target-preview");
688
+ if (Q || X) {
689
+ const f = r.selectedSegmentId && r.segments.find((z) => z.id === r.selectedSegmentId) || null;
690
+ Q && (Q.textContent = (f == null ? void 0 : f.sourceText) || "—", Q.setAttribute("aria-label", t.labels.sourcePreviewLabel)), X && (X.textContent = (f == null ? void 0 : f.text) || "—", X.setAttribute("aria-label", t.labels.targetPreviewLabel));
691
+ }
692
+ n.setAttribute("aria-label", t.labels.panelAriaLabel);
693
+ }
694
+ function Be(e) {
695
+ const n = u.get(e) || w;
696
+ if (!n)
697
+ return;
698
+ xe(e);
699
+ const t = window.setTimeout(() => {
700
+ se.delete(e), L(e, "realtime", !1);
701
+ }, n.debounceMs);
702
+ se.set(e, t);
703
+ }
704
+ function L(e, n, t) {
705
+ const r = u.get(e) || w;
706
+ if (!r)
707
+ return [];
708
+ const a = b(e, r), o = me(e, a);
709
+ a.segments = M(e, r, a);
710
+ const l = rt(e, a);
711
+ if (!t && a.snapshot === l)
712
+ 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(
714
+ new CustomEvent("editora:translation-workflow-validation", {
715
+ bubbles: !0,
716
+ detail: {
717
+ reason: n,
718
+ state: qe(e)
719
+ }
720
+ })
721
+ );
722
+ const s = h.get(e);
723
+ if (s) {
724
+ if (o)
725
+ return P(s, r.labels.readonlySegmentMessage), a.issues;
726
+ P(
727
+ s,
728
+ a.issues.length === 0 ? r.labels.noIssuesText : `${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} detected.`
729
+ );
730
+ }
731
+ return a.issues;
732
+ }
733
+ function Pe(e) {
734
+ const n = u.get(e) || w;
735
+ if (!n)
736
+ return !1;
737
+ const t = b(e, n), r = M(e, n, t);
738
+ r.forEach((o) => {
739
+ t.sourceTextBySegmentId.set(o.id, o.text);
740
+ }), t.snapshot = "", L(e, "capture-source", !0);
741
+ const a = h.get(e);
742
+ return a && P(a, n.labels.sourceCapturedMessage), e.dispatchEvent(
743
+ new CustomEvent("editora:translation-source-captured", {
744
+ bubbles: !0,
745
+ detail: {
746
+ sourceLocale: t.sourceLocale,
747
+ segmentCount: r.length
748
+ }
749
+ })
750
+ ), !0;
751
+ }
752
+ function ie(e, n, t) {
753
+ var c, g;
754
+ const r = u.get(e) || w;
755
+ if (!r)
756
+ return !1;
757
+ const a = b(e, r);
758
+ 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;
762
+ const s = ue(e, l);
763
+ if (!s)
764
+ return !1;
765
+ const i = typeof t == "boolean" ? t : !a.lockedSegmentIds.has(l);
766
+ 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
+ new CustomEvent("editora:translation-segment-lock", {
768
+ bubbles: !0,
769
+ detail: {
770
+ segmentId: l,
771
+ locked: i
772
+ }
773
+ })
774
+ ), !0;
775
+ }
776
+ function De(e, n) {
777
+ const t = u.get(e) || w;
778
+ if (!t)
779
+ return !1;
780
+ 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;
782
+ }
783
+ function pe(e, n, t = !0) {
784
+ const r = u.get(e) || w;
785
+ if (!r)
786
+ return !1;
787
+ 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;
789
+ }
790
+ function re(e, n) {
791
+ const t = u.get(e) || w;
792
+ if (!t)
793
+ return !1;
794
+ const r = b(e, t);
795
+ if (r.segments = M(e, t, r), r.segments.length === 0)
796
+ return !1;
797
+ const a = Math.max(
798
+ 0,
799
+ r.segments.findIndex((s) => s.id === r.selectedSegmentId)
800
+ );
801
+ let o = a;
802
+ n === "start" ? o = 0 : n === "end" ? o = r.segments.length - 1 : o = B(a + n, 0, r.segments.length - 1);
803
+ const l = r.segments[o];
804
+ return l ? pe(e, l.id, !0) : !1;
805
+ }
806
+ function G(e, n = !1) {
807
+ const t = h.get(e);
808
+ t && (t.classList.remove("show"), Y.set(e, !1), E(e), n && e.focus({ preventScroll: !0 }));
809
+ }
810
+ function he(e) {
811
+ const n = ut(e);
812
+ h.forEach((r, a) => {
813
+ a !== e && G(a, !1);
814
+ }), n.classList.add("show"), Y.set(e, !0), L(e, "panel-open", !1), R(e), be(e, n), E(e);
815
+ const t = n.querySelector('[data-field="target-locale"]');
816
+ t == null || t.focus();
817
+ }
818
+ function ze(e, n) {
819
+ const t = ye(e);
820
+ return (typeof n == "boolean" ? n : !t) ? he(e) : G(e, !1), !0;
821
+ }
822
+ function lt(e) {
823
+ const n = e.key.toLowerCase();
824
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
825
+ }
826
+ function st(e) {
827
+ const n = e.key.toLowerCase();
828
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
829
+ }
830
+ function it(e) {
831
+ const n = e.key.toLowerCase();
832
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
833
+ }
834
+ function ct(e) {
835
+ return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
836
+ }
837
+ function Ie(e) {
838
+ return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
839
+ }
840
+ function ut(e) {
841
+ const n = h.get(e);
842
+ if (n)
843
+ return n;
844
+ const t = u.get(e) || w || ae();
845
+ b(e, t);
846
+ const r = `rte-translation-workflow-panel-${Fe++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
847
+ 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
+ <header class="rte-translation-header">
849
+ <h2 class="rte-translation-title">${m(t.labels.panelTitle)}</h2>
850
+ <button type="button" class="rte-translation-icon-btn" data-action="close" aria-label="${m(
851
+ t.labels.closeText
852
+ )}">✕</button>
853
+ </header>
854
+ <div class="rte-translation-body">
855
+ <div class="rte-translation-locales">
856
+ <div class="rte-translation-locale-field">
857
+ <label class="rte-translation-source-label" for="${m(a)}"></label>
858
+ <select id="${m(a)}" class="rte-translation-select" data-field="source-locale"></select>
859
+ </div>
860
+ <div class="rte-translation-locale-field">
861
+ <label class="rte-translation-target-label" for="${m(o)}"></label>
862
+ <select id="${m(o)}" class="rte-translation-select" data-field="target-locale"></select>
863
+ </div>
864
+ </div>
865
+ <p class="rte-translation-summary"></p>
866
+ <div class="rte-translation-actions">
867
+ <button type="button" class="rte-translation-btn rte-translation-btn-primary" data-action="run-validation"></button>
868
+ <button type="button" class="rte-translation-btn" data-action="capture-source"></button>
869
+ <button type="button" class="rte-translation-btn" data-action="lock-selected"></button>
870
+ <button type="button" class="rte-translation-btn" data-action="toggle-realtime" aria-pressed="false"></button>
871
+ </div>
872
+ <p class="rte-translation-helper"></p>
873
+ <p class="rte-translation-shortcut"></p>
874
+ <div class="rte-translation-grid">
875
+ <section class="rte-translation-segments-wrap" aria-label="${m(t.labels.segmentsLabel)}">
876
+ <h3 class="rte-translation-subtitle">${m(t.labels.segmentsLabel)}</h3>
877
+ <ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(
878
+ t.labels.segmentsLabel
879
+ )}"></ul>
880
+ </section>
881
+ <section class="rte-translation-preview-wrap">
882
+ <h3 class="rte-translation-subtitle">${m(t.labels.sourcePreviewLabel)} / ${m(
883
+ t.labels.targetPreviewLabel
884
+ )}</h3>
885
+ <div class="rte-translation-preview-block">
886
+ <p class="rte-translation-preview-label">${m(t.labels.sourcePreviewLabel)}</p>
887
+ <p class="rte-translation-source-preview"></p>
888
+ </div>
889
+ <div class="rte-translation-preview-block">
890
+ <p class="rte-translation-preview-label">${m(t.labels.targetPreviewLabel)}</p>
891
+ <p class="rte-translation-target-preview"></p>
892
+ </div>
893
+ </section>
894
+ </div>
895
+ <section class="rte-translation-issues-wrap">
896
+ <h3 class="rte-translation-subtitle">${m(t.labels.issuesLabel)}</h3>
897
+ <ul class="rte-translation-issues" role="list" aria-label="${m(t.labels.issuesLabel)}"></ul>
898
+ <p class="rte-translation-empty" hidden></p>
899
+ </section>
900
+ </div>
901
+ <div class="rte-translation-live" aria-live="polite" aria-atomic="true"></div>
902
+ `, l.addEventListener("click", (s) => {
903
+ const i = s.target;
904
+ if (!i)
905
+ return;
906
+ const c = i.closest("[data-action]");
907
+ 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);
910
+ return;
911
+ }
912
+ const g = c.getAttribute("data-action");
913
+ if (g === "close") {
914
+ G(e, !0);
915
+ return;
916
+ }
917
+ if (g === "run-validation") {
918
+ L(e, "panel-button", !0);
919
+ return;
920
+ }
921
+ if (g === "capture-source") {
922
+ Pe(e);
923
+ return;
924
+ }
925
+ if (g === "lock-selected") {
926
+ ie(e);
927
+ return;
928
+ }
929
+ if (g === "toggle-realtime") {
930
+ De(e);
931
+ return;
932
+ }
933
+ if (g === "select-segment") {
934
+ const p = c.getAttribute("data-segment-id") || "";
935
+ p && pe(e, p, !0);
936
+ return;
937
+ }
938
+ if (g === "toggle-lock") {
939
+ const p = c.getAttribute("data-segment-id") || "";
940
+ p && ie(e, p);
941
+ }
942
+ }), l.addEventListener("change", (s) => {
943
+ const i = s.target;
944
+ if (!(i instanceof HTMLSelectElement))
945
+ return;
946
+ const c = u.get(e) || w;
947
+ if (!c)
948
+ return;
949
+ const g = b(e, c);
950
+ if (i.getAttribute("data-field") === "source-locale") {
951
+ g.sourceLocale = A(i.value), g.snapshot = "", L(e, "source-locale-change", !0);
952
+ return;
953
+ }
954
+ i.getAttribute("data-field") === "target-locale" && (g.targetLocale = A(i.value), g.snapshot = "", L(e, "target-locale-change", !0));
955
+ }), l.addEventListener("keydown", (s) => {
956
+ const i = s.target;
957
+ if (s.key === "Escape") {
958
+ s.preventDefault(), G(e, !0);
959
+ return;
960
+ }
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"));
962
+ }), ge(l, e), document.body.appendChild(l), h.set(e, l), Y.set(e, !1), R(e), l;
963
+ }
964
+ function dt(e) {
965
+ w = e, N || (N = (n) => {
966
+ var i;
967
+ le();
968
+ const t = n.target, r = t == null ? void 0 : t.closest(S);
969
+ if (!r)
970
+ return;
971
+ const a = u.get(r) || e, o = b(r, a);
972
+ u.set(r, a), x = r;
973
+ const l = ((i = He(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
974
+ l && (o.selectedSegmentId = l), E(r);
975
+ const s = h.get(r);
976
+ s && (ge(s, r), be(r, s), R(r));
977
+ }, document.addEventListener("focusin", N, !0)), O || (O = (n) => {
978
+ const t = n.target, r = t == null ? void 0 : t.closest(S);
979
+ if (!r)
980
+ return;
981
+ const a = u.get(r) || w;
982
+ if (!a)
983
+ return;
984
+ const o = b(r, a), l = me(r, o);
985
+ if (o.segments = M(r, a, o), !o.realtimeEnabled) {
986
+ if (l) {
987
+ const s = h.get(r);
988
+ s && P(s, a.labels.readonlySegmentMessage);
989
+ }
990
+ R(r), E(r);
991
+ return;
992
+ }
993
+ Be(r);
994
+ }, document.addEventListener("input", O, !0)), _ || (_ = (n) => {
995
+ 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;
1001
+ t.preventDefault();
1002
+ const l = h.get(a), s = u.get(a) || w;
1003
+ l && s && P(l, s.labels.readonlySegmentMessage);
1004
+ }, document.addEventListener("beforeinput", _, !0)), F || (F = (n) => {
1005
+ if (n.defaultPrevented)
1006
+ return;
1007
+ 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);
1011
+ if (!a && !o && !l && !s && !i)
1012
+ return;
1013
+ const c = Xe(n);
1014
+ if (!c)
1015
+ return;
1016
+ const g = u.get(c) || w || e;
1017
+ if (b(c, g), u.set(c, g), x = c, a && ye(c)) {
1018
+ n.preventDefault(), G(c, !0);
1019
+ return;
1020
+ }
1021
+ if (i && c.contains(i) && ct(n)) {
1022
+ n.preventDefault();
1023
+ const p = h.get(c);
1024
+ p && P(p, g.labels.readonlySegmentMessage);
1025
+ return;
1026
+ }
1027
+ if (o) {
1028
+ n.preventDefault(), n.stopPropagation(), ze(c);
1029
+ return;
1030
+ }
1031
+ if (l) {
1032
+ n.preventDefault(), n.stopPropagation(), L(c, "shortcut", !0);
1033
+ return;
1034
+ }
1035
+ s && (n.preventDefault(), n.stopPropagation(), ie(c));
1036
+ }, document.addEventListener("keydown", F, !0)), I || (I = () => {
1037
+ le(), h.forEach((n, t) => {
1038
+ !t.isConnected || !n.isConnected || (ge(n, t), be(t, n));
1039
+ });
1040
+ }, 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) => {
1042
+ const a = D.get(r);
1043
+ if (!a || a.lockedSegmentIds.size === 0 || !me(r, a))
1044
+ return;
1045
+ a.snapshot = "";
1046
+ const l = u.get(r) || w, s = h.get(r);
1047
+ s && l && P(s, l.labels.readonlySegmentMessage), l && (a.segments = M(r, l, a), R(r), E(r));
1048
+ });
1049
+ }), W.observe(document.body, {
1050
+ childList: !0,
1051
+ subtree: !0,
1052
+ characterData: !0
1053
+ }));
1054
+ }
1055
+ function ft() {
1056
+ 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
+ }
1058
+ function gt() {
1059
+ if (typeof document == "undefined" || document.getElementById(ve))
1060
+ return;
1061
+ const e = document.createElement("style");
1062
+ e.id = ve, e.textContent = `
1063
+ .rte-toolbar-group-items.${y},
1064
+ .editora-toolbar-group-items.${y},
1065
+ .rte-toolbar-group-items.${$},
1066
+ .editora-toolbar-group-items.${$} {
1067
+ display: flex;
1068
+ border: 1px solid #cbd5e1;
1069
+ border-radius: 4px;
1070
+ background: #ffffff;
1071
+ }
1072
+
1073
+ .rte-toolbar-group-items.${y} .rte-toolbar-button,
1074
+ .editora-toolbar-group-items.${y} .editora-toolbar-button,
1075
+ .rte-toolbar-group-items.${$} .rte-toolbar-button,
1076
+ .editora-toolbar-group-items.${$} .editora-toolbar-button {
1077
+ border: none;
1078
+ border-right: 1px solid #cbd5e1;
1079
+ border-radius: 0;
1080
+ }
1081
+
1082
+ .rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
1083
+ .editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button,
1084
+ .rte-toolbar-group-items.${$} .rte-toolbar-item:last-child .rte-toolbar-button,
1085
+ .editora-toolbar-group-items.${$} .editora-toolbar-item:last-child .editora-toolbar-button {
1086
+ border-right: none;
1087
+ }
1088
+
1089
+ ${k} .rte-toolbar-group-items.${y},
1090
+ ${k} .editora-toolbar-group-items.${y},
1091
+ ${k} .rte-toolbar-group-items.${$},
1092
+ ${k} .editora-toolbar-group-items.${$} {
1093
+ border-color: #566275;
1094
+ }
1095
+ .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1096
+ .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1097
+ .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1098
+ .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1099
+ .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
1100
+ .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
1101
+ background: #ccc;
1102
+ }
1103
+ ${k} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
1104
+ ${k} .editora-toolbar-group-items.${y} .editora-toolbar-button svg,
1105
+ ${k} .rte-toolbar-group-items.${$} .rte-toolbar-button svg,
1106
+ ${k} .editora-toolbar-group-items.${$} .editora-toolbar-button svg
1107
+ {
1108
+ fill: none;
1109
+ }
1110
+ ${k} .rte-toolbar-group-items.${y} .rte-toolbar-button,
1111
+ ${k} .editora-toolbar-group-items.${y} .editora-toolbar-button
1112
+ {
1113
+ border-color: #566275;
1114
+ }
1115
+
1116
+ ${k} .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1117
+ ${k} .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1118
+ ${k} .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1119
+ ${k} .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1120
+ ${k} .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
1121
+ ${k} .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
1122
+ background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
1123
+ }
1124
+
1125
+ .${d} {
1126
+ position: fixed;
1127
+ z-index: 12000;
1128
+ display: none;
1129
+ width: min(520px, calc(100vw - 20px));
1130
+ max-height: calc(100vh - 20px);
1131
+ border: 1px solid #d1d5db;
1132
+ border-radius: 14px;
1133
+ background: #ffffff;
1134
+ color: #0f172a;
1135
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
1136
+ overflow: hidden;
1137
+ }
1138
+
1139
+ .${d}.show {
1140
+ display: flex;
1141
+ flex-direction: column;
1142
+ }
1143
+
1144
+ .${d}.rte-translation-workflow-theme-dark {
1145
+ border-color: #334155;
1146
+ background: #0f172a;
1147
+ color: #e2e8f0;
1148
+ box-shadow: 0 24px 52px rgba(2, 6, 23, 0.68);
1149
+ }
1150
+
1151
+ .rte-translation-header {
1152
+ display: flex;
1153
+ align-items: center;
1154
+ justify-content: space-between;
1155
+ gap: 8px;
1156
+ padding: 12px 14px;
1157
+ border-bottom: 1px solid #e2e8f0;
1158
+ background: linear-gradient(180deg, #eff6ff 0%, #e2e8f0 100%);
1159
+ }
1160
+
1161
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-header {
1162
+ border-color: #1e293b;
1163
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
1164
+ }
1165
+
1166
+ .rte-translation-title {
1167
+ margin: 0;
1168
+ font-size: 15px;
1169
+ line-height: 1.2;
1170
+ font-weight: 700;
1171
+ }
1172
+
1173
+ .rte-translation-icon-btn {
1174
+ border: 1px solid #cbd5e1;
1175
+ border-radius: 6px;
1176
+ min-height: 34px;
1177
+ width: 34px;
1178
+ background: #ffffff;
1179
+ color: #0f172a;
1180
+ font-size: 16px;
1181
+ line-height: 1;
1182
+ font-weight: 600;
1183
+ padding: 0;
1184
+ display: inline-flex;
1185
+ align-items: center;
1186
+ justify-content: center;
1187
+ cursor: pointer;
1188
+ }
1189
+
1190
+ .rte-translation-icon-btn:hover,
1191
+ .rte-translation-icon-btn:focus-visible {
1192
+ outline: none;
1193
+ border-color: #3b82f6;
1194
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
1195
+ }
1196
+
1197
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
1198
+ border-color: #475569;
1199
+ background: #0f172a;
1200
+ color: #e2e8f0;
1201
+ }
1202
+
1203
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:hover,
1204
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:focus-visible {
1205
+ border-color: #60a5fa;
1206
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
1207
+ }
1208
+
1209
+ .rte-translation-body {
1210
+ display: flex;
1211
+ flex-direction: column;
1212
+ gap: 8px;
1213
+ padding: 12px;
1214
+ overflow: auto;
1215
+ }
1216
+
1217
+ .rte-translation-locales {
1218
+ display: grid;
1219
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1220
+ gap: 8px;
1221
+ }
1222
+
1223
+ .rte-translation-locale-field {
1224
+ display: grid;
1225
+ gap: 4px;
1226
+ }
1227
+
1228
+ .rte-translation-source-label,
1229
+ .rte-translation-target-label {
1230
+ font-size: 12px;
1231
+ font-weight: 700;
1232
+ color: #334155;
1233
+ }
1234
+
1235
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-source-label,
1236
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-target-label {
1237
+ color: #cbd5e1;
1238
+ }
1239
+
1240
+ .rte-translation-select {
1241
+ border: 1px solid #cbd5e1;
1242
+ border-radius: 8px;
1243
+ min-height: 34px;
1244
+ padding: 0 10px;
1245
+ font-size: 13px;
1246
+ background: #ffffff;
1247
+ color: inherit;
1248
+ }
1249
+
1250
+ .rte-translation-select:focus-visible {
1251
+ border-color: #0e7490;
1252
+ box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.18);
1253
+ outline: none;
1254
+ }
1255
+
1256
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-select {
1257
+ border-color: #334155;
1258
+ background: #0b1220;
1259
+ color: #e2e8f0;
1260
+ }
1261
+
1262
+ .rte-translation-summary,
1263
+ .rte-translation-helper,
1264
+ .rte-translation-shortcut {
1265
+ margin: 0;
1266
+ font-size: 12px;
1267
+ line-height: 1.35;
1268
+ color: #475569;
1269
+ }
1270
+
1271
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-summary,
1272
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-helper,
1273
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-shortcut {
1274
+ color: #94a3b8;
1275
+ }
1276
+
1277
+ .rte-translation-actions {
1278
+ display: grid;
1279
+ grid-template-columns: repeat(4, minmax(0, 1fr));
1280
+ gap: 8px;
1281
+ }
1282
+
1283
+ .rte-translation-btn {
1284
+ border: 1px solid #cbd5e1;
1285
+ border-radius: 8px;
1286
+ min-height: 34px;
1287
+ padding: 0 8px;
1288
+ background: #ffffff;
1289
+ color: inherit;
1290
+ font-size: 12px;
1291
+ font-weight: 700;
1292
+ cursor: pointer;
1293
+ }
1294
+
1295
+ .rte-translation-btn:disabled {
1296
+ opacity: 0.6;
1297
+ cursor: not-allowed;
1298
+ }
1299
+
1300
+ .rte-translation-btn-primary {
1301
+ border-color: #0e7490;
1302
+ background: #0e7490;
1303
+ color: #f8fafc;
1304
+ }
1305
+
1306
+ .rte-translation-btn:hover,
1307
+ .rte-translation-btn:focus-visible {
1308
+ border-color: #94a3b8;
1309
+ outline: none;
1310
+ }
1311
+
1312
+ .rte-translation-btn-primary:hover,
1313
+ .rte-translation-btn-primary:focus-visible {
1314
+ border-color: #155e75;
1315
+ background: #155e75;
1316
+ }
1317
+
1318
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-btn {
1319
+ border-color: #334155;
1320
+ background: #111827;
1321
+ color: #e2e8f0;
1322
+ }
1323
+
1324
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
1325
+ border-color: #22d3ee;
1326
+ background: #0e7490;
1327
+ color: #ecfeff;
1328
+ }
1329
+
1330
+ .rte-translation-grid {
1331
+ display: grid;
1332
+ grid-template-columns: 1fr 1fr;
1333
+ gap: 8px;
1334
+ }
1335
+
1336
+ .rte-translation-segments-wrap,
1337
+ .rte-translation-preview-wrap,
1338
+ .rte-translation-issues-wrap {
1339
+ border: 1px solid #e2e8f0;
1340
+ border-radius: 10px;
1341
+ background: #f8fafc;
1342
+ padding: 8px;
1343
+ min-height: 120px;
1344
+ }
1345
+
1346
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segments-wrap,
1347
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-preview-wrap,
1348
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issues-wrap {
1349
+ border-color: #334155;
1350
+ background: #0b1220;
1351
+ }
1352
+
1353
+ .rte-translation-subtitle {
1354
+ margin: 0 0 6px;
1355
+ font-size: 12px;
1356
+ font-weight: 700;
1357
+ color: #334155;
1358
+ }
1359
+
1360
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
1361
+ color: #cbd5e1;
1362
+ }
1363
+
1364
+ .rte-translation-segments {
1365
+ margin: 0;
1366
+ padding: 0;
1367
+ list-style: none;
1368
+ display: grid;
1369
+ gap: 6px;
1370
+ max-height: 220px;
1371
+ overflow: auto;
1372
+ outline: none;
1373
+ }
1374
+
1375
+ .rte-translation-segment-item {
1376
+ display: grid;
1377
+ grid-template-columns: 1fr auto;
1378
+ gap: 6px;
1379
+ border: 1px solid #cbd5e1;
1380
+ border-radius: 8px;
1381
+ background: #ffffff;
1382
+ padding: 6px;
1383
+ }
1384
+
1385
+ .rte-translation-segment-item.selected {
1386
+ border-color: #0e7490;
1387
+ box-shadow: 0 0 0 2px rgba(14, 116, 144, 0.16);
1388
+ }
1389
+
1390
+ .rte-translation-segment-item.locked {
1391
+ border-color: #f59e0b;
1392
+ background: #fffbeb;
1393
+ }
1394
+
1395
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
1396
+ border-color: #334155;
1397
+ background: #111827;
1398
+ }
1399
+
1400
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
1401
+ border-color: rgba(245, 158, 11, 0.72);
1402
+ background: rgba(120, 53, 15, 0.28);
1403
+ }
1404
+
1405
+ .rte-translation-segment-select {
1406
+ border: none;
1407
+ background: transparent;
1408
+ color: inherit;
1409
+ text-align: left;
1410
+ padding: 0;
1411
+ cursor: pointer;
1412
+ display: grid;
1413
+ gap: 2px;
1414
+ }
1415
+
1416
+ .rte-translation-segment-meta {
1417
+ font-size: 11px;
1418
+ color: #64748b;
1419
+ font-weight: 700;
1420
+ }
1421
+
1422
+ .rte-translation-segment-text {
1423
+ font-size: 12px;
1424
+ color: #334155;
1425
+ line-height: 1.3;
1426
+ }
1427
+
1428
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
1429
+ color: #94a3b8;
1430
+ }
1431
+
1432
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
1433
+ color: #e2e8f0;
1434
+ }
1435
+
1436
+ .rte-translation-segment-lock {
1437
+ border: 1px solid #cbd5e1;
1438
+ border-radius: 8px;
1439
+ width: 28px;
1440
+ min-height: 28px;
1441
+ background: #ffffff;
1442
+ cursor: pointer;
1443
+ position: relative;
1444
+ color: inherit;
1445
+ font-size: 0;
1446
+ }
1447
+
1448
+ .rte-translation-segment-lock::before {
1449
+ content: '🔒';
1450
+ font-size: 14px;
1451
+ position: absolute;
1452
+ inset: 0;
1453
+ display: grid;
1454
+ place-items: center;
1455
+ opacity: 0.35;
1456
+ }
1457
+
1458
+ .rte-translation-segment-lock[aria-pressed="true"]::before {
1459
+ opacity: 1;
1460
+ }
1461
+
1462
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
1463
+ border-color: #334155;
1464
+ background: #111827;
1465
+ }
1466
+
1467
+ .rte-translation-preview-block {
1468
+ display: grid;
1469
+ gap: 4px;
1470
+ margin-bottom: 8px;
1471
+ }
1472
+
1473
+ .rte-translation-preview-label {
1474
+ margin: 0;
1475
+ font-size: 11px;
1476
+ color: #64748b;
1477
+ font-weight: 700;
1478
+ }
1479
+
1480
+ .rte-translation-source-preview,
1481
+ .rte-translation-target-preview {
1482
+ margin: 0;
1483
+ border: 1px solid #cbd5e1;
1484
+ border-radius: 8px;
1485
+ background: #ffffff;
1486
+ padding: 8px;
1487
+ font-size: 12px;
1488
+ min-height: 56px;
1489
+ white-space: pre-wrap;
1490
+ line-height: 1.35;
1491
+ color: #1f2937;
1492
+ }
1493
+
1494
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
1495
+ color: #94a3b8;
1496
+ }
1497
+
1498
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
1499
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
1500
+ border-color: #334155;
1501
+ background: #111827;
1502
+ color: #e2e8f0;
1503
+ }
1504
+
1505
+ .rte-translation-issues {
1506
+ margin: 0;
1507
+ padding: 0;
1508
+ list-style: none;
1509
+ display: grid;
1510
+ gap: 6px;
1511
+ max-height: 200px;
1512
+ overflow: auto;
1513
+ }
1514
+
1515
+ .rte-translation-issue {
1516
+ border: 1px solid #cbd5e1;
1517
+ border-radius: 8px;
1518
+ background: #ffffff;
1519
+ padding: 8px;
1520
+ display: grid;
1521
+ gap: 4px;
1522
+ cursor: pointer;
1523
+ }
1524
+
1525
+ .rte-translation-issue.error {
1526
+ border-color: #ef4444;
1527
+ background: #fef2f2;
1528
+ }
1529
+
1530
+ .rte-translation-issue.warning {
1531
+ border-color: #f59e0b;
1532
+ background: #fffbeb;
1533
+ }
1534
+
1535
+ .rte-translation-issue.info {
1536
+ border-color: #0ea5e9;
1537
+ background: #f0f9ff;
1538
+ }
1539
+
1540
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue {
1541
+ border-color: #334155;
1542
+ background: #111827;
1543
+ color: #e2e8f0;
1544
+ }
1545
+
1546
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
1547
+ border-color: rgba(239, 68, 68, 0.7);
1548
+ background: rgba(127, 29, 29, 0.28);
1549
+ }
1550
+
1551
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
1552
+ border-color: rgba(245, 158, 11, 0.72);
1553
+ background: rgba(120, 53, 15, 0.28);
1554
+ }
1555
+
1556
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
1557
+ border-color: rgba(14, 165, 233, 0.7);
1558
+ background: rgba(7, 89, 133, 0.28);
1559
+ }
1560
+
1561
+ .rte-translation-issue-message,
1562
+ .rte-translation-issue-suggestion {
1563
+ margin: 0;
1564
+ font-size: 12px;
1565
+ line-height: 1.35;
1566
+ color: #1f2937;
1567
+ }
1568
+
1569
+ .rte-translation-issue-suggestion {
1570
+ color: #475569;
1571
+ }
1572
+
1573
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
1574
+ color: #e2e8f0;
1575
+ }
1576
+
1577
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
1578
+ color: #cbd5e1;
1579
+ }
1580
+
1581
+ .rte-translation-empty {
1582
+ margin: 8px;
1583
+ font-size: 12px;
1584
+ color: #64748b;
1585
+ }
1586
+
1587
+ .rte-translation-live {
1588
+ position: absolute;
1589
+ width: 1px;
1590
+ height: 1px;
1591
+ margin: -1px;
1592
+ padding: 0;
1593
+ overflow: hidden;
1594
+ clip: rect(0 0 0 0);
1595
+ border: 0;
1596
+ }
1597
+
1598
+ [data-translation-locked="true"].rte-translation-segment-locked {
1599
+ outline: 2px dashed rgba(245, 158, 11, 0.65);
1600
+ outline-offset: 2px;
1601
+ background: rgba(255, 251, 235, 0.8);
1602
+ border-radius: 4px;
1603
+ }
1604
+
1605
+ ${k} [data-translation-locked="true"].rte-translation-segment-locked {
1606
+ outline-color: rgba(245, 158, 11, 0.75);
1607
+ background: rgba(120, 53, 15, 0.22);
1608
+ }
1609
+
1610
+ @media (max-width: 920px) {
1611
+ .${d} {
1612
+ left: 10px !important;
1613
+ right: 10px;
1614
+ top: 10px !important;
1615
+ width: auto !important;
1616
+ max-height: calc(100vh - 20px);
1617
+ }
1618
+
1619
+ .rte-translation-locales,
1620
+ .rte-translation-actions,
1621
+ .rte-translation-grid {
1622
+ grid-template-columns: 1fr;
1623
+ }
1624
+ }
1625
+ `, document.head.appendChild(e);
1626
+ }
1627
+ const mt = (e = {}) => {
1628
+ const n = ae(e), t = /* @__PURE__ */ new Set();
1629
+ return gt(), {
1630
+ name: "translationWorkflow",
1631
+ toolbar: [
1632
+ {
1633
+ id: "translationWorkflowGroup",
1634
+ label: "Translation Workflow",
1635
+ type: "group",
1636
+ command: "translationWorkflow",
1637
+ items: [
1638
+ {
1639
+ id: "toggleTranslationWorkflowPanel",
1640
+ label: "Translation Workflow",
1641
+ command: "toggleTranslationWorkflowPanel",
1642
+ shortcut: "Mod-Alt-Shift-l",
1643
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 6.5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H8l-4 3V6.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M20 17.5a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-1.5" stroke="currentColor" stroke-width="1.6"/><path d="m13 8 2 2m0 0 2-2m-2 2V4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1644
+ },
1645
+ {
1646
+ id: "runTranslationLocaleValidation",
1647
+ label: "Run Locale Validation",
1648
+ command: "runTranslationLocaleValidation",
1649
+ shortcut: "Mod-Alt-Shift-v",
1650
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4.5" y="4" width="12" height="16" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M8 8h5.5M8 11h4M8 14h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="m15.5 15.5 1.7 1.7 3.3-3.3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1651
+ },
1652
+ {
1653
+ id: "toggleTranslationSegmentLock",
1654
+ label: "Toggle Segment Lock",
1655
+ command: "toggleTranslationSegmentLock",
1656
+ shortcut: "Mod-Alt-Shift-k",
1657
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="5" y="10" width="14" height="10" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M8.5 10V7.5a3.5 3.5 0 1 1 7 0V10" stroke="currentColor" stroke-width="1.6"/><circle cx="12" cy="15" r="1.2" fill="currentColor"/></svg>'
1658
+ },
1659
+ {
1660
+ id: "toggleTranslationRealtime",
1661
+ label: "Toggle Translation Realtime",
1662
+ command: "toggleTranslationRealtime",
1663
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 12a7.5 7.5 0 1 1 7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M9.5 19.5H5.5v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 8v4l2.5 2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1664
+ }
1665
+ ]
1666
+ }
1667
+ ],
1668
+ commands: {
1669
+ translationWorkflow: (r, a) => {
1670
+ const o = v(a, !1, !1);
1671
+ if (!o)
1672
+ return !1;
1673
+ const l = u.get(o) || n;
1674
+ return b(o, l), u.set(o, l), x = o, he(o), !0;
1675
+ },
1676
+ openTranslationWorkflowPanel: (r, a) => {
1677
+ const o = v(a, !1, !1);
1678
+ if (!o)
1679
+ return !1;
1680
+ const l = u.get(o) || n;
1681
+ return b(o, l), u.set(o, l), x = o, he(o), !0;
1682
+ },
1683
+ toggleTranslationWorkflowPanel: (r, a) => {
1684
+ const o = v(a, !1, !1);
1685
+ if (!o)
1686
+ return !1;
1687
+ 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);
1689
+ },
1690
+ runTranslationLocaleValidation: (r, a) => {
1691
+ const o = v(a, !1, !1);
1692
+ if (!o)
1693
+ return !1;
1694
+ const l = u.get(o) || n;
1695
+ return b(o, l), u.set(o, l), x = o, L(o, "command", !0), !0;
1696
+ },
1697
+ toggleTranslationRealtime: (r, a) => {
1698
+ const o = v(a, !1, !1);
1699
+ if (!o)
1700
+ return !1;
1701
+ 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);
1703
+ },
1704
+ toggleTranslationSegmentLock: (r, a) => {
1705
+ const o = v(a, !1, !1);
1706
+ if (!o)
1707
+ return !1;
1708
+ const l = u.get(o) || n;
1709
+ b(o, l), u.set(o, l), x = o;
1710
+ 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
+ return ie(o, i, s);
1712
+ },
1713
+ setTranslationLocales: (r, a) => {
1714
+ const o = v(a, !1, !1);
1715
+ if (!o || !r || typeof r != "object")
1716
+ return !1;
1717
+ const l = u.get(o) || n, s = b(o, l);
1718
+ 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
+ },
1720
+ captureTranslationSourceSnapshot: (r, a) => {
1721
+ const o = v(a, !1, !1);
1722
+ if (!o)
1723
+ return !1;
1724
+ const l = u.get(o) || n;
1725
+ return b(o, l), u.set(o, l), x = o, Pe(o);
1726
+ },
1727
+ 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 = {
1732
+ ...s,
1733
+ ...r,
1734
+ labels: {
1735
+ ...s.labels || {},
1736
+ ...r.labels || {}
1737
+ },
1738
+ localeRules: Array.isArray(r.localeRules) ? r.localeRules : s.localeRules,
1739
+ locales: Array.isArray(r.locales) ? r.locales : s.locales,
1740
+ normalizeText: r.normalizeText || l.normalizeText
1741
+ }, c = ae(i);
1742
+ u.set(o, c), oe.set(o, i);
1743
+ const g = b(o, c);
1744
+ 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
+ },
1746
+ getTranslationWorkflowState: (r, a) => {
1747
+ const o = v(a, !1, !1);
1748
+ if (!o)
1749
+ return !1;
1750
+ const l = u.get(o) || n;
1751
+ b(o, l);
1752
+ const s = qe(o);
1753
+ if (typeof r == "function")
1754
+ try {
1755
+ r(s);
1756
+ } catch (i) {
1757
+ }
1758
+ return o.__translationWorkflowState = s, o.dispatchEvent(
1759
+ new CustomEvent("editora:translation-workflow-state", {
1760
+ bubbles: !0,
1761
+ detail: s
1762
+ })
1763
+ ), !0;
1764
+ }
1765
+ },
1766
+ keymap: {
1767
+ "Mod-Alt-Shift-l": "toggleTranslationWorkflowPanel",
1768
+ "Mod-Alt-Shift-L": "toggleTranslationWorkflowPanel",
1769
+ "Mod-Alt-Shift-v": "runTranslationLocaleValidation",
1770
+ "Mod-Alt-Shift-V": "runTranslationLocaleValidation",
1771
+ "Mod-Alt-Shift-k": "toggleTranslationSegmentLock",
1772
+ "Mod-Alt-Shift-K": "toggleTranslationSegmentLock"
1773
+ },
1774
+ init: function(a) {
1775
+ ee += 1;
1776
+ const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = ae(o);
1777
+ dt(l);
1778
+ const s = v(
1779
+ a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
1780
+ !1,
1781
+ !1
1782
+ );
1783
+ if (!s)
1784
+ return;
1785
+ x = s, t.add(s);
1786
+ const i = b(s, l);
1787
+ u.set(s, l), oe.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
1788
+ },
1789
+ destroy: () => {
1790
+ t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && ft();
1791
+ }
1792
+ };
1793
+ };
1794
+ export {
1795
+ mt as TranslationWorkflowPlugin
1796
+ };
1797
+ //# sourceMappingURL=TranslationWorkflowPlugin.native-4e711b1e.mjs.map