@editora/plugins 1.0.8 → 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 (141) hide show
  1. package/README.md +27 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +447 -0
  11. package/dist/approval-workflow.esm.js +1111 -0
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +442 -0
  16. package/dist/blocks-library.esm.js +1384 -0
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +548 -0
  21. package/dist/citations.esm.js +1530 -0
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +626 -0
  31. package/dist/conditional-content.esm.js +1421 -0
  32. package/dist/content-rules.cjs.js +408 -0
  33. package/dist/content-rules.esm.js +1147 -0
  34. package/dist/data-binding.cjs.js +321 -0
  35. package/dist/data-binding.esm.js +953 -0
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +398 -0
  38. package/dist/doc-schema.esm.js +1378 -0
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -0
  49. package/dist/enterprise.esm.js +58 -0
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +124 -93
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +105 -0
  87. package/dist/mentions.esm.js +774 -0
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +67 -51
  92. package/dist/pii-redaction.cjs.js +436 -0
  93. package/dist/pii-redaction.esm.js +1447 -0
  94. package/dist/preview.cjs.js +3 -3
  95. package/dist/preview.esm.js +37 -32
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +20 -17
  98. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  99. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  100. package/dist/slash-commands.cjs.js +90 -0
  101. package/dist/slash-commands.esm.js +788 -0
  102. package/dist/smart-paste.cjs.js +398 -0
  103. package/dist/smart-paste.esm.js +1444 -0
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +69 -61
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +123 -97
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +19 -14
  110. package/dist/style.css +1 -0
  111. package/dist/table.cjs.js +4 -4
  112. package/dist/table.esm.js +225 -191
  113. package/dist/template.cjs.js +11 -11
  114. package/dist/template.esm.js +153 -124
  115. package/dist/text-alignment.cjs.js +1 -1
  116. package/dist/text-alignment.esm.js +27 -21
  117. package/dist/text-color.cjs.js +3 -3
  118. package/dist/text-color.esm.js +87 -70
  119. package/dist/track-changes.cjs.js +77 -0
  120. package/dist/track-changes.esm.js +817 -0
  121. package/dist/translation-workflow.cjs.js +626 -0
  122. package/dist/translation-workflow.esm.js +1794 -0
  123. package/dist/version-diff.cjs.js +362 -0
  124. package/dist/version-diff.esm.js +797 -0
  125. package/index.d.ts +798 -0
  126. package/package.json +114 -9
  127. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  128. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  129. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  130. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  131. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  132. package/dist/documentManager-Jf0RbSks.js +0 -17
  133. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  134. package/dist/index-CvJk4DKa.js +0 -221
  135. package/dist/index-D3CycEFU.mjs +0 -16543
  136. package/dist/index-tqLTHcO6.js +0 -1
  137. package/dist/index.es-CE_A4QSm.js +0 -5
  138. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  139. package/dist/jspdf.es.min-BoS80556.js +0 -77
  140. package/dist/plugins.css +0 -1
  141. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -0,0 +1,1447 @@
