image-pii-redactor 0.3.6 → 0.3.7
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.
- package/dist/image-pii-redactor.js +237 -217
- package/dist/image-pii-redactor.js.map +1 -1
- package/package.json +6 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
let
|
|
6
|
+
const H = globalThis, Q = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ee = Symbol(), oe = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let we = class {
|
|
8
8
|
constructor(e, r, i) {
|
|
9
9
|
if (this._$cssResult$ = !0, i !== ee) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = e, this.t = r;
|
|
@@ -22,30 +22,30 @@ let ye = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const De = (t) => new we(typeof t == "string" ? t : t + "", void 0, ee), Oe = (t, ...e) => {
|
|
26
26
|
const r = t.length === 1 ? t[0] : e.reduce((i, n, s) => i + ((o) => {
|
|
27
27
|
if (o._$cssResult$ === !0) return o.cssText;
|
|
28
28
|
if (typeof o == "number") return o;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(n) + t[s + 1], t[0]);
|
|
31
|
-
return new
|
|
32
|
-
},
|
|
31
|
+
return new we(r, t, ee);
|
|
32
|
+
}, Ue = (t, e) => {
|
|
33
33
|
if (Q) t.adoptedStyleSheets = e.map((r) => r instanceof CSSStyleSheet ? r : r.styleSheet);
|
|
34
34
|
else for (const r of e) {
|
|
35
|
-
const i = document.createElement("style"), n =
|
|
35
|
+
const i = document.createElement("style"), n = H.litNonce;
|
|
36
36
|
n !== void 0 && i.setAttribute("nonce", n), i.textContent = r.cssText, t.appendChild(i);
|
|
37
37
|
}
|
|
38
38
|
}, ae = Q ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
|
|
39
39
|
let r = "";
|
|
40
40
|
for (const i of e.cssRules) r += i.cssText;
|
|
41
|
-
return
|
|
41
|
+
return De(r);
|
|
42
42
|
})(t) : t;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: Te, defineProperty: Ne, getOwnPropertyDescriptor: Ie, getOwnPropertyNames: Le, getOwnPropertySymbols: ze, getPrototypeOf: Be } = Object, q = globalThis, le = q.trustedTypes, He = le ? le.emptyScript : "", We = q.reactiveElementPolyfillSupport, O = (t, e) => t, W = { toAttribute(t, e) {
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
t = t ? He : null;
|
|
@@ -73,9 +73,9 @@ const { is: Ue, defineProperty: De, getOwnPropertyDescriptor: ze, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return r;
|
|
76
|
-
} }, te = (t, e) => !
|
|
76
|
+
} }, te = (t, e) => !Te(t, e), ce = { attribute: !0, type: String, converter: W, reflect: !1, useDefault: !1, hasChanged: te };
|
|
77
77
|
Symbol.metadata ??= Symbol("metadata"), q.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
|
-
let
|
|
78
|
+
let M = class extends HTMLElement {
|
|
79
79
|
static addInitializer(e) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(e);
|
|
81
81
|
}
|
|
@@ -85,11 +85,11 @@ let E = class extends HTMLElement {
|
|
|
85
85
|
static createProperty(e, r = ce) {
|
|
86
86
|
if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(e, r), !r.noAccessor) {
|
|
87
87
|
const i = Symbol(), n = this.getPropertyDescriptor(e, i, r);
|
|
88
|
-
n !== void 0 &&
|
|
88
|
+
n !== void 0 && Ne(this.prototype, e, n);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(e, r, i) {
|
|
92
|
-
const { get: n, set: s } =
|
|
92
|
+
const { get: n, set: s } = Ie(this.prototype, e) ?? { get() {
|
|
93
93
|
return this[r];
|
|
94
94
|
}, set(o) {
|
|
95
95
|
this[r] = o;
|
|
@@ -103,14 +103,14 @@ let E = class extends HTMLElement {
|
|
|
103
103
|
return this.elementProperties.get(e) ?? ce;
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
106
|
+
if (this.hasOwnProperty(O("elementProperties"))) return;
|
|
107
107
|
const e = Be(this);
|
|
108
108
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
|
-
if (this.hasOwnProperty(
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
const r = this.properties, i = [...
|
|
111
|
+
if (this.hasOwnProperty(O("finalized"))) return;
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) {
|
|
113
|
+
const r = this.properties, i = [...Le(r), ...ze(r)];
|
|
114
114
|
for (const n of i) this.createProperty(n, r[n]);
|
|
115
115
|
}
|
|
116
116
|
const e = this[Symbol.metadata];
|
|
@@ -156,7 +156,7 @@ let E = class extends HTMLElement {
|
|
|
156
156
|
}
|
|
157
157
|
createRenderRoot() {
|
|
158
158
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
159
|
-
return
|
|
159
|
+
return Ue(e, this.constructor.elementStyles), e;
|
|
160
160
|
}
|
|
161
161
|
connectedCallback() {
|
|
162
162
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
@@ -172,14 +172,14 @@ let E = class extends HTMLElement {
|
|
|
172
172
|
_$ET(e, r) {
|
|
173
173
|
const i = this.constructor.elementProperties.get(e), n = this.constructor._$Eu(e, i);
|
|
174
174
|
if (n !== void 0 && i.reflect === !0) {
|
|
175
|
-
const s = (i.converter?.toAttribute !== void 0 ? i.converter :
|
|
175
|
+
const s = (i.converter?.toAttribute !== void 0 ? i.converter : W).toAttribute(r, i.type);
|
|
176
176
|
this._$Em = e, s == null ? this.removeAttribute(n) : this.setAttribute(n, s), this._$Em = null;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
_$AK(e, r) {
|
|
180
180
|
const i = this.constructor, n = i._$Eh.get(e);
|
|
181
181
|
if (n !== void 0 && this._$Em !== n) {
|
|
182
|
-
const s = i.getPropertyOptions(n), o = typeof s.converter == "function" ? { fromAttribute: s.converter } : s.converter?.fromAttribute !== void 0 ? s.converter :
|
|
182
|
+
const s = i.getPropertyOptions(n), o = typeof s.converter == "function" ? { fromAttribute: s.converter } : s.converter?.fromAttribute !== void 0 ? s.converter : W;
|
|
183
183
|
this._$Em = n;
|
|
184
184
|
const a = o.fromAttribute(r, s.type);
|
|
185
185
|
this[n] = a ?? this._$Ej?.get(n) ?? a, this._$Em = null;
|
|
@@ -256,56 +256,56 @@ let E = class extends HTMLElement {
|
|
|
256
256
|
firstUpdated(e) {
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
|
|
259
|
+
M.elementStyles = [], M.shadowRootOptions = { mode: "open" }, M[O("elementProperties")] = /* @__PURE__ */ new Map(), M[O("finalized")] = /* @__PURE__ */ new Map(), We?.({ ReactiveElement: M }), (q.reactiveElementVersions ??= []).push("2.1.2");
|
|
260
260
|
/**
|
|
261
261
|
* @license
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
263
263
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
264
|
*/
|
|
265
|
-
const re = globalThis, de = (t) => t,
|
|
266
|
-
\f\r]`,
|
|
267
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), ge = /'/g, fe = /"/g,
|
|
268
|
-
function
|
|
265
|
+
const re = globalThis, de = (t) => t, j = re.trustedTypes, he = j ? j.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, xe = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, $e = "?" + x, je = `<${$e}>`, S = document, T = () => S.createComment(""), N = (t) => t === null || typeof t != "object" && typeof t != "function", ie = Array.isArray, Fe = (t) => ie(t) || typeof t?.[Symbol.iterator] == "function", G = `[
|
|
266
|
+
\f\r]`, D = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, pe = /-->/g, ue = />/g, _ = RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
|
267
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ge = /'/g, fe = /"/g, _e = /^(?:script|style|textarea|title)$/i, Ae = (t) => (e, ...r) => ({ _$litType$: t, strings: e, values: r }), w = Ae(1), F = Ae(2), k = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), me = /* @__PURE__ */ new WeakMap(), A = S.createTreeWalker(S, 129);
|
|
268
|
+
function Se(t, e) {
|
|
269
269
|
if (!ie(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
270
270
|
return he !== void 0 ? he.createHTML(e) : e;
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const qe = (t, e) => {
|
|
273
273
|
const r = t.length - 1, i = [];
|
|
274
|
-
let n, s = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o =
|
|
274
|
+
let n, s = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = D;
|
|
275
275
|
for (let a = 0; a < r; a++) {
|
|
276
276
|
const l = t[a];
|
|
277
277
|
let d, h, c = -1, p = 0;
|
|
278
|
-
for (; p < l.length && (o.lastIndex = p, h = o.exec(l), h !== null); ) p = o.lastIndex, o ===
|
|
278
|
+
for (; p < l.length && (o.lastIndex = p, h = o.exec(l), h !== null); ) p = o.lastIndex, o === D ? h[1] === "!--" ? o = pe : h[1] !== void 0 ? o = ue : h[2] !== void 0 ? (_e.test(h[2]) && (n = RegExp("</" + h[2], "g")), o = _) : h[3] !== void 0 && (o = _) : o === _ ? h[0] === ">" ? (o = n ?? D, c = -1) : h[1] === void 0 ? c = -2 : (c = o.lastIndex - h[2].length, d = h[1], o = h[3] === void 0 ? _ : h[3] === '"' ? fe : ge) : o === fe || o === ge ? o = _ : o === pe || o === ue ? o = D : (o = _, n = void 0);
|
|
279
279
|
const f = o === _ && t[a + 1].startsWith("/>") ? " " : "";
|
|
280
|
-
s += o ===
|
|
280
|
+
s += o === D ? l + je : c >= 0 ? (i.push(d), l.slice(0, c) + xe + l.slice(c) + x + f) : l + x + (c === -2 ? a : f);
|
|
281
281
|
}
|
|
282
|
-
return [
|
|
282
|
+
return [Se(t, s + (t[r] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
283
283
|
};
|
|
284
|
-
class
|
|
284
|
+
class I {
|
|
285
285
|
constructor({ strings: e, _$litType$: r }, i) {
|
|
286
286
|
let n;
|
|
287
287
|
this.parts = [];
|
|
288
288
|
let s = 0, o = 0;
|
|
289
|
-
const a = e.length - 1, l = this.parts, [d, h] =
|
|
290
|
-
if (this.el =
|
|
289
|
+
const a = e.length - 1, l = this.parts, [d, h] = qe(e, r);
|
|
290
|
+
if (this.el = I.createElement(d, i), A.currentNode = this.el.content, r === 2 || r === 3) {
|
|
291
291
|
const c = this.el.content.firstChild;
|
|
292
292
|
c.replaceWith(...c.childNodes);
|
|
293
293
|
}
|
|
294
294
|
for (; (n = A.nextNode()) !== null && l.length < a; ) {
|
|
295
295
|
if (n.nodeType === 1) {
|
|
296
|
-
if (n.hasAttributes()) for (const c of n.getAttributeNames()) if (c.endsWith(
|
|
296
|
+
if (n.hasAttributes()) for (const c of n.getAttributeNames()) if (c.endsWith(xe)) {
|
|
297
297
|
const p = h[o++], f = n.getAttribute(c).split(x), y = /([.?@])?(.*)/.exec(p);
|
|
298
|
-
l.push({ type: 1, index: s, name: y[2], strings: f, ctor: y[1] === "." ? Ve : y[1] === "?" ?
|
|
298
|
+
l.push({ type: 1, index: s, name: y[2], strings: f, ctor: y[1] === "." ? Ve : y[1] === "?" ? Ge : y[1] === "@" ? Ke : Z }), n.removeAttribute(c);
|
|
299
299
|
} else c.startsWith(x) && (l.push({ type: 6, index: s }), n.removeAttribute(c));
|
|
300
|
-
if (
|
|
300
|
+
if (_e.test(n.tagName)) {
|
|
301
301
|
const c = n.textContent.split(x), p = c.length - 1;
|
|
302
302
|
if (p > 0) {
|
|
303
|
-
n.textContent =
|
|
304
|
-
for (let f = 0; f < p; f++) n.append(c[f],
|
|
305
|
-
n.append(c[p],
|
|
303
|
+
n.textContent = j ? j.emptyScript : "";
|
|
304
|
+
for (let f = 0; f < p; f++) n.append(c[f], T()), A.nextNode(), l.push({ type: 2, index: ++s });
|
|
305
|
+
n.append(c[p], T());
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
} else if (n.nodeType === 8) if (n.data ===
|
|
308
|
+
} else if (n.nodeType === 8) if (n.data === $e) l.push({ type: 2, index: s });
|
|
309
309
|
else {
|
|
310
310
|
let c = -1;
|
|
311
311
|
for (; (c = n.data.indexOf(x, c + 1)) !== -1; ) l.push({ type: 7, index: s }), c += x.length - 1;
|
|
@@ -318,13 +318,13 @@ class N {
|
|
|
318
318
|
return i.innerHTML = e, i;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
if (e ===
|
|
321
|
+
function P(t, e, r = t, i) {
|
|
322
|
+
if (e === k) return e;
|
|
323
323
|
let n = i !== void 0 ? r._$Co?.[i] : r._$Cl;
|
|
324
|
-
const s =
|
|
325
|
-
return n?.constructor !== s && (n?._$AO?.(!1), s === void 0 ? n = void 0 : (n = new s(t), n._$AT(t, r, i)), i !== void 0 ? (r._$Co ??= [])[i] = n : r._$Cl = n), n !== void 0 && (e =
|
|
324
|
+
const s = N(e) ? void 0 : e._$litDirective$;
|
|
325
|
+
return n?.constructor !== s && (n?._$AO?.(!1), s === void 0 ? n = void 0 : (n = new s(t), n._$AT(t, r, i)), i !== void 0 ? (r._$Co ??= [])[i] = n : r._$Cl = n), n !== void 0 && (e = P(t, n._$AS(t, e.values), n, i)), e;
|
|
326
326
|
}
|
|
327
|
-
class
|
|
327
|
+
class Ze {
|
|
328
328
|
constructor(e, r) {
|
|
329
329
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = r;
|
|
330
330
|
}
|
|
@@ -341,7 +341,7 @@ class qe {
|
|
|
341
341
|
for (; l !== void 0; ) {
|
|
342
342
|
if (o === l.index) {
|
|
343
343
|
let d;
|
|
344
|
-
l.type === 2 ? d = new
|
|
344
|
+
l.type === 2 ? d = new L(s, s.nextSibling, this, e) : l.type === 1 ? d = new l.ctor(s, l.name, l.strings, this, e) : l.type === 6 && (d = new Ye(s, this, e)), this._$AV.push(d), l = i[++a];
|
|
345
345
|
}
|
|
346
346
|
o !== l?.index && (s = A.nextNode(), o++);
|
|
347
347
|
}
|
|
@@ -352,7 +352,7 @@ class qe {
|
|
|
352
352
|
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, r), r += i.strings.length - 2) : i._$AI(e[r])), r++;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
class
|
|
355
|
+
class L {
|
|
356
356
|
get _$AU() {
|
|
357
357
|
return this._$AM?._$AU ?? this._$Cv;
|
|
358
358
|
}
|
|
@@ -371,7 +371,7 @@ class I {
|
|
|
371
371
|
return this._$AB;
|
|
372
372
|
}
|
|
373
373
|
_$AI(e, r = this) {
|
|
374
|
-
e =
|
|
374
|
+
e = P(this, e, r), N(e) ? e === u || e == null || e === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : e !== this._$AH && e !== k && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Fe(e) ? this.k(e) : this._(e);
|
|
375
375
|
}
|
|
376
376
|
O(e) {
|
|
377
377
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -380,25 +380,25 @@ class I {
|
|
|
380
380
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
381
381
|
}
|
|
382
382
|
_(e) {
|
|
383
|
-
this._$AH !== u &&
|
|
383
|
+
this._$AH !== u && N(this._$AH) ? this._$AA.nextSibling.data = e : this.T(S.createTextNode(e)), this._$AH = e;
|
|
384
384
|
}
|
|
385
385
|
$(e) {
|
|
386
|
-
const { values: r, _$litType$: i } = e, n = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el =
|
|
386
|
+
const { values: r, _$litType$: i } = e, n = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = I.createElement(Se(i.h, i.h[0]), this.options)), i);
|
|
387
387
|
if (this._$AH?._$AD === n) this._$AH.p(r);
|
|
388
388
|
else {
|
|
389
|
-
const s = new
|
|
389
|
+
const s = new Ze(n, this), o = s.u(this.options);
|
|
390
390
|
s.p(r), this.T(o), this._$AH = s;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
_$AC(e) {
|
|
394
394
|
let r = me.get(e.strings);
|
|
395
|
-
return r === void 0 && me.set(e.strings, r = new
|
|
395
|
+
return r === void 0 && me.set(e.strings, r = new I(e)), r;
|
|
396
396
|
}
|
|
397
397
|
k(e) {
|
|
398
398
|
ie(this._$AH) || (this._$AH = [], this._$AR());
|
|
399
399
|
const r = this._$AH;
|
|
400
400
|
let i, n = 0;
|
|
401
|
-
for (const s of e) n === r.length ? r.push(i = new
|
|
401
|
+
for (const s of e) n === r.length ? r.push(i = new L(this.O(T()), this.O(T()), this, this.options)) : i = r[n], i._$AI(s), n++;
|
|
402
402
|
n < r.length && (this._$AR(i && i._$AB.nextSibling, n), r.length = n);
|
|
403
403
|
}
|
|
404
404
|
_$AR(e = this._$AA.nextSibling, r) {
|
|
@@ -411,7 +411,7 @@ class I {
|
|
|
411
411
|
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
class
|
|
414
|
+
class Z {
|
|
415
415
|
get tagName() {
|
|
416
416
|
return this.element.tagName;
|
|
417
417
|
}
|
|
@@ -424,11 +424,11 @@ class V {
|
|
|
424
424
|
_$AI(e, r = this, i, n) {
|
|
425
425
|
const s = this.strings;
|
|
426
426
|
let o = !1;
|
|
427
|
-
if (s === void 0) e =
|
|
427
|
+
if (s === void 0) e = P(this, e, r, 0), o = !N(e) || e !== this._$AH && e !== k, o && (this._$AH = e);
|
|
428
428
|
else {
|
|
429
429
|
const a = e;
|
|
430
430
|
let l, d;
|
|
431
|
-
for (e = s[0], l = 0; l < s.length - 1; l++) d =
|
|
431
|
+
for (e = s[0], l = 0; l < s.length - 1; l++) d = P(this, a[i + l], r, l), d === k && (d = this._$AH[l]), o ||= !N(d) || d !== this._$AH[l], d === u ? e = u : e !== u && (e += (d ?? "") + s[l + 1]), this._$AH[l] = d;
|
|
432
432
|
}
|
|
433
433
|
o && !n && this.j(e);
|
|
434
434
|
}
|
|
@@ -436,7 +436,7 @@ class V {
|
|
|
436
436
|
e === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
class Ve extends
|
|
439
|
+
class Ve extends Z {
|
|
440
440
|
constructor() {
|
|
441
441
|
super(...arguments), this.type = 3;
|
|
442
442
|
}
|
|
@@ -444,7 +444,7 @@ class Ve extends V {
|
|
|
444
444
|
this.element[this.name] = e === u ? void 0 : e;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
class
|
|
447
|
+
class Ge extends Z {
|
|
448
448
|
constructor() {
|
|
449
449
|
super(...arguments), this.type = 4;
|
|
450
450
|
}
|
|
@@ -452,12 +452,12 @@ class Ze extends V {
|
|
|
452
452
|
this.element.toggleAttribute(this.name, !!e && e !== u);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class Ke extends Z {
|
|
456
456
|
constructor(e, r, i, n, s) {
|
|
457
457
|
super(e, r, i, n, s), this.type = 5;
|
|
458
458
|
}
|
|
459
459
|
_$AI(e, r = this) {
|
|
460
|
-
if ((e =
|
|
460
|
+
if ((e = P(this, e, r, 0) ?? u) === k) return;
|
|
461
461
|
const i = this._$AH, n = e === u && i !== u || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, s = e !== u && (i === u || n);
|
|
462
462
|
n && this.element.removeEventListener(this.name, this, i), s && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
463
463
|
}
|
|
@@ -465,7 +465,7 @@ class Ge extends V {
|
|
|
465
465
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
class
|
|
468
|
+
class Ye {
|
|
469
469
|
constructor(e, r, i) {
|
|
470
470
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = i;
|
|
471
471
|
}
|
|
@@ -473,17 +473,17 @@ class Ke {
|
|
|
473
473
|
return this._$AM._$AU;
|
|
474
474
|
}
|
|
475
475
|
_$AI(e) {
|
|
476
|
-
|
|
476
|
+
P(this, e);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
const Je = re.litHtmlPolyfillSupport;
|
|
480
|
-
Je?.(
|
|
481
|
-
const
|
|
480
|
+
Je?.(I, L), (re.litHtmlVersions ??= []).push("3.3.2");
|
|
481
|
+
const Xe = (t, e, r) => {
|
|
482
482
|
const i = r?.renderBefore ?? e;
|
|
483
483
|
let n = i._$litPart$;
|
|
484
484
|
if (n === void 0) {
|
|
485
485
|
const s = r?.renderBefore ?? null;
|
|
486
|
-
i._$litPart$ = n = new
|
|
486
|
+
i._$litPart$ = n = new L(e.insertBefore(T(), s), s, void 0, r ?? {});
|
|
487
487
|
}
|
|
488
488
|
return n._$AI(t), n;
|
|
489
489
|
};
|
|
@@ -493,7 +493,7 @@ const Ye = (t, e, r) => {
|
|
|
493
493
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
494
494
|
*/
|
|
495
495
|
const ne = globalThis;
|
|
496
|
-
class
|
|
496
|
+
class U extends M {
|
|
497
497
|
constructor() {
|
|
498
498
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
499
499
|
}
|
|
@@ -503,7 +503,7 @@ class T extends E {
|
|
|
503
503
|
}
|
|
504
504
|
update(e) {
|
|
505
505
|
const r = this.render();
|
|
506
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
506
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Xe(r, this.renderRoot, this.renderOptions);
|
|
507
507
|
}
|
|
508
508
|
connectedCallback() {
|
|
509
509
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -512,19 +512,19 @@ class T extends E {
|
|
|
512
512
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
513
513
|
}
|
|
514
514
|
render() {
|
|
515
|
-
return
|
|
515
|
+
return k;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
518
|
+
U._$litElement$ = !0, U.finalized = !0, ne.litElementHydrateSupport?.({ LitElement: U });
|
|
519
|
+
const Qe = ne.litElementPolyfillSupport;
|
|
520
|
+
Qe?.({ LitElement: U });
|
|
521
521
|
(ne.litElementVersions ??= []).push("4.2.2");
|
|
522
522
|
/**
|
|
523
523
|
* @license
|
|
524
524
|
* Copyright 2017 Google LLC
|
|
525
525
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
526
526
|
*/
|
|
527
|
-
const
|
|
527
|
+
const et = (t) => (e, r) => {
|
|
528
528
|
r !== void 0 ? r.addInitializer(() => {
|
|
529
529
|
customElements.define(t, e);
|
|
530
530
|
}) : customElements.define(t, e);
|
|
@@ -534,7 +534,7 @@ const Qe = (t) => (e, r) => {
|
|
|
534
534
|
* Copyright 2017 Google LLC
|
|
535
535
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
536
536
|
*/
|
|
537
|
-
const
|
|
537
|
+
const tt = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: te }, rt = (t = tt, e, r) => {
|
|
538
538
|
const { kind: i, metadata: n } = r;
|
|
539
539
|
let s = globalThis.litPropertyMetadata.get(n);
|
|
540
540
|
if (s === void 0 && globalThis.litPropertyMetadata.set(n, s = /* @__PURE__ */ new Map()), i === "setter" && ((t = Object.create(t)).wrapped = !0), s.set(r.name, t), i === "accessor") {
|
|
@@ -555,8 +555,8 @@ const et = { attribute: !0, type: String, converter: j, reflect: !1, hasChanged:
|
|
|
555
555
|
}
|
|
556
556
|
throw Error("Unsupported decorator location: " + i);
|
|
557
557
|
};
|
|
558
|
-
function
|
|
559
|
-
return (e, r) => typeof r == "object" ?
|
|
558
|
+
function R(t) {
|
|
559
|
+
return (e, r) => typeof r == "object" ? rt(t, e, r) : ((i, n, s) => {
|
|
560
560
|
const o = n.hasOwnProperty(s);
|
|
561
561
|
return n.constructor.createProperty(s, i), o ? Object.getOwnPropertyDescriptor(n, s) : void 0;
|
|
562
562
|
})(t, e, r);
|
|
@@ -567,28 +567,28 @@ function B(t) {
|
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
569
|
function v(t) {
|
|
570
|
-
return
|
|
570
|
+
return R({ ...t, state: !0, attribute: !1 });
|
|
571
571
|
}
|
|
572
572
|
/**
|
|
573
573
|
* @license
|
|
574
574
|
* Copyright 2017 Google LLC
|
|
575
575
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
576
576
|
*/
|
|
577
|
-
const
|
|
577
|
+
const it = (t, e, r) => (r.configurable = !0, r.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(t, e, r), r);
|
|
578
578
|
/**
|
|
579
579
|
* @license
|
|
580
580
|
* Copyright 2017 Google LLC
|
|
581
581
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
582
582
|
*/
|
|
583
|
-
function
|
|
583
|
+
function nt(t, e) {
|
|
584
584
|
return (r, i, n) => {
|
|
585
585
|
const s = (o) => o.renderRoot?.querySelector(t) ?? null;
|
|
586
|
-
return
|
|
586
|
+
return it(r, i, { get() {
|
|
587
587
|
return s(this);
|
|
588
588
|
} });
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
const
|
|
591
|
+
const st = Oe`
|
|
592
592
|
:host {
|
|
593
593
|
display: block;
|
|
594
594
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
@@ -1080,29 +1080,21 @@ const nt = Re`
|
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
`,
|
|
1083
|
+
`, ot = F`
|
|
1084
1084
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
1085
1085
|
stroke-linecap="round" stroke-linejoin="round" class="shield-icon">
|
|
1086
1086
|
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
|
|
1087
1087
|
<path d="m9 12 2 2 4-4"/>
|
|
1088
1088
|
</svg>
|
|
1089
|
-
`,
|
|
1089
|
+
`, at = F`
|
|
1090
1090
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
1091
1091
|
stroke-linecap="round" stroke-linejoin="round" class="dropzone-icon">
|
|
1092
1092
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
1093
1093
|
<polyline points="17 8 12 3 7 8"/>
|
|
1094
1094
|
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
1095
1095
|
</svg>
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
1099
|
-
stroke-linecap="round" stroke-linejoin="round" style="width:18px;height:18px">
|
|
1100
|
-
<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/>
|
|
1101
|
-
<circle cx="12" cy="13" r="3"/>
|
|
1102
|
-
</svg>
|
|
1103
|
-
`;
|
|
1104
|
-
const at = 128;
|
|
1105
|
-
function lt(t) {
|
|
1096
|
+
`, lt = 128;
|
|
1097
|
+
function ct(t) {
|
|
1106
1098
|
const e = Math.floor(t.length / 4);
|
|
1107
1099
|
if (e === 0) return 255;
|
|
1108
1100
|
let r = 0;
|
|
@@ -1112,10 +1104,10 @@ function lt(t) {
|
|
|
1112
1104
|
}
|
|
1113
1105
|
return r / e;
|
|
1114
1106
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return
|
|
1107
|
+
function dt(t) {
|
|
1108
|
+
return ct(t) < lt;
|
|
1117
1109
|
}
|
|
1118
|
-
async function
|
|
1110
|
+
async function ht(t) {
|
|
1119
1111
|
let e, r;
|
|
1120
1112
|
try {
|
|
1121
1113
|
const i = await createImageBitmap(t), { width: n, height: s } = i;
|
|
@@ -1123,7 +1115,7 @@ async function dt(t) {
|
|
|
1123
1115
|
return i.close(), t;
|
|
1124
1116
|
r.drawImage(i, 0, 0), i.close();
|
|
1125
1117
|
const o = Math.min(n * s, 1024), a = Math.ceil(Math.sqrt(o * n / s)), l = Math.ceil(Math.sqrt(o * s / n)), d = r.getImageData(0, 0, a, l);
|
|
1126
|
-
if (!
|
|
1118
|
+
if (!dt(d.data))
|
|
1127
1119
|
return await be(e, r, n, s, 1.2);
|
|
1128
1120
|
const c = r.getImageData(0, 0, n, s), p = c.data;
|
|
1129
1121
|
for (let f = 0; f < p.length; f += 4)
|
|
@@ -1146,7 +1138,7 @@ async function be(t, e, r, i, n) {
|
|
|
1146
1138
|
function K(t) {
|
|
1147
1139
|
return Math.max(0, Math.min(255, Math.round(t)));
|
|
1148
1140
|
}
|
|
1149
|
-
async function
|
|
1141
|
+
async function pt(t, e = "eng", r) {
|
|
1150
1142
|
const n = await (await import("./index-Br2RPwqy.js").then((b) => b.i)).createWorker(e, void 0, {
|
|
1151
1143
|
logger: (b) => {
|
|
1152
1144
|
r?.({
|
|
@@ -1173,7 +1165,7 @@ async function ht(t, e = "eng", r) {
|
|
|
1173
1165
|
const b = new OffscreenCanvas(t.naturalWidth, t.naturalHeight);
|
|
1174
1166
|
b.getContext("2d").drawImage(t, 0, 0), s = await b.convertToBlob({ type: "image/png" });
|
|
1175
1167
|
}
|
|
1176
|
-
const l = await
|
|
1168
|
+
const l = await ht(s);
|
|
1177
1169
|
let d;
|
|
1178
1170
|
try {
|
|
1179
1171
|
d = await n.recognize(l);
|
|
@@ -1184,35 +1176,35 @@ async function ht(t, e = "eng", r) {
|
|
|
1184
1176
|
let c = "", p = 0;
|
|
1185
1177
|
const f = d.data.lines ?? [];
|
|
1186
1178
|
for (let b = 0; b < f.length; b++) {
|
|
1187
|
-
const
|
|
1188
|
-
for (let
|
|
1189
|
-
const
|
|
1179
|
+
const V = f[b].words ?? [];
|
|
1180
|
+
for (let z = 0; z < V.length; z++) {
|
|
1181
|
+
const E = V[z], B = E.text, Pe = p, Re = p + B.length;
|
|
1190
1182
|
h.push({
|
|
1191
|
-
text:
|
|
1183
|
+
text: B,
|
|
1192
1184
|
bbox: {
|
|
1193
|
-
x0:
|
|
1194
|
-
y0:
|
|
1195
|
-
x1:
|
|
1196
|
-
y1:
|
|
1185
|
+
x0: E.bbox.x0,
|
|
1186
|
+
y0: E.bbox.y0,
|
|
1187
|
+
x1: E.bbox.x1,
|
|
1188
|
+
y1: E.bbox.y1
|
|
1197
1189
|
},
|
|
1198
|
-
confidence:
|
|
1199
|
-
charStart:
|
|
1200
|
-
charEnd:
|
|
1190
|
+
confidence: E.confidence,
|
|
1191
|
+
charStart: Pe,
|
|
1192
|
+
charEnd: Re,
|
|
1201
1193
|
lineIndex: b
|
|
1202
|
-
}), c +=
|
|
1194
|
+
}), c += B, p += B.length, z < V.length - 1 && (c += " ", p += 1);
|
|
1203
1195
|
}
|
|
1204
1196
|
b < f.length - 1 && (c += `
|
|
1205
1197
|
`, p += 1);
|
|
1206
1198
|
}
|
|
1207
|
-
const y = d.data,
|
|
1208
|
-
return { fullText: c, words: h, imageWidth:
|
|
1199
|
+
const y = d.data, Me = y.imageWidth ?? o, ke = y.imageHeight ?? a;
|
|
1200
|
+
return { fullText: c, words: h, imageWidth: Me, imageHeight: ke };
|
|
1209
1201
|
}
|
|
1210
|
-
function
|
|
1202
|
+
function ut(t, e, r) {
|
|
1211
1203
|
return t.filter((i) => i.charStart < r && i.charEnd > e);
|
|
1212
1204
|
}
|
|
1213
|
-
let $ = null,
|
|
1214
|
-
async function
|
|
1215
|
-
const n = await
|
|
1205
|
+
let $ = null, J = null, ve = !1;
|
|
1206
|
+
async function gt(t, e, r = 0.7, i) {
|
|
1207
|
+
const n = await Ce(e, i);
|
|
1216
1208
|
i?.({
|
|
1217
1209
|
phase: "detecting",
|
|
1218
1210
|
progress: 0,
|
|
@@ -1236,9 +1228,9 @@ async function ut(t, e, r = 0.7, i) {
|
|
|
1236
1228
|
phase: "detecting",
|
|
1237
1229
|
progress: 1,
|
|
1238
1230
|
message: "PII detection complete."
|
|
1239
|
-
}), s.length > 0 && s[0].entity_group != null ?
|
|
1231
|
+
}), s.length > 0 && s[0].entity_group != null ? ft(s, t, r) : mt(s, t, r);
|
|
1240
1232
|
}
|
|
1241
|
-
function
|
|
1233
|
+
function ft(t, e, r) {
|
|
1242
1234
|
let i = 0;
|
|
1243
1235
|
const n = [];
|
|
1244
1236
|
for (const s of t) {
|
|
@@ -1255,7 +1247,7 @@ function gt(t, e, r) {
|
|
|
1255
1247
|
const h = e.slice(l, d);
|
|
1256
1248
|
n.push({
|
|
1257
1249
|
id: `ner-${i++}`,
|
|
1258
|
-
label:
|
|
1250
|
+
label: Ee(o),
|
|
1259
1251
|
text: h || a,
|
|
1260
1252
|
start: l,
|
|
1261
1253
|
end: d,
|
|
@@ -1265,14 +1257,14 @@ function gt(t, e, r) {
|
|
|
1265
1257
|
}
|
|
1266
1258
|
return n;
|
|
1267
1259
|
}
|
|
1268
|
-
function
|
|
1260
|
+
function mt(t, e, r) {
|
|
1269
1261
|
const i = [];
|
|
1270
1262
|
let n = 0, s = [], o = "";
|
|
1271
1263
|
for (const a of t) {
|
|
1272
1264
|
const l = a.entity ?? "";
|
|
1273
1265
|
if (l === "O" || l === "") {
|
|
1274
1266
|
if (s.length > 0) {
|
|
1275
|
-
const c =
|
|
1267
|
+
const c = Y(s, o, e, n++, r);
|
|
1276
1268
|
c && i.push(c), s = [], o = "";
|
|
1277
1269
|
}
|
|
1278
1270
|
continue;
|
|
@@ -1280,7 +1272,7 @@ function ft(t, e, r) {
|
|
|
1280
1272
|
const d = l.substring(0, 2), h = l.includes("-") ? l.substring(2) : l;
|
|
1281
1273
|
if (d === "B-" || h !== o) {
|
|
1282
1274
|
if (s.length > 0) {
|
|
1283
|
-
const c =
|
|
1275
|
+
const c = Y(s, o, e, n++, r);
|
|
1284
1276
|
c && i.push(c);
|
|
1285
1277
|
}
|
|
1286
1278
|
s = [a], o = h;
|
|
@@ -1288,12 +1280,12 @@ function ft(t, e, r) {
|
|
|
1288
1280
|
s.push(a);
|
|
1289
1281
|
}
|
|
1290
1282
|
if (s.length > 0) {
|
|
1291
|
-
const a =
|
|
1283
|
+
const a = Y(s, o, e, n, r);
|
|
1292
1284
|
a && i.push(a);
|
|
1293
1285
|
}
|
|
1294
1286
|
return i;
|
|
1295
1287
|
}
|
|
1296
|
-
function
|
|
1288
|
+
function Y(t, e, r, i, n) {
|
|
1297
1289
|
if (t.length === 0) return null;
|
|
1298
1290
|
const s = t.reduce((c, p) => c + p.score, 0) / t.length;
|
|
1299
1291
|
if (s < n) return null;
|
|
@@ -1317,7 +1309,7 @@ function J(t, e, r, i, n) {
|
|
|
1317
1309
|
}
|
|
1318
1310
|
return {
|
|
1319
1311
|
id: `ner-${i}`,
|
|
1320
|
-
label:
|
|
1312
|
+
label: Ee(e),
|
|
1321
1313
|
text: h,
|
|
1322
1314
|
start: l,
|
|
1323
1315
|
end: d,
|
|
@@ -1332,11 +1324,11 @@ function X(t, e, r) {
|
|
|
1332
1324
|
const n = t.toLowerCase(), s = e.toLowerCase();
|
|
1333
1325
|
return i = n.indexOf(s, r), i !== -1 ? { start: i, end: i + e.length } : r > 0 && (i = n.indexOf(s, 0), i !== -1) ? { start: i, end: i + e.length } : null;
|
|
1334
1326
|
}
|
|
1335
|
-
function
|
|
1327
|
+
function Ee(t) {
|
|
1336
1328
|
return t.startsWith("B-") || t.startsWith("I-") ? t.substring(2) : t;
|
|
1337
1329
|
}
|
|
1338
|
-
async function
|
|
1339
|
-
if ($ &&
|
|
1330
|
+
async function Ce(t, e) {
|
|
1331
|
+
if ($ && J === t)
|
|
1340
1332
|
return $;
|
|
1341
1333
|
e?.({
|
|
1342
1334
|
phase: "loading",
|
|
@@ -1344,7 +1336,7 @@ async function ke(t, e) {
|
|
|
1344
1336
|
message: "Loading PII detection model..."
|
|
1345
1337
|
});
|
|
1346
1338
|
const { pipeline: r, env: i } = await import("./transformers-D4eH6I53.js");
|
|
1347
|
-
i.allowLocalModels = !1;
|
|
1339
|
+
ve || (i.allowLocalModels = !1, ve = !0);
|
|
1348
1340
|
const n = typeof navigator < "u" && /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
1349
1341
|
return $ = await r(
|
|
1350
1342
|
"token-classification",
|
|
@@ -1362,25 +1354,25 @@ async function ke(t, e) {
|
|
|
1362
1354
|
// q4 (~45 MB) vs q8 (~85 MB) — halves the download with minimal accuracy loss
|
|
1363
1355
|
dtype: "q4"
|
|
1364
1356
|
}
|
|
1365
|
-
),
|
|
1357
|
+
), J = t, e?.({
|
|
1366
1358
|
phase: "loading",
|
|
1367
1359
|
progress: 1,
|
|
1368
1360
|
message: "Model loaded."
|
|
1369
1361
|
}), $;
|
|
1370
1362
|
}
|
|
1371
|
-
async function
|
|
1372
|
-
await
|
|
1363
|
+
async function ye(t, e) {
|
|
1364
|
+
await Ce(t, e);
|
|
1373
1365
|
}
|
|
1374
|
-
async function
|
|
1366
|
+
async function bt() {
|
|
1375
1367
|
if ($) {
|
|
1376
1368
|
try {
|
|
1377
1369
|
typeof $.dispose == "function" && await $.dispose();
|
|
1378
1370
|
} catch {
|
|
1379
1371
|
}
|
|
1380
|
-
$ = null,
|
|
1372
|
+
$ = null, J = null;
|
|
1381
1373
|
}
|
|
1382
1374
|
}
|
|
1383
|
-
const
|
|
1375
|
+
const vt = [
|
|
1384
1376
|
// Email addresses
|
|
1385
1377
|
{
|
|
1386
1378
|
label: "EMAIL",
|
|
@@ -1396,15 +1388,20 @@ const bt = [
|
|
|
1396
1388
|
label: "TELEPHONENUM",
|
|
1397
1389
|
pattern: /\+\d{1,3}[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}/g
|
|
1398
1390
|
},
|
|
1399
|
-
// Social Security Numbers (US)
|
|
1391
|
+
// Social Security Numbers (US) — require consistent separators between all
|
|
1392
|
+
// groups (backreference) to avoid matching zip+4 codes like 94102-1234
|
|
1393
|
+
// (which would parse as 941-02-1234 with mixed separators).
|
|
1400
1394
|
{
|
|
1401
1395
|
label: "SSN",
|
|
1402
|
-
pattern: /\b\d{3}[-.\s]
|
|
1396
|
+
pattern: /\b\d{3}([-.\s])\d{2}\1\d{4}\b/g
|
|
1403
1397
|
},
|
|
1404
|
-
// Credit card numbers
|
|
1398
|
+
// Credit card numbers — require exactly 4 groups of 4 digits with a
|
|
1399
|
+
// consistent separator char (space, hyphen, or dot) OR 16 consecutive
|
|
1400
|
+
// digits (OCR may strip spaces). This avoids matching SSNs (9 digits)
|
|
1401
|
+
// and phone numbers (10 digits with different groupings).
|
|
1405
1402
|
{
|
|
1406
1403
|
label: "CREDITCARD",
|
|
1407
|
-
pattern: /\b
|
|
1404
|
+
pattern: /\b\d{4}([ .-])\d{4}\1\d{4}\1\d{4}\b|\b\d{16}\b/g
|
|
1408
1405
|
},
|
|
1409
1406
|
// IP addresses (v4)
|
|
1410
1407
|
{
|
|
@@ -1437,15 +1434,15 @@ const bt = [
|
|
|
1437
1434
|
pattern: /@[a-zA-Z0-9_]{2,30}\b/g
|
|
1438
1435
|
}
|
|
1439
1436
|
];
|
|
1440
|
-
let
|
|
1441
|
-
function
|
|
1437
|
+
let yt = 0;
|
|
1438
|
+
function wt(t) {
|
|
1442
1439
|
const e = [];
|
|
1443
|
-
for (const { label: r, pattern: i } of
|
|
1440
|
+
for (const { label: r, pattern: i } of vt) {
|
|
1444
1441
|
i.lastIndex = 0;
|
|
1445
1442
|
let n;
|
|
1446
1443
|
for (; (n = i.exec(t)) !== null; )
|
|
1447
1444
|
e.push({
|
|
1448
|
-
id: `regex-${
|
|
1445
|
+
id: `regex-${yt++}`,
|
|
1449
1446
|
label: r,
|
|
1450
1447
|
text: n[0],
|
|
1451
1448
|
start: n.index,
|
|
@@ -1454,9 +1451,9 @@ function yt(t) {
|
|
|
1454
1451
|
source: "regex"
|
|
1455
1452
|
});
|
|
1456
1453
|
}
|
|
1457
|
-
return e.sort((r, i) => r.start - i.start || i.end - r.end),
|
|
1454
|
+
return e.sort((r, i) => r.start - i.start || i.end - r.end), xt(e);
|
|
1458
1455
|
}
|
|
1459
|
-
function
|
|
1456
|
+
function xt(t) {
|
|
1460
1457
|
const e = [];
|
|
1461
1458
|
for (const r of t) {
|
|
1462
1459
|
const i = e[e.length - 1];
|
|
@@ -1470,21 +1467,21 @@ function wt(t) {
|
|
|
1470
1467
|
}
|
|
1471
1468
|
return e;
|
|
1472
1469
|
}
|
|
1473
|
-
let
|
|
1474
|
-
function
|
|
1470
|
+
let $t = 0;
|
|
1471
|
+
function _t(t, e, r = 0, i = 0) {
|
|
1475
1472
|
const n = [];
|
|
1476
1473
|
for (const s of t) {
|
|
1477
1474
|
if (s.start == null || s.end == null)
|
|
1478
1475
|
continue;
|
|
1479
|
-
let a =
|
|
1480
|
-
if (a.length === 0 && s.text && (a =
|
|
1476
|
+
let a = ut(e, s.start, s.end);
|
|
1477
|
+
if (a.length === 0 && s.text && (a = At(e, s.text)), a.length === 0)
|
|
1481
1478
|
continue;
|
|
1482
|
-
const l =
|
|
1479
|
+
const l = St(a);
|
|
1483
1480
|
for (const d of l.values()) {
|
|
1484
|
-
const h =
|
|
1481
|
+
const h = Et(d.map((c) => c.bbox));
|
|
1485
1482
|
n.push({
|
|
1486
|
-
id: `redact-${
|
|
1487
|
-
bbox:
|
|
1483
|
+
id: `redact-${$t++}`,
|
|
1484
|
+
bbox: Ct(h, 2, r, i),
|
|
1488
1485
|
source: "auto",
|
|
1489
1486
|
entityId: s.id,
|
|
1490
1487
|
enabled: !0,
|
|
@@ -1494,7 +1491,7 @@ function $t(t, e, r = 0, i = 0) {
|
|
|
1494
1491
|
}
|
|
1495
1492
|
return n;
|
|
1496
1493
|
}
|
|
1497
|
-
function
|
|
1494
|
+
function At(t, e) {
|
|
1498
1495
|
const r = e.toLowerCase().trim();
|
|
1499
1496
|
if (!r) return [];
|
|
1500
1497
|
const i = r.split(/\s+/);
|
|
@@ -1513,7 +1510,7 @@ function _t(t, e) {
|
|
|
1513
1510
|
return o === r || r.includes(o) || o.includes(r);
|
|
1514
1511
|
});
|
|
1515
1512
|
}
|
|
1516
|
-
function
|
|
1513
|
+
function St(t) {
|
|
1517
1514
|
const e = /* @__PURE__ */ new Map();
|
|
1518
1515
|
for (const r of t) {
|
|
1519
1516
|
const i = e.get(r.lineIndex) ?? [];
|
|
@@ -1521,7 +1518,7 @@ function At(t) {
|
|
|
1521
1518
|
}
|
|
1522
1519
|
return e;
|
|
1523
1520
|
}
|
|
1524
|
-
function
|
|
1521
|
+
function Et(t) {
|
|
1525
1522
|
return {
|
|
1526
1523
|
x0: Math.min(...t.map((e) => e.x0)),
|
|
1527
1524
|
y0: Math.min(...t.map((e) => e.y0)),
|
|
@@ -1529,7 +1526,7 @@ function St(t) {
|
|
|
1529
1526
|
y1: Math.max(...t.map((e) => e.y1))
|
|
1530
1527
|
};
|
|
1531
1528
|
}
|
|
1532
|
-
function
|
|
1529
|
+
function Ct(t, e, r = 0, i = 0) {
|
|
1533
1530
|
const n = t.x1 + e, s = t.y1 + e;
|
|
1534
1531
|
return {
|
|
1535
1532
|
x0: Math.max(0, t.x0 - e),
|
|
@@ -1538,7 +1535,7 @@ function kt(t, e, r = 0, i = 0) {
|
|
|
1538
1535
|
y1: i > 0 ? Math.min(i, s) : s
|
|
1539
1536
|
};
|
|
1540
1537
|
}
|
|
1541
|
-
function
|
|
1538
|
+
function Mt(t, e) {
|
|
1542
1539
|
const r = [...t, ...e];
|
|
1543
1540
|
r.sort((n, s) => n.start - s.start || s.end - n.end);
|
|
1544
1541
|
const i = [];
|
|
@@ -1557,8 +1554,8 @@ function Et(t, e) {
|
|
|
1557
1554
|
}
|
|
1558
1555
|
return i;
|
|
1559
1556
|
}
|
|
1560
|
-
async function
|
|
1561
|
-
const r = t instanceof HTMLImageElement ? t.naturalWidth : t.width, i = t instanceof HTMLImageElement ? t.naturalHeight : t.height, n =
|
|
1557
|
+
async function kt(t, e) {
|
|
1558
|
+
const r = t instanceof HTMLImageElement ? t.naturalWidth : t.width, i = t instanceof HTMLImageElement ? t.naturalHeight : t.height, n = Pt(r, i), s = Rt(n);
|
|
1562
1559
|
s.drawImage(t, 0, 0, r, i), s.fillStyle = "#000000";
|
|
1563
1560
|
const o = [];
|
|
1564
1561
|
for (const l of e) {
|
|
@@ -1571,13 +1568,13 @@ async function Ct(t, e) {
|
|
|
1571
1568
|
});
|
|
1572
1569
|
}
|
|
1573
1570
|
return {
|
|
1574
|
-
blob: await
|
|
1571
|
+
blob: await Dt(n),
|
|
1575
1572
|
entities: o,
|
|
1576
1573
|
width: r,
|
|
1577
1574
|
height: i
|
|
1578
1575
|
};
|
|
1579
1576
|
}
|
|
1580
|
-
function
|
|
1577
|
+
function Bt(t, e, r = {
|
|
1581
1578
|
fill: "rgba(0, 0, 0, 0.7)",
|
|
1582
1579
|
stroke: "#ff3333",
|
|
1583
1580
|
lineWidth: 2
|
|
@@ -1588,18 +1585,18 @@ function It(t, e, r = {
|
|
|
1588
1585
|
t.fillStyle = r.fill, t.fillRect(n, s, l, d), t.strokeStyle = r.stroke, t.lineWidth = r.lineWidth, t.strokeRect(n, s, l, d);
|
|
1589
1586
|
}
|
|
1590
1587
|
}
|
|
1591
|
-
function
|
|
1588
|
+
function Pt(t, e) {
|
|
1592
1589
|
if (typeof OffscreenCanvas < "u")
|
|
1593
1590
|
return new OffscreenCanvas(t, e);
|
|
1594
1591
|
const r = document.createElement("canvas");
|
|
1595
1592
|
return r.width = t, r.height = e, r;
|
|
1596
1593
|
}
|
|
1597
|
-
function
|
|
1594
|
+
function Rt(t) {
|
|
1598
1595
|
const e = t.getContext("2d");
|
|
1599
1596
|
if (!e) throw new Error("Could not get 2D canvas context");
|
|
1600
1597
|
return e;
|
|
1601
1598
|
}
|
|
1602
|
-
async function
|
|
1599
|
+
async function Dt(t) {
|
|
1603
1600
|
return t instanceof OffscreenCanvas ? t.convertToBlob({ type: "image/png" }) : new Promise((e, r) => {
|
|
1604
1601
|
t.toBlob(
|
|
1605
1602
|
(i) => {
|
|
@@ -1609,10 +1606,10 @@ async function Ot(t) {
|
|
|
1609
1606
|
);
|
|
1610
1607
|
});
|
|
1611
1608
|
}
|
|
1612
|
-
async function
|
|
1613
|
-
const i = { ...e }, n =
|
|
1609
|
+
async function Ot(t, e, r) {
|
|
1610
|
+
const i = { ...e }, n = Ut(i.memoryMode);
|
|
1614
1611
|
r?.({ phase: "ocr", progress: 0, message: "Starting OCR..." });
|
|
1615
|
-
const s = await
|
|
1612
|
+
const s = await pt(t, i.lang, r);
|
|
1616
1613
|
if (!s.fullText.trim())
|
|
1617
1614
|
return { ocr: s, entities: [], redactions: [] };
|
|
1618
1615
|
r?.({
|
|
@@ -1620,22 +1617,37 @@ async function Rt(t, e, r) {
|
|
|
1620
1617
|
progress: 0,
|
|
1621
1618
|
message: "Detecting personal information..."
|
|
1622
1619
|
});
|
|
1623
|
-
const o = i.useRegex ?
|
|
1624
|
-
n === "low" && await
|
|
1625
|
-
const a = await
|
|
1620
|
+
const o = i.useRegex ? wt(s.fullText) : [];
|
|
1621
|
+
n === "low" && await bt();
|
|
1622
|
+
const a = await gt(s.fullText, i.nerModel, i.minConfidence, r), l = Mt(a, o), d = _t(l, s.words, s.imageWidth, s.imageHeight);
|
|
1626
1623
|
return r?.({
|
|
1627
1624
|
phase: "reviewing",
|
|
1628
1625
|
progress: 1,
|
|
1629
1626
|
message: `Found ${d.length} items to redact.`
|
|
1630
1627
|
}), { ocr: s, entities: l, redactions: d };
|
|
1631
1628
|
}
|
|
1632
|
-
function
|
|
1629
|
+
function Ut(t) {
|
|
1633
1630
|
if (t === "low") return "low";
|
|
1634
1631
|
if (t === "normal") return "normal";
|
|
1635
1632
|
const e = navigator.deviceMemory;
|
|
1636
1633
|
return e !== void 0 && e < 4 ? "low" : "normal";
|
|
1637
1634
|
}
|
|
1638
|
-
const
|
|
1635
|
+
const Tt = {
|
|
1636
|
+
GIVENNAME: "First name",
|
|
1637
|
+
SURNAME: "Last name",
|
|
1638
|
+
EMAIL: "Email address",
|
|
1639
|
+
TELEPHONENUM: "Phone number",
|
|
1640
|
+
STREET: "Street address",
|
|
1641
|
+
CITY: "City",
|
|
1642
|
+
ZIPCODE: "ZIP code",
|
|
1643
|
+
SSN: "Social Security Number",
|
|
1644
|
+
CREDITCARD: "Credit card number",
|
|
1645
|
+
DATE: "Date",
|
|
1646
|
+
URL: "URL",
|
|
1647
|
+
USERNAME: "Username",
|
|
1648
|
+
IP_ADDRESS: "IP address",
|
|
1649
|
+
MANUAL: "Manual redaction"
|
|
1650
|
+
}, C = {
|
|
1639
1651
|
lang: "eng",
|
|
1640
1652
|
nerModel: "onnx-community/multilang-pii-ner-ONNX",
|
|
1641
1653
|
maxFileSize: 20 * 1024 * 1024,
|
|
@@ -1644,14 +1656,14 @@ const O = {
|
|
|
1644
1656
|
useRegex: !0,
|
|
1645
1657
|
memoryMode: "auto"
|
|
1646
1658
|
};
|
|
1647
|
-
var
|
|
1648
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
1659
|
+
var Nt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, m = (t, e, r, i) => {
|
|
1660
|
+
for (var n = i > 1 ? void 0 : i ? It(e, r) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1649
1661
|
(o = t[s]) && (n = (i ? o(e, r, n) : o(n)) || n);
|
|
1650
|
-
return i && n &&
|
|
1662
|
+
return i && n && Nt(e, r, n), n;
|
|
1651
1663
|
};
|
|
1652
|
-
let g = class extends
|
|
1664
|
+
let g = class extends U {
|
|
1653
1665
|
constructor() {
|
|
1654
|
-
super(...arguments), this.lang =
|
|
1666
|
+
super(...arguments), this.lang = C.lang, this.nerModel = C.nerModel, this.maxFileSize = C.maxFileSize, this.minConfidence = C.minConfidence, this.useRegex = C.useRegex, this.phase = "idle", this.progress = 0, this.progressMessage = "", this.errorMessage = "", this.imageUrl = "", this.imageWidth = 0, this.imageHeight = 0, this.redactions = [], this.entities = [], this.ocrResult = null, this.dragOver = !1, this.isDrawing = !1, this.drawMode = !1, this.drawStart = null, this.drawCurrent = null, this.networkRequestCount = 0, this.redactedBlob = null, this.modelCached = !1, this.imageFile = null, this.imageElement = null, this.undoStack = [], this.perfObserver = null;
|
|
1655
1667
|
}
|
|
1656
1668
|
connectedCallback() {
|
|
1657
1669
|
if (super.connectedCallback(), typeof PerformanceObserver < "u") {
|
|
@@ -1678,18 +1690,18 @@ let g = class extends T {
|
|
|
1678
1690
|
if (!e.charging && e.level < 0.2) return;
|
|
1679
1691
|
} catch {
|
|
1680
1692
|
}
|
|
1681
|
-
|
|
1693
|
+
ye(this.nerModel).catch(() => {
|
|
1682
1694
|
});
|
|
1683
1695
|
}
|
|
1684
1696
|
}
|
|
1685
1697
|
// --- Public methods ---
|
|
1686
1698
|
/** Pre-load AI models imperatively. Call this to warm up the cache ahead of time. */
|
|
1687
1699
|
async preload() {
|
|
1688
|
-
await
|
|
1700
|
+
await ye(this.nerModel, (t) => this.handleProgress(t));
|
|
1689
1701
|
}
|
|
1690
1702
|
/** Reset to the initial idle state. */
|
|
1691
1703
|
reset() {
|
|
1692
|
-
this.phase = "idle", this.progress = 0, this.progressMessage = "", this.errorMessage = "", this.redactions = [], this.entities = [], this.ocrResult = null, this.imageFile = null, this.undoStack = [], this.drawMode = !1, this.imageUrl && (URL.revokeObjectURL(this.imageUrl), this.imageUrl = ""), this.imageElement = null, this.redactedBlob = null;
|
|
1704
|
+
this.phase = "idle", this.progress = 0, this.progressMessage = "", this.errorMessage = "", this.redactions = [], this.entities = [], this.ocrResult = null, this.imageFile = null, this.undoStack = [], this.drawMode = !1, this.imageUrl && (URL.revokeObjectURL(this.imageUrl), this.imageUrl = ""), this.imageElement = null, this.redactedBlob = null, delete window.__redactionDone;
|
|
1693
1705
|
}
|
|
1694
1706
|
disconnectedCallback() {
|
|
1695
1707
|
super.disconnectedCallback(), this.imageUrl && URL.revokeObjectURL(this.imageUrl), this.perfObserver?.disconnect(), this.perfObserver = null;
|
|
@@ -1711,7 +1723,7 @@ let g = class extends T {
|
|
|
1711
1723
|
renderTrustBanner() {
|
|
1712
1724
|
return w`
|
|
1713
1725
|
<div class="trust-banner">
|
|
1714
|
-
${
|
|
1726
|
+
${ot}
|
|
1715
1727
|
<span>Your data never leaves your device. All processing happens in
|
|
1716
1728
|
your browser.</span>
|
|
1717
1729
|
</div>
|
|
@@ -1726,7 +1738,7 @@ let g = class extends T {
|
|
|
1726
1738
|
@dragleave=${this.handleDragLeave}
|
|
1727
1739
|
@drop=${this.handleDrop}
|
|
1728
1740
|
>
|
|
1729
|
-
${
|
|
1741
|
+
${at}
|
|
1730
1742
|
<div class="dropzone-text">
|
|
1731
1743
|
<strong>Choose a screenshot</strong> or drag it here
|
|
1732
1744
|
</div>
|
|
@@ -1812,7 +1824,7 @@ let g = class extends T {
|
|
|
1812
1824
|
@pointercancel=${this.handleSvgPointerCancel}
|
|
1813
1825
|
>
|
|
1814
1826
|
${this.redactions.map(
|
|
1815
|
-
(e) =>
|
|
1827
|
+
(e) => F`
|
|
1816
1828
|
<rect
|
|
1817
1829
|
class="redaction-box ${e.enabled ? "" : "disabled"}"
|
|
1818
1830
|
x=${e.bbox.x0}
|
|
@@ -1822,11 +1834,11 @@ let g = class extends T {
|
|
|
1822
1834
|
data-id=${e.id}
|
|
1823
1835
|
@click=${(r) => this.handleRedactionClick(r, e.id)}
|
|
1824
1836
|
>
|
|
1825
|
-
<title>${e.label
|
|
1837
|
+
<title>${this.getDisplayLabel(e.label)}: ${e.enabled ? "enabled" : "disabled"}</title>
|
|
1826
1838
|
</rect>
|
|
1827
1839
|
`
|
|
1828
1840
|
)}
|
|
1829
|
-
${this.isDrawing && this.drawStart && this.drawCurrent ?
|
|
1841
|
+
${this.isDrawing && this.drawStart && this.drawCurrent ? F`
|
|
1830
1842
|
<rect
|
|
1831
1843
|
class="drawing"
|
|
1832
1844
|
x=${Math.min(this.drawStart.x, this.drawCurrent.x)}
|
|
@@ -1855,7 +1867,7 @@ let g = class extends T {
|
|
|
1855
1867
|
r.target.checked
|
|
1856
1868
|
)}
|
|
1857
1869
|
/>
|
|
1858
|
-
<span class="entity-label">${e.label
|
|
1870
|
+
<span class="entity-label">${this.getDisplayLabel(e.label)}</span>
|
|
1859
1871
|
<span class="entity-text"
|
|
1860
1872
|
>${this.getRedactionText(e)}</span
|
|
1861
1873
|
>
|
|
@@ -1918,7 +1930,7 @@ let g = class extends T {
|
|
|
1918
1930
|
r && this.processFile(r), e.value = "";
|
|
1919
1931
|
}
|
|
1920
1932
|
async processFile(t) {
|
|
1921
|
-
if (!
|
|
1933
|
+
if (!C.acceptedTypes.includes(t.type)) {
|
|
1922
1934
|
this.errorMessage = `Unsupported file type: ${t.type}. Please use PNG, JPEG, or WebP.`;
|
|
1923
1935
|
return;
|
|
1924
1936
|
}
|
|
@@ -1933,8 +1945,9 @@ let g = class extends T {
|
|
|
1933
1945
|
const r = {
|
|
1934
1946
|
lang: this.lang,
|
|
1935
1947
|
nerModel: this.nerModel,
|
|
1936
|
-
minConfidence: this.minConfidence
|
|
1937
|
-
|
|
1948
|
+
minConfidence: this.minConfidence,
|
|
1949
|
+
useRegex: this.useRegex
|
|
1950
|
+
}, i = await Ot(
|
|
1938
1951
|
t,
|
|
1939
1952
|
r,
|
|
1940
1953
|
(n) => this.handleProgress(n)
|
|
@@ -2037,7 +2050,7 @@ let g = class extends T {
|
|
|
2037
2050
|
if (this.imageElement) {
|
|
2038
2051
|
this.phase = "exporting", this.progress = 0.5, this.progressMessage = "Rendering redacted image...";
|
|
2039
2052
|
try {
|
|
2040
|
-
const t = await
|
|
2053
|
+
const t = await kt(
|
|
2041
2054
|
this.imageElement,
|
|
2042
2055
|
this.redactions
|
|
2043
2056
|
);
|
|
@@ -2047,7 +2060,7 @@ let g = class extends T {
|
|
|
2047
2060
|
bubbles: !0,
|
|
2048
2061
|
composed: !0
|
|
2049
2062
|
})
|
|
2050
|
-
), this.redactedBlob = t.blob, this.phase = "done";
|
|
2063
|
+
), window.__redactionDone = !0, this.redactedBlob = t.blob, this.phase = "done";
|
|
2051
2064
|
} catch (t) {
|
|
2052
2065
|
console.error("Export error:", t), this.errorMessage = t instanceof Error ? t.message : "Failed to export redacted image.", this.phase = "reviewing";
|
|
2053
2066
|
}
|
|
@@ -2076,6 +2089,10 @@ let g = class extends T {
|
|
|
2076
2089
|
}
|
|
2077
2090
|
}
|
|
2078
2091
|
// --- Helpers ---
|
|
2092
|
+
/** Returns a user-friendly label for an entity type. */
|
|
2093
|
+
getDisplayLabel(t) {
|
|
2094
|
+
return t ? Tt[t] ?? t : "Manual redaction";
|
|
2095
|
+
}
|
|
2079
2096
|
getRedactionText(t) {
|
|
2080
2097
|
return t.source === "manual" ? "(manually drawn)" : !t.entityId || !this.ocrResult ? "" : this.entities.find((r) => r.id === t.entityId)?.text ?? "";
|
|
2081
2098
|
}
|
|
@@ -2084,19 +2101,22 @@ let g = class extends T {
|
|
|
2084
2101
|
this.imageWidth = e.naturalWidth, this.imageHeight = e.naturalHeight;
|
|
2085
2102
|
}
|
|
2086
2103
|
};
|
|
2087
|
-
g.styles =
|
|
2104
|
+
g.styles = st;
|
|
2088
2105
|
m([
|
|
2089
|
-
|
|
2106
|
+
R({ type: String })
|
|
2090
2107
|
], g.prototype, "lang", 2);
|
|
2091
2108
|
m([
|
|
2092
|
-
|
|
2109
|
+
R({ type: String, attribute: "ner-model" })
|
|
2093
2110
|
], g.prototype, "nerModel", 2);
|
|
2094
2111
|
m([
|
|
2095
|
-
|
|
2112
|
+
R({ type: Number, attribute: "max-file-size" })
|
|
2096
2113
|
], g.prototype, "maxFileSize", 2);
|
|
2097
2114
|
m([
|
|
2098
|
-
|
|
2115
|
+
R({ type: Number, attribute: "min-confidence" })
|
|
2099
2116
|
], g.prototype, "minConfidence", 2);
|
|
2117
|
+
m([
|
|
2118
|
+
R({ type: Boolean, attribute: "use-regex" })
|
|
2119
|
+
], g.prototype, "useRegex", 2);
|
|
2100
2120
|
m([
|
|
2101
2121
|
v()
|
|
2102
2122
|
], g.prototype, "phase", 2);
|
|
@@ -2152,12 +2172,12 @@ m([
|
|
|
2152
2172
|
v()
|
|
2153
2173
|
], g.prototype, "modelCached", 2);
|
|
2154
2174
|
m([
|
|
2155
|
-
|
|
2175
|
+
nt(".file-input")
|
|
2156
2176
|
], g.prototype, "fileInput", 2);
|
|
2157
2177
|
g = m([
|
|
2158
|
-
|
|
2178
|
+
et("pii-redactor")
|
|
2159
2179
|
], g);
|
|
2160
|
-
async function
|
|
2180
|
+
async function Ht(t = {}) {
|
|
2161
2181
|
if (!("serviceWorker" in navigator) || !navigator.serviceWorker)
|
|
2162
2182
|
return null;
|
|
2163
2183
|
const e = t.swPath ?? "/pii-redactor-sw.js", r = {};
|
|
@@ -2168,7 +2188,7 @@ async function Bt(t = {}) {
|
|
|
2168
2188
|
return null;
|
|
2169
2189
|
}
|
|
2170
2190
|
}
|
|
2171
|
-
async function
|
|
2191
|
+
async function Wt() {
|
|
2172
2192
|
if (!("serviceWorker" in navigator) || !navigator.serviceWorker)
|
|
2173
2193
|
return !1;
|
|
2174
2194
|
try {
|
|
@@ -2179,23 +2199,23 @@ async function Ht() {
|
|
|
2179
2199
|
}
|
|
2180
2200
|
}
|
|
2181
2201
|
export {
|
|
2182
|
-
|
|
2183
|
-
|
|
2202
|
+
lt as DARK_THRESHOLD,
|
|
2203
|
+
C as DEFAULT_CONFIG,
|
|
2184
2204
|
g as PiiRedactor,
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2205
|
+
Ot as analyzeImage,
|
|
2206
|
+
ct as computeAverageLuminance,
|
|
2207
|
+
gt as detectPiiNer,
|
|
2208
|
+
wt as detectPiiRegex,
|
|
2209
|
+
Bt as drawRedactionPreview,
|
|
2210
|
+
_t as entitiesToRedactions,
|
|
2211
|
+
dt as isDarkBackground,
|
|
2212
|
+
Mt as mergeEntities,
|
|
2213
|
+
ye as preloadNerModel,
|
|
2214
|
+
ht as preprocessForOcr,
|
|
2215
|
+
Ht as registerServiceWorker,
|
|
2216
|
+
bt as releaseNerModel,
|
|
2217
|
+
kt as renderRedactedImage,
|
|
2218
|
+
pt as runOcr,
|
|
2219
|
+
Wt as unregisterServiceWorker
|
|
2200
2220
|
};
|
|
2201
2221
|
//# sourceMappingURL=image-pii-redactor.js.map
|