@editora/core 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +1 -1
  2. package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
  3. package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
  4. package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
  5. package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
  6. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  7. package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
  8. package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  9. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  10. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  11. package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
  12. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  13. package/dist/CodePlugin.native-veDC_kx5.mjs +4600 -0
  14. package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
  15. package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
  16. package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
  17. package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
  18. package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
  19. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  20. package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
  21. package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
  22. package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
  23. package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
  24. package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
  25. package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
  26. package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
  27. package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
  28. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  29. package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
  30. package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
  31. package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  32. package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
  33. package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
  34. package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
  35. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  36. package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
  37. package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
  38. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  39. package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
  40. package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
  41. package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
  42. package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
  43. package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
  44. package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
  45. package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
  46. package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
  47. package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
  48. package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
  49. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  50. package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
  51. package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
  52. package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
  53. package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
  54. package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  55. package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
  56. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  57. package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
  58. package/dist/core.css +1 -0
  59. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  60. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
  61. package/dist/editora.min.js +13 -14
  62. package/dist/editora.umd.js +13 -14
  63. package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
  64. package/dist/index-BslAFzmv.mjs +16544 -0
  65. package/dist/index-CPMGUZfB.js +10 -0
  66. package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
  67. package/dist/index.cjs.js +1 -1
  68. package/dist/index.es-BYD2KEo6.mjs +6666 -0
  69. package/dist/index.esm.js +7 -12
  70. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  71. package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
  72. package/dist/plugin-loader.js +67 -67
  73. package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
  74. package/dist/webcomponent-core.js +131 -168
  75. package/dist/webcomponent-core.min.css +1 -1
  76. package/dist/webcomponent-core.min.js +147 -65
  77. package/dist/webcomponent.cjs.js +1 -1
  78. package/dist/webcomponent.esm.js +1 -1
  79. package/dist/webcomponent.js +191 -228
  80. package/dist/webcomponent.min.css +1 -1
  81. package/dist/webcomponent.min.js +1248 -1346
  82. package/package.json +1 -1
  83. package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
  84. package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
  85. package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
  86. package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
  87. package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
  88. package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
  89. package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
  90. package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
  91. package/dist/MathPlugin.native-735bbac2.mjs +0 -296
  92. package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
  93. package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
  94. package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
  95. package/dist/documentManager-8327fb6e.mjs +0 -9166
  96. package/dist/index-072ef022.js +0 -11
  97. package/dist/index-49d31221.mjs +0 -16860
  98. package/dist/index.es-b47a189f.mjs +0 -5782
  99. package/dist/style.css +0 -1
