@exige/web-scanner-sdk 0.2.10 → 0.2.12
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/assets/document-worker.js +1 -1
- package/dist/assets/document-worker.js.map +1 -1
- package/dist/components/scanner-camera-overlay.css +1 -1
- package/dist/{finder-BeINpYm3.js → finder-B8yMQmN9.js} +156 -141
- package/dist/finder-B8yMQmN9.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/react/parts.d.ts +1 -1
- package/dist/react/types.d.ts +18 -1
- package/dist/react.js +262 -226
- package/dist/react.js.map +1 -1
- package/dist/scanner-sdk.js +286 -286
- package/dist/scanner-sdk.js.map +1 -1
- package/dist/sdk/model-download.d.ts +1 -1
- package/package.json +1 -1
- package/dist/finder-BeINpYm3.js.map +0 -1
package/dist/scanner-sdk.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, F as i,
|
|
1
|
+
import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as ee, j as te, k as ne, l as re, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./finder-B8yMQmN9.js";
|
|
2
2
|
//#region src/sdk/frame-geometry.ts
|
|
3
|
-
function
|
|
3
|
+
function b(e, t, n) {
|
|
4
4
|
let r = Math.max(1, t.width), i = Math.max(1, t.height), a = Math.max(1, n.width), o = Math.max(1, n.height), s = Math.max(r / a, i / o), c = (r - a * s) / 2, l = (i - o * s) / 2;
|
|
5
5
|
return {
|
|
6
6
|
x: (e.x - c) / s,
|
|
7
7
|
y: (e.y - l) / s
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function ge(e, t, n) {
|
|
11
11
|
return {
|
|
12
|
-
topLeft:
|
|
13
|
-
topRight:
|
|
14
|
-
bottomRight:
|
|
15
|
-
bottomLeft:
|
|
12
|
+
topLeft: b(e.topLeft, t, n),
|
|
13
|
+
topRight: b(e.topRight, t, n),
|
|
14
|
+
bottomRight: b(e.bottomRight, t, n),
|
|
15
|
+
bottomLeft: b(e.bottomLeft, t, n)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/sdk/finder-simulator.ts
|
|
20
|
-
function
|
|
20
|
+
function x(e, t = 960, n = 600) {
|
|
21
21
|
let r = t * .86, i = n * .86;
|
|
22
22
|
if (e < 1200) {
|
|
23
23
|
let a = e / 1200;
|
|
@@ -50,15 +50,15 @@ function S(e, t = 960, n = 600) {
|
|
|
50
50
|
phase: "settled"
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function S(e, t, n) {
|
|
54
54
|
let r = Math.cos(n.rotation), i = Math.sin(n.rotation);
|
|
55
55
|
return {
|
|
56
56
|
x: n.centerX + e * r - t * i,
|
|
57
57
|
y: n.centerY + e * i + t * r
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
let t =
|
|
60
|
+
function _e(e) {
|
|
61
|
+
let t = S(-e.width / 2, -e.height / 2, e), n = S(e.width / 2, -e.height / 2, e), r = S(e.width / 2, e.height / 2, e), i = S(-e.width / 2, e.height / 2, e);
|
|
62
62
|
return {
|
|
63
63
|
topLeft: t,
|
|
64
64
|
topRight: n,
|
|
@@ -84,20 +84,20 @@ function he(e) {
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function C(e, t) {
|
|
88
88
|
let n = e.getContext("2d");
|
|
89
|
-
if (!n) throw
|
|
89
|
+
if (!n) throw a();
|
|
90
90
|
let r = n.createLinearGradient(0, 0, e.width, e.height);
|
|
91
91
|
r.addColorStop(0, "#16231c"), r.addColorStop(1, "#32443a"), n.fillStyle = r, n.fillRect(0, 0, e.width, e.height), n.save(), n.translate(t.centerX, t.centerY), n.rotate(t.rotation), n.shadowColor = "rgba(0,0,0,.45)", n.shadowBlur = 24, n.fillStyle = "#fffdf4", n.strokeStyle = "#111914", n.lineWidth = 7, n.fillRect(-t.width / 2, -t.height / 2, t.width, t.height), n.strokeRect(-t.width / 2, -t.height / 2, t.width, t.height), n.shadowColor = "transparent";
|
|
92
|
-
let
|
|
93
|
-
n.fillStyle = "#d7ded8", n.fillRect(
|
|
92
|
+
let i = -t.width / 2, o = -t.height / 2;
|
|
93
|
+
n.fillStyle = "#d7ded8", n.fillRect(i + 38, o + 84, 145, 190), n.fillStyle = "#617269", n.beginPath(), n.arc(i + 110, o + 140, 38, 0, Math.PI * 2), n.fill(), n.fillRect(i + 70, o + 185, 80, 65), n.fillStyle = "#17231c", n.font = "700 25px Arial", n.fillText("IDENTITY CARD", i + 38, o + 48), n.font = "700 31px Arial", n.fillText("TAYLOR MORGAN", i + 220, o + 118), n.font = "23px Arial", n.fillText("01/02/1990", i + 220, o + 166), n.fillText("A1234567", i + 220, o + 208), n.fillText("123 MAIN ST", i + 220, o + 270), n.fillText("AUSTIN TX 78701", i + 220, o + 307), n.restore();
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function ve(e) {
|
|
96
96
|
e.width ||= 960, e.height ||= 600;
|
|
97
97
|
let t = !1, n = 0, r = 0, i = (a) => {
|
|
98
|
-
t && (n ||= a,
|
|
98
|
+
t && (n ||= a, C(e, x(a - n, e.width, e.height)), r = requestAnimationFrame(i));
|
|
99
99
|
}, a = () => {
|
|
100
|
-
n = 0,
|
|
100
|
+
n = 0, C(e, x(0, e.width, e.height));
|
|
101
101
|
};
|
|
102
102
|
return a(), {
|
|
103
103
|
start() {
|
|
@@ -111,24 +111,24 @@ function ge(e) {
|
|
|
111
111
|
}
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/sdk/ocr-runtime.ts
|
|
114
|
-
var
|
|
115
|
-
function
|
|
114
|
+
var ye = new URL("./assets/tesseract/worker.min.js", import.meta.url), be = new URL("./assets/tesseract/tesseract-core-lstm.wasm.js", import.meta.url), xe = new URL("./assets/tesseract/tesseract-core-simd-lstm.wasm.js", import.meta.url), Se = new URL("./assets/tesseract/tesseract-core-relaxedsimd-lstm.wasm.js", import.meta.url), Ce = new URL("./assets/tesseract/eng.traineddata.gz", import.meta.url), we = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11), Te = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11);
|
|
115
|
+
function w(e) {
|
|
116
116
|
try {
|
|
117
117
|
return typeof WebAssembly < "u" && WebAssembly.validate(e);
|
|
118
118
|
} catch {
|
|
119
119
|
return !1;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function Ee() {
|
|
123
123
|
return {
|
|
124
|
-
relaxedSimd:
|
|
125
|
-
simd:
|
|
124
|
+
relaxedSimd: w(we),
|
|
125
|
+
simd: w(Te)
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return e.relaxedSimd ?
|
|
128
|
+
function De(e) {
|
|
129
|
+
return e.relaxedSimd ? Se : e.simd ? xe : be;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Oe(e, t) {
|
|
132
132
|
let n = e?.trim() || "eng", r = t?.trim() || "";
|
|
133
133
|
if (r) return {
|
|
134
134
|
kind: "lang-path",
|
|
@@ -139,22 +139,22 @@ function Ee(e, t) {
|
|
|
139
139
|
kind: "bundled-eng",
|
|
140
140
|
language: "eng"
|
|
141
141
|
};
|
|
142
|
-
throw new
|
|
142
|
+
throw new i("language", `OCR language "${n}" is not packaged. Pass langPath, a directory URL that contains ${n}.traineddata.gz.`);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function ke(e = Ce) {
|
|
145
145
|
let t = e.href, n = t.lastIndexOf("/");
|
|
146
146
|
return n === -1 ? t : t.slice(0, n);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return e.kind === "bundled-eng" ?
|
|
148
|
+
function Ae(e) {
|
|
149
|
+
return e.kind === "bundled-eng" ? ke() : e.langPath;
|
|
150
150
|
}
|
|
151
|
-
async function
|
|
152
|
-
return new Promise((r,
|
|
153
|
-
let
|
|
154
|
-
if (
|
|
155
|
-
|
|
151
|
+
async function je(e, t, n) {
|
|
152
|
+
return new Promise((r, a) => {
|
|
153
|
+
let o = !1, s = (e) => {
|
|
154
|
+
if (o) return;
|
|
155
|
+
o = !0;
|
|
156
156
|
let t = e instanceof Error ? e.message : String(e);
|
|
157
|
-
|
|
157
|
+
a(new i("worker", `OCR worker failed to start (${t}).`));
|
|
158
158
|
};
|
|
159
159
|
e(t, void 0, {
|
|
160
160
|
workerPath: n.workerPath,
|
|
@@ -162,19 +162,19 @@ async function ke(e, t, n) {
|
|
|
162
162
|
langPath: n.langPath,
|
|
163
163
|
gzip: !0,
|
|
164
164
|
logger: n.logger,
|
|
165
|
-
errorHandler:
|
|
165
|
+
errorHandler: s
|
|
166
166
|
}).then((e) => {
|
|
167
|
-
if (
|
|
167
|
+
if (o) {
|
|
168
168
|
e.terminate?.();
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
},
|
|
171
|
+
o = !0, r(e);
|
|
172
|
+
}, s);
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/sdk/ocr.ts
|
|
177
|
-
function
|
|
177
|
+
function T(e, t = 1, n = 1, r = 0, i = 0) {
|
|
178
178
|
return {
|
|
179
179
|
text: e.text,
|
|
180
180
|
confidence: Math.max(0, Math.min(1, e.confidence / 100)),
|
|
@@ -186,20 +186,20 @@ function E(e, t = 1, n = 1, r = 0, i = 0) {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function E(e = .5) {
|
|
190
190
|
if (!Number.isFinite(e) || e < 0 || e > 1) throw RangeError("OCR minConfidence must be between 0 and 1.");
|
|
191
191
|
return e;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Me(e, t) {
|
|
194
194
|
let n = Math.max(e.bbox.x, t.bbox.x), r = Math.max(e.bbox.y, t.bbox.y), i = Math.min(e.bbox.x + e.bbox.width, t.bbox.x + t.bbox.width), a = Math.min(e.bbox.y + e.bbox.height, t.bbox.y + t.bbox.height), o = Math.max(0, i - n) * Math.max(0, a - r), s = Math.min(e.bbox.width * e.bbox.height, t.bbox.width * t.bbox.height);
|
|
195
195
|
return s > 0 ? o / s : 0;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function D(e) {
|
|
198
198
|
let t = [...e].sort((e, t) => t.confidence - e.confidence || e.bbox.y - t.bbox.y || e.bbox.x - t.bbox.x || e.text.localeCompare(t.text)), n = [];
|
|
199
|
-
for (let e of t) n.some((t) =>
|
|
199
|
+
for (let e of t) n.some((t) => Me(t, e) >= .65) || n.push(e);
|
|
200
200
|
return n;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function O(e, t, n, r, i) {
|
|
203
203
|
let a = e.text.trim();
|
|
204
204
|
if (!a || !/[\p{L}\p{N}]/u.test(a)) return !1;
|
|
205
205
|
let o = e.bbox.width * e.bbox.height / Math.max(1, n * r), s = e.bbox.width / Math.max(1, e.bbox.height);
|
|
@@ -210,7 +210,7 @@ function k(e, t, n, r, i) {
|
|
|
210
210
|
}
|
|
211
211
|
return !0;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Ne(e) {
|
|
214
214
|
let t = [...e].sort((e, t) => e.bbox.y + e.bbox.height / 2 - (t.bbox.y + t.bbox.height / 2) || e.bbox.x - t.bbox.x), n = [];
|
|
215
215
|
for (let e of t) {
|
|
216
216
|
let t = e.bbox.y + e.bbox.height / 2, r = n.find((n) => Math.abs(n.centerY - t) <= Math.max(n.height, e.bbox.height) * .6);
|
|
@@ -226,28 +226,28 @@ function je(e) {
|
|
|
226
226
|
}
|
|
227
227
|
return n.sort((e, t) => e.centerY - t.centerY).map((e) => e.words.sort((e, t) => e.bbox.x - t.bbox.x).map((e) => e.text.trim()).join(" ")).join("\n");
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
let i =
|
|
229
|
+
function k(e, t, n, r) {
|
|
230
|
+
let i = E(t.minConfidence), a = [], o = [], s = 1, c = 1;
|
|
231
231
|
for (let t of e) {
|
|
232
232
|
let e = t.scaleX ?? 1, n = t.scaleY ?? 1, r = t.offsetX ?? 0, l = t.offsetY ?? 0;
|
|
233
233
|
for (let u of t.blocks ?? []) for (let t of u.paragraphs) for (let u of t.lines) for (let t of u.words) {
|
|
234
|
-
let u =
|
|
234
|
+
let u = T(t, e, n, r, l);
|
|
235
235
|
s = Math.max(s, u.bbox.x + u.bbox.width), c = Math.max(c, u.bbox.y + u.bbox.height), u.confidence >= i && a.push(u);
|
|
236
236
|
for (let a of t.symbols) {
|
|
237
|
-
let t =
|
|
237
|
+
let t = T(a, e, n, r, l);
|
|
238
238
|
t.confidence >= i && o.push(t);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
let l = n?.width ?? s, u = n?.height ?? c, d =
|
|
242
|
+
let l = n?.width ?? s, u = n?.height ?? c, d = D(a).filter((e) => O(e, "word", l, u, r)), f = D(o).filter((e) => O(e, "character", l, u, r));
|
|
243
243
|
return {
|
|
244
|
-
text:
|
|
244
|
+
text: Ne(d),
|
|
245
245
|
confidence: d.length ? d.reduce((e, t) => e + t.confidence, 0) / d.length : 0,
|
|
246
246
|
words: t.includeWords ? d : [],
|
|
247
247
|
characters: t.includeCharacters ? f : []
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function Pe(e) {
|
|
251
251
|
let t = /* @__PURE__ */ new Uint32Array(256);
|
|
252
252
|
for (let n of e) t[n] += 1;
|
|
253
253
|
let n = 0;
|
|
@@ -263,9 +263,9 @@ function Me(e) {
|
|
|
263
263
|
}
|
|
264
264
|
return o;
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function A(e) {
|
|
267
267
|
let t = e.getContext("2d", { willReadFrequently: !0 });
|
|
268
|
-
if (!t) throw
|
|
268
|
+
if (!t) throw a();
|
|
269
269
|
let n = t.getImageData(0, 0, e.width, e.height), r = new Uint8Array(e.width * e.height);
|
|
270
270
|
for (let e = 0, t = 0; e < r.length; e += 1, t += 4) r[e] = Math.round(n.data[t] * .299 + n.data[t + 1] * .587 + n.data[t + 2] * .114);
|
|
271
271
|
return {
|
|
@@ -274,17 +274,17 @@ function j(e) {
|
|
|
274
274
|
luminance: r
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
let t = 1800, n = Math.max(e.width, e.height), r = n > t ? t / n : Math.min(2, t / Math.max(1, n)),
|
|
279
|
-
|
|
280
|
-
let o =
|
|
281
|
-
if (!o) throw
|
|
282
|
-
o.drawImage(e, 0, 0,
|
|
283
|
-
let { image: s, luminance: c } =
|
|
277
|
+
function Fe(e) {
|
|
278
|
+
let t = 1800, n = Math.max(e.width, e.height), r = n > t ? t / n : Math.min(2, t / Math.max(1, n)), i = document.createElement("canvas");
|
|
279
|
+
i.width = Math.max(1, Math.round(e.width * r)), i.height = Math.max(1, Math.round(e.height * r));
|
|
280
|
+
let o = i.getContext("2d", { willReadFrequently: !0 });
|
|
281
|
+
if (!o) throw a();
|
|
282
|
+
o.drawImage(e, 0, 0, i.width, i.height);
|
|
283
|
+
let { image: s, luminance: c } = A(i), l = re(c, i.width, i.height);
|
|
284
284
|
for (let e = 0, t = 0; e < l.length; e += 1, t += 4) s.data[t] = l[e], s.data[t + 1] = l[e], s.data[t + 2] = l[e], s.data[t + 3] = 255;
|
|
285
|
-
return o.putImageData(s, 0, 0),
|
|
285
|
+
return o.putImageData(s, 0, 0), i;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Ie(e) {
|
|
288
288
|
let t = document.createElement("canvas");
|
|
289
289
|
t.width = 72, t.height = 72;
|
|
290
290
|
let n = t.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -295,19 +295,19 @@ function Pe(e) {
|
|
|
295
295
|
areaRatio: 0
|
|
296
296
|
};
|
|
297
297
|
n.drawImage(e, 0, 0, t.width, t.height);
|
|
298
|
-
let { luminance: r } =
|
|
299
|
-
return
|
|
298
|
+
let { luminance: r } = A(t);
|
|
299
|
+
return h(r, t.width, t.height);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function Le(e, t, n, r) {
|
|
302
302
|
let i = (e.bbox.x + e.bbox.width / 2) / n, a = (e.bbox.y + e.bbox.height / 2) / r;
|
|
303
303
|
return i >= t.x && i <= t.x + t.width && a >= t.y && a <= t.y + t.height;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Re(e, t, n) {
|
|
306
306
|
if (!e.strong || !e.region) return !1;
|
|
307
|
-
let r = t.filter((t) =>
|
|
307
|
+
let r = t.filter((t) => Le(t, e.region, n.width, n.height)).length, i = t.length - r, a = e.region.width * e.region.height, o = i > 0 && a < .95 ? i / (1 - a) * a : 3;
|
|
308
308
|
return r < Math.max(3, o * .85);
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function ze(e, t, n, r) {
|
|
311
311
|
let i = Math.max(0, Math.floor(t.x * e.width)), a = Math.max(0, Math.floor(t.y * e.height)), o = Math.min(e.width, Math.ceil((t.x + t.width) * e.width)), s = Math.min(e.height, Math.ceil((t.y + t.height) * e.height)), c = document.createElement("canvas");
|
|
312
312
|
c.width = Math.max(1, o - i), c.height = Math.max(1, s - a), c.getContext("2d")?.drawImage(e, i, a, c.width, c.height, 0, 0, c.width, c.height);
|
|
313
313
|
let l = n / e.width, u = r / e.height;
|
|
@@ -321,22 +321,22 @@ function Le(e, t, n, r) {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function
|
|
325
|
-
let t = 2200, n = Math.max(e.width, e.height), r = n > t ? t / n : Math.min(1.5, t / Math.max(1, n)),
|
|
326
|
-
|
|
327
|
-
let o =
|
|
328
|
-
if (!o) throw
|
|
329
|
-
o.drawImage(e, 0, 0,
|
|
330
|
-
let s = o.getImageData(0, 0,
|
|
324
|
+
function Be(e) {
|
|
325
|
+
let t = 2200, n = Math.max(e.width, e.height), r = n > t ? t / n : Math.min(1.5, t / Math.max(1, n)), i = document.createElement("canvas");
|
|
326
|
+
i.width = Math.max(1, Math.round(e.width * r)), i.height = Math.max(1, Math.round(e.height * r));
|
|
327
|
+
let o = i.getContext("2d", { willReadFrequently: !0 });
|
|
328
|
+
if (!o) throw a();
|
|
329
|
+
o.drawImage(e, 0, 0, i.width, i.height);
|
|
330
|
+
let s = o.getImageData(0, 0, i.width, i.height), c = new Uint8Array(i.width * i.height);
|
|
331
331
|
for (let e = 0, t = 0; e < c.length; e += 1, t += 4) c[e] = Math.round(s.data[t] * .299 + s.data[t + 1] * .587 + s.data[t + 2] * .114);
|
|
332
|
-
let l =
|
|
332
|
+
let l = Pe(c);
|
|
333
333
|
for (let e = 0, t = 0; e < c.length; e += 1, t += 4) {
|
|
334
334
|
let n = c[e] <= l ? 0 : 255;
|
|
335
335
|
s.data[t] = n, s.data[t + 1] = n, s.data[t + 2] = n, s.data[t + 3] = 255;
|
|
336
336
|
}
|
|
337
|
-
return o.putImageData(s, 0, 0),
|
|
337
|
+
return o.putImageData(s, 0, 0), i;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Ve(e) {
|
|
340
340
|
let t = document.createElement("canvas");
|
|
341
341
|
t.width = 24, t.height = 24;
|
|
342
342
|
let n = t.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -354,58 +354,58 @@ function ze(e) {
|
|
|
354
354
|
return l / s.length;
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
async function
|
|
358
|
-
await
|
|
359
|
-
let r =
|
|
360
|
-
|
|
361
|
-
let a = await n(e, { cloneCanvas: !1 }),
|
|
357
|
+
async function j(e, t = {}) {
|
|
358
|
+
await o("ocr");
|
|
359
|
+
let r = Oe(t.language, t.langPath), i = r.language;
|
|
360
|
+
E(t.minConfidence);
|
|
361
|
+
let a = await n(e, { cloneCanvas: !1 }), s = Be(a), c = t.shadowPass === !1 ? {
|
|
362
362
|
strong: !1,
|
|
363
363
|
strength: 0,
|
|
364
364
|
darkness: 0,
|
|
365
365
|
areaRatio: 0
|
|
366
|
-
} :
|
|
367
|
-
workerPath:
|
|
368
|
-
corePath:
|
|
369
|
-
langPath:
|
|
366
|
+
} : Ie(a), { createWorker: l, PSM: u } = await import("tesseract.js"), d = 0, f = c.strong ? 3 : 2, p = await je(l, i, {
|
|
367
|
+
workerPath: ye.href,
|
|
368
|
+
corePath: De(Ee()).href,
|
|
369
|
+
langPath: Ae(r),
|
|
370
370
|
logger(e) {
|
|
371
|
-
typeof e.progress == "number" && t.onProgress?.(Math.min(1, (
|
|
371
|
+
typeof e.progress == "number" && t.onProgress?.(Math.min(1, (d + e.progress) / f), e.status ?? "recognizing text");
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
try {
|
|
375
|
-
await
|
|
376
|
-
let e = await
|
|
375
|
+
await p.setParameters({ tessedit_pageseg_mode: u.AUTO });
|
|
376
|
+
let e = await p.recognize(a, {}, {
|
|
377
377
|
text: !0,
|
|
378
378
|
blocks: !0
|
|
379
379
|
});
|
|
380
|
-
|
|
381
|
-
tessedit_pageseg_mode:
|
|
380
|
+
d = 1, await p.setParameters({
|
|
381
|
+
tessedit_pageseg_mode: u.SPARSE_TEXT,
|
|
382
382
|
preserve_interword_spaces: "1"
|
|
383
383
|
});
|
|
384
|
-
let n = await
|
|
384
|
+
let n = await p.recognize(s, {}, {
|
|
385
385
|
text: !0,
|
|
386
386
|
blocks: !0
|
|
387
387
|
}), r = [{ blocks: e.data.blocks }, {
|
|
388
388
|
blocks: n.data.blocks,
|
|
389
|
-
scaleX: a.width /
|
|
390
|
-
scaleY: a.height /
|
|
391
|
-
}],
|
|
389
|
+
scaleX: a.width / s.width,
|
|
390
|
+
scaleY: a.height / s.height
|
|
391
|
+
}], o = {
|
|
392
392
|
...t,
|
|
393
393
|
includeWords: !0
|
|
394
|
-
},
|
|
394
|
+
}, l = Ve(a), f = k(r, o, {
|
|
395
395
|
width: a.width,
|
|
396
396
|
height: a.height
|
|
397
|
-
},
|
|
397
|
+
}, l), m = t.shadowPass !== !1 && Re(c, f.words, {
|
|
398
398
|
width: a.width,
|
|
399
399
|
height: a.height
|
|
400
400
|
});
|
|
401
|
-
if (m &&
|
|
402
|
-
|
|
403
|
-
let { tile: e, passMapping: t } =
|
|
404
|
-
await
|
|
405
|
-
tessedit_pageseg_mode:
|
|
401
|
+
if (m && c.region) {
|
|
402
|
+
d = 2;
|
|
403
|
+
let { tile: e, passMapping: t } = ze(Fe(a), c.region, a.width, a.height);
|
|
404
|
+
await p.setParameters({
|
|
405
|
+
tessedit_pageseg_mode: u.SPARSE_TEXT,
|
|
406
406
|
preserve_interword_spaces: "1"
|
|
407
407
|
});
|
|
408
|
-
let n = await
|
|
408
|
+
let n = await p.recognize(e, {}, {
|
|
409
409
|
text: !0,
|
|
410
410
|
blocks: !0
|
|
411
411
|
});
|
|
@@ -414,10 +414,10 @@ async function M(e, t = {}) {
|
|
|
414
414
|
...t
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
-
let h = r.length === 2 ?
|
|
417
|
+
let h = r.length === 2 ? f : k(r, o, {
|
|
418
418
|
width: a.width,
|
|
419
419
|
height: a.height
|
|
420
|
-
},
|
|
420
|
+
}, l);
|
|
421
421
|
return t.onProgress?.(1, "recognizing text"), {
|
|
422
422
|
text: h.text,
|
|
423
423
|
confidence: h.confidence,
|
|
@@ -426,55 +426,55 @@ async function M(e, t = {}) {
|
|
|
426
426
|
imageHeight: a.height,
|
|
427
427
|
diagnostics: {
|
|
428
428
|
shadowPassUsed: m,
|
|
429
|
-
castShadowStrength:
|
|
430
|
-
shadowRegion:
|
|
431
|
-
x:
|
|
432
|
-
y:
|
|
433
|
-
width:
|
|
434
|
-
height:
|
|
429
|
+
castShadowStrength: c.strength,
|
|
430
|
+
shadowRegion: c.region ? {
|
|
431
|
+
x: c.region.x * a.width,
|
|
432
|
+
y: c.region.y * a.height,
|
|
433
|
+
width: c.region.width * a.width,
|
|
434
|
+
height: c.region.height * a.height
|
|
435
435
|
} : void 0
|
|
436
436
|
},
|
|
437
437
|
...t.includeWords ? { words: h.words } : {},
|
|
438
438
|
...t.includeCharacters ? { characters: h.characters } : {}
|
|
439
439
|
};
|
|
440
440
|
} finally {
|
|
441
|
-
await
|
|
441
|
+
await p.terminate();
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
//#endregion
|
|
445
445
|
//#region src/sdk/redact.ts
|
|
446
|
-
async function
|
|
447
|
-
await
|
|
448
|
-
let
|
|
449
|
-
if (!
|
|
446
|
+
async function M(e, t, i = {}) {
|
|
447
|
+
await o("redaction");
|
|
448
|
+
let s = await n(e), c = s.getContext("2d");
|
|
449
|
+
if (!c) throw a();
|
|
450
450
|
for (let e of t) {
|
|
451
|
-
let t = r(e,
|
|
451
|
+
let t = r(e, s.width, s.height);
|
|
452
452
|
if (t.width < 1 || t.height < 1) continue;
|
|
453
|
-
if ((e.mode ??
|
|
454
|
-
|
|
453
|
+
if ((e.mode ?? i.mode ?? "blackout") === "blackout") {
|
|
454
|
+
c.fillStyle = "#050706", c.fillRect(t.x, t.y, t.width, t.height);
|
|
455
455
|
continue;
|
|
456
456
|
}
|
|
457
457
|
let n = document.createElement("canvas");
|
|
458
458
|
n.width = Math.ceil(t.width), n.height = Math.ceil(t.height);
|
|
459
|
-
let
|
|
460
|
-
if (!
|
|
461
|
-
|
|
462
|
-
let
|
|
463
|
-
|
|
459
|
+
let a = n.getContext("2d");
|
|
460
|
+
if (!a) continue;
|
|
461
|
+
a.filter = `blur(${i.blurRadius ?? 18}px)`;
|
|
462
|
+
let o = Math.max(12, i.blurRadius ?? 18);
|
|
463
|
+
a.drawImage(s, t.x - o, t.y - o, t.width + o * 2, t.height + o * 2, -o, -o, t.width + o * 2, t.height + o * 2), c.drawImage(n, t.x, t.y, t.width, t.height);
|
|
464
464
|
}
|
|
465
465
|
return {
|
|
466
|
-
canvas:
|
|
467
|
-
blob: await
|
|
466
|
+
canvas: s,
|
|
467
|
+
blob: await d(s, i.mimeType ?? "image/png", i.quality)
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
470
|
//#endregion
|
|
471
471
|
//#region src/sdk/face-model.ts
|
|
472
|
-
var
|
|
473
|
-
function
|
|
472
|
+
var N = /* @__PURE__ */ new Map(), He = 8400;
|
|
473
|
+
function Ue(e, t) {
|
|
474
474
|
let n = Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
|
|
475
475
|
return n / Math.max(1, e.width * e.height + t.width * t.height - n);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function We(e, t, n, r, i, a, o) {
|
|
478
478
|
return {
|
|
479
479
|
x: (e - n / 2) / i * a,
|
|
480
480
|
y: (t - r / 2) / i * o,
|
|
@@ -482,48 +482,48 @@ function He(e, t, n, r, i, a, o) {
|
|
|
482
482
|
height: r / i * o
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function Ge(e, t, n) {
|
|
486
486
|
let r = t.length === 3 ? t[1] : t[0], i = t.length === 3 ? t[2] : t[1];
|
|
487
|
-
if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${
|
|
487
|
+
if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${He}, 6].`);
|
|
488
488
|
let a = n.confidence ?? .35, o = n.inputSize ?? 640, s = [];
|
|
489
489
|
for (let t = 0; t < r; t += 1) {
|
|
490
490
|
let r = t * i, c = e[r + 4] * e[r + 5];
|
|
491
491
|
c < a || s.push({
|
|
492
492
|
confidence: c,
|
|
493
|
-
bbox:
|
|
493
|
+
bbox: We(e[r], e[r + 1], e[r + 2], e[r + 3], o, n.imageWidth, n.imageHeight)
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
-
return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) =>
|
|
496
|
+
return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => Ue(e.bbox, t.bbox) < .45)).slice(0, 8);
|
|
497
497
|
}
|
|
498
|
-
async function
|
|
499
|
-
let
|
|
498
|
+
async function Ke(e, t, r = .35) {
|
|
499
|
+
let i = await n(e, { cloneCanvas: !1 }), o = await import("onnxruntime-web"), s = document.createElement("canvas");
|
|
500
500
|
s.width = 640, s.height = 640;
|
|
501
501
|
let c = s.getContext("2d", { willReadFrequently: !0 });
|
|
502
|
-
if (!c) throw
|
|
503
|
-
c.drawImage(
|
|
502
|
+
if (!c) throw a();
|
|
503
|
+
c.drawImage(i, 0, 0, 640, 640);
|
|
504
504
|
let l = c.getImageData(0, 0, 640, 640).data, u = 409600, d = new Float32Array(u * 3);
|
|
505
505
|
for (let e = 0; e < u; e += 1) d[e] = l[e * 4] / 255, d[u + e] = l[e * 4 + 1] / 255, d[u * 2 + e] = l[e * 4 + 2] / 255;
|
|
506
|
-
let f =
|
|
506
|
+
let f = N.get(t);
|
|
507
507
|
f || (f = o.InferenceSession.create(t, {
|
|
508
508
|
executionProviders: ["wasm"],
|
|
509
509
|
graphOptimizationLevel: "all"
|
|
510
|
-
}),
|
|
510
|
+
}), N.set(t, f));
|
|
511
511
|
let p = await f, m = (await p.run({ [p.inputNames[0]]: new o.Tensor("float32", d, [
|
|
512
512
|
1,
|
|
513
513
|
3,
|
|
514
514
|
640,
|
|
515
515
|
640
|
|
516
516
|
]) }))[p.outputNames[0]];
|
|
517
|
-
return
|
|
517
|
+
return Ge(m.data, m.dims.map(Number), {
|
|
518
518
|
confidence: r,
|
|
519
|
-
imageWidth:
|
|
520
|
-
imageHeight:
|
|
519
|
+
imageWidth: i.width,
|
|
520
|
+
imageHeight: i.height,
|
|
521
521
|
inputSize: 640
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
524
|
//#endregion
|
|
525
525
|
//#region src/sdk/field-model.ts
|
|
526
|
-
var
|
|
526
|
+
var P = /* @__PURE__ */ new Map(), F = [
|
|
527
527
|
"person_name",
|
|
528
528
|
"date_of_birth",
|
|
529
529
|
"address",
|
|
@@ -531,19 +531,19 @@ var F = /* @__PURE__ */ new Map(), I = [
|
|
|
531
531
|
"expiration_date",
|
|
532
532
|
"postal_code",
|
|
533
533
|
"state"
|
|
534
|
-
],
|
|
535
|
-
function
|
|
534
|
+
], qe = 8400;
|
|
535
|
+
function I(e) {
|
|
536
536
|
return 5 + e;
|
|
537
537
|
}
|
|
538
|
-
var
|
|
539
|
-
function
|
|
538
|
+
var L = 640;
|
|
539
|
+
function Je(e, t) {
|
|
540
540
|
let n = Math.max(0, Math.min(e.bbox.x + e.bbox.width, t.bbox.x + t.bbox.width) - Math.max(e.bbox.x, t.bbox.x)) * Math.max(0, Math.min(e.bbox.y + e.bbox.height, t.bbox.y + t.bbox.height) - Math.max(e.bbox.y, t.bbox.y));
|
|
541
541
|
return n / Math.max(1, e.bbox.width * e.bbox.height + t.bbox.width * t.bbox.height - n);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field ||
|
|
543
|
+
function R(e) {
|
|
544
|
+
return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field || Je(e, t) < .45)).slice(0, 30);
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function z(e, t, n, r, i, a, o) {
|
|
547
547
|
return {
|
|
548
548
|
x: (e - n / 2) / i * a,
|
|
549
549
|
y: (t - r / 2) / i * o,
|
|
@@ -551,8 +551,8 @@ function B(e, t, n, r, i, a, o) {
|
|
|
551
551
|
height: r / i * o
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
let n =
|
|
554
|
+
function B(e, t) {
|
|
555
|
+
let n = I(t);
|
|
556
556
|
return e.length === 3 && e[0] === 1 && e[2] === n && e[1] > e[2] ? {
|
|
557
557
|
anchors: e[1],
|
|
558
558
|
features: n
|
|
@@ -561,15 +561,15 @@ function V(e, t) {
|
|
|
561
561
|
features: n
|
|
562
562
|
} : null;
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Ye(e) {
|
|
565
565
|
return e.length === 3 && e[1] >= 5 && e[2] >= 1;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
let t =
|
|
569
|
-
return /* @__PURE__ */ Error(`YOLOX field layout expects [1, anchors, ${t}] (cx, cy, w, h, objectness, ${e} class scores). A 640 YOLOX-Nano export with decode baked in is [1, ${
|
|
567
|
+
function Xe(e) {
|
|
568
|
+
let t = I(e);
|
|
569
|
+
return /* @__PURE__ */ Error(`YOLOX field layout expects [1, anchors, ${t}] (cx, cy, w, h, objectness, ${e} class scores). A 640 YOLOX-Nano export with decode baked in is [1, ${qe}, ${t}].`);
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
if (!
|
|
571
|
+
function Ze(e, t, n, r, i, a, o) {
|
|
572
|
+
if (!Ye(t)) throw Error("Unsupported field-model YOLO output shape.");
|
|
573
573
|
let s = t[1], c = t[2], l = [];
|
|
574
574
|
for (let t = 0; t < c; t += 1) {
|
|
575
575
|
let u = 0, d = 0;
|
|
@@ -581,14 +581,14 @@ function Ye(e, t, n, r, i, a, o) {
|
|
|
581
581
|
!f || u < r || l.push({
|
|
582
582
|
field: f,
|
|
583
583
|
confidence: u,
|
|
584
|
-
bbox:
|
|
584
|
+
bbox: z(e[t], e[c + t], e[c * 2 + t], e[c * 3 + t], i, a, o)
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
return
|
|
587
|
+
return R(l);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
let s =
|
|
591
|
-
if (!s) throw
|
|
589
|
+
function Qe(e, t, n, r, i, a, o) {
|
|
590
|
+
let s = B(t, n.length);
|
|
591
|
+
if (!s) throw Xe(n.length);
|
|
592
592
|
let c = [];
|
|
593
593
|
for (let t = 0; t < s.anchors; t += 1) {
|
|
594
594
|
let l = t * s.features, u = e[l + 4], d = 0, f = 0;
|
|
@@ -600,54 +600,54 @@ function Xe(e, t, n, r, i, a, o) {
|
|
|
600
600
|
!p || m < r || c.push({
|
|
601
601
|
field: p,
|
|
602
602
|
confidence: m,
|
|
603
|
-
bbox:
|
|
603
|
+
bbox: z(e[l], e[l + 1], e[l + 2], e[l + 3], i, a, o)
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
return
|
|
606
|
+
return R(c);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
let r = n.classes ??
|
|
608
|
+
function $e(e, t, n) {
|
|
609
|
+
let r = n.classes ?? F, i = n.confidence ?? .35, a = n.inputSize ?? L, o = B(t, r.length);
|
|
610
610
|
if (n.layout === "yolov8" && o) throw Error("This tensor is YOLOX [1, anchors, 5+classes]. Pass fieldLayout: 'yolox', or omit fieldLayout to detect it from the shape.");
|
|
611
|
-
return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ?
|
|
611
|
+
return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ? Qe(e, t, r, i, a, n.imageWidth, n.imageHeight) : Ze(e, t, r, i, a, n.imageWidth, n.imageHeight);
|
|
612
612
|
}
|
|
613
|
-
async function
|
|
614
|
-
let
|
|
613
|
+
async function et(e, t, r = F, i = .35, o) {
|
|
614
|
+
let s = await n(e, { cloneCanvas: !1 }), l = import("onnxruntime-web"), u = L, d = document.createElement("canvas");
|
|
615
615
|
d.width = u, d.height = u;
|
|
616
616
|
let f = d.getContext("2d", { willReadFrequently: !0 });
|
|
617
|
-
if (!f) throw
|
|
618
|
-
f.drawImage(
|
|
617
|
+
if (!f) throw a();
|
|
618
|
+
f.drawImage(s, 0, 0, u, u);
|
|
619
619
|
let p = f.getImageData(0, 0, u, u).data, m = u * u, h = new Float32Array(m * 3);
|
|
620
620
|
for (let e = 0; e < m; e += 1) h[e] = p[e * 4] / 255, h[m + e] = p[e * 4 + 1] / 255, h[m * 2 + e] = p[e * 4 + 2] / 255;
|
|
621
|
-
let g =
|
|
621
|
+
let g = P.get(t);
|
|
622
622
|
g || (g = (async () => {
|
|
623
623
|
try {
|
|
624
|
-
let [e, n] = await Promise.all([l,
|
|
624
|
+
let [e, n] = await Promise.all([l, c(t)]);
|
|
625
625
|
return await e.InferenceSession.create(n, {
|
|
626
626
|
executionProviders: ["wasm"],
|
|
627
627
|
graphOptimizationLevel: "all"
|
|
628
628
|
});
|
|
629
629
|
} catch (e) {
|
|
630
|
-
throw
|
|
630
|
+
throw P.delete(t), e;
|
|
631
631
|
}
|
|
632
|
-
})(),
|
|
632
|
+
})(), P.set(t, g));
|
|
633
633
|
let [_, v] = await Promise.all([l, g]), y = (await v.run({ [v.inputNames[0]]: new _.Tensor("float32", h, [
|
|
634
634
|
1,
|
|
635
635
|
3,
|
|
636
636
|
u,
|
|
637
637
|
u
|
|
638
638
|
]) }))[v.outputNames[0]];
|
|
639
|
-
return
|
|
639
|
+
return $e(y.data, y.dims.map(Number), {
|
|
640
640
|
classes: r,
|
|
641
|
-
confidence:
|
|
641
|
+
confidence: i,
|
|
642
642
|
layout: o,
|
|
643
|
-
imageWidth:
|
|
644
|
-
imageHeight:
|
|
643
|
+
imageWidth: s.width,
|
|
644
|
+
imageHeight: s.height,
|
|
645
645
|
inputSize: u
|
|
646
646
|
});
|
|
647
647
|
}
|
|
648
648
|
//#endregion
|
|
649
649
|
//#region src/sdk/programmatic-redaction.ts
|
|
650
|
-
function
|
|
650
|
+
function V(e) {
|
|
651
651
|
let t = Math.min(...e.map((e) => e.bbox.x)), n = Math.min(...e.map((e) => e.bbox.y)), r = Math.max(...e.map((e) => e.bbox.x + e.bbox.width)), i = Math.max(...e.map((e) => e.bbox.y + e.bbox.height));
|
|
652
652
|
return {
|
|
653
653
|
x: t,
|
|
@@ -656,11 +656,11 @@ function H(e) {
|
|
|
656
656
|
height: i - n
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function H(e) {
|
|
660
660
|
let t = [], n = [...e].sort((e, t) => e.bbox.y + e.bbox.height / 2 - (t.bbox.y + t.bbox.height / 2) || e.bbox.x - t.bbox.x);
|
|
661
661
|
for (let e of n) {
|
|
662
662
|
let n = e.bbox.y + e.bbox.height / 2, r = t.find((t) => {
|
|
663
|
-
let r =
|
|
663
|
+
let r = V(t), i = r.y + r.height / 2;
|
|
664
664
|
return Math.abs(n - i) <= Math.max(e.bbox.height, r.height) * .65;
|
|
665
665
|
});
|
|
666
666
|
r ? r.push(e) : t.push([e]);
|
|
@@ -668,17 +668,17 @@ function U(e) {
|
|
|
668
668
|
return t.map((e) => (e.sort((e, t) => e.bbox.x - t.bbox.x), {
|
|
669
669
|
words: e,
|
|
670
670
|
text: e.map((e) => e.text).join(" "),
|
|
671
|
-
bbox:
|
|
671
|
+
bbox: V(e)
|
|
672
672
|
}));
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function U(e, t, n = !1) {
|
|
675
675
|
let r = e.trim().replace(/\s+/g, " "), i = n ? r.replace(/[::]\s*$/, "") : r;
|
|
676
676
|
return t ? i.toLocaleLowerCase() : i;
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function W(e) {
|
|
679
679
|
return e.reduce((e, t) => e + t.confidence, 0) / Math.max(1, e.length);
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function tt(e, t) {
|
|
682
682
|
let n = e.mode, r = n === "case-insensitive", i = e.scope ?? "line", a;
|
|
683
683
|
if (n === "regex") {
|
|
684
684
|
let t = e.pattern ?? e.values?.[0];
|
|
@@ -689,14 +689,14 @@ function $e(e, t) {
|
|
|
689
689
|
ruleId: e.id,
|
|
690
690
|
strategy: "string",
|
|
691
691
|
source: "string",
|
|
692
|
-
bbox:
|
|
692
|
+
bbox: V(t),
|
|
693
693
|
text: t.map((e) => e.text).join(" "),
|
|
694
|
-
confidence:
|
|
694
|
+
confidence: W(t)
|
|
695
695
|
});
|
|
696
696
|
if (i === "word") {
|
|
697
697
|
for (let e of t) for (let t of e.words) {
|
|
698
|
-
let e =
|
|
699
|
-
(a ? a.test(t.text) : o.some((t) => e ===
|
|
698
|
+
let e = U(t.text, r);
|
|
699
|
+
(a ? a.test(t.text) : o.some((t) => e === U(t, r))) && c([t]);
|
|
700
700
|
}
|
|
701
701
|
return s;
|
|
702
702
|
}
|
|
@@ -706,40 +706,40 @@ function $e(e, t) {
|
|
|
706
706
|
continue;
|
|
707
707
|
}
|
|
708
708
|
for (let t of o) {
|
|
709
|
-
let n =
|
|
709
|
+
let n = U(t, r).split(" ");
|
|
710
710
|
for (let t = 0; t <= e.words.length - n.length; t += 1) {
|
|
711
711
|
let i = e.words.slice(t, t + n.length);
|
|
712
|
-
i.every((e, t) =>
|
|
712
|
+
i.every((e, t) => U(e.text, r) === n[t]) && c(i);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
return s;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
let n = e.labelMode !== "exact", r =
|
|
718
|
+
function nt(e, t) {
|
|
719
|
+
let n = e.labelMode !== "exact", r = U(e.label, n, !0).split(" ");
|
|
720
720
|
for (let e of t) for (let t = 0; t <= e.words.length - r.length; t += 1) {
|
|
721
721
|
let i = e.words.slice(t, t + r.length);
|
|
722
|
-
if (i.every((e, t) =>
|
|
722
|
+
if (i.every((e, t) => U(e.text, n, !0) === r[t])) return i;
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function rt(e, t, n, r, i, a) {
|
|
726
726
|
let o = a.window?.distance ?? .28, s = a.window?.crossAxis ?? .12, c = t.x + t.width / 2, l = t.y + t.height / 2;
|
|
727
727
|
return e.filter((e) => {
|
|
728
728
|
let a = e.bbox.x + e.bbox.width / 2, u = e.bbox.y + e.bbox.height / 2;
|
|
729
729
|
return n === "right" ? e.bbox.x >= t.x + t.width && e.bbox.x - t.x - t.width <= r * o && Math.abs(u - l) <= i * s : n === "left" ? e.bbox.x + e.bbox.width <= t.x && t.x - e.bbox.x - e.bbox.width <= r * o && Math.abs(u - l) <= i * s : n === "below" ? e.bbox.y >= t.y + t.height && e.bbox.y - t.y - t.height <= i * o && Math.abs(a - c) <= r * s : e.bbox.y + e.bbox.height <= t.y && t.y - e.bbox.y - e.bbox.height <= i * o && Math.abs(a - c) <= r * s;
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
let o =
|
|
732
|
+
function G(e, t, n, r, i, a = "label") {
|
|
733
|
+
let o = nt(e, n);
|
|
734
734
|
if (!o) return [];
|
|
735
|
-
let s =
|
|
735
|
+
let s = V(o), c = new Set(o), l = t.filter((e) => !c.has(e)), u = e.direction === "any" ? [
|
|
736
736
|
"right",
|
|
737
737
|
"below",
|
|
738
738
|
"left",
|
|
739
739
|
"above"
|
|
740
740
|
] : [e.direction], d;
|
|
741
741
|
for (let t of u) {
|
|
742
|
-
let n =
|
|
742
|
+
let n = H(rt(l, s, t, r, i, e));
|
|
743
743
|
for (let t of n) {
|
|
744
744
|
if (e.valuePattern && !new RegExp(e.valuePattern, e.patternFlags).test(t.text)) continue;
|
|
745
745
|
let n = t.bbox.x + t.bbox.width / 2, a = t.bbox.y + t.bbox.height / 2, o = s.x + s.width / 2, c = s.y + s.height / 2, l = Math.hypot((n - o) / r, (a - c) / i);
|
|
@@ -755,12 +755,12 @@ function K(e, t, n, r, i, a = "label") {
|
|
|
755
755
|
ruleId: e.id,
|
|
756
756
|
strategy: a,
|
|
757
757
|
source: a === "template-anchor" ? "template" : "label",
|
|
758
|
-
bbox:
|
|
758
|
+
bbox: V(f),
|
|
759
759
|
text: d.words.map((e) => e.text).join(" "),
|
|
760
|
-
confidence: Math.max(0,
|
|
760
|
+
confidence: Math.max(0, W(d.words) * (1 - Math.min(.5, d.distance)))
|
|
761
761
|
}];
|
|
762
762
|
}
|
|
763
|
-
var
|
|
763
|
+
var K = {
|
|
764
764
|
person_name: [
|
|
765
765
|
"LN",
|
|
766
766
|
"FN",
|
|
@@ -797,32 +797,32 @@ var q = {
|
|
|
797
797
|
"POSTAL"
|
|
798
798
|
],
|
|
799
799
|
state: ["STATE", "DAJ"]
|
|
800
|
-
},
|
|
801
|
-
function
|
|
800
|
+
}, it = new Set(Object.values(K).flat()), q = /^(?:\d{2}[/-]\d{2}[/-]\d{2,4}|\d{4}[/-]\d{2}[/-]\d{2}|\d{6}|\d{8})$/, J = /\b(?:ST|STREET|AVE|AVENUE|RD|ROAD|BLVD|BOULEVARD|LN|LANE|DR|DRIVE|WAY|CT|COURT)\b/i, Y = /\b(?:DRIVER|LICENSE|IDENTIFICATION|CARD|CLASS|SEX|EYES|HEIGHT|RESTRICTIONS)\b/i;
|
|
801
|
+
function X(e, t) {
|
|
802
802
|
let n = t.trim();
|
|
803
|
-
return n ? e === "date_of_birth" || e === "expiration_date" ?
|
|
803
|
+
return n ? e === "date_of_birth" || e === "expiration_date" ? q.test(n.replace(/\s/g, "")) : e === "postal_code" ? /^(?:\d{5}(?:-\d{4})?|[A-Z]\d[A-Z]\s?\d[A-Z]\d)$/i.test(n) : e === "state" ? /^[A-Z]{2}$/i.test(n) : e === "document_number" ? /^(?=.*\d)[A-Z0-9-]{5,20}$/i.test(n) : e === "person_name" ? !/\d/.test(n) && /^[A-ZÀ-ÖØ-öø-ÿ' -]{3,}$/i.test(n) && !Y.test(n) : /\d/.test(n) && /[A-Z]/i.test(n) : !1;
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function Z(e, t, n, r, i = 1) {
|
|
806
806
|
return {
|
|
807
807
|
ruleId: e,
|
|
808
808
|
strategy: "semantic",
|
|
809
809
|
source: t,
|
|
810
|
-
bbox:
|
|
810
|
+
bbox: V(n),
|
|
811
811
|
text: r ?? n.map((e) => e.text).join(" "),
|
|
812
|
-
confidence: Math.max(0, Math.min(1,
|
|
812
|
+
confidence: Math.max(0, Math.min(1, W(n) * i))
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
let r =
|
|
815
|
+
function at(e, t, n) {
|
|
816
|
+
let r = K[e], i = [];
|
|
817
817
|
for (let a of n) for (let n = 0; n < a.words.length; n += 1) {
|
|
818
818
|
let o = a.words[n].text.toUpperCase().replace(/[^A-Z0-9]/g, ""), s = r.find((e) => o === e || o.startsWith(e));
|
|
819
819
|
if (!s) continue;
|
|
820
820
|
let c, l;
|
|
821
|
-
o === s ? (c = a.words.slice(n + 1).filter((e) => !
|
|
821
|
+
o === s ? (c = a.words.slice(n + 1).filter((e) => !it.has(e.text.toUpperCase().replace(/[^A-Z0-9]/g, ""))), l = c.map((e) => e.text).join(" ")) : (c = [a.words[n]], l = a.words[n].text.replace(RegExp(`^${s}[:\\s-]*`, "i"), "")), c.length && X(e, l) && i.push(Z(t, "alias", c, l, .98));
|
|
822
822
|
}
|
|
823
823
|
return i;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function Q(e, t, n) {
|
|
826
826
|
let r = n.filter((e) => {
|
|
827
827
|
let t = e.text.replace(/\s/g, "");
|
|
828
828
|
return t.includes("<<") || /^[A-Z0-9<]{25,}$/.test(t);
|
|
@@ -832,19 +832,19 @@ function it(e, t, n) {
|
|
|
832
832
|
let e = r.find((e) => e.text.includes("<<"));
|
|
833
833
|
if (!e) return [];
|
|
834
834
|
let n = e.text.replace(/\s/g, ""), i = /^[PIV]<[A-Z]{3}/.test(n) ? 5 : n.indexOf("<") + 1, a = n.slice(i).replace(/<+/g, " ").trim();
|
|
835
|
-
return a ? [
|
|
835
|
+
return a ? [Z(t, "mrz", e.words, a, .96)] : [];
|
|
836
836
|
}
|
|
837
837
|
if (e === "date_of_birth") for (let e of r) {
|
|
838
838
|
let n = e.text.replace(/\s/g, ""), r = /^\d{6}/.exec(n)?.[0] ?? /^.{13}(\d{6})/.exec(n)?.[1];
|
|
839
|
-
if (r) return [
|
|
839
|
+
if (r) return [Z(t, "mrz", e.words, r, .96)];
|
|
840
840
|
}
|
|
841
841
|
if (e === "document_number") {
|
|
842
842
|
let e = r[0];
|
|
843
|
-
return [
|
|
843
|
+
return [Z(t, "mrz", e.words, e.text, .9)];
|
|
844
844
|
}
|
|
845
845
|
return [];
|
|
846
846
|
}
|
|
847
|
-
function
|
|
847
|
+
function ot(e) {
|
|
848
848
|
let t = e.replace(/\s/g, ""), n = t.match(/\d{4}/)?.[0];
|
|
849
849
|
if (n) return Number(n);
|
|
850
850
|
let r = t.match(/^\d{2}/)?.[0];
|
|
@@ -852,67 +852,67 @@ function at(e) {
|
|
|
852
852
|
let i = Number(r);
|
|
853
853
|
return i > (/* @__PURE__ */ new Date()).getFullYear() % 100 ? 1900 + i : 2e3 + i;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function st(e, t, n, r, i) {
|
|
856
856
|
if (e === "address") {
|
|
857
|
-
let e = r.findIndex((e) => /\d/.test(e.text) &&
|
|
857
|
+
let e = r.findIndex((e) => /\d/.test(e.text) && J.test(e.text));
|
|
858
858
|
if (e < 0) return [];
|
|
859
859
|
let n = [...r[e].words], i = r[e + 1];
|
|
860
|
-
return i && /(?:\b[A-Z]{2}\b.*\d{5}|\d{5})/i.test(i.text) && n.push(...i.words), [
|
|
860
|
+
return i && /(?:\b[A-Z]{2}\b.*\d{5}|\d{5})/i.test(i.text) && n.push(...i.words), [Z(t, "layout", n, void 0, .76)];
|
|
861
861
|
}
|
|
862
862
|
if (e === "person_name") {
|
|
863
863
|
let e = r.map((e) => {
|
|
864
|
-
let t = e.words.filter((e) => /^[A-ZÀ-ÖØ-öø-ÿ'-]+$/i.test(e.text)), n = e.bbox.y / Math.max(1, i), r = t.length >= 2 && t.length <= 5 && t.length === e.words.length && !
|
|
864
|
+
let t = e.words.filter((e) => /^[A-ZÀ-ÖØ-öø-ÿ'-]+$/i.test(e.text)), n = e.bbox.y / Math.max(1, i), r = t.length >= 2 && t.length <= 5 && t.length === e.words.length && !Y.test(e.text) && !J.test(e.text) && !e.text.includes("<"), a = e.text.replace(/[^A-Z]/g, "").length / Math.max(1, e.text.replace(/[^A-Za-z]/g, "").length);
|
|
865
865
|
return {
|
|
866
866
|
line: e,
|
|
867
|
-
score: r ? .45 +
|
|
867
|
+
score: r ? .45 + W(e.words) * .3 + a * .15 + (n < .65 ? .1 : 0) : 0
|
|
868
868
|
};
|
|
869
869
|
}).filter((e) => e.score >= .68).sort((e, t) => t.score - e.score);
|
|
870
|
-
return !e.length || e[1] && e[0].score - e[1].score < .04 ? [] : [
|
|
870
|
+
return !e.length || e[1] && e[0].score - e[1].score < .04 ? [] : [Z(t, "layout", e[0].line.words, void 0, e[0].score)];
|
|
871
871
|
}
|
|
872
872
|
if (e === "date_of_birth" || e === "expiration_date") {
|
|
873
|
-
let r = (/* @__PURE__ */ new Date()).getFullYear(), i = n.filter((e) =>
|
|
873
|
+
let r = (/* @__PURE__ */ new Date()).getFullYear(), i = n.filter((e) => q.test(e.text.replace(/\s/g, ""))).map((e) => ({
|
|
874
874
|
word: e,
|
|
875
|
-
year:
|
|
875
|
+
year: ot(e.text)
|
|
876
876
|
})).filter((e) => e.year !== void 0), a = e === "date_of_birth" ? i.filter((e) => e.year <= r - 14 && e.year >= r - 120) : i.filter((e) => e.year >= r - 1);
|
|
877
|
-
return a.sort((t, n) => e === "date_of_birth" ? t.year - n.year : n.year - t.year), a.length ? [
|
|
877
|
+
return a.sort((t, n) => e === "date_of_birth" ? t.year - n.year : n.year - t.year), a.length ? [Z(t, "layout", [a[0].word], void 0, .72)] : [];
|
|
878
878
|
}
|
|
879
879
|
if (e === "postal_code") {
|
|
880
|
-
let r = n.find((t) =>
|
|
881
|
-
return r ? [
|
|
880
|
+
let r = n.find((t) => X(e, t.text));
|
|
881
|
+
return r ? [Z(t, "layout", [r], void 0, .78)] : [];
|
|
882
882
|
}
|
|
883
883
|
if (e === "state") {
|
|
884
|
-
let r = n.filter((t) =>
|
|
885
|
-
return r.length === 1 ? [
|
|
884
|
+
let r = n.filter((t) => X(e, t.text));
|
|
885
|
+
return r.length === 1 ? [Z(t, "layout", r, void 0, .7)] : [];
|
|
886
886
|
}
|
|
887
887
|
if (e === "document_number") {
|
|
888
|
-
let r = n.filter((t) =>
|
|
889
|
-
return r.sort((e, t) => t.text.length - e.text.length), r.length ? [
|
|
888
|
+
let r = n.filter((t) => X(e, t.text));
|
|
889
|
+
return r.sort((e, t) => t.text.length - e.text.length), r.length ? [Z(t, "layout", [r[0]], void 0, .7)] : [];
|
|
890
890
|
}
|
|
891
891
|
return [];
|
|
892
892
|
}
|
|
893
|
-
function
|
|
893
|
+
function ct(e, t) {
|
|
894
894
|
return Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)) / Math.max(1, t.width * t.height);
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
let i =
|
|
898
|
-
return i.length || a.length ? [...i, ...a] :
|
|
896
|
+
function lt(e, t, n, r) {
|
|
897
|
+
let i = at(e.field, e.id, n), a = Q(e.field, e.id, n);
|
|
898
|
+
return i.length || a.length ? [...i, ...a] : st(e.field, e.id, t, n, r);
|
|
899
899
|
}
|
|
900
|
-
function
|
|
900
|
+
function ut(e, t, n) {
|
|
901
901
|
let r = (n ?? []).filter((t) => t.field === e.field).sort((e, t) => t.confidence - e.confidence);
|
|
902
902
|
for (let n of r) {
|
|
903
|
-
let r = t.filter((e) =>
|
|
903
|
+
let r = t.filter((e) => ct(n.bbox, e.bbox) >= .3);
|
|
904
904
|
if (!r.length) continue;
|
|
905
905
|
let i = r.map((e) => e.text).join(" ");
|
|
906
|
-
if (
|
|
906
|
+
if (X(e.field, i)) return Z(e.id, "model", r, i, n.confidence);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
let o =
|
|
909
|
+
function dt(e, t, n, r, i, a) {
|
|
910
|
+
let o = lt(e, t, n, r);
|
|
911
911
|
if (e.detector !== "model" || !a) return o;
|
|
912
|
-
let s =
|
|
912
|
+
let s = ut(e, t, i);
|
|
913
913
|
return s ? [s] : [];
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function ft(e, t, n, r) {
|
|
916
916
|
let i = (e) => Math.max(0, Math.min(1, e)), a = i(e.rect.x), o = i(e.rect.y);
|
|
917
917
|
return {
|
|
918
918
|
ruleId: `${t}.${e.id}`,
|
|
@@ -928,18 +928,18 @@ function dt(e, t, n, r) {
|
|
|
928
928
|
};
|
|
929
929
|
}
|
|
930
930
|
function $(e, t) {
|
|
931
|
-
let n = t.imageWidth ?? e?.imageWidth ?? 0, r = t.imageHeight ?? e?.imageHeight ?? 0, i = e?.words ?? [], a =
|
|
931
|
+
let n = t.imageWidth ?? e?.imageWidth ?? 0, r = t.imageHeight ?? e?.imageHeight ?? 0, i = e?.words ?? [], a = H(i), o = [], s = [];
|
|
932
932
|
for (let e of t.rules) {
|
|
933
|
-
let c = e.strategy === "string" ?
|
|
933
|
+
let c = e.strategy === "string" ? tt(e, a) : e.strategy === "label" ? G(e, i, a, n, r) : dt(e, i, a, r, t.semanticDetections, t.modelRequested === !0);
|
|
934
934
|
c.length ? o.push(...c) : s.push(e.id);
|
|
935
935
|
}
|
|
936
936
|
for (let e of t.template?.fields ?? []) {
|
|
937
937
|
let c = `${t.template.id}.${e.id}`;
|
|
938
938
|
if (e.strategy === "rect") {
|
|
939
|
-
n && r ? o.push(
|
|
939
|
+
n && r ? o.push(ft(e, t.template.id, n, r)) : s.push(c);
|
|
940
940
|
continue;
|
|
941
941
|
}
|
|
942
|
-
let l =
|
|
942
|
+
let l = G({
|
|
943
943
|
...e,
|
|
944
944
|
id: c,
|
|
945
945
|
strategy: "label"
|
|
@@ -957,68 +957,68 @@ function $(e, t) {
|
|
|
957
957
|
confidence: u
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function pt(e) {
|
|
961
961
|
return e.rules.length > 0 || e.template?.fields.some((e) => e.strategy === "anchor") === !0;
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function mt(e, t = !1) {
|
|
964
964
|
return t && !e.complete ? "unmatched" : e.complete ? "success" : "partial";
|
|
965
965
|
}
|
|
966
|
-
async function
|
|
967
|
-
await
|
|
966
|
+
async function ht(e, t) {
|
|
967
|
+
await o("redaction");
|
|
968
968
|
let r = await n(e, { cloneCanvas: !1 }), i = t.ocr;
|
|
969
|
-
|
|
970
|
-
let a = t.semanticDetections,
|
|
969
|
+
pt(t) && !i && (i = await j(r, { includeWords: !0 }));
|
|
970
|
+
let a = t.semanticDetections, s = t.modelRequested === !0, c = "not-requested", l;
|
|
971
971
|
if (t.models?.fields) try {
|
|
972
|
-
a = await
|
|
972
|
+
a = await et(r, t.models.fields, t.models.fieldClasses, t.models.confidence, t.models.fieldLayout), s = !0, c = "loaded";
|
|
973
973
|
} catch (e) {
|
|
974
|
-
|
|
974
|
+
l = e instanceof Error ? e.message : "The field model could not load.";
|
|
975
975
|
let n = t.models.allowHeuristicFallback !== !1;
|
|
976
|
-
|
|
976
|
+
s = !n, c = n ? "fallback" : "failed";
|
|
977
977
|
}
|
|
978
|
-
let
|
|
978
|
+
let u = $(i, {
|
|
979
979
|
rules: t.rules,
|
|
980
980
|
template: t.template,
|
|
981
981
|
imageWidth: r.width,
|
|
982
982
|
imageHeight: r.height,
|
|
983
983
|
semanticDetections: a,
|
|
984
|
-
modelRequested:
|
|
985
|
-
}),
|
|
984
|
+
modelRequested: s
|
|
985
|
+
}), d = mt(u, t.requireAll), f = [], p = "not-requested", m;
|
|
986
986
|
if (t.models?.face) try {
|
|
987
|
-
|
|
987
|
+
f = await Ke(r, t.models.face, t.models.faceConfidence), p = "loaded";
|
|
988
988
|
} catch (e) {
|
|
989
|
-
|
|
989
|
+
m = e instanceof Error ? e.message : "The face model could not load.", p = "failed";
|
|
990
990
|
}
|
|
991
|
-
if (
|
|
992
|
-
...
|
|
993
|
-
status:
|
|
991
|
+
if (d === "unmatched") return {
|
|
992
|
+
...u,
|
|
993
|
+
status: d,
|
|
994
994
|
ocr: i,
|
|
995
|
-
modelStatus:
|
|
996
|
-
modelError:
|
|
997
|
-
faces:
|
|
998
|
-
faceStatus:
|
|
999
|
-
faceError:
|
|
995
|
+
modelStatus: c,
|
|
996
|
+
modelError: l,
|
|
997
|
+
faces: f,
|
|
998
|
+
faceStatus: p,
|
|
999
|
+
faceError: m
|
|
1000
1000
|
};
|
|
1001
|
-
let
|
|
1001
|
+
let h = await M(r, [...u.matches.map((e) => ({
|
|
1002
1002
|
...e.bbox,
|
|
1003
1003
|
mode: t.style?.mode
|
|
1004
|
-
})), ...
|
|
1004
|
+
})), ...f.map((e) => ({
|
|
1005
1005
|
...e.bbox,
|
|
1006
1006
|
mode: t.style?.mode
|
|
1007
1007
|
}))], t.style);
|
|
1008
1008
|
return {
|
|
1009
|
-
...
|
|
1010
|
-
status:
|
|
1009
|
+
...u,
|
|
1010
|
+
status: d,
|
|
1011
1011
|
ocr: i,
|
|
1012
|
-
canvas:
|
|
1013
|
-
blob:
|
|
1014
|
-
modelStatus:
|
|
1015
|
-
modelError:
|
|
1016
|
-
faces:
|
|
1017
|
-
faceStatus:
|
|
1018
|
-
faceError:
|
|
1012
|
+
canvas: h.canvas,
|
|
1013
|
+
blob: h.blob,
|
|
1014
|
+
modelStatus: c,
|
|
1015
|
+
modelError: l,
|
|
1016
|
+
faces: f,
|
|
1017
|
+
faceStatus: p,
|
|
1018
|
+
faceError: m
|
|
1019
1019
|
};
|
|
1020
1020
|
}
|
|
1021
1021
|
//#endregion
|
|
1022
|
-
export {
|
|
1022
|
+
export { de as AutoTorchController, m as DEFAULT_DOCUMENT_MODEL_URL, e as DEV_LICENSE_HOSTS, te as LicenseError, g as NEAR_BLACK_LUMINANCE, ue as QuadStabilityTracker, i as ScannerError, M as applyRedactions, o as assertLicense, ae as autoCaptureControl, _ as captureVideoFrame, ve as createFinderSimulator, me as cropDocument, se as detectBrowserEngine, u as detectDocument, ie as formatCaptureDiagnosticsReport, s as getLicense, y as isNearBlackFrame, ce as limitingFillTarget, ge as mapDocumentCornersToFrame, $ as matchRedactionRules, v as meanFrameLuminance, ee as measureQuadFill, f as mobileCameraConstraints, j as recognizeText, ht as redactProgrammatically, t as resolveDocumentModelUrl, pe as scanDocument, p as selectFinderGuidance, oe as selectFinderHint, l as setLicenseKey, _e as simulatorQuad, fe as startCamera, le as startFinder, ne as subscribeModelDownloads, he as torchControl };
|
|
1023
1023
|
|
|
1024
1024
|
//# sourceMappingURL=scanner-sdk.js.map
|