1
+ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", we = "__editoraCommandEditorRoot", Ee = "rte-pii-redaction-styles", u = "rte-pii-redaction-panel", k = "pii-redaction", v = "piiRedaction", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pe = typeof NodeFilter < "u" ? NodeFilter.SHOW_TEXT : 4, Oe = [
2
+ "email",
3
+ "phone",
4
+ "ssn",
5
+ "credit-card",
6
+ "ipv4",
7
+ "api-key",
8
+ "jwt"
9
+ ], ze = {
10
+ panelTitle: "PII Redaction",
11
+ panelAriaLabel: "PII redaction panel",
12
+ scanText: "Scan PII",
13
+ redactAllText: "Redact All",
14
+ redactText: "Redact",
15
+ locateText: "Locate",
16
+ realtimeOnText: "Realtime On",
17
+ realtimeOffText: "Realtime Off",
18
+ closeText: "Close",
19
+ noFindingsText: "No PII detected in the document.",
20
+ summaryPrefix: "Findings",
21
+ shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+I/U/M/Y",
22
+ readonlyRedactionText: "Editor is read-only. Reopen editable mode to redact.",
23
+ matchLabel: "Detected",
24
+ maskedLabel: "Masked",
25
+ excerptLabel: "Context"
26
+ }, Fe = {
27
+ email: {
28
+ label: "Email",
29
+ severity: "medium",
30
+ pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi
31
+ },
32
+ phone: {
33
+ label: "Phone",
34
+ severity: "medium",
35
+ pattern: /\b(?:\+?\d{1,3}[\s.-]?)?(?:\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4})\b/g
36
+ },
37
+ ssn: {
38
+ label: "SSN",
39
+ severity: "high",
40
+ pattern: /\b\d{3}-\d{2}-\d{4}\b/g
41
+ },
42
+ "credit-card": {
43
+ label: "Credit Card",
44
+ severity: "high",
45
+ pattern: /\b(?:\d[ -]*?){13,19}\b/g,
46
+ validator: (e) => We(e)
47
+ },
48
+ ipv4: {
49
+ label: "IPv4",
50
+ severity: "low",
51
+ pattern: /\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g
52
+ },
53
+ "api-key": {
54
+ label: "API Key",
55
+ severity: "high",
56
+ pattern: /\b(?:sk-[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z\-_]{35}|ghp_[A-Za-z0-9]{36}|xox[baprs]-[A-Za-z0-9-]{10,})\b/g
57
+ },
58
+ jwt: {
59
+ label: "JWT",
60
+ severity: "high",
61
+ pattern: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g
62
+ }
63
+ }, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set();
64
+ let G = 0, He = 0, ve = 0, M = null, g = null, L = null, D = null, _ = null, R = null, N = null;
65
+ function b(e) {
66
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
67
+ }
68
+ function Be(e) {
69
+ return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
70
+ }
71
+ function Y(e) {
72
+ const t = e.flags.includes("g") ? e.flags : `${e.flags}g`;
73
+ return new RegExp(e.source, t);
74
+ }
75
+ function be(e) {
76
+ return new RegExp(e.source, e.flags);
77
+ }
78
+ function X(e, t, n) {
79
+ return Math.max(t, Math.min(n, e));
80
+ }
81
+ function Ke(e, t) {
82
+ return e === "high" || e === "medium" || e === "low" ? e : t;
83
+ }
84
+ function qe(e) {
85
+ const t = (e || "*").slice(0, 1) || "*";
86
+ return /[A-Za-z0-9._%+\-\s]/.test(t) ? "*" : t;
87
+ }
88
+ function $e(e) {
89
+ let t = 2166136261;
90
+ for (let n = 0; n < e.length; n += 1)
91
+ t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
92
+ return t >>> 0;
93
+ }
94
+ function We(e) {
95
+ const t = e.replace(/\D/g, "");
96
+ if (t.length < 13 || t.length > 19)
97
+ return !1;
98
+ let n = 0, r = !1;
99
+ for (let o = t.length - 1; o >= 0; o -= 1) {
100
+ let i = Number(t[o]);
101
+ r && (i *= 2, i > 9 && (i -= 9)), n += i, r = !r;
102
+ }
103
+ return n % 10 === 0;
104
+ }
105
+ function je(e, t) {
106
+ const n = Fe[e];
107
+ if (typeof t == "boolean")
108
+ return {
109
+ type: e,
110
+ label: n.label,
111
+ severity: n.severity,
112
+ enabled: t,
113
+ pattern: Y(n.pattern),
114
+ validator: n.validator
115
+ };
116
+ if (!t)
117
+ return {
118
+ type: e,
119
+ label: n.label,
120
+ severity: n.severity,
121
+ enabled: !0,
122
+ pattern: Y(n.pattern),
123
+ validator: n.validator
124
+ };
125
+ const r = t.pattern instanceof RegExp ? Y(t.pattern) : Y(n.pattern);
126
+ return {
127
+ type: e,
128
+ label: n.label,
129
+ severity: Ke(t.severity, n.severity),
130
+ enabled: t.enabled !== !1,
131
+ pattern: r,
132
+ validator: n.validator
133
+ };
134
+ }
135
+ function ee(e = {}) {
136
+ const t = Oe.map((r) => {
137
+ var o;
138
+ return je(r, (o = e.detectors) == null ? void 0 : o[r]);
139
+ }), n = t.map((r) => `${r.type}:${r.enabled ? "1" : "0"}:${r.severity}:${r.pattern.source}:${r.pattern.flags}`).join("|");
140
+ return {
141
+ enableRealtime: e.enableRealtime !== !1,
142
+ debounceMs: X(Number(e.debounceMs ?? 220), 60, 3e3),
143
+ maxFindings: X(Number(e.maxFindings ?? 140), 1, 500),
144
+ maskChar: qe(e.maskChar),
145
+ revealStart: X(Number(e.revealStart ?? 2), 0, 12),
146
+ revealEnd: X(Number(e.revealEnd ?? 2), 0, 12),
147
+ redactionMode: e.redactionMode === "mask" ? "mask" : "token",
148
+ redactionToken: (e.redactionToken || "REDACTED").trim() || "REDACTED",
149
+ skipInCodeBlocks: e.skipInCodeBlocks !== !1,
150
+ labels: {
151
+ ...ze,
152
+ ...e.labels || {}
153
+ },
154
+ normalizeText: e.normalizeText || Be,
155
+ detectors: t,
156
+ detectorSignature: n
157
+ };
158
+ }
159
+ function ce(e) {
160
+ const t = {};
161
+ return e.detectors.forEach((n) => {
162
+ t[n.type] = {
163
+ enabled: n.enabled,
164
+ severity: n.severity,
165
+ pattern: n.pattern
166
+ };
167
+ }), {
168
+ enableRealtime: e.enableRealtime,
169
+ debounceMs: e.debounceMs,
170
+ maxFindings: e.maxFindings,
171
+ maskChar: e.maskChar,
172
+ revealStart: e.revealStart,
173
+ revealEnd: e.revealEnd,
174
+ redactionMode: e.redactionMode,
175
+ redactionToken: e.redactionToken,
176
+ skipInCodeBlocks: e.skipInCodeBlocks,
177
+ labels: { ...e.labels },
178
+ normalizeText: e.normalizeText,
179
+ detectors: t
180
+ };
181
+ }
182
+ function ge(e) {
183
+ return e.closest(ae) || e;
184
+ }
185
+ function Ze(e) {
186
+ const t = e.closest("[data-editora-editor]");
187
+ if (t && z(t) === e)
188
+ return t;
189
+ let n = e;
190
+ for (; n; ) {
191
+ if (n.matches(ae) && (n === e || z(n) === e))
192
+ return n;
193
+ n = n.parentElement;
194
+ }
195
+ return ge(e);
196
+ }
197
+ function z(e) {
198
+ if (!e)
199
+ return null;
200
+ if (e.matches(x))
201
+ return e;
202
+ const t = e.querySelector(x);
203
+ return t instanceof HTMLElement ? t : null;
204
+ }
205
+ function Ve() {
206
+ if (typeof window > "u")
207
+ return null;
208
+ const e = window[we];
209
+ if (!(e instanceof HTMLElement))
210
+ return null;
211
+ window[we] = null;
212
+ const t = z(e);
213
+ if (t)
214
+ return t;
215
+ const n = e.closest(ae);
216
+ if (n) {
217
+ const o = z(n);
218
+ if (o)
219
+ return o;
220
+ }
221
+ const r = e.closest(x);
222
+ return r instanceof HTMLElement ? r : null;
223
+ }
224
+ function J(e) {
225
+ 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;
226
+ }
227
+ function Ue(e) {
228
+ const t = ge(e);
229
+ if (J(t))
230
+ return !0;
231
+ const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
232
+ return J(n) ? !0 : J(document.documentElement) || J(document.body);
233
+ }
234
+ function ne(e, t) {
235
+ e.classList.remove("rte-pii-redaction-theme-dark"), Ue(t) && e.classList.add("rte-pii-redaction-theme-dark");
236
+ }
237
+ function re(e) {
238
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
239
+ }
240
+ function me(e) {
241
+ const t = te.get(e);
242
+ typeof t == "number" && (window.clearTimeout(t), j.delete(t), te.delete(e));
243
+ }
244
+ function U(e) {
245
+ return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
246
+ }
247
+ function le(e = 0) {
248
+ return {
249
+ total: 0,
250
+ high: 0,
251
+ medium: 0,
252
+ low: 0,
253
+ redactedCount: e,
254
+ byType: {
255
+ email: 0,
256
+ phone: 0,
257
+ ssn: 0,
258
+ "credit-card": 0,
259
+ ipv4: 0,
260
+ "api-key": 0,
261
+ jwt: 0
262
+ }
263
+ };
264
+ }
265
+ function q() {
266
+ Array.from(W).forEach((t) => {
267
+ t.isConnected || Te(t);
268
+ });
269
+ }
270
+ function Ge(e) {
271
+ var t, n, r, o;
272
+ for (let i = 0; i < e.length; i += 1) {
273
+ const a = e[i];
274
+ if (!(a.type !== "childList" || a.removedNodes.length === 0))
275
+ for (let l = 0; l < a.removedNodes.length; l += 1) {
276
+ const c = a.removedNodes[l];
277
+ if (c.nodeType !== Node.ELEMENT_NODE)
278
+ continue;
279
+ const s = c;
280
+ if ((t = s.matches) != null && t.call(s, x) || (n = s.matches) != null && n.call(s, `.${u}`) || (r = s.querySelector) != null && r.call(s, x) || (o = s.querySelector) != null && o.call(s, `.${u}`))
281
+ return !0;
282
+ }
283
+ }
284
+ return !1;
285
+ }
286
+ function T(e, t = !0) {
287
+ if (q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
288
+ return e.contentElement;
289
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
290
+ const i = e.editorElement, a = z(i);
291
+ if (a)
292
+ return a;
293
+ }
294
+ const n = Ve();
295
+ if (n)
296
+ return n;
297
+ const r = window.getSelection();
298
+ if (r && r.rangeCount > 0) {
299
+ const i = re(r.getRangeAt(0).startContainer), a = i == null ? void 0 : i.closest(x);
300
+ if (a)
301
+ return a;
302
+ }
303
+ const o = document.activeElement;
304
+ if (o) {
305
+ if (o.matches(x))
306
+ return o;
307
+ const i = o.closest(x);
308
+ if (i)
309
+ return i;
310
+ }
311
+ return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(x) : null);
312
+ }
313
+ function Te(e) {
314
+ var t;
315
+ me(e), (t = m.get(e)) == null || t.remove(), m.delete(e), V.delete(e), f.delete(e), I.delete(e), E.delete(e), S.delete(e), de.delete(e), Q.delete(e), W.delete(e), g === e && (g = null);
316
+ }
317
+ function C(e, t, n) {
318
+ const r = Ze(e);
319
+ Array.from(
320
+ r.querySelectorAll(
321
+ `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
322
+ )
323
+ ).forEach((i) => {
324
+ i.classList.toggle("active", n), i.setAttribute("data-active", n ? "true" : "false"), i.setAttribute("aria-pressed", n ? "true" : "false");
325
+ });
326
+ }
327
+ function w(e, t) {
328
+ f.has(e) || f.set(e, t), I.has(e) || I.set(e, []), E.has(e) || E.set(e, le(0)), S.has(e) || S.set(e, t.enableRealtime), W.add(e);
329
+ }
330
+ function ie(e) {
331
+ return V.get(e) === !0;
332
+ }
333
+ function Ie(e, t, n, r) {
334
+ if (!e)
335
+ return e;
336
+ if (e.length <= n + r)
337
+ return t.repeat(e.length);
338
+ const o = e.slice(0, n), i = r > 0 ? e.slice(e.length - r) : "";
339
+ return `${o}${t.repeat(Math.max(1, e.length - n - r))}${i}`;
340
+ }
341
+ function se(e, t, n) {
342
+ const r = e.replace(/\D/g, "");
343
+ if (r.length === 0)
344
+ return e;
345
+ let o = 0;
346
+ const i = Math.max(0, r.length - n);
347
+ return e.split("").map((a) => /\d/.test(a) ? (o += 1, o <= i ? t : a) : a).join("");
348
+ }
349
+ function Ye(e, t) {
350
+ const n = e.indexOf("@");
351
+ if (n <= 0)
352
+ return e;
353
+ const r = e.slice(0, n), o = e.slice(n + 1);
354
+ return r.length <= 2 ? `${r[0] || ""}${t}[at]${o}` : `${r[0]}${t.repeat(Math.max(1, r.length - 2))}${r[r.length - 1]}[at]${o}`;
355
+ }
356
+ function Xe(e, t) {
357
+ const n = e.split(".");
358
+ return n.length !== 4 ? e : `${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1, n[3].length))}`;
359
+ }
360
+ function Ce(e, t, n) {
361
+ return e && (t === "email" ? Ye(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? se(e, n.maskChar, 4) : t === "ipv4" ? Xe(e, n.maskChar) : t === "api-key" || t === "jwt" ? Ie(e, n.maskChar, 0, 0) : Ie(e, n.maskChar, n.revealStart, n.revealEnd));
362
+ }
363
+ function Re(e, t, n) {
364
+ return n.redactionMode === "mask" ? Ce(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
365
+ }
366
+ function Je(e) {
367
+ return ve += 1, `pii-${e}-${Date.now().toString(36)}-${ve.toString(36)}`;
368
+ }
369
+ function he(e, t) {
370
+ var n;
371
+ return t.skipInCodeBlocks ? !!((n = e.parentElement) != null && n.closest("code, pre, kbd, samp")) : !1;
372
+ }
373
+ function Qe(e, t) {
374
+ return t.some((n) => e.start < n.end && n.start < e.end);
375
+ }
376
+ function et(e, t, n) {
377
+ const r = [];
378
+ t.filter((a) => a.enabled).forEach((a) => {
379
+ const l = be(a.pattern);
380
+ let c = l.exec(e);
381
+ for (; c && r.length < n * 5; ) {
382
+ const s = c[0] || "", d = c.index, p = d + s.length;
383
+ s && p > d && (!a.validator || a.validator(s)) && r.push({
384
+ type: a.type,
385
+ severity: a.severity,
386
+ value: s,
387
+ start: d,
388
+ end: p
389
+ }), l.lastIndex === c.index && (l.lastIndex += 1), c = l.exec(e);
390
+ }
391
+ }), r.sort((a, l) => a.start !== l.start ? a.start - l.start : l.end - a.end);
392
+ const i = [];
393
+ for (let a = 0; a < r.length && !(i.length >= n); a += 1) {
394
+ const l = r[a];
395
+ Qe({ start: l.start, end: l.end }, i) || i.push(l);
396
+ }
397
+ return i;
398
+ }
399
+ function ue(e, t = 120) {
400
+ return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
401
+ }
402
+ function tt(e, t, n) {
403
+ const r = Math.max(0, t - 28), o = Math.min(e.length, n + 28);
404
+ return ue(e.slice(r, o).trim(), 180);
405
+ }
406
+ function nt(e, t) {
407
+ const n = le(t);
408
+ return n.total = e.length, e.forEach((r) => {
409
+ n.byType[r.type] += 1, r.severity === "high" ? n.high += 1 : r.severity === "medium" ? n.medium += 1 : n.low += 1;
410
+ }), n;
411
+ }
412
+ function oe(e, t) {
413
+ const n = e.querySelector(".rte-pii-redaction-live");
414
+ n && (n.textContent = t);
415
+ }
416
+ function F(e, t, n) {
417
+ const r = t.querySelector('[data-action="toggle-realtime"]');
418
+ if (!r)
419
+ return;
420
+ const o = H(e, n);
421
+ r.textContent = o ? n.labels.realtimeOnText : n.labels.realtimeOffText, r.setAttribute("aria-pressed", o ? "true" : "false"), C(e, "togglePIIRealtime", o);
422
+ }
423
+ function rt(e, t) {
424
+ e.setAttribute("aria-label", t.labels.panelAriaLabel);
425
+ const n = e.querySelector(".rte-pii-redaction-title");
426
+ n && (n.textContent = t.labels.panelTitle);
427
+ const r = e.querySelector('[data-action="close"]');
428
+ r && r.setAttribute("aria-label", t.labels.closeText);
429
+ const o = e.querySelector('[data-action="run-scan"]');
430
+ o && (o.textContent = t.labels.scanText);
431
+ const i = e.querySelector('[data-action="redact-all"]');
432
+ i && (i.textContent = t.labels.redactAllText);
433
+ const a = e.querySelector(".rte-pii-redaction-shortcut");
434
+ a && (a.textContent = t.labels.shortcutText);
435
+ }
436
+ function B(e) {
437
+ const t = m.get(e);
438
+ if (!t)
439
+ return;
440
+ const n = f.get(e) || M;
441
+ if (!n)
442
+ return;
443
+ const r = I.get(e) || [], o = E.get(e) || le(0), i = U(e), a = t.querySelector(".rte-pii-redaction-count"), l = t.querySelector(".rte-pii-redaction-summary"), c = t.querySelector(".rte-pii-redaction-list"), s = t.querySelector('[data-action="redact-all"]');
444
+ if (!(!a || !l || !c || !s)) {
445
+ if (a.textContent = String(o.total), l.textContent = `${n.labels.summaryPrefix}: ${o.total} | High ${o.high} | Medium ${o.medium} | Low ${o.low} | Redacted ${o.redactedCount}`, s.disabled = i || r.length === 0, i ? oe(t, n.labels.readonlyRedactionText) : oe(t, `${o.total} PII findings detected.`), F(e, t, n), r.length === 0) {
446
+ c.innerHTML = `<li class="rte-pii-redaction-empty">${b(n.labels.noFindingsText)}</li>`;
447
+ return;
448
+ }
449
+ c.innerHTML = r.map((d) => {
450
+ const p = d.type.toUpperCase(), A = d.suggestion || "Redact this finding before export/share.", P = `${n.labels.locateText}: ${d.match}`, K = `${n.labels.redactText}: ${d.match}`, y = i ? 'disabled aria-disabled="true"' : "";
451
+ return `
452
+ <li class="rte-pii-redaction-item rte-pii-redaction-item-${d.severity}">
453
+ <button
454
+ type="button"
455
+ class="rte-pii-redaction-item-btn"
456
+ data-action="locate-finding"
457
+ data-finding-id="${b(d.id)}"
458
+ data-role="finding-button"
459
+ aria-label="${b(P)}"
460
+ >
461
+ <span class="rte-pii-redaction-badge">${b(d.severity.toUpperCase())}</span>
462
+ <span class="rte-pii-redaction-type">${b(p)}</span>
463
+ </button>
464
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.matchLabel)}:</strong> ${b(ue(d.match, 80))}</p>
465
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.maskedLabel)}:</strong> ${b(ue(d.masked, 80))}</p>
466
+ ${d.excerpt ? `<p class="rte-pii-redaction-line"><strong>${b(n.labels.excerptLabel)}:</strong> ${b(d.excerpt)}</p>` : ""}
467
+ <p class="rte-pii-redaction-help">${b(A)}</p>
468
+ <div class="rte-pii-redaction-item-actions">
469
+ <button type="button" class="rte-pii-redaction-btn" data-action="redact-finding" data-finding-id="${b(
470
+ d.id
471
+ )}" aria-label="${b(K)}" ${y}>${b(n.labels.redactText)}</button>
472
+ </div>
473
+ </li>
474
+ `;
475
+ }).join("");
476
+ }
477
+ }
478
+ function fe(e, t) {
479
+ if (!t.classList.contains("show"))
480
+ return;
481
+ const r = ge(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 390), i = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, r.right - o), i), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, r.top + 10));
482
+ t.style.width = `${o}px`, t.style.left = `${a}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
483
+ }
484
+ function H(e, t) {
485
+ const n = S.get(e);
486
+ return typeof n == "boolean" ? n : t ? t.enableRealtime : !0;
487
+ }
488
+ function Se(e, t) {
489
+ if (t === e.innerHTML)
490
+ return;
491
+ const n = window.execEditorCommand || window.executeEditorCommand;
492
+ if (typeof n == "function")
493
+ try {
494
+ n("recordDomTransaction", e, t, e.innerHTML);
495
+ } catch {
496
+ }
497
+ }
498
+ function Ae(e) {
499
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
500
+ }
501
+ function Me(e, t) {
502
+ e.dispatchEvent(
503
+ new CustomEvent("editora:pii-redacted", {
504
+ bubbles: !0,
505
+ detail: {
506
+ redactedCount: t
507
+ }
508
+ })
509
+ );
510
+ }
511
+ function Pe(e, t) {
512
+ return (I.get(e) || []).find((r) => r.id === t);
513
+ }
514
+ function it(e) {
515
+ const t = m.get(e);
516
+ if (t)
517
+ return t;
518
+ const n = f.get(e) || M || ee(), r = `rte-pii-redaction-panel-${He++}`, o = document.createElement("section");
519
+ return o.className = u, o.id = r, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.innerHTML = `
520
+ <header class="rte-pii-redaction-header">
521
+ <h2 class="rte-pii-redaction-title">${b(n.labels.panelTitle)}</h2>
522
+ <button type="button" class="rte-pii-redaction-icon-btn" data-action="close" aria-label="${b(
523
+ n.labels.closeText
524
+ )}">✕</button>
525
+ </header>
526
+ <div class="rte-pii-redaction-body">
527
+ <div class="rte-pii-redaction-topline">
528
+ <p class="rte-pii-redaction-summary" aria-live="polite"></p>
529
+ <span class="rte-pii-redaction-count" aria-hidden="true">0</span>
530
+ </div>
531
+ <div class="rte-pii-redaction-controls" role="toolbar" aria-label="PII redaction controls">
532
+ <button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${b(
533
+ n.labels.scanText
534
+ )}</button>
535
+ <button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${b(
536
+ n.labels.redactAllText
537
+ )}</button>
538
+ <button type="button" class="rte-pii-redaction-btn" data-action="toggle-realtime" aria-pressed="false"></button>
539
+ </div>
540
+ <ul class="rte-pii-redaction-list" role="list" aria-label="Detected PII findings"></ul>
541
+ <p class="rte-pii-redaction-shortcut">${b(n.labels.shortcutText)}</p>
542
+ <span class="rte-pii-redaction-live" aria-live="polite"></span>
543
+ </div>
544
+ `, o.addEventListener("click", (i) => {
545
+ const a = i.target, l = a == null ? void 0 : a.closest("[data-action]");
546
+ if (!l)
547
+ return;
548
+ const c = l.getAttribute("data-action") || "", s = f.get(e) || M || n;
549
+ if (f.set(e, s), w(e, s), c === "close") {
550
+ Z(e, !0);
551
+ return;
552
+ }
553
+ if (c === "run-scan") {
554
+ h(e, s, !0);
555
+ return;
556
+ }
557
+ if (c === "toggle-realtime") {
558
+ const d = !H(e, s);
559
+ S.set(e, d), F(e, o, s), d && h(e, s, !0);
560
+ return;
561
+ }
562
+ if (c === "redact-all") {
563
+ xe(e, s);
564
+ return;
565
+ }
566
+ if (c === "locate-finding") {
567
+ const d = l.getAttribute("data-finding-id") || "", p = Pe(e, d);
568
+ if (!p)
569
+ return;
570
+ lt(e, p, s);
571
+ return;
572
+ }
573
+ if (c === "redact-finding") {
574
+ const d = l.getAttribute("data-finding-id") || "";
575
+ _e(e, d, s);
576
+ }
577
+ }), o.addEventListener("keydown", (i) => {
578
+ if (i.key === "Escape") {
579
+ i.preventDefault(), Z(e, !0);
580
+ return;
581
+ }
582
+ if (i.key !== "ArrowDown" && i.key !== "ArrowUp")
583
+ return;
584
+ const a = Array.from(o.querySelectorAll('[data-role="finding-button"]'));
585
+ if (a.length === 0)
586
+ return;
587
+ const l = document.activeElement, c = a.findIndex((p) => p === l);
588
+ if (c === -1)
589
+ return;
590
+ i.preventDefault();
591
+ const s = i.key === "ArrowDown" ? 1 : -1, d = (c + s + a.length) % a.length;
592
+ a[d].focus();
593
+ }), ne(o, e), document.body.appendChild(o), m.set(e, o), V.set(e, !1), B(e), o;
594
+ }
595
+ function Z(e, t = !1) {
596
+ const n = m.get(e);
597
+ n && (n.classList.remove("show"), V.set(e, !1), C(e, "togglePIIRedactionPanel", !1), t && e.focus({ preventScroll: !0 }));
598
+ }
599
+ function O(e) {
600
+ q();
601
+ const t = it(e);
602
+ m.forEach((r, o) => {
603
+ o !== e && Z(o, !1);
604
+ }), t.classList.add("show"), V.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), fe(e, t), B(e);
605
+ const n = t.querySelector('[data-action="run-scan"]');
606
+ n == null || n.focus();
607
+ }
608
+ function Le(e, t) {
609
+ const n = ie(e);
610
+ return (typeof t == "boolean" ? t : !n) ? O(e) : Z(e), !0;
611
+ }
612
+ function ot(e, t) {
613
+ const n = t.normalizeText(e.innerText || e.textContent || ""), r = e.innerHTML;
614
+ return `${n.length}:${$e(n)}:${r.length}:${$e(r)}:${t.detectorSignature}`;
615
+ }
616
+ function at(e, t) {
617
+ const n = [], r = be(e.pattern);
618
+ let o = r.exec(t);
619
+ for (; o; ) {
620
+ const i = o[0] || "", a = o.index, l = a + i.length;
621
+ i && l > a && (!e.validator || e.validator(i)) && n.push({ value: i, start: a, end: l }), r.lastIndex === o.index && (r.lastIndex += 1), o = r.exec(t);
622
+ }
623
+ return n;
624
+ }
625
+ function De(e, t, n) {
626
+ const r = n.detectors.find((c) => c.type === t.type && c.enabled);
627
+ if (!r)
628
+ return null;
629
+ const o = t.match.toLowerCase();
630
+ let i = 0;
631
+ const a = document.createTreeWalker(e, pe, null);
632
+ let l = a.nextNode();
633
+ for (; l; ) {
634
+ if (!he(l, n)) {
635
+ const c = at(r, l.data);
636
+ for (let s = 0; s < c.length; s += 1) {
637
+ const d = c[s];
638
+ if (d.value.toLowerCase() === o && (i += 1, i === t.occurrence)) {
639
+ const p = document.createRange();
640
+ return p.setStart(l, d.start), p.setEnd(l, d.end), p;
641
+ }
642
+ }
643
+ }
644
+ l = a.nextNode();
645
+ }
646
+ return null;
647
+ }
648
+ function lt(e, t, n) {
649
+ const r = De(e, t, n);
650
+ if (!r)
651
+ return !1;
652
+ const o = window.getSelection();
653
+ if (!o)
654
+ return !1;
655
+ o.removeAllRanges(), o.addRange(r);
656
+ const i = re(r.startContainer);
657
+ return i == null || i.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 }), !0;
658
+ }
659
+ async function h(e, t, n = !1) {
660
+ var p;
661
+ w(e, t);
662
+ const r = ot(e, t);
663
+ if (!n && de.get(e) === r)
664
+ return I.get(e) || [];
665
+ const o = (Q.get(e) || 0) + 1;
666
+ Q.set(e, o);
667
+ const i = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, pe, null);
668
+ let c = l.nextNode();
669
+ for (; c && i.length < t.maxFindings; ) {
670
+ const A = c.data || "";
671
+ if (A.trim() && !he(c, t)) {
672
+ const P = et(A, t.detectors, t.maxFindings - i.length);
673
+ for (let K = 0; K < P.length && !(i.length >= t.maxFindings); K += 1) {
674
+ const y = P[K], ye = `${y.type}:${y.value.toLowerCase()}`, ke = (a.get(ye) || 0) + 1;
675
+ a.set(ye, ke), i.push({
676
+ id: Je(y.type),
677
+ type: y.type,
678
+ severity: y.severity,
679
+ match: y.value,
680
+ masked: Ce(y.value, y.type, t),
681
+ occurrence: ke,
682
+ excerpt: tt(A, y.start, y.end),
683
+ suggestion: "Review and redact this value before external sharing."
684
+ });
685
+ }
686
+ }
687
+ c = l.nextNode();
688
+ }
689
+ if (Q.get(e) !== o)
690
+ return I.get(e) || [];
691
+ const s = ((p = E.get(e)) == null ? void 0 : p.redactedCount) || 0, d = nt(i, s);
692
+ return de.set(e, r), I.set(e, i), E.set(e, d), B(e), e.dispatchEvent(
693
+ new CustomEvent("editora:pii-scan", {
694
+ bubbles: !0,
695
+ detail: {
696
+ findings: i,
697
+ stats: d
698
+ }
699
+ })
700
+ ), i;
701
+ }
702
+ function ct(e, t) {
703
+ let n = e, r = 0;
704
+ return t.detectors.filter((i) => i.enabled).forEach((i) => {
705
+ const a = be(i.pattern);
706
+ n = n.replace(a, (l) => i.validator && !i.validator(l) ? l : (r += 1, Re(l, i.type, t)));
707
+ }), { nextValue: n, count: r };
708
+ }
709
+ async function _e(e, t, n) {
710
+ var s;
711
+ if (U(e)) {
712
+ const d = m.get(e);
713
+ return d && oe(d, n.labels.readonlyRedactionText), !1;
714
+ }
715
+ const r = Pe(e, t);
716
+ if (!r)
717
+ return !1;
718
+ const o = De(e, r, n);
719
+ if (!o)
720
+ return !1;
721
+ const i = e.innerHTML, a = Re(r.match, r.type, n);
722
+ if (o.startContainer === o.endContainer && o.startContainer.nodeType === Node.TEXT_NODE) {
723
+ const d = o.startContainer, p = d.data, A = o.startOffset, P = o.endOffset;
724
+ d.data = `${p.slice(0, A)}${a}${p.slice(P)}`;
725
+ } else
726
+ o.deleteContents(), o.insertNode(document.createTextNode(a));
727
+ Ae(e), Se(e, i);
728
+ const l = ((s = E.get(e)) == null ? void 0 : s.redactedCount) || 0;
729
+ await h(e, n, !0);
730
+ const c = E.get(e);
731
+ return c && (c.redactedCount = l + 1, B(e)), Me(e, 1), !0;
732
+ }
733
+ async function xe(e, t) {
734
+ var s;
735
+ if (U(e)) {
736
+ const d = m.get(e);
737
+ return d && oe(d, t.labels.readonlyRedactionText), 0;
738
+ }
739
+ (I.get(e) || []).length === 0 && await h(e, t, !0);
740
+ const r = e.innerHTML;
741
+ let o = 0;
742
+ const i = document.createTreeWalker(e, pe, null);
743
+ let a = i.nextNode();
744
+ for (; a; ) {
745
+ if (he(a, t)) {
746
+ a = i.nextNode();
747
+ continue;
748
+ }
749
+ const d = a.data || "";
750
+ if (!d) {
751
+ a = i.nextNode();
752
+ continue;
753
+ }
754
+ const p = ct(d, t);
755
+ p.count > 0 && p.nextValue !== d && (a.data = p.nextValue, o += p.count), a = i.nextNode();
756
+ }
757
+ if (o === 0)
758
+ return 0;
759
+ Ae(e), Se(e, r);
760
+ const l = ((s = E.get(e)) == null ? void 0 : s.redactedCount) || 0;
761
+ await h(e, t, !0);
762
+ const c = E.get(e);
763
+ return c && (c.redactedCount = l + o, B(e)), Me(e, o), o;
764
+ }
765
+ function Ne(e) {
766
+ const t = f.get(e) || M;
767
+ if (!t || !H(e, t) || U(e))
768
+ return;
769
+ me(e);
770
+ const n = window.setTimeout(() => {
771
+ j.delete(n), te.delete(e), h(e, t, !1);
772
+ }, t.debounceMs);
773
+ j.add(n), te.set(e, n);
774
+ }
775
+ function st(e) {
776
+ const t = e.key.toLowerCase();
777
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
778
+ }
779
+ function dt(e) {
780
+ const t = e.key.toLowerCase();
781
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
782
+ }
783
+ function ut(e) {
784
+ const t = e.key.toLowerCase();
785
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
786
+ }
787
+ function ft(e) {
788
+ const t = e.key.toLowerCase();
789
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
790
+ }
791
+ function pt(e) {
792
+ var r;
793
+ const t = re(e.target);
794
+ if (t) {
795
+ const o = t.closest(x);
796
+ if (o)
797
+ return o;
798
+ const i = t.closest(ae);
799
+ if (i) {
800
+ const l = z(i);
801
+ if (l)
802
+ return l;
803
+ }
804
+ const a = t.closest(`.${u}`);
805
+ if (a) {
806
+ const l = Array.from(m.entries()).find(([, c]) => c === a);
807
+ if (l)
808
+ return l[0];
809
+ }
810
+ }
811
+ const n = window.getSelection();
812
+ if (n && n.rangeCount > 0) {
813
+ const o = (r = re(n.getRangeAt(0).startContainer)) == null ? void 0 : r.closest(
814
+ x
815
+ );
816
+ if (o)
817
+ return o;
818
+ }
819
+ return null;
820
+ }
821
+ function bt() {
822
+ if (typeof document > "u" || document.getElementById(Ee))
823
+ return;
824
+ const e = document.createElement("style");
825
+ e.id = Ee, e.textContent = `
826
+ .rte-toolbar-group-items.${k},
827
+ .editora-toolbar-group-items.${k},
828
+ .rte-toolbar-group-items.${v},
829
+ .editora-toolbar-group-items.${v} {
830
+ display: flex;
831
+ border: 1px solid #ccc;
832
+ border-radius: 3px;
833
+ background: #fff;
834
+ }
835
+
836
+ .rte-toolbar-group-items.${k} .rte-toolbar-button,
837
+ .editora-toolbar-group-items.${k} .editora-toolbar-button,
838
+ .rte-toolbar-group-items.${v} .rte-toolbar-button,
839
+ .editora-toolbar-group-items.${v} .editora-toolbar-button {
840
+ border: none;
841
+ border-radius: 0;
842
+ border-right: 1px solid #ccc;
843
+ }
844
+
845
+ .rte-toolbar-group-items.${k} .rte-toolbar-item:last-child .rte-toolbar-button,
846
+ .editora-toolbar-group-items.${k} .editora-toolbar-item:last-child .editora-toolbar-button,
847
+ .rte-toolbar-group-items.${v} .rte-toolbar-item:last-child .rte-toolbar-button,
848
+ .editora-toolbar-group-items.${v} .editora-toolbar-item:last-child .editora-toolbar-button {
849
+ border-right: none;
850
+ }
851
+
852
+ .rte-toolbar-button[data-command="togglePIIRealtime"].active,
853
+ .editora-toolbar-button[data-command="togglePIIRealtime"].active {
854
+ background-color: #ccc;
855
+ }
856
+
857
+ ${$} .rte-toolbar-group-items.${k},
858
+ ${$} .editora-toolbar-group-items.${k},
859
+ ${$} .rte-toolbar-group-items.${v},
860
+ ${$} .editora-toolbar-group-items.${v},
861
+ .${u}.rte-pii-redaction-theme-dark {
862
+ border-color: #566275;
863
+ }
864
+ ${$} .rte-toolbar-group-items.${k} .rte-toolbar-button svg,
865
+ ${$} .editora-toolbar-group-items.${k} .editora-toolbar-button svg,
866
+ ${$} .rte-toolbar-group-items.${v} .rte-toolbar-button svg,
867
+ ${$} .editora-toolbar-group-items.${v} .editora-toolbar-button svg
868
+ {
869
+ fill: none;
870
+ }
871
+ ${$} .rte-toolbar-group-items.${k} .rte-toolbar-button,
872
+ ${$} .editora-toolbar-group-items.${k} .editora-toolbar-button
873
+ {
874
+ border-color: #566275;
875
+ }
876
+ .${u} {
877
+ position: fixed;
878
+ z-index: 12000;
879
+ display: none;
880
+ width: min(390px, calc(100vw - 20px));
881
+ max-height: calc(100vh - 20px);
882
+ border: 1px solid #d1d5db;
883
+ border-radius: 14px;
884
+ background: #ffffff;
885
+ color: #111827;
886
+ box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
887
+ overflow: hidden;
888
+ }
889
+
890
+ .${u}.show {
891
+ display: flex;
892
+ flex-direction: column;
893
+ }
894
+
895
+ .${u}.rte-pii-redaction-theme-dark {
896
+ border-color: #334155;
897
+ background: #0f172a;
898
+ color: #e2e8f0;
899
+ box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
900
+ }
901
+
902
+ .rte-pii-redaction-header {
903
+ display: flex;
904
+ align-items: center;
905
+ justify-content: space-between;
906
+ gap: 8px;
907
+ padding: 12px 14px;
908
+ border-bottom: 1px solid #e5e7eb;
909
+ background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
910
+ }
911
+
912
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-header {
913
+ border-color: #1e293b;
914
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
915
+ }
916
+
917
+ .rte-pii-redaction-title {
918
+ margin: 0;
919
+ font-size: 15px;
920
+ line-height: 1.2;
921
+ font-weight: 700;
922
+ }
923
+
924
+ .rte-pii-redaction-icon-btn {
925
+ width: 34px;
926
+ height: 34px;
927
+ border: 1px solid #cbd5e1;
928
+ border-radius: 6px;
929
+ background: #ffffff;
930
+ color: #0f172a;
931
+ font-size: 16px;
932
+ line-height: 1;
933
+ font-weight: 600;
934
+ padding: 0;
935
+ display: inline-flex;
936
+ align-items: center;
937
+ justify-content: center;
938
+ cursor: pointer;
939
+ }
940
+
941
+ .rte-pii-redaction-icon-btn:hover,
942
+ .rte-pii-redaction-icon-btn:focus-visible {
943
+ outline: none;
944
+ border-color: #3b82f6;
945
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
946
+ }
947
+
948
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn {
949
+ background: #0f172a;
950
+ border-color: #475569;
951
+ color: #e2e8f0;
952
+ }
953
+
954
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn:hover,
955
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn:focus-visible {
956
+ border-color: #60a5fa;
957
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
958
+ }
959
+
960
+ .rte-pii-redaction-body {
961
+ display: flex;
962
+ flex-direction: column;
963
+ gap: 10px;
964
+ padding: 12px;
965
+ overflow: auto;
966
+ }
967
+
968
+ .rte-pii-redaction-topline {
969
+ display: flex;
970
+ align-items: center;
971
+ justify-content: space-between;
972
+ gap: 8px;
973
+ }
974
+
975
+ .rte-pii-redaction-summary {
976
+ margin: 0;
977
+ font-size: 12px;
978
+ line-height: 1.35;
979
+ color: #475569;
980
+ flex: 1;
981
+ }
982
+
983
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-summary {
984
+ color: #94a3b8;
985
+ }
986
+
987
+ .rte-pii-redaction-count {
988
+ min-width: 32px;
989
+ height: 32px;
990
+ border-radius: 999px;
991
+ display: inline-flex;
992
+ align-items: center;
993
+ justify-content: center;
994
+ font-weight: 700;
995
+ font-size: 13px;
996
+ border: 1px solid #cbd5e1;
997
+ background: #f8fafc;
998
+ }
999
+
1000
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-count {
1001
+ border-color: #334155;
1002
+ background: #111827;
1003
+ color: #cbd5e1;
1004
+ }
1005
+
1006
+ .rte-pii-redaction-controls {
1007
+ display: flex;
1008
+ gap: 8px;
1009
+ flex-wrap: wrap;
1010
+ }
1011
+
1012
+ .rte-pii-redaction-btn {
1013
+ border: 1px solid #cbd5e1;
1014
+ border-radius: 8px;
1015
+ height: 34px;
1016
+ padding: 0 10px;
1017
+ background: #ffffff;
1018
+ color: inherit;
1019
+ font-size: 12px;
1020
+ font-weight: 600;
1021
+ cursor: pointer;
1022
+ }
1023
+
1024
+ .rte-pii-redaction-btn:hover,
1025
+ .rte-pii-redaction-btn:focus-visible {
1026
+ border-color: #94a3b8;
1027
+ background: #f8fafc;
1028
+ outline: none;
1029
+ }
1030
+
1031
+ .rte-pii-redaction-btn:disabled {
1032
+ opacity: 0.56;
1033
+ cursor: not-allowed;
1034
+ }
1035
+
1036
+ .rte-pii-redaction-btn-primary {
1037
+ border-color: #0284c7;
1038
+ background: #0ea5e9;
1039
+ color: #f8fafc;
1040
+ }
1041
+
1042
+ .rte-pii-redaction-btn-primary:hover,
1043
+ .rte-pii-redaction-btn-primary:focus-visible {
1044
+ border-color: #0369a1;
1045
+ background: #0284c7;
1046
+ color: #ffffff;
1047
+ }
1048
+
1049
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn {
1050
+ border-color: #334155;
1051
+ background: #111827;
1052
+ color: #e2e8f0;
1053
+ }
1054
+
1055
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn:hover,
1056
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn:focus-visible {
1057
+ border-color: #475569;
1058
+ background: #1e293b;
1059
+ }
1060
+
1061
+ .rte-pii-redaction-list {
1062
+ list-style: none;
1063
+ margin: 0;
1064
+ padding: 0;
1065
+ display: flex;
1066
+ flex-direction: column;
1067
+ gap: 8px;
1068
+ max-height: min(55vh, 420px);
1069
+ overflow: auto;
1070
+ }
1071
+
1072
+ .rte-pii-redaction-item {
1073
+ border: 1px solid #e2e8f0;
1074
+ border-radius: 10px;
1075
+ padding: 8px;
1076
+ background: #ffffff;
1077
+ display: grid;
1078
+ gap: 6px;
1079
+ }
1080
+
1081
+ .rte-pii-redaction-item-high {
1082
+ border-color: #fca5a5;
1083
+ background: #fef2f2;
1084
+ }
1085
+
1086
+ .rte-pii-redaction-item-medium {
1087
+ border-color: #fcd34d;
1088
+ background: #fffbeb;
1089
+ }
1090
+
1091
+ .rte-pii-redaction-item-low {
1092
+ border-color: #93c5fd;
1093
+ background: #eff6ff;
1094
+ }
1095
+
1096
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item {
1097
+ border-color: #334155;
1098
+ background: #0b1220;
1099
+ }
1100
+
1101
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-high {
1102
+ border-color: #7f1d1d;
1103
+ background: #2b0b11;
1104
+ }
1105
+
1106
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-medium {
1107
+ border-color: #78350f;
1108
+ background: #2b1907;
1109
+ }
1110
+
1111
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-low {
1112
+ border-color: #1d4ed8;
1113
+ background: #0a162f;
1114
+ }
1115
+
1116
+ .rte-pii-redaction-item-btn {
1117
+ border: none;
1118
+ background: transparent;
1119
+ width: 100%;
1120
+ display: flex;
1121
+ align-items: center;
1122
+ gap: 8px;
1123
+ text-align: left;
1124
+ padding: 0;
1125
+ color: inherit;
1126
+ cursor: pointer;
1127
+ }
1128
+
1129
+ .rte-pii-redaction-item-btn:focus-visible {
1130
+ outline: 2px solid #0284c7;
1131
+ outline-offset: 3px;
1132
+ border-radius: 6px;
1133
+ }
1134
+
1135
+ .rte-pii-redaction-badge {
1136
+ border-radius: 999px;
1137
+ border: 1px solid currentColor;
1138
+ padding: 1px 8px;
1139
+ font-size: 10px;
1140
+ font-weight: 700;
1141
+ line-height: 1.3;
1142
+ text-transform: uppercase;
1143
+ opacity: 0.86;
1144
+ }
1145
+
1146
+ .rte-pii-redaction-type {
1147
+ font-size: 12px;
1148
+ font-weight: 700;
1149
+ letter-spacing: 0.03em;
1150
+ }
1151
+
1152
+ .rte-pii-redaction-line,
1153
+ .rte-pii-redaction-help {
1154
+ margin: 0;
1155
+ font-size: 12px;
1156
+ line-height: 1.35;
1157
+ color: #334155;
1158
+ word-break: break-word;
1159
+ }
1160
+
1161
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-line,
1162
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-help {
1163
+ color: #94a3b8;
1164
+ }
1165
+
1166
+ .rte-pii-redaction-item-actions {
1167
+ display: flex;
1168
+ justify-content: flex-end;
1169
+ }
1170
+
1171
+ .rte-pii-redaction-empty {
1172
+ border: 1px dashed #cbd5e1;
1173
+ border-radius: 10px;
1174
+ padding: 10px;
1175
+ font-size: 13px;
1176
+ color: #475569;
1177
+ background: #f8fafc;
1178
+ }
1179
+
1180
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-empty {
1181
+ border-color: #334155;
1182
+ background: #0b1220;
1183
+ color: #94a3b8;
1184
+ }
1185
+
1186
+ .rte-pii-redaction-shortcut {
1187
+ margin: 2px 0 0;
1188
+ font-size: 11px;
1189
+ color: #64748b;
1190
+ }
1191
+
1192
+ .${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-shortcut {
1193
+ color: #94a3b8;
1194
+ }
1195
+
1196
+ .rte-pii-redaction-live {
1197
+ position: absolute;
1198
+ width: 1px;
1199
+ height: 1px;
1200
+ margin: -1px;
1201
+ padding: 0;
1202
+ overflow: hidden;
1203
+ clip: rect(0 0 0 0);
1204
+ border: 0;
1205
+ }
1206
+
1207
+ @media (max-width: 768px) {
1208
+ .${u} {
1209
+ left: 10px !important;
1210
+ right: 10px;
1211
+ top: 10px !important;
1212
+ width: auto !important;
1213
+ max-height: calc(100vh - 20px);
1214
+ }
1215
+
1216
+ .rte-pii-redaction-list {
1217
+ max-height: 45vh;
1218
+ }
1219
+ }
1220
+ `, document.head.appendChild(e);
1221
+ }
1222
+ function gt(e) {
1223
+ M = e, L || (L = (t) => {
1224
+ q();
1225
+ const n = t.target, r = n == null ? void 0 : n.closest(x);
1226
+ if (!r)
1227
+ return;
1228
+ g = r;
1229
+ const o = f.get(r) || e;
1230
+ w(r, o), f.set(r, o), C(r, "togglePIIRedactionPanel", ie(r)), C(r, "togglePIIRealtime", H(r, o));
1231
+ const i = m.get(r);
1232
+ i && (ne(i, r), fe(r, i), F(r, i, o));
1233
+ }, document.addEventListener("focusin", L, !0)), D || (D = (t) => {
1234
+ const n = t.target, r = n == null ? void 0 : n.closest(x);
1235
+ r && (g = r, Ne(r));
1236
+ }, document.addEventListener("input", D, !0)), _ || (_ = (t) => {
1237
+ if (t.defaultPrevented)
1238
+ return;
1239
+ const n = t.target;
1240
+ if (n != null && n.closest(`.${u} input, .${u} textarea, .${u} select`))
1241
+ return;
1242
+ const r = pt(t);
1243
+ if (!r)
1244
+ return;
1245
+ const o = f.get(r) || M || e;
1246
+ if (w(r, o), f.set(r, o), g = r, t.key === "Escape" && ie(r)) {
1247
+ t.preventDefault(), Z(r, !0);
1248
+ return;
1249
+ }
1250
+ if (st(t)) {
1251
+ t.preventDefault(), t.stopPropagation(), Le(r);
1252
+ return;
1253
+ }
1254
+ if (dt(t)) {
1255
+ t.preventDefault(), t.stopPropagation(), h(r, o, !0), O(r);
1256
+ return;
1257
+ }
1258
+ if (ut(t)) {
1259
+ t.preventDefault(), t.stopPropagation(), U(r) || (xe(r, o), O(r));
1260
+ return;
1261
+ }
1262
+ if (ft(t)) {
1263
+ t.preventDefault(), t.stopPropagation();
1264
+ const i = !H(r, o);
1265
+ S.set(r, i);
1266
+ const a = m.get(r);
1267
+ a && F(r, a, o), C(r, "togglePIIRealtime", i), i && h(r, o, !0);
1268
+ }
1269
+ }, document.addEventListener("keydown", _, !0)), R || (R = () => {
1270
+ q(), m.forEach((t, n) => {
1271
+ !n.isConnected || !t.isConnected || (ne(t, n), fe(n, t));
1272
+ });
1273
+ }, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !N && typeof MutationObserver < "u" && document.body && (N = new MutationObserver((t) => {
1274
+ Ge(t) && q();
1275
+ }), N.observe(document.body, {
1276
+ childList: !0,
1277
+ subtree: !0
1278
+ }));
1279
+ }
1280
+ function mt() {
1281
+ L && (document.removeEventListener("focusin", L, !0), L = null), D && (document.removeEventListener("input", D, !0), D = null), _ && (document.removeEventListener("keydown", _, !0), _ = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), N && (N.disconnect(), N = null), m.forEach((e) => e.remove()), m.clear(), W.forEach((e) => me(e)), W.clear(), M = null, g = null;
1282
+ }
1283
+ const ht = (e = {}) => {
1284
+ const t = ee(e), n = /* @__PURE__ */ new Set();
1285
+ return bt(), {
1286
+ name: "piiRedaction",
1287
+ toolbar: [
1288
+ {
1289
+ id: "piiRedactionGroup",
1290
+ label: "PII Redaction",
1291
+ type: "group",
1292
+ command: "piiRedaction",
1293
+ items: [
1294
+ {
1295
+ id: "piiRedaction",
1296
+ label: "PII Redaction",
1297
+ command: "togglePIIRedactionPanel",
1298
+ shortcut: "Mod-Alt-Shift-i",
1299
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3.5 19 6.5v4.8c0 4.4-2.7 8.1-7 9.2-4.3-1.1-7-4.8-7-9.2V6.5l7-3Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M8.8 11.6h6.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12" cy="11.6" r="1.2" fill="currentColor"/></svg>'
1300
+ },
1301
+ {
1302
+ id: "piiScan",
1303
+ label: "Scan PII",
1304
+ command: "runPIIScan",
1305
+ shortcut: "Mod-Alt-Shift-u",
1306
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4.5" y="3.5" width="11" height="15" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M7.5 8.2h5M7.5 11.2h5M7.5 14.2h3.2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="16.8" cy="16.8" r="2.8" stroke="currentColor" stroke-width="1.6"/><path d="m18.8 18.8 2 2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
1307
+ },
1308
+ {
1309
+ id: "piiRedactAll",
1310
+ label: "Redact All PII",
1311
+ command: "redactAllPII",
1312
+ shortcut: "Mod-Alt-Shift-m",
1313
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 18h14" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M7 6h10l-1 8H8L7 6Z" stroke="currentColor" stroke-width="1.7"/><path d="m9 9 6 4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'
1314
+ },
1315
+ {
1316
+ id: "piiRealtime",
1317
+ label: "Toggle Realtime PII Scan",
1318
+ command: "togglePIIRealtime",
1319
+ shortcut: "Mod-Alt-Shift-y",
1320
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3v4M12 17v4M4 12h4M16 12h4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="1.7"/></svg>'
1321
+ }
1322
+ ]
1323
+ }
1324
+ ],
1325
+ commands: {
1326
+ piiRedaction: (r, o) => {
1327
+ const i = T(o);
1328
+ if (!i)
1329
+ return !1;
1330
+ const a = f.get(i) || t;
1331
+ return w(i, a), f.set(i, a), g = i, O(i), h(i, a, !1), !0;
1332
+ },
1333
+ togglePIIRedactionPanel: (r, o) => {
1334
+ const i = T(o);
1335
+ if (!i)
1336
+ return !1;
1337
+ const a = f.get(i) || t;
1338
+ w(i, a), f.set(i, a), g = i;
1339
+ const l = Le(i, typeof r == "boolean" ? r : void 0);
1340
+ return ie(i) && h(i, a, !1), l;
1341
+ },
1342
+ runPIIScan: async (r, o) => {
1343
+ const i = T(o);
1344
+ if (!i)
1345
+ return !1;
1346
+ const a = f.get(i) || t;
1347
+ return w(i, a), f.set(i, a), g = i, await h(i, a, !0), O(i), !0;
1348
+ },
1349
+ redactAllPII: async (r, o) => {
1350
+ const i = T(o);
1351
+ if (!i)
1352
+ return !1;
1353
+ const a = f.get(i) || t;
1354
+ w(i, a), f.set(i, a), g = i;
1355
+ const l = await xe(i, a);
1356
+ return l > 0 && O(i), l > 0;
1357
+ },
1358
+ redactPIIFinding: async (r, o) => {
1359
+ const i = T(o);
1360
+ if (!i || typeof r != "string" || !r)
1361
+ return !1;
1362
+ const a = f.get(i) || t;
1363
+ return w(i, a), f.set(i, a), g = i, _e(i, r, a);
1364
+ },
1365
+ togglePIIRealtime: (r, o) => {
1366
+ const i = T(o);
1367
+ if (!i)
1368
+ return !1;
1369
+ const a = f.get(i) || t;
1370
+ w(i, a), f.set(i, a);
1371
+ const l = typeof r == "boolean" ? r : !H(i, a);
1372
+ S.set(i, l);
1373
+ const c = m.get(i);
1374
+ return c && F(i, c, a), C(i, "togglePIIRealtime", l), l && h(i, a, !0), !0;
1375
+ },
1376
+ getPIIRedactionFindings: (r, o) => {
1377
+ const i = T(o);
1378
+ if (!i)
1379
+ return !1;
1380
+ const a = I.get(i) || [], l = E.get(i) || le(0), c = a.map((d) => ({ ...d })), s = {
1381
+ ...l,
1382
+ byType: { ...l.byType }
1383
+ };
1384
+ if (typeof r == "function")
1385
+ try {
1386
+ r(c, s);
1387
+ } catch {
1388
+ }
1389
+ return i.__piiRedactionFindings = c, i.dispatchEvent(
1390
+ new CustomEvent("editora:pii-findings", {
1391
+ bubbles: !0,
1392
+ detail: { findings: c, stats: s }
1393
+ })
1394
+ ), !0;
1395
+ },
1396
+ setPIIRedactionOptions: (r, o) => {
1397
+ const i = T(o);
1398
+ if (!i || !r || typeof r != "object")
1399
+ return !1;
1400
+ const a = f.get(i) || t, l = ee({
1401
+ ...ce(a),
1402
+ ...r,
1403
+ labels: {
1404
+ ...a.labels,
1405
+ ...r.labels || {}
1406
+ },
1407
+ detectors: {
1408
+ ...ce(a).detectors || {},
1409
+ ...r.detectors || {}
1410
+ },
1411
+ normalizeText: r.normalizeText || a.normalizeText
1412
+ });
1413
+ f.set(i, l), typeof r.enableRealtime == "boolean" && S.set(i, r.enableRealtime);
1414
+ const c = m.get(i);
1415
+ return c && (rt(c, l), B(i), F(i, c, l)), h(i, l, !0), !0;
1416
+ }
1417
+ },
1418
+ keymap: {
1419
+ "Mod-Alt-Shift-i": "togglePIIRedactionPanel",
1420
+ "Mod-Alt-Shift-I": "togglePIIRedactionPanel",
1421
+ "Mod-Alt-Shift-u": "runPIIScan",
1422
+ "Mod-Alt-Shift-U": "runPIIScan",
1423
+ "Mod-Alt-Shift-m": "redactAllPII",
1424
+ "Mod-Alt-Shift-M": "redactAllPII",
1425
+ "Mod-Alt-Shift-y": "togglePIIRealtime",
1426
+ "Mod-Alt-Shift-Y": "togglePIIRealtime"
1427
+ },
1428
+ init: function(o) {
1429
+ G += 1;
1430
+ const i = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1431
+ gt(i);
1432
+ const a = T(
1433
+ o != null && o.editorElement ? { editorElement: o.editorElement } : void 0,
1434
+ !1
1435
+ );
1436
+ a && (g = a, n.add(a), w(a, i), f.set(a, i), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", i.enableRealtime), i.enableRealtime && Ne(a));
1437
+ },
1438
+ destroy: () => {
1439
+ n.forEach((r) => Te(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (j.forEach((r) => {
1440
+ window.clearTimeout(r);
1441
+ }), j.clear(), mt());
1442
+ }
1443
+ };
1444
+ };
1445
+ export {
1446
+ ht as PIIRedactionPlugin
1447
+ };