@@ -1,4 +1,4 @@
1
- const 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 != "undefined" ? NodeFilter.SHOW_TEXT : 4, Oe = [
1
+ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Ee = "__editoraCommandEditorRoot", ve = "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)', be = typeof NodeFilter != "undefined" ? NodeFilter.SHOW_TEXT : 4, ze = [
2
2
  "email",
3
3
  "phone",
4
4
  "ssn",
@@ -6,7 +6,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
6
6
  "ipv4",
7
7
  "api-key",
8
8
  "jwt"
9
- ], ze = {
9
+ ], Fe = {
10
10
  panelTitle: "PII Redaction",
11
11
  panelAriaLabel: "PII redaction panel",
12
12
  scanText: "Scan PII",
@@ -23,7 +23,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
23
23
  matchLabel: "Detected",
24
24
  maskedLabel: "Masked",
25
25
  excerptLabel: "Context"
26
- }, Fe = {
26
+ }, He = {
27
27
  email: {
28
28
  label: "Email",
29
29
  severity: "medium",
@@ -43,7 +43,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
43
43
  label: "Credit Card",
44
44
  severity: "high",
45
45
  pattern: /\b(?:\d[ -]*?){13,19}\b/g,
46
- validator: (e) => We(e)
46
+ validator: (e) => je(e)
47
47
  },
48
48
  ipv4: {
49
49
  label: "IPv4",
@@ -60,41 +60,40 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
60
60
  severity: "high",
61
61
  pattern: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g
62
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;
63
+ }, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ue = /* @__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, Be = 0, $e = 0, M = null, g = null, L = null, D = null, _ = null, R = null, N = null;
65
65
  function b(e) {
66
66
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
67
67
  }
68
- function Be(e) {
68
+ function Ke(e) {
69
69
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
70
70
  }
71
71
  function Y(e) {
72
72
  const t = e.flags.includes("g") ? e.flags : `${e.flags}g`;
73
73
  return new RegExp(e.source, t);
74
74
  }
75
- function be(e) {
75
+ function ge(e) {
76
76
  return new RegExp(e.source, e.flags);
77
77
  }
78
78
  function X(e, t, n) {
79
79
  return Math.max(t, Math.min(n, e));
80
80
  }
81
- function Ke(e, t) {
81
+ function qe(e, t) {
82
82
  return e === "high" || e === "medium" || e === "low" ? e : t;
83
83
  }
84
- function qe(e) {
84
+ function We(e) {
85
85
  const t = (e || "*").slice(0, 1) || "*";
86
86
  return /[A-Za-z0-9._%+\-\s]/.test(t) ? "*" : t;
87
87
  }
88
- function $e(e) {
88
+ function Ie(e) {
89
89
  let t = 2166136261;
90
90
  for (let n = 0; n < e.length; n += 1)
91
91
  t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
92
92
  return t >>> 0;
93
93
  }
94
- function We(e) {
94
+ function je(e) {
95
95
  const t = e.replace(/\D/g, "");
96
- if (t.length < 13 || t.length > 19)
97
- return !1;
96
+ if (t.length < 13 || t.length > 19) return !1;
98
97
  let n = 0, i = !1;
99
98
  for (let o = t.length - 1; o >= 0; o -= 1) {
100
99
  let r = Number(t[o]);
@@ -102,8 +101,8 @@ function We(e) {
102
101
  }
103
102
  return n % 10 === 0;
104
103
  }
105
- function je(e, t) {
106
- const n = Fe[e];
104
+ function Ze(e, t) {
105
+ const n = He[e];
107
106
  if (typeof t == "boolean")
108
107
  return {
109
108
  type: e,
@@ -126,7 +125,7 @@ function je(e, t) {
126
125
  return {
127
126
  type: e,
128
127
  label: n.label,
129
- severity: Ke(t.severity, n.severity),
128
+ severity: qe(t.severity, n.severity),
130
129
  enabled: t.enabled !== !1,
131
130
  pattern: i,
132
131
  validator: n.validator
@@ -134,30 +133,30 @@ function je(e, t) {
134
133
  }
135
134
  function ee(e = {}) {
136
135
  var i, o, r, a;
137
- const t = Oe.map((l) => {
136
+ const t = ze.map((l) => {
138
137
  var c;
139
- return je(l, (c = e.detectors) == null ? void 0 : c[l]);
138
+ return Ze(l, (c = e.detectors) == null ? void 0 : c[l]);
140
139
  }), n = t.map((l) => `${l.type}:${l.enabled ? "1" : "0"}:${l.severity}:${l.pattern.source}:${l.pattern.flags}`).join("|");
141
140
  return {
142
141
  enableRealtime: e.enableRealtime !== !1,
143
142
  debounceMs: X(Number((i = e.debounceMs) != null ? i : 220), 60, 3e3),
144
143
  maxFindings: X(Number((o = e.maxFindings) != null ? o : 140), 1, 500),
145
- maskChar: qe(e.maskChar),
144
+ maskChar: We(e.maskChar),
146
145
  revealStart: X(Number((r = e.revealStart) != null ? r : 2), 0, 12),
147
146
  revealEnd: X(Number((a = e.revealEnd) != null ? a : 2), 0, 12),
148
147
  redactionMode: e.redactionMode === "mask" ? "mask" : "token",
149
148
  redactionToken: (e.redactionToken || "REDACTED").trim() || "REDACTED",
150
149
  skipInCodeBlocks: e.skipInCodeBlocks !== !1,
151
150
  labels: {
152
- ...ze,
151
+ ...Fe,
153
152
  ...e.labels || {}
154
153
  },
155
- normalizeText: e.normalizeText || Be,
154
+ normalizeText: e.normalizeText || Ke,
156
155
  detectors: t,
157
156
  detectorSignature: n
158
157
  };
159
158
  }
160
- function ce(e) {
159
+ function se(e) {
161
160
  const t = {};
162
161
  return e.detectors.forEach((n) => {
163
162
  t[n.type] = {
@@ -180,10 +179,10 @@ function ce(e) {
180
179
  detectors: t
181
180
  };
182
181
  }
183
- function ge(e) {
182
+ function me(e) {
184
183
  return e.closest(ae) || e;
185
184
  }
186
- function Ze(e) {
185
+ function Ve(e) {
187
186
  const t = e.closest("[data-editora-editor]");
188
187
  if (t && z(t) === e)
189
188
  return t;
@@ -193,31 +192,25 @@ function Ze(e) {
193
192
  return n;
194
193
  n = n.parentElement;
195
194
  }
196
- return ge(e);
195
+ return me(e);
197
196
  }
198
197
  function z(e) {
199
- if (!e)
200
- return null;
201
- if (e.matches(x))
202
- return e;
198
+ if (!e) return null;
199
+ if (e.matches(x)) return e;
203
200
  const t = e.querySelector(x);
204
201
  return t instanceof HTMLElement ? t : null;
205
202
  }
206
- function Ve() {
207
- if (typeof window == "undefined")
208
- return null;
209
- const e = window[we];
210
- if (!(e instanceof HTMLElement))
211
- return null;
212
- window[we] = null;
203
+ function Ue() {
204
+ if (typeof window == "undefined") return null;
205
+ const e = window[Ee];
206
+ if (!(e instanceof HTMLElement)) return null;
207
+ window[Ee] = null;
213
208
  const t = z(e);
214
- if (t)
215
- return t;
209
+ if (t) return t;
216
210
  const n = e.closest(ae);
217
211
  if (n) {
218
212
  const o = z(n);
219
- if (o)
220
- return o;
213
+ if (o) return o;
221
214
  }
222
215
  const i = e.closest(x);
223
216
  return i instanceof HTMLElement ? i : null;
@@ -225,20 +218,19 @@ function Ve() {
225
218
  function J(e) {
226
219
  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;
227
220
  }
228
- function Ue(e) {
229
- const t = ge(e);
230
- if (J(t))
231
- return !0;
221
+ function Ge(e) {
222
+ const t = me(e);
223
+ if (J(t)) return !0;
232
224
  const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
233
225
  return J(n) ? !0 : J(document.documentElement) || J(document.body);
234
226
  }
235
227
  function ne(e, t) {
236
- e.classList.remove("rte-pii-redaction-theme-dark"), Ue(t) && e.classList.add("rte-pii-redaction-theme-dark");
228
+ e.classList.remove("rte-pii-redaction-theme-dark"), Ge(t) && e.classList.add("rte-pii-redaction-theme-dark");
237
229
  }
238
230
  function re(e) {
239
231
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
240
232
  }
241
- function me(e) {
233
+ function he(e) {
242
234
  const t = te.get(e);
243
235
  typeof t == "number" && (window.clearTimeout(t), j.delete(t), te.delete(e));
244
236
  }
@@ -265,18 +257,17 @@ function le(e = 0) {
265
257
  }
266
258
  function q() {
267
259
  Array.from(W).forEach((t) => {
268
- t.isConnected || Te(t);
260
+ t.isConnected || Ce(t);
269
261
  });
270
262
  }
271
- function Ge(e) {
263
+ function Ye(e) {
272
264
  var t, n, i, o;
273
265
  for (let r = 0; r < e.length; r += 1) {
274
266
  const a = e[r];
275
267
  if (!(a.type !== "childList" || a.removedNodes.length === 0))
276
268
  for (let l = 0; l < a.removedNodes.length; l += 1) {
277
269
  const c = a.removedNodes[l];
278
- if (c.nodeType !== Node.ELEMENT_NODE)
279
- continue;
270
+ if (c.nodeType !== Node.ELEMENT_NODE) continue;
280
271
  const d = c;
281
272
  if ((t = d.matches) != null && t.call(d, x) || (n = d.matches) != null && n.call(d, `.${u}`) || (i = d.querySelector) != null && i.call(d, x) || (o = d.querySelector) != null && o.call(d, `.${u}`))
282
273
  return !0;
@@ -285,38 +276,32 @@ function Ge(e) {
285
276
  return !1;
286
277
  }
287
278
  function T(e, t = !0) {
288
- if (q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
289
- return e.contentElement;
279
+ if (q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
290
280
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
291
281
  const r = e.editorElement, a = z(r);
292
- if (a)
293
- return a;
282
+ if (a) return a;
294
283
  }
295
- const n = Ve();
296
- if (n)
297
- return n;
284
+ const n = Ue();
285
+ if (n) return n;
298
286
  const i = window.getSelection();
299
287
  if (i && i.rangeCount > 0) {
300
288
  const r = re(i.getRangeAt(0).startContainer), a = r == null ? void 0 : r.closest(x);
301
- if (a)
302
- return a;
289
+ if (a) return a;
303
290
  }
304
291
  const o = document.activeElement;
305
292
  if (o) {
306
- if (o.matches(x))
307
- return o;
293
+ if (o.matches(x)) return o;
308
294
  const r = o.closest(x);
309
- if (r)
310
- return r;
295
+ if (r) return r;
311
296
  }
312
297
  return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(x) : null);
313
298
  }
314
- function Te(e) {
299
+ function Ce(e) {
315
300
  var t;
316
- 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);
301
+ he(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), ue.delete(e), Q.delete(e), W.delete(e), g === e && (g = null);
317
302
  }
318
303
  function C(e, t, n) {
319
- const i = Ze(e);
304
+ const i = Ve(e);
320
305
  Array.from(
321
306
  i.querySelectorAll(
322
307
  `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
@@ -331,53 +316,50 @@ function w(e, t) {
331
316
  function ie(e) {
332
317
  return V.get(e) === !0;
333
318
  }
334
- function Ie(e, t, n, i) {
335
- if (!e)
336
- return e;
319
+ function Te(e, t, n, i) {
320
+ if (!e) return e;
337
321
  if (e.length <= n + i)
338
322
  return t.repeat(e.length);
339
323
  const o = e.slice(0, n), r = i > 0 ? e.slice(e.length - i) : "";
340
324
  return `${o}${t.repeat(Math.max(1, e.length - n - i))}${r}`;
341
325
  }
342
- function se(e, t, n) {
326
+ function de(e, t, n) {
343
327
  const i = e.replace(/\D/g, "");
344
- if (i.length === 0)
345
- return e;
328
+ if (i.length === 0) return e;
346
329
  let o = 0;
347
330
  const r = Math.max(0, i.length - n);
348
331
  return e.split("").map((a) => /\d/.test(a) ? (o += 1, o <= r ? t : a) : a).join("");
349
332
  }
350
- function Ye(e, t) {
333
+ function Xe(e, t) {
351
334
  const n = e.indexOf("@");
352
- if (n <= 0)
353
- return e;
335
+ if (n <= 0) return e;
354
336
  const i = e.slice(0, n), o = e.slice(n + 1);
355
337
  return i.length <= 2 ? `${i[0] || ""}${t}[at]${o}` : `${i[0]}${t.repeat(Math.max(1, i.length - 2))}${i[i.length - 1]}[at]${o}`;
356
338
  }
357
- function Xe(e, t) {
339
+ function Je(e, t) {
358
340
  const n = e.split(".");
359
341
  return n.length !== 4 ? e : `${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1, n[3].length))}`;
360
342
  }
361
- function Ce(e, t, n) {
362
- 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));
363
- }
364
343
  function Re(e, t, n) {
365
- return n.redactionMode === "mask" ? Ce(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
344
+ return e && (t === "email" ? Xe(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? de(e, n.maskChar, 4) : t === "ipv4" ? Je(e, n.maskChar) : t === "api-key" || t === "jwt" ? Te(e, n.maskChar, 0, 0) : Te(e, n.maskChar, n.revealStart, n.revealEnd));
366
345
  }
367
- function Je(e) {
368
- return ve += 1, `pii-${e}-${Date.now().toString(36)}-${ve.toString(36)}`;
346
+ function Se(e, t, n) {
347
+ return n.redactionMode === "mask" ? Re(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
369
348
  }
370
- function he(e, t) {
349
+ function Qe(e) {
350
+ return $e += 1, `pii-${e}-${Date.now().toString(36)}-${$e.toString(36)}`;
351
+ }
352
+ function xe(e, t) {
371
353
  var n;
372
354
  return t.skipInCodeBlocks ? !!((n = e.parentElement) != null && n.closest("code, pre, kbd, samp")) : !1;
373
355
  }
374
- function Qe(e, t) {
356
+ function et(e, t) {
375
357
  return t.some((n) => e.start < n.end && n.start < e.end);
376
358
  }
377
- function et(e, t, n) {
359
+ function tt(e, t, n) {
378
360
  const i = [];
379
361
  t.filter((a) => a.enabled).forEach((a) => {
380
- const l = be(a.pattern);
362
+ const l = ge(a.pattern);
381
363
  let c = l.exec(e);
382
364
  for (; c && i.length < n * 5; ) {
383
365
  const d = c[0] || "", s = c.index, p = s + d.length;
@@ -393,18 +375,18 @@ function et(e, t, n) {
393
375
  const r = [];
394
376
  for (let a = 0; a < i.length && !(r.length >= n); a += 1) {
395
377
  const l = i[a];
396
- Qe({ start: l.start, end: l.end }, r) || r.push(l);
378
+ et({ start: l.start, end: l.end }, r) || r.push(l);
397
379
  }
398
380
  return r;
399
381
  }
400
- function ue(e, t = 120) {
382
+ function fe(e, t = 120) {
401
383
  return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
402
384
  }
403
- function tt(e, t, n) {
385
+ function nt(e, t, n) {
404
386
  const i = Math.max(0, t - 28), o = Math.min(e.length, n + 28);
405
- return ue(e.slice(i, o).trim(), 180);
387
+ return fe(e.slice(i, o).trim(), 180);
406
388
  }
407
- function nt(e, t) {
389
+ function rt(e, t) {
408
390
  const n = le(t);
409
391
  return n.total = e.length, e.forEach((i) => {
410
392
  n.byType[i.type] += 1, i.severity === "high" ? n.high += 1 : i.severity === "medium" ? n.medium += 1 : n.low += 1;
@@ -416,12 +398,11 @@ function oe(e, t) {
416
398
  }
417
399
  function F(e, t, n) {
418
400
  const i = t.querySelector('[data-action="toggle-realtime"]');
419
- if (!i)
420
- return;
401
+ if (!i) return;
421
402
  const o = H(e, n);
422
403
  i.textContent = o ? n.labels.realtimeOnText : n.labels.realtimeOffText, i.setAttribute("aria-pressed", o ? "true" : "false"), C(e, "togglePIIRealtime", o);
423
404
  }
424
- function rt(e, t) {
405
+ function it(e, t) {
425
406
  e.setAttribute("aria-label", t.labels.panelAriaLabel);
426
407
  const n = e.querySelector(".rte-pii-redaction-title");
427
408
  n && (n.textContent = t.labels.panelTitle);
@@ -436,11 +417,9 @@ function rt(e, t) {
436
417
  }
437
418
  function B(e) {
438
419
  const t = m.get(e);
439
- if (!t)
440
- return;
420
+ if (!t) return;
441
421
  const n = f.get(e) || M;
442
- if (!n)
443
- return;
422
+ if (!n) return;
444
423
  const i = I.get(e) || [], o = E.get(e) || le(0), r = U(e), a = t.querySelector(".rte-pii-redaction-count"), l = t.querySelector(".rte-pii-redaction-summary"), c = t.querySelector(".rte-pii-redaction-list"), d = t.querySelector('[data-action="redact-all"]');
445
424
  if (!(!a || !l || !c || !d)) {
446
425
  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}`, d.disabled = r || i.length === 0, r ? oe(t, n.labels.readonlyRedactionText) : oe(t, `${o.total} PII findings detected.`), F(e, t, n), i.length === 0) {
@@ -462,8 +441,8 @@ function B(e) {
462
441
  <span class="rte-pii-redaction-badge">${b(s.severity.toUpperCase())}</span>
463
442
  <span class="rte-pii-redaction-type">${b(p)}</span>
464
443
  </button>
465
- <p class="rte-pii-redaction-line"><strong>${b(n.labels.matchLabel)}:</strong> ${b(ue(s.match, 80))}</p>
466
- <p class="rte-pii-redaction-line"><strong>${b(n.labels.maskedLabel)}:</strong> ${b(ue(s.masked, 80))}</p>
444
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.matchLabel)}:</strong> ${b(fe(s.match, 80))}</p>
445
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.maskedLabel)}:</strong> ${b(fe(s.masked, 80))}</p>
467
446
  ${s.excerpt ? `<p class="rte-pii-redaction-line"><strong>${b(n.labels.excerptLabel)}:</strong> ${b(s.excerpt)}</p>` : ""}
468
447
  <p class="rte-pii-redaction-help">${b(A)}</p>
469
448
  <div class="rte-pii-redaction-item-actions">
@@ -476,19 +455,17 @@ function B(e) {
476
455
  }).join("");
477
456
  }
478
457
  }
479
- function fe(e, t) {
480
- if (!t.classList.contains("show"))
481
- return;
482
- const i = ge(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 390), r = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, i.right - o), r), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, i.top + 10));
458
+ function pe(e, t) {
459
+ if (!t.classList.contains("show")) return;
460
+ const i = me(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 390), r = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, i.right - o), r), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, i.top + 10));
483
461
  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`;
484
462
  }
485
463
  function H(e, t) {
486
464
  const n = S.get(e);
487
465
  return typeof n == "boolean" ? n : t ? t.enableRealtime : !0;
488
466
  }
489
- function Se(e, t) {
490
- if (t === e.innerHTML)
491
- return;
467
+ function Ae(e, t) {
468
+ if (t === e.innerHTML) return;
492
469
  const n = window.execEditorCommand || window.executeEditorCommand;
493
470
  if (typeof n == "function")
494
471
  try {
@@ -496,10 +473,10 @@ function Se(e, t) {
496
473
  } catch (i) {
497
474
  }
498
475
  }
499
- function Ae(e) {
476
+ function Me(e) {
500
477
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
501
478
  }
502
- function Me(e, t) {
479
+ function Pe(e, t) {
503
480
  e.dispatchEvent(
504
481
  new CustomEvent("editora:pii-redacted", {
505
482
  bubbles: !0,
@@ -509,14 +486,13 @@ function Me(e, t) {
509
486
  })
510
487
  );
511
488
  }
512
- function Pe(e, t) {
489
+ function Le(e, t) {
513
490
  return (I.get(e) || []).find((i) => i.id === t);
514
491
  }
515
- function it(e) {
492
+ function ot(e) {
516
493
  const t = m.get(e);
517
- if (t)
518
- return t;
519
- const n = f.get(e) || M || ee(), i = `rte-pii-redaction-panel-${He++}`, o = document.createElement("section");
494
+ if (t) return t;
495
+ const n = f.get(e) || M || ee(), i = `rte-pii-redaction-panel-${Be++}`, o = document.createElement("section");
520
496
  return o.className = u, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.innerHTML = `
521
497
  <header class="rte-pii-redaction-header">
522
498
  <h2 class="rte-pii-redaction-title">${b(n.labels.panelTitle)}</h2>
@@ -544,8 +520,7 @@ function it(e) {
544
520
  </div>
545
521
  `, o.addEventListener("click", (r) => {
546
522
  const a = r.target, l = a == null ? void 0 : a.closest("[data-action]");
547
- if (!l)
548
- return;
523
+ if (!l) return;
549
524
  const c = l.getAttribute("data-action") || "", d = f.get(e) || M || n;
550
525
  if (f.set(e, d), w(e, d), c === "close") {
551
526
  Z(e, !0);
@@ -561,33 +536,29 @@ function it(e) {
561
536
  return;
562
537
  }
563
538
  if (c === "redact-all") {
564
- xe(e, d);
539
+ ye(e, d);
565
540
  return;
566
541
  }
567
542
  if (c === "locate-finding") {
568
- const s = l.getAttribute("data-finding-id") || "", p = Pe(e, s);
569
- if (!p)
570
- return;
571
- lt(e, p, d);
543
+ const s = l.getAttribute("data-finding-id") || "", p = Le(e, s);
544
+ if (!p) return;
545
+ ct(e, p, d);
572
546
  return;
573
547
  }
574
548
  if (c === "redact-finding") {
575
549
  const s = l.getAttribute("data-finding-id") || "";
576
- _e(e, s, d);
550
+ Ne(e, s, d);
577
551
  }
578
552
  }), o.addEventListener("keydown", (r) => {
579
553
  if (r.key === "Escape") {
580
554
  r.preventDefault(), Z(e, !0);
581
555
  return;
582
556
  }
583
- if (r.key !== "ArrowDown" && r.key !== "ArrowUp")
584
- return;
557
+ if (r.key !== "ArrowDown" && r.key !== "ArrowUp") return;
585
558
  const a = Array.from(o.querySelectorAll('[data-role="finding-button"]'));
586
- if (a.length === 0)
587
- return;
559
+ if (a.length === 0) return;
588
560
  const l = document.activeElement, c = a.findIndex((p) => p === l);
589
- if (c === -1)
590
- return;
561
+ if (c === -1) return;
591
562
  r.preventDefault();
592
563
  const d = r.key === "ArrowDown" ? 1 : -1, s = (c + d + a.length) % a.length;
593
564
  a[s].focus();
@@ -599,23 +570,23 @@ function Z(e, t = !1) {
599
570
  }
600
571
  function O(e) {
601
572
  q();
602
- const t = it(e);
573
+ const t = ot(e);
603
574
  m.forEach((i, o) => {
604
575
  o !== e && Z(o, !1);
605
- }), t.classList.add("show"), V.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), fe(e, t), B(e);
576
+ }), t.classList.add("show"), V.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), pe(e, t), B(e);
606
577
  const n = t.querySelector('[data-action="run-scan"]');
607
578
  n == null || n.focus();
608
579
  }
609
- function Le(e, t) {
580
+ function De(e, t) {
610
581
  const n = ie(e);
611
582
  return (typeof t == "boolean" ? t : !n) ? O(e) : Z(e), !0;
612
583
  }
613
- function ot(e, t) {
584
+ function at(e, t) {
614
585
  const n = t.normalizeText(e.innerText || e.textContent || ""), i = e.innerHTML;
615
- return `${n.length}:${$e(n)}:${i.length}:${$e(i)}:${t.detectorSignature}`;
586
+ return `${n.length}:${Ie(n)}:${i.length}:${Ie(i)}:${t.detectorSignature}`;
616
587
  }
617
- function at(e, t) {
618
- const n = [], i = be(e.pattern);
588
+ function lt(e, t) {
589
+ const n = [], i = ge(e.pattern);
619
590
  let o = i.exec(t);
620
591
  for (; o; ) {
621
592
  const r = o[0] || "", a = o.index, l = a + r.length;
@@ -623,17 +594,16 @@ function at(e, t) {
623
594
  }
624
595
  return n;
625
596
  }
626
- function De(e, t, n) {
597
+ function _e(e, t, n) {
627
598
  const i = n.detectors.find((c) => c.type === t.type && c.enabled);
628
- if (!i)
629
- return null;
599
+ if (!i) return null;
630
600
  const o = t.match.toLowerCase();
631
601
  let r = 0;
632
- const a = document.createTreeWalker(e, pe, null);
602
+ const a = document.createTreeWalker(e, be, null);
633
603
  let l = a.nextNode();
634
604
  for (; l; ) {
635
- if (!he(l, n)) {
636
- const c = at(i, l.data);
605
+ if (!xe(l, n)) {
606
+ const c = lt(i, l.data);
637
607
  for (let d = 0; d < c.length; d += 1) {
638
608
  const s = c[d];
639
609
  if (s.value.toLowerCase() === o && (r += 1, r === t.occurrence)) {
@@ -646,13 +616,11 @@ function De(e, t, n) {
646
616
  }
647
617
  return null;
648
618
  }
649
- function lt(e, t, n) {
650
- const i = De(e, t, n);
651
- if (!i)
652
- return !1;
619
+ function ct(e, t, n) {
620
+ const i = _e(e, t, n);
621
+ if (!i) return !1;
653
622
  const o = window.getSelection();
654
- if (!o)
655
- return !1;
623
+ if (!o) return !1;
656
624
  o.removeAllRanges(), o.addRange(i);
657
625
  const r = re(i.startContainer);
658
626
  return r == null || r.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 }), !0;
@@ -660,27 +628,27 @@ function lt(e, t, n) {
660
628
  async function h(e, t, n = !1) {
661
629
  var p;
662
630
  w(e, t);
663
- const i = ot(e, t);
664
- if (!n && de.get(e) === i)
631
+ const i = at(e, t);
632
+ if (!n && ue.get(e) === i)
665
633
  return I.get(e) || [];
666
634
  const o = (Q.get(e) || 0) + 1;
667
635
  Q.set(e, o);
668
- const r = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, pe, null);
636
+ const r = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, be, null);
669
637
  let c = l.nextNode();
670
638
  for (; c && r.length < t.maxFindings; ) {
671
639
  const A = c.data || "";
672
- if (A.trim() && !he(c, t)) {
673
- const P = et(A, t.detectors, t.maxFindings - r.length);
640
+ if (A.trim() && !xe(c, t)) {
641
+ const P = tt(A, t.detectors, t.maxFindings - r.length);
674
642
  for (let K = 0; K < P.length && !(r.length >= t.maxFindings); K += 1) {
675
- const y = P[K], ye = `${y.type}:${y.value.toLowerCase()}`, ke = (a.get(ye) || 0) + 1;
676
- a.set(ye, ke), r.push({
677
- id: Je(y.type),
643
+ const y = P[K], ke = `${y.type}:${y.value.toLowerCase()}`, we = (a.get(ke) || 0) + 1;
644
+ a.set(ke, we), r.push({
645
+ id: Qe(y.type),
678
646
  type: y.type,
679
647
  severity: y.severity,
680
648
  match: y.value,
681
- masked: Ce(y.value, y.type, t),
682
- occurrence: ke,
683
- excerpt: tt(A, y.start, y.end),
649
+ masked: Re(y.value, y.type, t),
650
+ occurrence: we,
651
+ excerpt: nt(A, y.start, y.end),
684
652
  suggestion: "Review and redact this value before external sharing."
685
653
  });
686
654
  }
@@ -689,8 +657,8 @@ async function h(e, t, n = !1) {
689
657
  }
690
658
  if (Q.get(e) !== o)
691
659
  return I.get(e) || [];
692
- const d = ((p = E.get(e)) == null ? void 0 : p.redactedCount) || 0, s = nt(r, d);
693
- return de.set(e, i), I.set(e, r), E.set(e, s), B(e), e.dispatchEvent(
660
+ const d = ((p = E.get(e)) == null ? void 0 : p.redactedCount) || 0, s = rt(r, d);
661
+ return ue.set(e, i), I.set(e, r), E.set(e, s), B(e), e.dispatchEvent(
694
662
  new CustomEvent("editora:pii-scan", {
695
663
  bubbles: !0,
696
664
  detail: {
@@ -700,38 +668,36 @@ async function h(e, t, n = !1) {
700
668
  })
701
669
  ), r;
702
670
  }
703
- function ct(e, t) {
671
+ function st(e, t) {
704
672
  let n = e, i = 0;
705
673
  return t.detectors.filter((r) => r.enabled).forEach((r) => {
706
- const a = be(r.pattern);
707
- n = n.replace(a, (l) => r.validator && !r.validator(l) ? l : (i += 1, Re(l, r.type, t)));
674
+ const a = ge(r.pattern);
675
+ n = n.replace(a, (l) => r.validator && !r.validator(l) ? l : (i += 1, Se(l, r.type, t)));
708
676
  }), { nextValue: n, count: i };
709
677
  }
710
- async function _e(e, t, n) {
678
+ async function Ne(e, t, n) {
711
679
  var d;
712
680
  if (U(e)) {
713
681
  const s = m.get(e);
714
682
  return s && oe(s, n.labels.readonlyRedactionText), !1;
715
683
  }
716
- const i = Pe(e, t);
717
- if (!i)
718
- return !1;
719
- const o = De(e, i, n);
720
- if (!o)
721
- return !1;
722
- const r = e.innerHTML, a = Re(i.match, i.type, n);
684
+ const i = Le(e, t);
685
+ if (!i) return !1;
686
+ const o = _e(e, i, n);
687
+ if (!o) return !1;
688
+ const r = e.innerHTML, a = Se(i.match, i.type, n);
723
689
  if (o.startContainer === o.endContainer && o.startContainer.nodeType === Node.TEXT_NODE) {
724
690
  const s = o.startContainer, p = s.data, A = o.startOffset, P = o.endOffset;
725
691
  s.data = `${p.slice(0, A)}${a}${p.slice(P)}`;
726
692
  } else
727
693
  o.deleteContents(), o.insertNode(document.createTextNode(a));
728
- Ae(e), Se(e, r);
694
+ Me(e), Ae(e, r);
729
695
  const l = ((d = E.get(e)) == null ? void 0 : d.redactedCount) || 0;
730
696
  await h(e, n, !0);
731
697
  const c = E.get(e);
732
- return c && (c.redactedCount = l + 1, B(e)), Me(e, 1), !0;
698
+ return c && (c.redactedCount = l + 1, B(e)), Pe(e, 1), !0;
733
699
  }
734
- async function xe(e, t) {
700
+ async function ye(e, t) {
735
701
  var d;
736
702
  if (U(e)) {
737
703
  const s = m.get(e);
@@ -740,10 +706,10 @@ async function xe(e, t) {
740
706
  (I.get(e) || []).length === 0 && await h(e, t, !0);
741
707
  const i = e.innerHTML;
742
708
  let o = 0;
743
- const r = document.createTreeWalker(e, pe, null);
709
+ const r = document.createTreeWalker(e, be, null);
744
710
  let a = r.nextNode();
745
711
  for (; a; ) {
746
- if (he(a, t)) {
712
+ if (xe(a, t)) {
747
713
  a = r.nextNode();
748
714
  continue;
749
715
  }
@@ -752,61 +718,59 @@ async function xe(e, t) {
752
718
  a = r.nextNode();
753
719
  continue;
754
720
  }
755
- const p = ct(s, t);
721
+ const p = st(s, t);
756
722
  p.count > 0 && p.nextValue !== s && (a.data = p.nextValue, o += p.count), a = r.nextNode();
757
723
  }
758
- if (o === 0)
759
- return 0;
760
- Ae(e), Se(e, i);
724
+ if (o === 0) return 0;
725
+ Me(e), Ae(e, i);
761
726
  const l = ((d = E.get(e)) == null ? void 0 : d.redactedCount) || 0;
762
727
  await h(e, t, !0);
763
728
  const c = E.get(e);
764
- return c && (c.redactedCount = l + o, B(e)), Me(e, o), o;
729
+ return c && (c.redactedCount = l + o, B(e)), Pe(e, o), o;
765
730
  }
766
- function Ne(e) {
731
+ function Oe(e) {
767
732
  const t = f.get(e) || M;
768
- if (!t || !H(e, t) || U(e))
769
- return;
770
- me(e);
733
+ if (!t || !H(e, t) || U(e)) return;
734
+ he(e);
771
735
  const n = window.setTimeout(() => {
772
736
  j.delete(n), te.delete(e), h(e, t, !1);
773
737
  }, t.debounceMs);
774
738
  j.add(n), te.set(e, n);
775
739
  }
776
- function st(e) {
777
- const t = e.key.toLowerCase();
778
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
740
+ function ce(e) {
741
+ return typeof e.key == "string" ? e.key.toLowerCase() : "";
779
742
  }
780
743
  function dt(e) {
781
- const t = e.key.toLowerCase();
782
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
744
+ const t = ce(e);
745
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
783
746
  }
784
747
  function ut(e) {
785
- const t = e.key.toLowerCase();
786
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
748
+ const t = ce(e);
749
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
787
750
  }
788
751
  function ft(e) {
789
- const t = e.key.toLowerCase();
790
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
752
+ const t = ce(e);
753
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
791
754
  }
792
755
  function pt(e) {
756
+ const t = ce(e);
757
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
758
+ }
759
+ function bt(e) {
793
760
  var i;
794
761
  const t = re(e.target);
795
762
  if (t) {
796
763
  const o = t.closest(x);
797
- if (o)
798
- return o;
764
+ if (o) return o;
799
765
  const r = t.closest(ae);
800
766
  if (r) {
801
767
  const l = z(r);
802
- if (l)
803
- return l;
768
+ if (l) return l;
804
769
  }
805
770
  const a = t.closest(`.${u}`);
806
771
  if (a) {
807
772
  const l = Array.from(m.entries()).find(([, c]) => c === a);
808
- if (l)
809
- return l[0];
773
+ if (l) return l[0];
810
774
  }
811
775
  }
812
776
  const n = window.getSelection();
@@ -814,16 +778,14 @@ function pt(e) {
814
778
  const o = (i = re(n.getRangeAt(0).startContainer)) == null ? void 0 : i.closest(
815
779
  x
816
780
  );
817
- if (o)
818
- return o;
781
+ if (o) return o;
819
782
  }
820
783
  return null;
821
784
  }
822
- function bt() {
823
- if (typeof document == "undefined" || document.getElementById(Ee))
824
- return;
785
+ function gt() {
786
+ if (typeof document == "undefined" || document.getElementById(ve)) return;
825
787
  const e = document.createElement("style");
826
- e.id = Ee, e.textContent = `
788
+ e.id = ve, e.textContent = `
827
789
  .rte-toolbar-group-items.${k},
828
790
  .editora-toolbar-group-items.${k},
829
791
  .rte-toolbar-group-items.${v},
@@ -1220,47 +1182,43 @@ function bt() {
1220
1182
  }
1221
1183
  `, document.head.appendChild(e);
1222
1184
  }
1223
- function gt(e) {
1185
+ function mt(e) {
1224
1186
  M = e, L || (L = (t) => {
1225
1187
  q();
1226
1188
  const n = t.target, i = n == null ? void 0 : n.closest(x);
1227
- if (!i)
1228
- return;
1189
+ if (!i) return;
1229
1190
  g = i;
1230
1191
  const o = f.get(i) || e;
1231
1192
  w(i, o), f.set(i, o), C(i, "togglePIIRedactionPanel", ie(i)), C(i, "togglePIIRealtime", H(i, o));
1232
1193
  const r = m.get(i);
1233
- r && (ne(r, i), fe(i, r), F(i, r, o));
1194
+ r && (ne(r, i), pe(i, r), F(i, r, o));
1234
1195
  }, document.addEventListener("focusin", L, !0)), D || (D = (t) => {
1235
1196
  const n = t.target, i = n == null ? void 0 : n.closest(x);
1236
- i && (g = i, Ne(i));
1197
+ i && (g = i, Oe(i));
1237
1198
  }, document.addEventListener("input", D, !0)), _ || (_ = (t) => {
1238
- if (t.defaultPrevented)
1239
- return;
1199
+ if (t.defaultPrevented) return;
1240
1200
  const n = t.target;
1241
- if (n != null && n.closest(`.${u} input, .${u} textarea, .${u} select`))
1242
- return;
1243
- const i = pt(t);
1244
- if (!i)
1245
- return;
1201
+ if (n != null && n.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
1202
+ const i = bt(t);
1203
+ if (!i) return;
1246
1204
  const o = f.get(i) || M || e;
1247
1205
  if (w(i, o), f.set(i, o), g = i, t.key === "Escape" && ie(i)) {
1248
1206
  t.preventDefault(), Z(i, !0);
1249
1207
  return;
1250
1208
  }
1251
- if (st(t)) {
1252
- t.preventDefault(), t.stopPropagation(), Le(i);
1253
- return;
1254
- }
1255
1209
  if (dt(t)) {
1256
- t.preventDefault(), t.stopPropagation(), h(i, o, !0), O(i);
1210
+ t.preventDefault(), t.stopPropagation(), De(i);
1257
1211
  return;
1258
1212
  }
1259
1213
  if (ut(t)) {
1260
- t.preventDefault(), t.stopPropagation(), U(i) || (xe(i, o), O(i));
1214
+ t.preventDefault(), t.stopPropagation(), h(i, o, !0), O(i);
1261
1215
  return;
1262
1216
  }
1263
1217
  if (ft(t)) {
1218
+ t.preventDefault(), t.stopPropagation(), U(i) || (ye(i, o), O(i));
1219
+ return;
1220
+ }
1221
+ if (pt(t)) {
1264
1222
  t.preventDefault(), t.stopPropagation();
1265
1223
  const r = !H(i, o);
1266
1224
  S.set(i, r);
@@ -1269,21 +1227,21 @@ function gt(e) {
1269
1227
  }
1270
1228
  }, document.addEventListener("keydown", _, !0)), R || (R = () => {
1271
1229
  q(), m.forEach((t, n) => {
1272
- !n.isConnected || !t.isConnected || (ne(t, n), fe(n, t));
1230
+ !n.isConnected || !t.isConnected || (ne(t, n), pe(n, t));
1273
1231
  });
1274
1232
  }, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !N && typeof MutationObserver != "undefined" && document.body && (N = new MutationObserver((t) => {
1275
- Ge(t) && q();
1233
+ Ye(t) && q();
1276
1234
  }), N.observe(document.body, {
1277
1235
  childList: !0,
1278
1236
  subtree: !0
1279
1237
  }));
1280
1238
  }
1281
- function mt() {
1282
- 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;
1239
+ function ht() {
1240
+ 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) => he(e)), W.clear(), M = null, g = null;
1283
1241
  }
1284
- const ht = (e = {}) => {
1242
+ const xt = (e = {}) => {
1285
1243
  const t = ee(e), n = /* @__PURE__ */ new Set();
1286
- return bt(), {
1244
+ return gt(), {
1287
1245
  name: "piiRedaction",
1288
1246
  toolbar: [
1289
1247
  {
@@ -1326,47 +1284,41 @@ const ht = (e = {}) => {
1326
1284
  commands: {
1327
1285
  piiRedaction: (i, o) => {
1328
1286
  const r = T(o);
1329
- if (!r)
1330
- return !1;
1287
+ if (!r) return !1;
1331
1288
  const a = f.get(r) || t;
1332
1289
  return w(r, a), f.set(r, a), g = r, O(r), h(r, a, !1), !0;
1333
1290
  },
1334
1291
  togglePIIRedactionPanel: (i, o) => {
1335
1292
  const r = T(o);
1336
- if (!r)
1337
- return !1;
1293
+ if (!r) return !1;
1338
1294
  const a = f.get(r) || t;
1339
1295
  w(r, a), f.set(r, a), g = r;
1340
- const l = Le(r, typeof i == "boolean" ? i : void 0);
1296
+ const l = De(r, typeof i == "boolean" ? i : void 0);
1341
1297
  return ie(r) && h(r, a, !1), l;
1342
1298
  },
1343
1299
  runPIIScan: async (i, o) => {
1344
1300
  const r = T(o);
1345
- if (!r)
1346
- return !1;
1301
+ if (!r) return !1;
1347
1302
  const a = f.get(r) || t;
1348
1303
  return w(r, a), f.set(r, a), g = r, await h(r, a, !0), O(r), !0;
1349
1304
  },
1350
1305
  redactAllPII: async (i, o) => {
1351
1306
  const r = T(o);
1352
- if (!r)
1353
- return !1;
1307
+ if (!r) return !1;
1354
1308
  const a = f.get(r) || t;
1355
1309
  w(r, a), f.set(r, a), g = r;
1356
- const l = await xe(r, a);
1310
+ const l = await ye(r, a);
1357
1311
  return l > 0 && O(r), l > 0;
1358
1312
  },
1359
1313
  redactPIIFinding: async (i, o) => {
1360
1314
  const r = T(o);
1361
- if (!r || typeof i != "string" || !i)
1362
- return !1;
1315
+ if (!r || typeof i != "string" || !i) return !1;
1363
1316
  const a = f.get(r) || t;
1364
- return w(r, a), f.set(r, a), g = r, _e(r, i, a);
1317
+ return w(r, a), f.set(r, a), g = r, Ne(r, i, a);
1365
1318
  },
1366
1319
  togglePIIRealtime: (i, o) => {
1367
1320
  const r = T(o);
1368
- if (!r)
1369
- return !1;
1321
+ if (!r) return !1;
1370
1322
  const a = f.get(r) || t;
1371
1323
  w(r, a), f.set(r, a);
1372
1324
  const l = typeof i == "boolean" ? i : !H(r, a);
@@ -1376,8 +1328,7 @@ const ht = (e = {}) => {
1376
1328
  },
1377
1329
  getPIIRedactionFindings: (i, o) => {
1378
1330
  const r = T(o);
1379
- if (!r)
1380
- return !1;
1331
+ if (!r) return !1;
1381
1332
  const a = I.get(r) || [], l = E.get(r) || le(0), c = a.map((s) => ({ ...s })), d = {
1382
1333
  ...l,
1383
1334
  byType: { ...l.byType }
@@ -1396,24 +1347,23 @@ const ht = (e = {}) => {
1396
1347
  },
1397
1348
  setPIIRedactionOptions: (i, o) => {
1398
1349
  const r = T(o);
1399
- if (!r || !i || typeof i != "object")
1400
- return !1;
1350
+ if (!r || !i || typeof i != "object") return !1;
1401
1351
  const a = f.get(r) || t, l = ee({
1402
- ...ce(a),
1352
+ ...se(a),
1403
1353
  ...i,
1404
1354
  labels: {
1405
1355
  ...a.labels,
1406
1356
  ...i.labels || {}
1407
1357
  },
1408
1358
  detectors: {
1409
- ...ce(a).detectors || {},
1359
+ ...se(a).detectors || {},
1410
1360
  ...i.detectors || {}
1411
1361
  },
1412
1362
  normalizeText: i.normalizeText || a.normalizeText
1413
1363
  });
1414
1364
  f.set(r, l), typeof i.enableRealtime == "boolean" && S.set(r, i.enableRealtime);
1415
1365
  const c = m.get(r);
1416
- return c && (rt(c, l), B(r), F(r, c, l)), h(r, l, !0), !0;
1366
+ return c && (it(c, l), B(r), F(r, c, l)), h(r, l, !0), !0;
1417
1367
  }
1418
1368
  },
1419
1369
  keymap: {
@@ -1428,22 +1378,22 @@ const ht = (e = {}) => {
1428
1378
  },
1429
1379
  init: function(o) {
1430
1380
  G += 1;
1431
- const r = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1432
- gt(r);
1381
+ const r = this && typeof this.__pluginConfig == "object" ? ee({ ...se(t), ...this.__pluginConfig }) : t;
1382
+ mt(r);
1433
1383
  const a = T(
1434
1384
  o != null && o.editorElement ? { editorElement: o.editorElement } : void 0,
1435
1385
  !1
1436
1386
  );
1437
- a && (g = a, n.add(a), w(a, r), f.set(a, r), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", r.enableRealtime), r.enableRealtime && Ne(a));
1387
+ a && (g = a, n.add(a), w(a, r), f.set(a, r), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", r.enableRealtime), r.enableRealtime && Oe(a));
1438
1388
  },
1439
1389
  destroy: () => {
1440
- n.forEach((i) => Te(i)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (j.forEach((i) => {
1390
+ n.forEach((i) => Ce(i)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (j.forEach((i) => {
1441
1391
  window.clearTimeout(i);
1442
- }), j.clear(), mt());
1392
+ }), j.clear(), ht());
1443
1393
  }
1444
1394
  };
1445
1395
  };
1446
1396
  export {
1447
- ht as PIIRedactionPlugin
1397
+ xt as PIIRedactionPlugin
1448
1398
  };
1449
- //# sourceMappingURL=PIIRedactionPlugin.native-7ab10b9f.mjs.map
1399
+ //# sourceMappingURL=PIIRedactionPlugin.native-g7j4jOmm.mjs.map