@exige/web-scanner-sdk 0.2.26 → 0.2.28

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.
@@ -1,4 +1,4 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, U as g, V as _, _ as v, a as y, b as ee, c as te, d as ne, f as re, g as ie, h as ae, i as oe, j as se, k as ce, l as le, m as ue, n as de, o as fe, p as pe, r as me, s as he, t as ge, u as _e, v as ve, w as ye, x as be, y as xe, z as b } from "./finder-Dcg3mVJM.js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, _ as ee, a as te, b, c as ne, d as re, f as ie, g as ae, h as oe, i as se, j as ce, k as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as Se, z as Ce } from "./finder-BvBpdbHa.js";
2
2
  //#region src/sdk/frame-geometry.ts
3
3
  function x(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;
@@ -7,7 +7,7 @@ function x(e, t, n) {
7
7
  y: (e.y - l) / s
8
8
  };
9
9
  }
10
- function Se(e, t, n) {
10
+ function we(e, t, n) {
11
11
  return {
12
12
  topLeft: x(e.topLeft, t, n),
13
13
  topRight: x(e.topRight, t, n),
@@ -57,7 +57,7 @@ function C(e, t, n) {
57
57
  y: n.centerY + e * i + t * r
58
58
  };
59
59
  }
60
- function Ce(e) {
60
+ function Te(e) {
61
61
  let t = C(-e.width / 2, -e.height / 2, e), n = C(e.width / 2, -e.height / 2, e), r = C(e.width / 2, e.height / 2, e), i = C(-e.width / 2, e.height / 2, e);
62
62
  return {
63
63
  topLeft: t,
@@ -86,13 +86,13 @@ function Ce(e) {
86
86
  }
87
87
  function w(e, t) {
88
88
  let n = e.getContext("2d");
89
- if (!n) throw g();
89
+ if (!n) throw o();
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
92
  let i = -t.width / 2, a = -t.height / 2;
93
93
  n.fillStyle = "#d7ded8", n.fillRect(i + 38, a + 84, 145, 190), n.fillStyle = "#617269", n.beginPath(), n.arc(i + 110, a + 140, 38, 0, Math.PI * 2), n.fill(), n.fillRect(i + 70, a + 185, 80, 65), n.fillStyle = "#17231c", n.font = "700 25px Arial", n.fillText("IDENTITY CARD", i + 38, a + 48), n.font = "700 31px Arial", n.fillText("TAYLOR MORGAN", i + 220, a + 118), n.font = "23px Arial", n.fillText("01/02/1990", i + 220, a + 166), n.fillText("A1234567", i + 220, a + 208), n.fillText("123 MAIN ST", i + 220, a + 270), n.fillText("AUSTIN TX 78701", i + 220, a + 307), n.restore();
94
94
  }
95
- function we(e) {
95
+ function Ee(e) {
96
96
  e.width ||= 960, e.height ||= 600;
97
97
  let t = !1, n = 0, r = 0, i = (a) => {
98
98
  t && (n ||= a, w(e, S(a - n, e.width, e.height)), r = requestAnimationFrame(i));
@@ -111,7 +111,7 @@ function we(e) {
111
111
  }
112
112
  //#endregion
113
113
  //#region src/sdk/ocr-runtime.ts
114
- var Te = new URL("./assets/tesseract/worker.min.js", import.meta.url), Ee = new URL("./assets/tesseract/tesseract-core-lstm.wasm.js", import.meta.url), De = new URL("./assets/tesseract/tesseract-core-simd-lstm.wasm.js", import.meta.url), Oe = new URL("./assets/tesseract/tesseract-core-relaxedsimd-lstm.wasm.js", import.meta.url), ke = new URL("./assets/tesseract/eng.traineddata.gz", import.meta.url), Ae = 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), je = 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);
114
+ var De = new URL("./assets/tesseract/worker.min.js", import.meta.url), Oe = new URL("./assets/tesseract/tesseract-core-lstm.wasm.js", import.meta.url), ke = new URL("./assets/tesseract/tesseract-core-simd-lstm.wasm.js", import.meta.url), Ae = new URL("./assets/tesseract/tesseract-core-relaxedsimd-lstm.wasm.js", import.meta.url), je = new URL("./assets/tesseract/eng.traineddata.gz", import.meta.url), Me = 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), Ne = 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
115
  function T(e) {
116
116
  try {
117
117
  return typeof WebAssembly < "u" && WebAssembly.validate(e);
@@ -119,16 +119,16 @@ function T(e) {
119
119
  return !1;
120
120
  }
121
121
  }
122
- function Me() {
122
+ function Pe() {
123
123
  return {
124
- relaxedSimd: T(Ae),
125
- simd: T(je)
124
+ relaxedSimd: T(Me),
125
+ simd: T(Ne)
126
126
  };
127
127
  }
128
- function Ne(e) {
129
- return e.relaxedSimd ? Oe : e.simd ? De : Ee;
128
+ function Fe(e) {
129
+ return e.relaxedSimd ? Ae : e.simd ? ke : Oe;
130
130
  }
131
- function Pe(e, t) {
131
+ function Ie(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 Pe(e, t) {
139
139
  kind: "bundled-eng",
140
140
  language: "eng"
141
141
  };
142
- throw new o("language", `OCR language "${n}" is not packaged. Pass langPath, a directory URL that contains ${n}.traineddata.gz.`);
142
+ throw new y("language", `OCR language "${n}" is not packaged. Pass langPath, a directory URL that contains ${n}.traineddata.gz.`);
143
143
  }
144
- function Fe(e = ke) {
144
+ function Le(e = je) {
145
145
  let t = e.href, n = t.lastIndexOf("/");
146
146
  return n === -1 ? t : t.slice(0, n);
147
147
  }
148
- function Ie(e) {
149
- return e.kind === "bundled-eng" ? Fe() : e.langPath;
148
+ function Re(e) {
149
+ return e.kind === "bundled-eng" ? Le() : e.langPath;
150
150
  }
151
- async function Le(e, t, n) {
151
+ async function ze(e, t, n) {
152
152
  return new Promise((r, i) => {
153
- let a = !1, s = (e) => {
153
+ let a = !1, o = (e) => {
154
154
  if (a) return;
155
155
  a = !0;
156
156
  let t = e instanceof Error ? e.message : String(e);
157
- i(new o("worker", `OCR worker failed to start (${t}).`));
157
+ i(new y("worker", `OCR worker failed to start (${t}).`));
158
158
  };
159
159
  e(t, void 0, {
160
160
  workerPath: n.workerPath,
@@ -162,14 +162,14 @@ async function Le(e, t, n) {
162
162
  langPath: n.langPath,
163
163
  gzip: !0,
164
164
  logger: n.logger,
165
- errorHandler: s
165
+ errorHandler: o
166
166
  }).then((e) => {
167
167
  if (a) {
168
168
  e.terminate?.();
169
169
  return;
170
170
  }
171
171
  a = !0, r(e);
172
- }, s);
172
+ }, o);
173
173
  });
174
174
  }
175
175
  //#endregion
@@ -190,13 +190,13 @@ function D(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 Re(e, t) {
193
+ function Be(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
197
  function O(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) => Re(t, e) >= .65) || n.push(e);
199
+ for (let e of t) n.some((t) => Be(t, e) >= .65) || n.push(e);
200
200
  return n;
201
201
  }
202
202
  function k(e, t, n, r, i) {
@@ -210,7 +210,7 @@ function k(e, t, n, r, i) {
210
210
  }
211
211
  return !0;
212
212
  }
213
- function ze(e) {
213
+ function Ve(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);
@@ -241,7 +241,7 @@ function A(e, t, n, r) {
241
241
  }
242
242
  let l = n?.width ?? s, u = n?.height ?? c, d = O(a).filter((e) => k(e, "word", l, u, r)), f = O(o).filter((e) => k(e, "character", l, u, r));
243
243
  return {
244
- text: ze(d),
244
+ text: Ve(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 : []
@@ -249,7 +249,7 @@ function A(e, t, n, r) {
249
249
  }
250
250
  function j(e) {
251
251
  let t = e.getContext("2d", { willReadFrequently: !0 });
252
- if (!t) throw g();
252
+ if (!t) throw o();
253
253
  let n = t.getImageData(0, 0, e.width, e.height), r = new Uint8Array(e.width * e.height);
254
254
  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);
255
255
  return {
@@ -258,7 +258,7 @@ function j(e) {
258
258
  luminance: r
259
259
  };
260
260
  }
261
- function Be(e) {
261
+ function He(e) {
262
262
  let t = document.createElement("canvas");
263
263
  t.width = 72, t.height = 72;
264
264
  let n = t.getContext("2d", { willReadFrequently: !0 });
@@ -270,26 +270,26 @@ function Be(e) {
270
270
  };
271
271
  n.drawImage(e, 0, 0, t.width, t.height);
272
272
  let { luminance: r } = j(t);
273
- return le(r, t.width, t.height);
273
+ return ue(r, t.width, t.height);
274
274
  }
275
- function Ve(e, t, n, r) {
275
+ function Ue(e, t, n, r) {
276
276
  let i = (e.bbox.x + e.bbox.width / 2) / n, a = (e.bbox.y + e.bbox.height / 2) / r;
277
277
  return i >= t.x && i <= t.x + t.width && a >= t.y && a <= t.y + t.height;
278
278
  }
279
- var He = .58;
280
- function Ue(e) {
279
+ var We = .58;
280
+ function Ge(e) {
281
281
  let t = e.trim();
282
282
  if (!t || !/[\p{L}\p{N}]/u.test(t)) return 0;
283
283
  if (/^\$?\d{1,5}([.,]\d{2})?$/.test(t)) return 1;
284
284
  let n = t.replace(/[^\p{L}]/gu, "");
285
285
  return n.length >= 3 && /[aeiouy]/i.test(n) ? .9 : n.length >= 4 ? .7 : t.length <= 2 ? .35 : /[^\p{L}\p{N}.,'’$/-]/u.test(t) ? .25 : .5;
286
286
  }
287
- function We(e, t, n) {
287
+ function Ke(e, t, n) {
288
288
  let r = Math.max(0, Math.min(1, (1 - e.darkness / 80) * (1 - e.strength / 24)));
289
289
  if (!t.length) return r * .35;
290
290
  let i = 0;
291
291
  for (let e of t) {
292
- let t = Ue(e.text);
292
+ let t = Ge(e.text);
293
293
  if (n) {
294
294
  let r = n(e.bbox);
295
295
  (r < .04 || r > .62) && (t *= .4);
@@ -298,10 +298,10 @@ function We(e, t, n) {
298
298
  }
299
299
  return r * .7 + i / t.length * .3;
300
300
  }
301
- function Ge(e, t, n, r) {
302
- return !e.strong || !e.region ? !1 : We(e, t.filter((t) => Ve(t, e.region, n.width, n.height)), r) < He;
301
+ function qe(e, t, n, r) {
302
+ return !e.strong || !e.region ? !1 : Ke(e, t.filter((t) => Ue(t, e.region, n.width, n.height)), r) < We;
303
303
  }
304
- function Ke(e, t, n, r) {
304
+ function Je(e, t, n, r) {
305
305
  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");
306
306
  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);
307
307
  let l = n / e.width, u = r / e.height;
@@ -318,23 +318,23 @@ function Ke(e, t, n, r) {
318
318
  function M(e, t) {
319
319
  for (let n = 0, r = 0; n < t.length; n += 1, r += 4) e.data[r] = t[n], e.data[r + 1] = t[n], e.data[r + 2] = t[n], e.data[r + 3] = 255;
320
320
  }
321
- function qe(e) {
321
+ function Ye(e) {
322
322
  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");
323
323
  i.width = Math.max(1, Math.round(e.width * r)), i.height = Math.max(1, Math.round(e.height * r));
324
324
  let a = i.getContext("2d", { willReadFrequently: !0 });
325
- if (!a) throw g();
325
+ if (!a) throw o();
326
326
  a.drawImage(e, 0, 0, i.width, i.height);
327
- let { image: o, luminance: s } = j(i), c = _e(s, i.width, i.height), l = te(c, i.width, i.height), u = document.createElement("canvas");
328
- u.width = i.width, u.height = i.height;
329
- let d = u.getContext("2d", { willReadFrequently: !0 });
330
- if (!d) throw g();
331
- let f = d.createImageData(u.width, u.height);
332
- return M(f, c), d.putImageData(f, 0, 0), M(o, l), a.putImageData(o, 0, 0), {
327
+ let { image: s, luminance: c } = j(i), l = ve(c, i.width, i.height), u = ne(l, i.width, i.height), d = document.createElement("canvas");
328
+ d.width = i.width, d.height = i.height;
329
+ let f = d.getContext("2d", { willReadFrequently: !0 });
330
+ if (!f) throw o();
331
+ let p = f.createImageData(d.width, d.height);
332
+ return M(p, l), f.putImageData(p, 0, 0), M(s, u), a.putImageData(s, 0, 0), {
333
333
  sparseCanvas: i,
334
- flattenedCanvas: u
334
+ flattenedCanvas: d
335
335
  };
336
336
  }
337
- function Je(e) {
337
+ function Xe(e) {
338
338
  let t = document.createElement("canvas");
339
339
  t.width = 24, t.height = 24;
340
340
  let n = t.getContext("2d", { willReadFrequently: !0 });
@@ -353,33 +353,33 @@ function Je(e) {
353
353
  };
354
354
  }
355
355
  async function N(e, t = {}) {
356
- await b("ocr");
357
- let n = Pe(t.language, t.langPath), r = n.language;
356
+ await v("ocr");
357
+ let n = Ie(t.language, t.langPath), r = n.language;
358
358
  D(t.minConfidence);
359
- let i = await f(e, { cloneCanvas: !1 }), { sparseCanvas: a, flattenedCanvas: o } = qe(i), s = t.shadowPass === !1 ? {
359
+ let i = await b(e, { cloneCanvas: !1 }), { sparseCanvas: a, flattenedCanvas: o } = Ye(i), s = t.shadowPass === !1 ? {
360
360
  strong: !1,
361
361
  strength: 0,
362
362
  darkness: 0,
363
363
  areaRatio: 0
364
- } : Be(i), { createWorker: c, PSM: l } = await import("tesseract.js"), u = 0, d = s.strong ? 3 : 2, p = await Le(c, r, {
365
- workerPath: Te.href,
366
- corePath: Ne(Me()).href,
367
- langPath: Ie(n),
364
+ } : He(i), { createWorker: c, PSM: l } = await import("tesseract.js"), u = 0, d = s.strong ? 3 : 2, f = await ze(c, r, {
365
+ workerPath: De.href,
366
+ corePath: Fe(Pe()).href,
367
+ langPath: Re(n),
368
368
  logger(e) {
369
369
  typeof e.progress == "number" && t.onProgress?.(Math.min(1, (u + e.progress) / d), e.status ?? "recognizing text");
370
370
  }
371
371
  });
372
372
  try {
373
- await p.setParameters({ tessedit_pageseg_mode: l.AUTO });
374
- let e = await p.recognize(i, {}, {
373
+ await f.setParameters({ tessedit_pageseg_mode: l.AUTO });
374
+ let e = await f.recognize(i, {}, {
375
375
  text: !0,
376
376
  blocks: !0
377
377
  });
378
- u = 1, await p.setParameters({
378
+ u = 1, await f.setParameters({
379
379
  tessedit_pageseg_mode: l.SPARSE_TEXT,
380
380
  preserve_interword_spaces: "1"
381
381
  });
382
- let n = await p.recognize(a, {}, {
382
+ let n = await f.recognize(a, {}, {
383
383
  text: !0,
384
384
  blocks: !0
385
385
  }), c = [{ blocks: e.data.blocks }, {
@@ -389,21 +389,21 @@ async function N(e, t = {}) {
389
389
  }], d = {
390
390
  ...t,
391
391
  includeWords: !0
392
- }, f = Je(i), m = A(c, d, {
392
+ }, p = Xe(i), m = A(c, d, {
393
393
  width: i.width,
394
394
  height: i.height
395
- }, f), h = t.shadowPass !== !1 && Ge(s, m.words, {
395
+ }, p), h = t.shadowPass !== !1 && qe(s, m.words, {
396
396
  width: i.width,
397
397
  height: i.height
398
- }, f);
398
+ }, p);
399
399
  if (h && s.region) {
400
400
  u = 2;
401
- let { tile: e, passMapping: t } = Ke(o, s.region, i.width, i.height);
402
- await p.setParameters({
401
+ let { tile: e, passMapping: t } = Je(o, s.region, i.width, i.height);
402
+ await f.setParameters({
403
403
  tessedit_pageseg_mode: l.SPARSE_TEXT,
404
404
  preserve_interword_spaces: "1"
405
405
  });
406
- let n = await p.recognize(e, {}, {
406
+ let n = await f.recognize(e, {}, {
407
407
  text: !0,
408
408
  blocks: !0
409
409
  });
@@ -415,7 +415,7 @@ async function N(e, t = {}) {
415
415
  let g = c.length === 2 ? m : A(c, d, {
416
416
  width: i.width,
417
417
  height: i.height
418
- }, f);
418
+ }, p);
419
419
  return t.onProgress?.(1, "recognizing text"), {
420
420
  text: g.text,
421
421
  confidence: g.confidence,
@@ -436,17 +436,17 @@ async function N(e, t = {}) {
436
436
  ...t.includeCharacters ? { characters: g.characters } : {}
437
437
  };
438
438
  } finally {
439
- await p.terminate();
439
+ await f.terminate();
440
440
  }
441
441
  }
442
442
  //#endregion
443
443
  //#region src/sdk/redact.ts
444
444
  async function P(e, t, n = {}) {
445
- await b("redaction");
446
- let r = await f(e), i = r.getContext("2d");
447
- if (!i) throw g();
445
+ await v("redaction");
446
+ let r = await b(e), i = r.getContext("2d");
447
+ if (!i) throw o();
448
448
  for (let e of t) {
449
- let t = u(e, r.width, r.height);
449
+ let t = Se(e, r.width, r.height);
450
450
  if (t.width < 1 || t.height < 1) continue;
451
451
  if ((e.mode ?? n.mode ?? "blackout") === "blackout") {
452
452
  i.fillStyle = "#050706", i.fillRect(t.x, t.y, t.width, t.height);
@@ -462,17 +462,17 @@ async function P(e, t, n = {}) {
462
462
  }
463
463
  return {
464
464
  canvas: r,
465
- blob: await l(r, n.mimeType ?? "image/png", n.quality)
465
+ blob: await ye(r, n.mimeType ?? "image/png", n.quality)
466
466
  };
467
467
  }
468
468
  //#endregion
469
469
  //#region src/sdk/face-model.ts
470
- var F = /* @__PURE__ */ new Map(), Ye = 8400;
471
- function Xe(e, t) {
470
+ var F = /* @__PURE__ */ new Map(), Ze = 8400;
471
+ function Qe(e, t) {
472
472
  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));
473
473
  return n / Math.max(1, e.width * e.height + t.width * t.height - n);
474
474
  }
475
- function Ze(e, t, n, r, i, a, o) {
475
+ function $e(e, t, n, r, i, a, o) {
476
476
  return {
477
477
  x: (e - n / 2) / i * a,
478
478
  y: (t - r / 2) / i * o,
@@ -480,39 +480,39 @@ function Ze(e, t, n, r, i, a, o) {
480
480
  height: r / i * o
481
481
  };
482
482
  }
483
- function Qe(e, t, n) {
483
+ function et(e, t, n) {
484
484
  let r = t.length === 3 ? t[1] : t[0], i = t.length === 3 ? t[2] : t[1];
485
- if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${Ye}, 6].`);
485
+ if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${Ze}, 6].`);
486
486
  let a = n.confidence ?? .35, o = n.inputSize ?? 640, s = [];
487
487
  for (let t = 0; t < r; t += 1) {
488
488
  let r = t * i, c = e[r + 4] * e[r + 5];
489
489
  c < a || s.push({
490
490
  confidence: c,
491
- bbox: Ze(e[r], e[r + 1], e[r + 2], e[r + 3], o, n.imageWidth, n.imageHeight)
491
+ bbox: $e(e[r], e[r + 1], e[r + 2], e[r + 3], o, n.imageWidth, n.imageHeight)
492
492
  });
493
493
  }
494
- return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => Xe(e.bbox, t.bbox) < .45)).slice(0, 8);
494
+ return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => Qe(e.bbox, t.bbox) < .45)).slice(0, 8);
495
495
  }
496
- async function $e(e, t, n = .35) {
497
- let r = await f(e, { cloneCanvas: !1 }), i = await import("onnxruntime-web"), a = document.createElement("canvas");
496
+ async function tt(e, t, n = .35) {
497
+ let r = await b(e, { cloneCanvas: !1 }), i = await import("onnxruntime-web"), a = document.createElement("canvas");
498
498
  a.width = 640, a.height = 640;
499
- let o = a.getContext("2d", { willReadFrequently: !0 });
500
- if (!o) throw g();
501
- o.drawImage(r, 0, 0, 640, 640);
502
- let s = o.getImageData(0, 0, 640, 640).data, c = 409600, l = new Float32Array(c * 3);
503
- for (let e = 0; e < c; e += 1) l[e] = s[e * 4] / 255, l[c + e] = s[e * 4 + 1] / 255, l[c * 2 + e] = s[e * 4 + 2] / 255;
504
- let u = F.get(t);
505
- u || (u = i.InferenceSession.create(t, {
499
+ let s = a.getContext("2d", { willReadFrequently: !0 });
500
+ if (!s) throw o();
501
+ s.drawImage(r, 0, 0, 640, 640);
502
+ let c = s.getImageData(0, 0, 640, 640).data, l = 409600, u = new Float32Array(l * 3);
503
+ for (let e = 0; e < l; e += 1) u[e] = c[e * 4] / 255, u[l + e] = c[e * 4 + 1] / 255, u[l * 2 + e] = c[e * 4 + 2] / 255;
504
+ let d = F.get(t);
505
+ d || (d = i.InferenceSession.create(t, {
506
506
  executionProviders: ["wasm"],
507
507
  graphOptimizationLevel: "all"
508
- }), F.set(t, u));
509
- let d = await u, p = (await d.run({ [d.inputNames[0]]: new i.Tensor("float32", l, [
508
+ }), F.set(t, d));
509
+ let f = await d, p = (await f.run({ [f.inputNames[0]]: new i.Tensor("float32", u, [
510
510
  1,
511
511
  3,
512
512
  640,
513
513
  640
514
- ]) }))[d.outputNames[0]];
515
- return Qe(p.data, p.dims.map(Number), {
514
+ ]) }))[f.outputNames[0]];
515
+ return et(p.data, p.dims.map(Number), {
516
516
  confidence: n,
517
517
  imageWidth: r.width,
518
518
  imageHeight: r.height,
@@ -529,17 +529,17 @@ var I = /* @__PURE__ */ new Map(), L = [
529
529
  "expiration_date",
530
530
  "postal_code",
531
531
  "state"
532
- ], et = 8400;
532
+ ], nt = 8400;
533
533
  function R(e) {
534
534
  return 5 + e;
535
535
  }
536
536
  var z = 640;
537
- function tt(e, t) {
537
+ function rt(e, t) {
538
538
  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));
539
539
  return n / Math.max(1, e.bbox.width * e.bbox.height + t.bbox.width * t.bbox.height - n);
540
540
  }
541
541
  function B(e) {
542
- return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field || tt(e, t) < .45)).slice(0, 30);
542
+ return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field || rt(e, t) < .45)).slice(0, 30);
543
543
  }
544
544
  function V(e, t, n, r, i, a, o) {
545
545
  return {
@@ -559,15 +559,15 @@ function H(e, t) {
559
559
  features: n
560
560
  } : null;
561
561
  }
562
- function nt(e) {
562
+ function it(e) {
563
563
  return e.length === 3 && e[1] >= 5 && e[2] >= 1;
564
564
  }
565
- function rt(e) {
565
+ function at(e) {
566
566
  let t = R(e);
567
- 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, ${et}, ${t}].`);
567
+ 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, ${nt}, ${t}].`);
568
568
  }
569
- function it(e, t, n, r, i, a, o) {
570
- if (!nt(t)) throw Error("Unsupported field-model YOLO output shape.");
569
+ function ot(e, t, n, r, i, a, o) {
570
+ if (!it(t)) throw Error("Unsupported field-model YOLO output shape.");
571
571
  let s = t[1], c = t[2], l = [];
572
572
  for (let t = 0; t < c; t += 1) {
573
573
  let u = 0, d = 0;
@@ -584,9 +584,9 @@ function it(e, t, n, r, i, a, o) {
584
584
  }
585
585
  return B(l);
586
586
  }
587
- function at(e, t, n, r, i, a, o) {
587
+ function st(e, t, n, r, i, a, o) {
588
588
  let s = H(t, n.length);
589
- if (!s) throw rt(n.length);
589
+ if (!s) throw at(n.length);
590
590
  let c = [];
591
591
  for (let t = 0; t < s.anchors; t += 1) {
592
592
  let l = t * s.features, u = e[l + 4], d = 0, f = 0;
@@ -603,23 +603,23 @@ function at(e, t, n, r, i, a, o) {
603
603
  }
604
604
  return B(c);
605
605
  }
606
- function ot(e, t, n) {
606
+ function ct(e, t, n) {
607
607
  let r = n.classes ?? L, i = n.confidence ?? .35, a = n.inputSize ?? z, o = H(t, r.length);
608
608
  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.");
609
- return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ? at(e, t, r, i, a, n.imageWidth, n.imageHeight) : it(e, t, r, i, a, n.imageWidth, n.imageHeight);
610
- }
611
- async function st(e, t, n = L, r = .35, i) {
612
- let o = await f(e, { cloneCanvas: !1 }), s = import("onnxruntime-web"), c = z, l = document.createElement("canvas");
613
- l.width = c, l.height = c;
614
- let u = l.getContext("2d", { willReadFrequently: !0 });
615
- if (!u) throw g();
616
- u.drawImage(o, 0, 0, c, c);
617
- let d = u.getImageData(0, 0, c, c).data, p = c * c, m = new Float32Array(p * 3);
618
- for (let e = 0; e < p; e += 1) m[e] = d[e * 4] / 255, m[p + e] = d[e * 4 + 1] / 255, m[p * 2 + e] = d[e * 4 + 2] / 255;
609
+ return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ? st(e, t, r, i, a, n.imageWidth, n.imageHeight) : ot(e, t, r, i, a, n.imageWidth, n.imageHeight);
610
+ }
611
+ async function lt(e, t, n = L, r = .35, i) {
612
+ let a = await b(e, { cloneCanvas: !1 }), s = import("onnxruntime-web"), c = z, u = document.createElement("canvas");
613
+ u.width = c, u.height = c;
614
+ let d = u.getContext("2d", { willReadFrequently: !0 });
615
+ if (!d) throw o();
616
+ d.drawImage(a, 0, 0, c, c);
617
+ let f = d.getImageData(0, 0, c, c).data, p = c * c, m = new Float32Array(p * 3);
618
+ for (let e = 0; e < p; e += 1) m[e] = f[e * 4] / 255, m[p + e] = f[e * 4 + 1] / 255, m[p * 2 + e] = f[e * 4 + 2] / 255;
619
619
  let h = I.get(t);
620
620
  h || (h = (async () => {
621
621
  try {
622
- let [e, n] = await Promise.all([s, a(t)]);
622
+ let [e, n] = await Promise.all([s, l(t)]);
623
623
  return await e.InferenceSession.create(n, {
624
624
  executionProviders: ["wasm"],
625
625
  graphOptimizationLevel: "all"
@@ -628,18 +628,18 @@ async function st(e, t, n = L, r = .35, i) {
628
628
  throw I.delete(t), e;
629
629
  }
630
630
  })(), I.set(t, h));
631
- let [_, v] = await Promise.all([s, h]), y = (await v.run({ [v.inputNames[0]]: new _.Tensor("float32", m, [
631
+ let [g, _] = await Promise.all([s, h]), v = (await _.run({ [_.inputNames[0]]: new g.Tensor("float32", m, [
632
632
  1,
633
633
  3,
634
634
  c,
635
635
  c
636
- ]) }))[v.outputNames[0]];
637
- return ot(y.data, y.dims.map(Number), {
636
+ ]) }))[_.outputNames[0]];
637
+ return ct(v.data, v.dims.map(Number), {
638
638
  classes: n,
639
639
  confidence: r,
640
640
  layout: i,
641
- imageWidth: o.width,
642
- imageHeight: o.height,
641
+ imageWidth: a.width,
642
+ imageHeight: a.height,
643
643
  inputSize: c
644
644
  });
645
645
  }
@@ -676,7 +676,7 @@ function G(e, t, n = !1) {
676
676
  function K(e) {
677
677
  return e.reduce((e, t) => e + t.confidence, 0) / Math.max(1, e.length);
678
678
  }
679
- function ct(e, t) {
679
+ function ut(e, t) {
680
680
  let n = e.mode, r = n === "case-insensitive", i = e.scope ?? "line", a;
681
681
  if (n === "regex") {
682
682
  let t = e.pattern ?? e.values?.[0];
@@ -713,14 +713,14 @@ function ct(e, t) {
713
713
  }
714
714
  return s;
715
715
  }
716
- function lt(e, t) {
716
+ function dt(e, t) {
717
717
  let n = e.labelMode !== "exact", r = G(e.label, n, !0).split(" ");
718
718
  for (let e of t) for (let t = 0; t <= e.words.length - r.length; t += 1) {
719
719
  let i = e.words.slice(t, t + r.length);
720
720
  if (i.every((e, t) => G(e.text, n, !0) === r[t])) return i;
721
721
  }
722
722
  }
723
- function ut(e, t, n, r, i, a) {
723
+ function ft(e, t, n, r, i, a) {
724
724
  let o = a.window?.distance ?? .28, s = a.window?.crossAxis ?? .12, c = t.x + t.width / 2, l = t.y + t.height / 2;
725
725
  return e.filter((e) => {
726
726
  let a = e.bbox.x + e.bbox.width / 2, u = e.bbox.y + e.bbox.height / 2;
@@ -728,7 +728,7 @@ function ut(e, t, n, r, i, a) {
728
728
  });
729
729
  }
730
730
  function q(e, t, n, r, i, a = "label") {
731
- let o = lt(e, n);
731
+ let o = dt(e, n);
732
732
  if (!o) return [];
733
733
  let s = U(o), c = new Set(o), l = t.filter((e) => !c.has(e)), u = e.direction === "any" ? [
734
734
  "right",
@@ -737,7 +737,7 @@ function q(e, t, n, r, i, a = "label") {
737
737
  "above"
738
738
  ] : [e.direction], d;
739
739
  for (let t of u) {
740
- let n = W(ut(l, s, t, r, i, e));
740
+ let n = W(ft(l, s, t, r, i, e));
741
741
  for (let t of n) {
742
742
  if (e.valuePattern && !new RegExp(e.valuePattern, e.patternFlags).test(t.text)) continue;
743
743
  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);
@@ -795,7 +795,7 @@ var J = {
795
795
  "POSTAL"
796
796
  ],
797
797
  state: ["STATE", "DAJ"]
798
- }, dt = new Set(Object.values(J).flat()), Y = /^(?:\d{2}[/-]\d{2}[/-]\d{2,4}|\d{4}[/-]\d{2}[/-]\d{2}|\d{6}|\d{8})$/, X = /\b(?:ST|STREET|AVE|AVENUE|RD|ROAD|BLVD|BOULEVARD|LN|LANE|DR|DRIVE|WAY|CT|COURT)\b/i, Z = /\b(?:DRIVER|LICENSE|IDENTIFICATION|CARD|CLASS|SEX|EYES|HEIGHT|RESTRICTIONS)\b/i;
798
+ }, pt = new Set(Object.values(J).flat()), Y = /^(?:\d{2}[/-]\d{2}[/-]\d{2,4}|\d{4}[/-]\d{2}[/-]\d{2}|\d{6}|\d{8})$/, X = /\b(?:ST|STREET|AVE|AVENUE|RD|ROAD|BLVD|BOULEVARD|LN|LANE|DR|DRIVE|WAY|CT|COURT)\b/i, Z = /\b(?:DRIVER|LICENSE|IDENTIFICATION|CARD|CLASS|SEX|EYES|HEIGHT|RESTRICTIONS)\b/i;
799
799
  function Q(e, t) {
800
800
  let n = t.trim();
801
801
  return n ? e === "date_of_birth" || e === "expiration_date" ? Y.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) && !Z.test(n) : /\d/.test(n) && /[A-Z]/i.test(n) : !1;
@@ -810,17 +810,17 @@ function $(e, t, n, r, i = 1) {
810
810
  confidence: Math.max(0, Math.min(1, K(n) * i))
811
811
  };
812
812
  }
813
- function ft(e, t, n) {
813
+ function mt(e, t, n) {
814
814
  let r = J[e], i = [];
815
815
  for (let a of n) for (let n = 0; n < a.words.length; n += 1) {
816
816
  let o = a.words[n].text.toUpperCase().replace(/[^A-Z0-9]/g, ""), s = r.find((e) => o === e || o.startsWith(e));
817
817
  if (!s) continue;
818
818
  let c, l;
819
- o === s ? (c = a.words.slice(n + 1).filter((e) => !dt.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 && Q(e, l) && i.push($(t, "alias", c, l, .98));
819
+ o === s ? (c = a.words.slice(n + 1).filter((e) => !pt.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 && Q(e, l) && i.push($(t, "alias", c, l, .98));
820
820
  }
821
821
  return i;
822
822
  }
823
- function pt(e, t, n) {
823
+ function ht(e, t, n) {
824
824
  let r = n.filter((e) => {
825
825
  let t = e.text.replace(/\s/g, "");
826
826
  return t.includes("<<") || /^[A-Z0-9<]{25,}$/.test(t);
@@ -842,7 +842,7 @@ function pt(e, t, n) {
842
842
  }
843
843
  return [];
844
844
  }
845
- function mt(e) {
845
+ function gt(e) {
846
846
  let t = e.replace(/\s/g, ""), n = t.match(/\d{4}/)?.[0];
847
847
  if (n) return Number(n);
848
848
  let r = t.match(/^\d{2}/)?.[0];
@@ -850,7 +850,7 @@ function mt(e) {
850
850
  let i = Number(r);
851
851
  return i > (/* @__PURE__ */ new Date()).getFullYear() % 100 ? 1900 + i : 2e3 + i;
852
852
  }
853
- function ht(e, t, n, r, i) {
853
+ function _t(e, t, n, r, i) {
854
854
  if (e === "address") {
855
855
  let e = r.findIndex((e) => /\d/.test(e.text) && X.test(e.text));
856
856
  if (e < 0) return [];
@@ -870,7 +870,7 @@ function ht(e, t, n, r, i) {
870
870
  if (e === "date_of_birth" || e === "expiration_date") {
871
871
  let r = (/* @__PURE__ */ new Date()).getFullYear(), i = n.filter((e) => Y.test(e.text.replace(/\s/g, ""))).map((e) => ({
872
872
  word: e,
873
- year: mt(e.text)
873
+ year: gt(e.text)
874
874
  })).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);
875
875
  return a.sort((t, n) => e === "date_of_birth" ? t.year - n.year : n.year - t.year), a.length ? [$(t, "layout", [a[0].word], void 0, .72)] : [];
876
876
  }
@@ -888,29 +888,29 @@ function ht(e, t, n, r, i) {
888
888
  }
889
889
  return [];
890
890
  }
891
- function gt(e, t) {
891
+ function vt(e, t) {
892
892
  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);
893
893
  }
894
- function _t(e, t, n, r) {
895
- let i = ft(e.field, e.id, n), a = pt(e.field, e.id, n);
896
- return i.length || a.length ? [...i, ...a] : ht(e.field, e.id, t, n, r);
894
+ function yt(e, t, n, r) {
895
+ let i = mt(e.field, e.id, n), a = ht(e.field, e.id, n);
896
+ return i.length || a.length ? [...i, ...a] : _t(e.field, e.id, t, n, r);
897
897
  }
898
- function vt(e, t, n) {
898
+ function bt(e, t, n) {
899
899
  let r = (n ?? []).filter((t) => t.field === e.field).sort((e, t) => t.confidence - e.confidence);
900
900
  for (let n of r) {
901
- let r = t.filter((e) => gt(n.bbox, e.bbox) >= .3);
901
+ let r = t.filter((e) => vt(n.bbox, e.bbox) >= .3);
902
902
  if (!r.length) continue;
903
903
  let i = r.map((e) => e.text).join(" ");
904
904
  if (Q(e.field, i)) return $(e.id, "model", r, i, n.confidence);
905
905
  }
906
906
  }
907
- function yt(e, t, n, r, i, a) {
908
- let o = _t(e, t, n, r);
907
+ function xt(e, t, n, r, i, a) {
908
+ let o = yt(e, t, n, r);
909
909
  if (e.detector !== "model" || !a) return o;
910
- let s = vt(e, t, i);
910
+ let s = bt(e, t, i);
911
911
  return s ? [s] : [];
912
912
  }
913
- function bt(e, t, n, r) {
913
+ function St(e, t, n, r) {
914
914
  let i = (e) => Math.max(0, Math.min(1, e)), a = i(e.rect.x), o = i(e.rect.y);
915
915
  return {
916
916
  ruleId: `${t}.${e.id}`,
@@ -925,16 +925,16 @@ function bt(e, t, n, r) {
925
925
  confidence: 1
926
926
  };
927
927
  }
928
- function xt(e, t) {
928
+ function Ct(e, t) {
929
929
  let n = t.imageWidth ?? e?.imageWidth ?? 0, r = t.imageHeight ?? e?.imageHeight ?? 0, i = e?.words ?? [], a = W(i), o = [], s = [];
930
930
  for (let e of t.rules) {
931
- let c = e.strategy === "string" ? ct(e, a) : e.strategy === "label" ? q(e, i, a, n, r) : yt(e, i, a, r, t.semanticDetections, t.modelRequested === !0);
931
+ let c = e.strategy === "string" ? ut(e, a) : e.strategy === "label" ? q(e, i, a, n, r) : xt(e, i, a, r, t.semanticDetections, t.modelRequested === !0);
932
932
  c.length ? o.push(...c) : s.push(e.id);
933
933
  }
934
934
  for (let e of t.template?.fields ?? []) {
935
935
  let c = `${t.template.id}.${e.id}`;
936
936
  if (e.strategy === "rect") {
937
- n && r ? o.push(bt(e, t.template.id, n, r)) : s.push(c);
937
+ n && r ? o.push(St(e, t.template.id, n, r)) : s.push(c);
938
938
  continue;
939
939
  }
940
940
  let l = q({
@@ -955,36 +955,36 @@ function xt(e, t) {
955
955
  confidence: u
956
956
  };
957
957
  }
958
- function St(e) {
958
+ function wt(e) {
959
959
  return e.rules.length > 0 || e.template?.fields.some((e) => e.strategy === "anchor") === !0;
960
960
  }
961
- function Ct(e, t = !1) {
961
+ function Tt(e, t = !1) {
962
962
  return t && !e.complete ? "unmatched" : e.complete ? "success" : "partial";
963
963
  }
964
- async function wt(e, t) {
965
- await b("redaction");
966
- let n = await f(e, { cloneCanvas: !1 }), r = t.ocr;
967
- St(t) && !r && (r = await N(n, { includeWords: !0 }));
964
+ async function Et(e, t) {
965
+ await v("redaction");
966
+ let n = await b(e, { cloneCanvas: !1 }), r = t.ocr;
967
+ wt(t) && !r && (r = await N(n, { includeWords: !0 }));
968
968
  let i = t.semanticDetections, a = t.modelRequested === !0, o = "not-requested", s;
969
969
  if (t.models?.fields) try {
970
- i = await st(n, t.models.fields, t.models.fieldClasses, t.models.confidence, t.models.fieldLayout), a = !0, o = "loaded";
970
+ i = await lt(n, t.models.fields, t.models.fieldClasses, t.models.confidence, t.models.fieldLayout), a = !0, o = "loaded";
971
971
  } catch (e) {
972
972
  s = e instanceof Error ? e.message : "The field model could not load.";
973
973
  let n = t.models.allowHeuristicFallback !== !1;
974
974
  a = !n, o = n ? "fallback" : "failed";
975
975
  }
976
- let c = xt(r, {
976
+ let c = Ct(r, {
977
977
  rules: t.rules,
978
978
  template: t.template,
979
979
  imageWidth: n.width,
980
980
  imageHeight: n.height,
981
981
  semanticDetections: i,
982
982
  modelRequested: a
983
- }), l = Ct(c, t.requireAll), u = [], d = "not-requested", p;
983
+ }), l = Tt(c, t.requireAll), u = [], d = "not-requested", f;
984
984
  if (t.models?.face) try {
985
- u = await $e(n, t.models.face, t.models.faceConfidence), d = "loaded";
985
+ u = await tt(n, t.models.face, t.models.faceConfidence), d = "loaded";
986
986
  } catch (e) {
987
- p = e instanceof Error ? e.message : "The face model could not load.", d = "failed";
987
+ f = e instanceof Error ? e.message : "The face model could not load.", d = "failed";
988
988
  }
989
989
  if (l === "unmatched") return {
990
990
  ...c,
@@ -994,9 +994,9 @@ async function wt(e, t) {
994
994
  modelError: s,
995
995
  faces: u,
996
996
  faceStatus: d,
997
- faceError: p
997
+ faceError: f
998
998
  };
999
- let m = await P(n, [...c.matches.map((e) => ({
999
+ let p = await P(n, [...c.matches.map((e) => ({
1000
1000
  ...e.bbox,
1001
1001
  mode: t.style?.mode
1002
1002
  })), ...u.map((e) => ({
@@ -1007,16 +1007,16 @@ async function wt(e, t) {
1007
1007
  ...c,
1008
1008
  status: l,
1009
1009
  ocr: r,
1010
- canvas: m.canvas,
1011
- blob: m.blob,
1010
+ canvas: p.canvas,
1011
+ blob: p.blob,
1012
1012
  modelStatus: o,
1013
1013
  modelError: s,
1014
1014
  faces: u,
1015
1015
  faceStatus: d,
1016
- faceError: p
1016
+ faceError: f
1017
1017
  };
1018
1018
  }
1019
1019
  //#endregion
1020
- export { ne as AutoTorchController, h as DEFAULT_DOCUMENT_MODEL_URL, c as DEV_LICENSE_HOSTS, p as LicenseError, re as NEAR_BLACK_LUMINANCE, ge as QuadStabilityTracker, pe as STILL_MAX_EDGE, o as ScannerError, P as applyRedactions, b as assertLicense, de as autoCaptureControl, ue as captureVideoFrame, we as createFinderSimulator, i as cropDocument, ae as detectBrowserEngine, r as detectDocument, ie as formatCaptureDiagnosticsReport, t as getLicense, v as isAndroidBrowser, ve as isNearBlackFrame, me as limitingFillTarget, Se as mapDocumentCornersToFrame, xt as matchRedactionRules, xe as meanFrameLuminance, oe as measureQuadFill, ee as mobileCameraConstraints, be as pickNativeCameraStill, N as recognizeText, wt as redactProgrammatically, d as resolveDocumentModelUrl, ce as scanDocument, e as scanSystemCameraStill, y as selectFinderGuidance, fe as selectFinderHint, _ as setLicenseKey, m as shouldUseSystemCameraCapture, Ce as simulatorQuad, n as startCamera, he as startFinder, s as subscribeModelDownloads, se as systemCameraFindMessage, ye as torchControl };
1020
+ export { xe as AutoTorchController, re as DEFAULT_DOCUMENT_MODEL_URL, Ce as DEV_LICENSE_HOSTS, t as LicenseError, h as NEAR_BLACK_LUMINANCE, _e as QuadStabilityTracker, n as STILL_MAX_EDGE, y as ScannerError, P as applyRedactions, v as assertLicense, fe as autoCaptureControl, be as captureVideoFrame, Ee as createFinderSimulator, ie as cropDocument, g as detectBrowserEngine, me as detectDocument, i as formatCaptureDiagnosticsReport, s as getLicense, r as hasTransientUserActivation, f as isAndroidBrowser, le as isNearBlackFrame, he as limitingFillTarget, we as mapDocumentCornersToFrame, Ct as matchRedactionRules, e as meanFrameLuminance, se as measureQuadFill, ce as mobileCameraConstraints, u as pickNativeCameraStill, N as recognizeText, Et as redactProgrammatically, de as resolveDocumentModelUrl, oe as scanDocument, ae as scanSystemCameraStill, te as selectFinderGuidance, pe as selectFinderHint, _ as setLicenseKey, d as shouldPreferWebGpuForDocumentModel, p as shouldUseSystemCameraCapture, Te as simulatorQuad, a as startCamera, ge as startFinder, m as subscribeModelDownloads, ee as systemCameraFindMessage, c as torchControl };
1021
1021
 
1022
1022
  //# sourceMappingURL=scanner-sdk.js.map