@exige/web-scanner-sdk 0.2.28 → 0.2.29

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/react.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { A as e, D as t, E as n, F as r, M as i, P as a, R as o, T as s, g as c, o as l, s as u } from "./finder-BvBpdbHa.js";
3
- import { createContext as d, useCallback as f, useContext as p, useEffect as m, useLayoutEffect as ee, useMemo as te, useRef as h, useState as g } from "react";
4
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
2
+ import { B as e, I as t, M as n, N as r, R as i, T as a, U as o, V as s, i as c, j as l, n as u, v as d, y as f } from "./driver-license-CKMrW8dP.js";
3
+ import { createContext as p, useCallback as m, useContext as h, useEffect as g, useLayoutEffect as ee, useMemo as te, useRef as _, useState as v } from "react";
4
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
5
5
  //#region src/sdk/display-quad.ts
6
- function b(e) {
6
+ function S(e) {
7
7
  return [
8
8
  e.topLeft,
9
9
  e.topRight,
@@ -11,7 +11,7 @@ function b(e) {
11
11
  e.bottomLeft
12
12
  ];
13
13
  }
14
- function x(e) {
14
+ function C(e) {
15
15
  let [t, n, r, i] = e;
16
16
  return {
17
17
  topLeft: t,
@@ -38,8 +38,8 @@ function x(e) {
38
38
  }
39
39
  };
40
40
  }
41
- function S(e) {
42
- return x(b(e).map((e) => ({ ...e })));
41
+ function w(e) {
42
+ return C(S(e).map((e) => ({ ...e })));
43
43
  }
44
44
  var ne = class {
45
45
  current;
@@ -50,11 +50,11 @@ var ne = class {
50
50
  this.response = e.response ?? 14, this.snapDistance = e.snapDistance ?? .1;
51
51
  }
52
52
  setTarget(e, t, n) {
53
- let r = Math.max(1, Math.hypot(t, n)), i = !this.current || b(e).some((e, t) => {
54
- let n = b(this.current)[t];
53
+ let r = Math.max(1, Math.hypot(t, n)), i = !this.current || S(e).some((e, t) => {
54
+ let n = S(this.current)[t];
55
55
  return Math.hypot(e.x - n.x, e.y - n.y) / r > this.snapDistance;
56
56
  });
57
- return this.target = S(e), i && (this.current = S(e)), {
57
+ return this.target = w(e), i && (this.current = w(e)), {
58
58
  quad: this.current,
59
59
  snapped: i
60
60
  };
@@ -62,8 +62,8 @@ var ne = class {
62
62
  step(e) {
63
63
  if (!this.current || !this.target) return this.current;
64
64
  let t = 1 - Math.exp(-this.response * Math.max(0, e) / 1e3);
65
- return this.current = x(b(this.current).map((e, n) => {
66
- let r = b(this.target)[n];
65
+ return this.current = C(S(this.current).map((e, n) => {
66
+ let r = S(this.target)[n];
67
67
  return {
68
68
  x: e.x + (r.x - e.x) * t,
69
69
  y: e.y + (r.y - e.y) * t
@@ -76,7 +76,7 @@ var ne = class {
76
76
  getCurrent() {
77
77
  return this.current;
78
78
  }
79
- }, re = d(null);
79
+ }, re = p(null);
80
80
  //#endregion
81
81
  //#region src/react/context.tsx
82
82
  function ie(e) {
@@ -90,295 +90,373 @@ function ae(e) {
90
90
  return;
91
91
  }
92
92
  }
93
- function C({ open: s, autoCapture: d = "defaultOn", captureMode: p = "auto", torch: _ = "defaultOff", onCapture: y, onCancel: b, onError: x, onSettings: S, onFinderStatus: C, modelUrl: w, ortWasmPaths: T, detectionIntervalMs: oe, apiRef: E, children: se }) {
94
- let D = a(p), O = h(void 0), k = h(void 0), A = h(void 0), j = h(void 0), M = h({}), N = h(new ne()), P = h(!1), F = h(!1), I = h({
95
- onCapture: y,
96
- onCancel: b,
97
- onError: x,
98
- onSettings: S,
99
- onFinderStatus: C
100
- }), L = h(null), [R, ce] = g(null), [le, z] = g(D && s ? "capturing" : D ? "ready" : "starting"), [B, V] = g(), [ue, H] = g(), [de, fe] = g({
93
+ function T({ open: l, useCase: u = "document", autoCapture: p = "defaultOn", captureMode: h = "auto", torch: y = "defaultOff", onCapture: x, onDriverLicense: S, onCancel: C, onError: w, onSettings: T, onFinderStatus: E, modelUrl: D, ortWasmPaths: O, detectionIntervalMs: oe, apiRef: k, children: se }) {
94
+ let A = e(h), j = _(void 0), M = _(void 0), N = _(void 0), P = _(void 0), F = _({}), I = _(new ne()), L = _(!1), R = _(!1), z = _({
95
+ onCapture: x,
96
+ onDriverLicense: S,
97
+ onCancel: C,
98
+ onError: w,
99
+ onSettings: T,
100
+ onFinderStatus: E,
101
+ useCase: u
102
+ }), ce = _(void 0), B = _(void 0), le = _(async () => void 0), ue = _(null), [V, de] = v(null), [fe, H] = v(A && l ? "capturing" : A ? "ready" : "starting"), [U, pe] = v(), [me, W] = v(), [he, ge] = v({
101
103
  width: 1,
102
104
  height: 1
103
- }), [pe, me] = g(), [he, U] = g(), [ge, W] = g(""), [_e, ve] = g(0), [ye, G] = g(), [be, K] = g(), [xe, q] = g("idle"), [Se, Ce] = g(), J = h(void 0), [we, Te] = g({
105
+ }), [_e, ve] = v(), [ye, G] = v(), [be, K] = v(""), [xe, Se] = v(0), [Ce, q] = v(), [we, J] = v(), [Te, Y] = v("idle"), [Ee, De] = v(), X = _(void 0), [Oe, ke] = v("front"), Ae = _("front"), [je, Me] = v(!1), [Ne, Pe] = v({
104
106
  downloading: !1,
105
107
  loaded: 0,
106
108
  total: null
107
- }), Y = f(() => {
108
- ie(J.current), J.current = void 0, Ce(void 0);
109
- }, []), X = f((e, t) => {
109
+ }), Z = m(() => {
110
+ ie(X.current), X.current = void 0, De(void 0);
111
+ }, []), Q = m((e, t) => {
110
112
  let n = ae(e);
111
- ie(J.current), J.current = n, Ce(n), t?.pause();
113
+ ie(X.current), X.current = n, De(n), t?.pause();
112
114
  }, []);
113
- m(() => {
114
- I.current = {
115
- onCapture: y,
116
- onCancel: b,
117
- onError: x,
118
- onSettings: S,
119
- onFinderStatus: C
115
+ g(() => {
116
+ z.current = {
117
+ onCapture: x,
118
+ onDriverLicense: S,
119
+ onCancel: C,
120
+ onError: w,
121
+ onSettings: T,
122
+ onFinderStatus: E,
123
+ useCase: u
120
124
  };
121
125
  }, [
122
- y,
123
- b,
124
126
  x,
125
127
  S,
126
- C
127
- ]), m(() => o(Te), []);
128
- let Ee = f((e) => {
129
- ce(e);
128
+ C,
129
+ w,
130
+ T,
131
+ E,
132
+ u
133
+ ]), g(() => o(Pe), []), g(() => {
134
+ if (!l || u !== "drivers-license") {
135
+ B.current = void 0, ce.current = void 0, ke("front"), Me(!1);
136
+ return;
137
+ }
138
+ let e = c({ scan: {
139
+ modelUrl: D,
140
+ ortWasmPaths: O
141
+ } });
142
+ return B.current = e, e.then((e) => {
143
+ ce.current = e;
144
+ }), () => {
145
+ e.then((e) => e.cancel()), ce.current &&= void 0, B.current = void 0;
146
+ };
147
+ }, [
148
+ l,
149
+ u,
150
+ D,
151
+ O
152
+ ]);
153
+ let Fe = m((e) => {
154
+ de(e);
130
155
  }, []);
131
- m(() => {
132
- if (!s || !R) return;
156
+ g(() => {
157
+ if (!l || !V) return;
133
158
  let e = () => {
134
- let e = R.getBoundingClientRect();
135
- fe({
159
+ let e = V.getBoundingClientRect();
160
+ ge({
136
161
  width: e.width,
137
162
  height: e.height
138
163
  });
139
164
  };
140
165
  if (e(), typeof ResizeObserver > "u") return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
141
166
  let t = new ResizeObserver(e);
142
- return t.observe(R), () => t.disconnect();
143
- }, [s, R]), m(() => {
144
- if (!s) return;
167
+ return t.observe(V), () => t.disconnect();
168
+ }, [l, V]), g(() => {
169
+ if (!l) return;
145
170
  let e = window.setInterval(() => {
146
- let e = O.current?.getDiagnostics();
147
- e && G(e);
171
+ let e = j.current?.getDiagnostics();
172
+ e && q(e);
148
173
  }, 500);
149
174
  return () => window.clearInterval(e);
150
- }, [s, _e]), m(() => {
151
- if (!s) return;
175
+ }, [l, xe]), g(() => {
176
+ if (!l) return;
152
177
  let e = 0, t = performance.now(), n = (r) => {
153
- let i = N.current.step(r - t);
154
- t = r, i && H(i), e = requestAnimationFrame(n);
178
+ let i = I.current.step(r - t);
179
+ t = r, i && W(i), e = requestAnimationFrame(n);
155
180
  };
156
181
  return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
157
- }, [s]), m(() => {
158
- if (!s || D || !R) return;
182
+ }, [l]), g(() => {
183
+ if (!l || A || !V) return;
159
184
  let e = !1, t = () => {
160
- k.current?.stop(), k.current = void 0, O.current?.stop(), O.current = void 0, j.current = void 0, A.current = void 0, M.current = {}, Y();
185
+ M.current?.stop(), M.current = void 0, j.current?.stop(), j.current = void 0, P.current = void 0, N.current = void 0, F.current = {}, Z();
161
186
  };
162
187
  return (async () => {
163
- t(), P.current = !1, z("starting"), W(""), V(void 0), U(void 0), K(void 0), q("idle"), Y();
188
+ t(), L.current = !1, H("starting"), K(""), pe(void 0), G(void 0), J(void 0), Y("idle"), Z();
164
189
  try {
165
- let t = await r(R, { torch: _ });
190
+ let t = await s(V, { torch: y });
166
191
  if (e) {
167
192
  t.stop();
168
193
  return;
169
194
  }
170
- O.current = t;
195
+ j.current = t;
171
196
  let n = t.getSettings();
172
- me(n), I.current.onSettings?.(n), console.info("[ScannerProvider] camera settings", n), k.current = await u({
173
- source: R,
174
- autoCapture: d,
197
+ ve(n), z.current.onSettings?.(n), console.info("[ScannerProvider] camera settings", n), M.current = await f({
198
+ source: V,
199
+ autoCapture: p,
175
200
  intervalMs: oe,
176
201
  detection: {
177
- modelUrl: w,
178
- ortWasmPaths: T
202
+ modelUrl: D,
203
+ ortWasmPaths: O
179
204
  },
180
205
  onStatus: (e) => {
181
- if (A.current = e, V(e), I.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
182
- let t = N.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
183
- H(t.quad);
184
- } else N.current.clear(), H(void 0);
185
- e.state !== "captured" && !P.current && z("ready");
206
+ if (N.current = e, pe(e), z.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
207
+ let t = I.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
208
+ W(t.quad);
209
+ } else I.current.clear(), W(void 0);
210
+ e.state !== "captured" && !L.current && H("ready");
186
211
  },
187
212
  captureFrame: async () => {
188
- z("capturing"), M.current = {
189
- quad: N.current.getCurrent(),
190
- sourceWidth: A.current?.sourceWidth,
191
- sourceHeight: A.current?.sourceHeight
213
+ H("capturing"), F.current = {
214
+ quad: I.current.getCurrent(),
215
+ sourceWidth: N.current?.sourceWidth,
216
+ sourceHeight: N.current?.sourceHeight
192
217
  };
193
218
  let e = await t.capturePhoto();
194
- if (j.current = e, U(e.method), K(e.diagnostics), G(e.diagnostics), e.luminance <= 10) throw Error(`The captured frame was blank (luminance ${e.luminance.toFixed(1)} via ${e.method}). Keep the scanner visible while capturing and retake.`);
195
- return X(e.frame, R), z("captured"), e.frame;
219
+ if (P.current = e, G(e.method), J(e.diagnostics), q(e.diagnostics), e.luminance <= 10) throw Error(`The captured frame was blank (luminance ${e.luminance.toFixed(1)} via ${e.method}). Keep the scanner visible while capturing and retake.`);
220
+ return Q(e.frame, V), H("captured"), e.frame;
196
221
  },
197
222
  onCaptureError: (e) => {
198
- P.current = !0, z("error"), W(e.message);
199
- let t = O.current?.getDiagnostics();
200
- t && G(t), I.current.onError?.(e);
223
+ L.current = !0, H("error"), K(e.message);
224
+ let t = j.current?.getDiagnostics();
225
+ t && q(t), z.current.onError?.(e);
201
226
  },
202
227
  onCapture: async (e) => {
203
- let n = j.current;
204
- await new Promise((e) => window.setTimeout(e, 140)), await I.current.onCapture({
228
+ let n = P.current;
229
+ await new Promise((e) => window.setTimeout(e, 140));
230
+ let r = {
205
231
  ...e,
206
232
  method: n?.method ?? "video-frame",
207
233
  settings: n?.settings ?? t.getSettings(),
208
234
  fallbackReason: n?.fallbackReason,
209
235
  luminance: n?.luminance,
210
236
  diagnostics: n?.diagnostics,
211
- displayedQuad: M.current.quad,
212
- displaySourceWidth: M.current.sourceWidth,
213
- displaySourceHeight: M.current.sourceHeight
214
- });
237
+ displayedQuad: F.current.quad,
238
+ displaySourceWidth: F.current.sourceWidth,
239
+ displaySourceHeight: F.current.sourceHeight
240
+ };
241
+ if (z.current.useCase === "drivers-license") {
242
+ await le.current(r);
243
+ return;
244
+ }
245
+ await z.current.onCapture?.(r);
215
246
  }
216
247
  });
217
248
  } catch (n) {
218
249
  if (e) return;
219
250
  t();
220
251
  let r = n instanceof Error ? n : /* @__PURE__ */ Error("Camera access failed.");
221
- W(r.message), z("error"), I.current.onError?.(r);
252
+ K(r.message), H("error"), z.current.onError?.(r);
222
253
  }
223
254
  })(), () => {
224
255
  e = !0, t();
225
256
  };
226
257
  }, [
227
- s,
228
- R,
258
+ l,
259
+ V,
260
+ A,
261
+ p,
262
+ y,
229
263
  D,
230
- d,
231
- _,
232
- w,
233
- T,
264
+ O,
234
265
  oe,
235
- _e,
236
- Y,
237
- X
266
+ xe,
267
+ Z,
268
+ Q
238
269
  ]);
239
- let De = {
240
- open: s,
241
- phase: le,
242
- autoCapture: d,
243
- captureMode: p,
244
- usingSystemCamera: D,
245
- finderStatus: B,
246
- displayQuad: ue,
247
- previewSize: de,
248
- settings: pe,
249
- captureMethod: he,
250
- error: ge,
251
- diagnostics: ye,
252
- shutterDiagnostics: be,
253
- copyState: xe,
254
- guidanceHint: B ? l(B.guidance, B.lighting) : void 0,
255
- detectorStatus: B?.modelStatus === "failed" ? `ML failed${B.modelError ? `: ${B.modelError}` : ""}` : B?.detector === "ml" ? `ML ${B.modelProvider ?? ""}`.trim() : "ML loading",
256
- modelDownload: we,
257
- frozenPreviewUrl: Se
270
+ let Ie = {
271
+ open: l,
272
+ phase: fe,
273
+ autoCapture: p,
274
+ captureMode: h,
275
+ usingSystemCamera: A,
276
+ finderStatus: U,
277
+ displayQuad: me,
278
+ previewSize: he,
279
+ settings: _e,
280
+ captureMethod: ye,
281
+ error: be,
282
+ diagnostics: Ce,
283
+ shutterDiagnostics: we,
284
+ copyState: Te,
285
+ guidanceHint: U ? d(U.guidance, U.lighting) : void 0,
286
+ detectorStatus: U?.modelStatus === "failed" ? `ML failed${U.modelError ? `: ${U.modelError}` : ""}` : U?.detector === "ml" ? `ML ${U.modelProvider ?? ""}`.trim() : "ML loading",
287
+ modelDownload: Ne,
288
+ frozenPreviewUrl: Ee,
289
+ useCase: u,
290
+ licenseSide: u === "drivers-license" ? Oe : void 0,
291
+ licenseBusy: u === "drivers-license" ? je : void 0
258
292
  };
259
- m(() => {
260
- L.current = De;
293
+ g(() => {
294
+ ue.current = Ie;
261
295
  });
262
- let Oe = f(() => {
263
- I.current.onCancel();
264
- }, []), Z = f(async () => {
265
- if (!F.current) {
266
- F.current = !0, P.current = !1, W(""), H(void 0), N.current.clear(), z("capturing");
296
+ let Le = m(() => {
297
+ z.current.onCancel();
298
+ }, []), $ = m(async () => {
299
+ if (!R.current) {
300
+ R.current = !0, L.current = !1, K(""), W(void 0), I.current.clear(), H("capturing");
267
301
  try {
268
- let t = await i();
269
- X(t);
302
+ let e = await i();
303
+ Q(e);
270
304
  let n = {
271
- width: t.width,
272
- height: t.height
305
+ width: e.width,
306
+ height: e.height
273
307
  };
274
- me(n), I.current.onSettings?.(n), U("system-camera");
308
+ ve(n), z.current.onSettings?.(n), G("system-camera");
275
309
  let r;
276
310
  try {
277
- let n = t.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, t.width, t.height).data;
278
- n && (r = e(n));
311
+ let n = e.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, e.width, e.height).data;
312
+ n && (r = t(n));
279
313
  } catch {
280
314
  r = void 0;
281
315
  }
282
- let a = await c(t, {
283
- modelUrl: w,
284
- ortWasmPaths: T
316
+ let o = await a(e, {
317
+ modelUrl: D,
318
+ ortWasmPaths: O
285
319
  });
286
- if (a.status !== "success" || !a.corners || !a.quad) {
287
- P.current = !0, z("error"), W(a.message), I.current.onError?.(Error(a.message));
320
+ if ((z.current.useCase !== "drivers-license" || Ae.current !== "back") && (o.status !== "success" || !o.corners || !o.quad)) {
321
+ L.current = !0, H("error"), K(o.message), z.current.onError?.(Error(o.message));
288
322
  return;
289
323
  }
290
- M.current = {
291
- quad: a.quad,
292
- sourceWidth: a.sourceWidth,
293
- sourceHeight: a.sourceHeight
294
- }, H(a.quad), z("captured"), await I.current.onCapture({
295
- frame: t,
296
- detection: a,
324
+ F.current = {
325
+ quad: o.quad,
326
+ sourceWidth: o.sourceWidth,
327
+ sourceHeight: o.sourceHeight
328
+ }, o.quad && W(o.quad), H("captured");
329
+ let s = {
330
+ frame: e,
331
+ detection: o,
297
332
  reason: "manual",
298
333
  method: "system-camera",
299
334
  settings: n,
300
335
  luminance: r,
301
- displayedQuad: a.quad,
302
- displaySourceWidth: a.sourceWidth,
303
- displaySourceHeight: a.sourceHeight
304
- });
336
+ displayedQuad: o.quad,
337
+ displaySourceWidth: o.sourceWidth,
338
+ displaySourceHeight: o.sourceHeight
339
+ };
340
+ if (z.current.useCase === "drivers-license") {
341
+ await le.current(s);
342
+ return;
343
+ }
344
+ await z.current.onCapture?.(s);
305
345
  } catch (e) {
306
346
  let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not take a photo.");
307
347
  if (t.message === "No photo was selected.") {
308
- if (J.current) {
309
- z("error");
348
+ if (X.current) {
349
+ H("error");
310
350
  return;
311
351
  }
312
- I.current.onCancel();
352
+ z.current.onCancel();
313
353
  return;
314
354
  }
315
- P.current = !0, W(t.message), z("error"), I.current.onError?.(t);
355
+ L.current = !0, K(t.message), H("error"), z.current.onError?.(t);
316
356
  } finally {
317
- F.current = !1;
357
+ R.current = !1;
318
358
  }
319
359
  }
320
360
  }, [
321
- X,
322
- w,
323
- T
324
- ]), ke = f(async () => {
325
- if (D) {
326
- await Z();
361
+ Q,
362
+ D,
363
+ O
364
+ ]), Re = m(async (e) => {
365
+ let t = await B.current;
366
+ if (t) {
367
+ Me(!0);
368
+ try {
369
+ let n = await t.submitStill(e.frame, e.detection);
370
+ if (n.kind === "need-back") {
371
+ if (Ae.current = "back", ke("back"), L.current = !1, K(""), W(void 0), I.current.clear(), Z(), A) {
372
+ H("ready");
373
+ return;
374
+ }
375
+ V?.paused && V.play(), H("starting"), Se((e) => e + 1);
376
+ return;
377
+ }
378
+ if (n.kind === "retry") {
379
+ L.current = !0, K(n.message), H("error");
380
+ return;
381
+ }
382
+ await z.current.onDriverLicense?.(n.result);
383
+ } catch (e) {
384
+ let t = e instanceof Error ? e : /* @__PURE__ */ Error("Driver’s license scan failed.");
385
+ L.current = !0, K(t.message), H("error"), z.current.onError?.(t);
386
+ } finally {
387
+ Me(!1);
388
+ }
389
+ }
390
+ }, [
391
+ Z,
392
+ V,
393
+ A
394
+ ]);
395
+ ee(() => {
396
+ le.current = Re;
397
+ }, [Re]);
398
+ let ze = m(async () => {
399
+ if (A) {
400
+ await $();
327
401
  return;
328
402
  }
329
403
  try {
330
- await k.current?.capture();
404
+ await M.current?.capture();
331
405
  } catch (e) {
332
406
  let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
333
- P.current = !0, W(t.message);
334
- let n = O.current?.getDiagnostics();
335
- n && G(n), j.current?.diagnostics && K(j.current.diagnostics), z("error"), I.current.onError?.(t);
407
+ L.current = !0, K(t.message);
408
+ let n = j.current?.getDiagnostics();
409
+ n && q(n), P.current?.diagnostics && J(P.current.diagnostics), H("error"), z.current.onError?.(t);
336
410
  }
337
- }, [Z, D]), Ae = h(Z);
338
- Ae.current = Z;
339
- let Q = h(!1);
411
+ }, [$, A]), Be = _($);
412
+ Be.current = $;
413
+ let Ve = _(!1);
340
414
  ee(() => {
341
- if (!s || !D) {
342
- Q.current = !1;
415
+ if (!l || !A) {
416
+ Ve.current = !1;
343
417
  return;
344
418
  }
345
- if (!Q.current) {
346
- if (Q.current = !0, P.current = !1, W(""), V(void 0), U(void 0), K(void 0), q("idle"), H(void 0), N.current.clear(), Y(), !t()) {
347
- z("ready");
419
+ if (!Ve.current) {
420
+ if (Ve.current = !0, L.current = !1, K(""), pe(void 0), G(void 0), J(void 0), Y("idle"), W(void 0), I.current.clear(), Z(), !r()) {
421
+ H("ready");
348
422
  return;
349
423
  }
350
- Ae.current();
424
+ Be.current();
351
425
  }
352
426
  }, [
353
- s,
354
- D,
355
- Y
427
+ l,
428
+ A,
429
+ Z
356
430
  ]);
357
- let je = f(() => {
358
- if (P.current = !1, W(""), K(void 0), q("idle"), H(void 0), N.current.clear(), D) {
359
- Z();
431
+ let He = m(() => {
432
+ if (L.current = !1, K(""), J(void 0), Y("idle"), W(void 0), I.current.clear(), A) {
433
+ $();
360
434
  return;
361
435
  }
362
- Y();
363
- let e = O.current;
364
- R?.paused && R.play(), z(e ? "ready" : "starting"), e || ve((e) => e + 1);
436
+ if (Z(), u === "drivers-license") {
437
+ H("starting"), Se((e) => e + 1);
438
+ return;
439
+ }
440
+ let e = j.current;
441
+ V?.paused && V.play(), H(e ? "ready" : "starting"), e || Se((e) => e + 1);
365
442
  }, [
443
+ $,
366
444
  Z,
367
- Y,
368
- R,
369
- D
370
- ]), Me = f(async (e) => {
371
- let t = O.current;
372
- t && (await t.setTorch(e), G(t.getDiagnostics()));
373
- }, []), Ne = f((e) => {
374
- k.current?.setAutoCapture(e);
375
- }, []), Pe = f(async () => {
376
- let e = L.current, t = O.current?.getDiagnostics() ?? e.diagnostics, r = e.finderStatus, i = n({
445
+ V,
446
+ u,
447
+ A
448
+ ]), Ue = m(async (e) => {
449
+ let t = j.current;
450
+ t && (await t.setTorch(e), q(t.getDiagnostics()));
451
+ }, []), We = m((e) => {
452
+ M.current?.setAutoCapture(e);
453
+ }, []), Ge = m(async () => {
454
+ let e = ue.current, t = j.current?.getDiagnostics() ?? e.diagnostics, r = e.finderStatus, i = n({
377
455
  error: e.error || void 0,
378
456
  captureMethod: e.captureMethod,
379
- luminance: j.current?.luminance,
380
- fallbackReason: j.current?.fallbackReason,
381
- shutter: e.shutterDiagnostics ?? j.current?.diagnostics,
457
+ luminance: P.current?.luminance,
458
+ fallbackReason: P.current?.fallbackReason,
459
+ shutter: e.shutterDiagnostics ?? P.current?.diagnostics,
382
460
  live: t,
383
461
  finder: r ? {
384
462
  state: r.state,
@@ -403,55 +481,55 @@ function C({ open: s, autoCapture: d = "defaultOn", captureMode: p = "auto", tor
403
481
  let t = document.execCommand("copy");
404
482
  if (e.remove(), !t) throw Error("Clipboard copy is unavailable.");
405
483
  }
406
- q("copied");
484
+ Y("copied");
407
485
  } catch {
408
- q("failed");
486
+ Y("failed");
409
487
  }
410
- }, []), Fe = f(() => L.current, []), $ = te(() => ({
411
- capture: ke,
412
- cancel: Oe,
413
- retry: je,
414
- setTorch: Me,
415
- setAutoCapture: Ne,
416
- copyReport: Pe,
417
- getState: Fe
488
+ }, []), Ke = m(() => ue.current, []), qe = te(() => ({
489
+ capture: ze,
490
+ cancel: Le,
491
+ retry: He,
492
+ setTorch: Ue,
493
+ setAutoCapture: We,
494
+ copyReport: Ge,
495
+ getState: Ke
418
496
  }), [
419
- ke,
420
- Oe,
421
- je,
422
- Me,
423
- Ne,
424
- Pe,
425
- Fe
497
+ ze,
498
+ Le,
499
+ He,
500
+ Ue,
501
+ We,
502
+ Ge,
503
+ Ke
426
504
  ]);
427
- m(() => {
428
- if (E) return E.current = $, () => {
429
- E.current = null;
505
+ g(() => {
506
+ if (k) return k.current = qe, () => {
507
+ k.current = null;
430
508
  };
431
- }, [$, E]);
432
- let Ie = {
433
- ...De,
434
- ...$,
435
- bindPreview: Ee
509
+ }, [qe, k]);
510
+ let Je = {
511
+ ...Ie,
512
+ ...qe,
513
+ bindPreview: Fe
436
514
  };
437
- return /* @__PURE__ */ v(re.Provider, {
438
- value: Ie,
515
+ return /* @__PURE__ */ b(re.Provider, {
516
+ value: Je,
439
517
  children: se
440
518
  });
441
519
  }
442
520
  //#endregion
443
521
  //#region src/react/hooks.ts
444
- function w() {
445
- return h(null);
522
+ function E() {
523
+ return _(null);
446
524
  }
447
- function T() {
448
- let e = p(re);
525
+ function D() {
526
+ let e = h(re);
449
527
  if (!e) throw Error("useScanner must be used within ScannerProvider.");
450
528
  return e;
451
529
  }
452
530
  //#endregion
453
531
  //#region src/live-overlay-geometry.ts
454
- function oe(e, t, n, r, i) {
532
+ function O(e, t, n, r, i) {
455
533
  let a = Math.max(1, e), o = Math.max(1, t), s = Math.max(1, n), c = Math.max(1, r), l = s / a, u = c / o, d = i === "cover" ? Math.max(l, u) : Math.min(l, u), f = (s - a * d) / 2, p = (c - o * d) / 2;
456
534
  if (i === "contain") return {
457
535
  viewBox: `0 0 ${a} ${o}`,
@@ -460,9 +538,9 @@ function oe(e, t, n, r, i) {
460
538
  offsetX: f,
461
539
  offsetY: p
462
540
  };
463
- let m = s / d, ee = c / d;
541
+ let m = s / d, h = c / d;
464
542
  return {
465
- viewBox: `${-f / d} ${-p / d} ${m} ${ee}`,
543
+ viewBox: `${-f / d} ${-p / d} ${m} ${h}`,
466
544
  preserveAspectRatio: "none",
467
545
  scale: d,
468
546
  offsetX: f,
@@ -471,10 +549,10 @@ function oe(e, t, n, r, i) {
471
549
  }
472
550
  //#endregion
473
551
  //#region src/components/ModelDownloadRing.tsx
474
- function E({ snapshot: e }) {
552
+ function oe({ snapshot: e }) {
475
553
  if (!e.downloading) return null;
476
554
  let t = e.total && e.total > 0 ? Math.min(1, e.loaded / e.total) : null, n = t === null ? null : Math.round(t * 100), r = 2 * Math.PI * 28;
477
- return /* @__PURE__ */ y("div", {
555
+ return /* @__PURE__ */ x("div", {
478
556
  className: `model-download-ring${t === null ? " is-indeterminate" : ""}`,
479
557
  role: "progressbar",
480
558
  "aria-label": "Model download",
@@ -483,15 +561,15 @@ function E({ snapshot: e }) {
483
561
  "aria-valuenow": n ?? void 0,
484
562
  "data-loaded": e.loaded,
485
563
  "data-total": e.total ?? "",
486
- children: [/* @__PURE__ */ y("svg", {
564
+ children: [/* @__PURE__ */ x("svg", {
487
565
  viewBox: "0 0 72 72",
488
566
  "aria-hidden": "true",
489
- children: [/* @__PURE__ */ v("circle", {
567
+ children: [/* @__PURE__ */ b("circle", {
490
568
  className: "track",
491
569
  cx: "36",
492
570
  cy: "36",
493
571
  r: 28
494
- }), /* @__PURE__ */ v("circle", {
572
+ }), /* @__PURE__ */ b("circle", {
495
573
  className: "value",
496
574
  cx: "36",
497
575
  cy: "36",
@@ -499,15 +577,15 @@ function E({ snapshot: e }) {
499
577
  strokeDasharray: t === null ? void 0 : `${r} ${r}`,
500
578
  strokeDashoffset: t === null ? void 0 : r * (1 - t)
501
579
  })]
502
- }), n === null ? /* @__PURE__ */ v("strong", {
580
+ }), n === null ? /* @__PURE__ */ b("strong", {
503
581
  className: "model-download-ring__pending",
504
582
  children: "…"
505
- }) : /* @__PURE__ */ y("strong", { children: [n, "%"] })]
583
+ }) : /* @__PURE__ */ x("strong", { children: [n, "%"] })]
506
584
  });
507
585
  }
508
586
  //#endregion
509
587
  //#region src/react/parts.tsx
510
- var se = {
588
+ var k = {
511
589
  primaryColorHex: "--scanner-overlay-primary",
512
590
  seekingColorHex: "--scanner-overlay-seeking",
513
591
  detectingColorHex: "--scanner-overlay-detecting",
@@ -515,46 +593,46 @@ var se = {
515
593
  readyColorHex: "--scanner-overlay-ready",
516
594
  capturedColorHex: "--scanner-overlay-captured"
517
595
  };
518
- function D(e) {
596
+ function se(e) {
519
597
  if (!e) return;
520
598
  let t = {};
521
- for (let [n, r] of Object.entries(se)) {
599
+ for (let [n, r] of Object.entries(k)) {
522
600
  let i = e[n]?.trim();
523
601
  i && (t[r] = i);
524
602
  }
525
603
  return Object.keys(t).length > 0 ? t : void 0;
526
604
  }
527
- function O({ theme: e, style: t, title: n = "Scan a document", children: r }) {
528
- let i = T();
605
+ function A({ theme: e, style: t, title: n, children: r }) {
606
+ let i = D();
529
607
  if (!i.open) return null;
530
- let a = D(e), o = a ? {
608
+ let a = n ?? (i.useCase === "drivers-license" ? "Scan a driver’s license" : "Scan a document"), o = se(e), s = o ? {
531
609
  ...t,
532
- ...a
610
+ ...o
533
611
  } : t;
534
- return /* @__PURE__ */ y("div", {
612
+ return /* @__PURE__ */ x("div", {
535
613
  className: `scanner-camera-overlay ${i.phase === "captured" || i.finderStatus?.state === "captured" ? "is-captured" : ""} ${i.usingSystemCamera ? "is-system-camera" : ""}`.trim(),
536
- style: o,
614
+ style: s,
537
615
  role: "dialog",
538
616
  "aria-modal": "true",
539
- "aria-label": n,
540
- children: [r, /* @__PURE__ */ v(I, {})]
617
+ "aria-label": a,
618
+ children: [r, /* @__PURE__ */ b(R, {})]
541
619
  });
542
620
  }
543
- function k() {
544
- let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = T(), r = h(null), i = f((t) => {
621
+ function j() {
622
+ let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = D(), r = _(null), i = m((t) => {
545
623
  r.current = t, e(t);
546
624
  }, [e]);
547
- return m(() => {
625
+ return g(() => {
548
626
  t && r.current?.pause();
549
- }, [t]), n ? t ? /* @__PURE__ */ v("img", {
627
+ }, [t]), n ? t ? /* @__PURE__ */ b("img", {
550
628
  src: t,
551
629
  className: "scanner-camera-overlay__video scanner-camera-overlay__still",
552
630
  alt: "",
553
631
  "aria-label": "Captured document"
554
- }) : /* @__PURE__ */ v("div", {
632
+ }) : /* @__PURE__ */ b("div", {
555
633
  className: "scanner-camera-overlay__video",
556
634
  "aria-hidden": "true"
557
- }) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("video", {
635
+ }) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("video", {
558
636
  ref: i,
559
637
  className: "scanner-camera-overlay__video",
560
638
  muted: !0,
@@ -563,45 +641,50 @@ function k() {
563
641
  style: { objectFit: "cover" },
564
642
  "aria-hidden": !!t,
565
643
  "aria-label": "Rear camera preview"
566
- }), t ? /* @__PURE__ */ v("img", {
644
+ }), t ? /* @__PURE__ */ b("img", {
567
645
  src: t,
568
646
  className: "scanner-camera-overlay__video scanner-camera-overlay__still",
569
647
  alt: "",
570
648
  "aria-label": "Captured document"
571
649
  }) : null] });
572
650
  }
573
- function A() {
574
- let { finderStatus: e, displayQuad: t, previewSize: n } = T();
651
+ function M() {
652
+ let { finderStatus: e, displayQuad: t, previewSize: n } = D();
575
653
  if (!t || !e?.sourceWidth || !e.sourceHeight) return null;
576
- let r = oe(e.sourceWidth, e.sourceHeight, n.width, n.height, "cover");
577
- return /* @__PURE__ */ v("svg", {
654
+ let r = O(e.sourceWidth, e.sourceHeight, n.width, n.height, "cover");
655
+ return /* @__PURE__ */ b("svg", {
578
656
  className: `scanner-camera-overlay__quad ${e.state}`,
579
657
  viewBox: r.viewBox,
580
658
  preserveAspectRatio: r.preserveAspectRatio,
581
659
  "aria-label": `${e.state} document boundary`,
582
- children: /* @__PURE__ */ v("polygon", { points: `${t.topLeft.x},${t.topLeft.y} ${t.topRight.x},${t.topRight.y} ${t.bottomRight.x},${t.bottomRight.y} ${t.bottomLeft.x},${t.bottomLeft.y}` })
660
+ children: /* @__PURE__ */ b("polygon", { points: `${t.topLeft.x},${t.topLeft.y} ${t.topRight.x},${t.topRight.y} ${t.bottomRight.x},${t.bottomRight.y} ${t.bottomLeft.x},${t.bottomLeft.y}` })
583
661
  });
584
662
  }
585
- function j({ title: e = "Scan a document" }) {
586
- let { phase: t, guidanceHint: n, cancel: r, usingSystemCamera: i } = T();
587
- return /* @__PURE__ */ y("div", {
663
+ function N({ title: e }) {
664
+ let { phase: t, guidanceHint: n, cancel: r, usingSystemCamera: i, useCase: a, licenseSide: o, licenseBusy: s } = D(), c = a === "drivers-license" ? u(o ?? "front", i) : void 0, l = e ?? c?.title ?? "Scan a document";
665
+ return /* @__PURE__ */ x("div", {
588
666
  className: "scanner-camera-overlay__topbar",
589
- children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("strong", { children: e }), /* @__PURE__ */ v("span", {
667
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("strong", { children: l }), /* @__PURE__ */ x("span", {
590
668
  "aria-live": "polite",
591
- children: i ? /* @__PURE__ */ y(_, { children: [
592
- t === "starting" && "Preparing the system camera…",
593
- t === "ready" && "Take a photo. There is no live document guide.",
594
- t === "capturing" && "Looking for a document…",
595
- t === "captured" && "Document captured",
596
- t === "error" && "No document found"
597
- ] }) : /* @__PURE__ */ y(_, { children: [
598
- t === "starting" && "Starting rear camera…",
599
- t === "ready" && (n ?? "Place the document in the frame"),
600
- t === "capturing" && "Capturing full resolution…",
601
- t === "captured" && "Document captured",
602
- t === "error" && "Camera unavailable"
603
- ] })
604
- })] }), /* @__PURE__ */ v("button", {
669
+ children: [
670
+ s && (o === "back" ? "Reading the barcode…" : "Reading the front…"),
671
+ !s && c && /* @__PURE__ */ x(y, { children: [t === "error" && (o === "back" ? "Could not read the back" : "Could not read the front"), t !== "error" && c.headline] }),
672
+ !s && !c && i && /* @__PURE__ */ x(y, { children: [
673
+ t === "starting" && "Preparing the system camera…",
674
+ t === "ready" && "Take a photo. There is no live document guide.",
675
+ t === "capturing" && "Looking for a document…",
676
+ t === "captured" && "Document captured",
677
+ t === "error" && "No document found"
678
+ ] }),
679
+ !s && !c && !i && /* @__PURE__ */ x(y, { children: [
680
+ t === "starting" && "Starting rear camera…",
681
+ t === "ready" && (n ?? "Place the document in the frame"),
682
+ t === "capturing" && "Capturing full resolution…",
683
+ t === "captured" && "Document captured",
684
+ t === "error" && "Camera unavailable"
685
+ ] })
686
+ ]
687
+ })] }), /* @__PURE__ */ b("button", {
605
688
  type: "button",
606
689
  onClick: r,
607
690
  "aria-label": "Close camera",
@@ -609,102 +692,112 @@ function j({ title: e = "Scan a document" }) {
609
692
  })]
610
693
  });
611
694
  }
612
- function M() {
613
- let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c } = T();
614
- return e === "error" ? /* @__PURE__ */ y("div", {
695
+ function P() {
696
+ let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c, useCase: l, licenseSide: d, licenseBusy: f } = D(), p = l === "drivers-license" ? u(d ?? "front", s) : void 0;
697
+ return e === "error" ? /* @__PURE__ */ x("div", {
615
698
  className: "scanner-camera-overlay__message",
616
699
  role: "alert",
617
700
  children: [
618
- /* @__PURE__ */ v("strong", { children: s ? c ? "No document found" : "Could not take a photo" : n ? "Capture failed" : "Could not open the camera" }),
619
- /* @__PURE__ */ v("p", { children: t }),
620
- /* @__PURE__ */ y("div", { children: [
621
- /* @__PURE__ */ v("button", {
701
+ /* @__PURE__ */ b("strong", { children: p ? d === "back" ? "Could not read the back" : "Could not read the front" : s ? c ? "No document found" : "Could not take a photo" : n ? "Capture failed" : "Could not open the camera" }),
702
+ /* @__PURE__ */ b("p", { children: t }),
703
+ /* @__PURE__ */ x("div", { children: [
704
+ /* @__PURE__ */ b("button", {
622
705
  type: "button",
623
706
  onClick: i,
624
707
  children: "Try again"
625
708
  }),
626
- /* @__PURE__ */ v("button", {
709
+ /* @__PURE__ */ b("button", {
627
710
  type: "button",
628
711
  onClick: () => void a(),
629
712
  children: r === "copied" ? "Copied" : r === "failed" ? "Copy failed" : "Copy report"
630
713
  }),
631
- /* @__PURE__ */ v("button", {
714
+ /* @__PURE__ */ b("button", {
632
715
  type: "button",
633
716
  onClick: o,
634
717
  children: "Cancel"
635
718
  })
636
719
  ] })
637
720
  ]
638
- }) : s && e === "capturing" && !c ? /* @__PURE__ */ y("div", {
721
+ }) : f ? /* @__PURE__ */ x("div", {
639
722
  className: "scanner-camera-overlay__message",
640
723
  "aria-live": "polite",
641
724
  children: [
642
- /* @__PURE__ */ v("span", { className: "scanner-camera-overlay__spinner" }),
643
- /* @__PURE__ */ v("strong", { children: "Opening the system camera" }),
644
- /* @__PURE__ */ v("p", { children: "There is no live document guide. We find the page after you take the photo." })
725
+ /* @__PURE__ */ b("span", { className: "scanner-camera-overlay__spinner" }),
726
+ /* @__PURE__ */ b("strong", { children: d === "back" ? "Reading the barcode" : "Reading the front" }),
727
+ /* @__PURE__ */ b("p", { children: d === "back" ? "Decoding the AAMVA PDF417 on the back." : "Finding the card and reading the front with OCR." })
645
728
  ]
646
- }) : s && e === "ready" && !c ? /* @__PURE__ */ y("div", {
729
+ }) : s && e === "capturing" && !c ? /* @__PURE__ */ x("div", {
647
730
  className: "scanner-camera-overlay__message",
648
731
  "aria-live": "polite",
649
- children: [/* @__PURE__ */ v("strong", { children: "System camera" }), /* @__PURE__ */ v("p", { children: "Tap the shutter to open the Camera app. There is no live document guide." })]
650
- }) : e === "starting" && !s ? /* @__PURE__ */ y("div", {
732
+ children: [
733
+ /* @__PURE__ */ b("span", { className: "scanner-camera-overlay__spinner" }),
734
+ /* @__PURE__ */ b("strong", { children: p ? p.headline : "Opening the system camera" }),
735
+ /* @__PURE__ */ b("p", { children: p ? p.detail : "There is no live document guide. We find the page after you take the photo." })
736
+ ]
737
+ }) : s && e === "ready" && !c ? /* @__PURE__ */ x("div", {
738
+ className: "scanner-camera-overlay__message",
739
+ "aria-live": "polite",
740
+ children: [/* @__PURE__ */ b("strong", { children: p ? p.headline : "System camera" }), /* @__PURE__ */ b("p", { children: p ? p.detail : "Tap the shutter to open the Camera app. There is no live document guide." })]
741
+ }) : e === "starting" && !s ? /* @__PURE__ */ x("div", {
651
742
  className: "scanner-camera-overlay__message",
652
743
  "aria-live": "polite",
653
744
  children: [
654
- /* @__PURE__ */ v("span", { className: "scanner-camera-overlay__spinner" }),
655
- /* @__PURE__ */ v("strong", { children: "Requesting the highest practical resolution" }),
656
- /* @__PURE__ */ v("p", { children: "Allow camera access to continue." })
745
+ /* @__PURE__ */ b("span", { className: "scanner-camera-overlay__spinner" }),
746
+ /* @__PURE__ */ b("strong", { children: "Requesting the highest practical resolution" }),
747
+ /* @__PURE__ */ b("p", { children: "Allow camera access to continue." })
657
748
  ]
658
749
  }) : null;
659
750
  }
660
- function N() {
661
- let { finderStatus: e, detectorStatus: t, settings: n, usingSystemCamera: r, captureMethod: i, phase: a } = T(), o = n?.width, s = n?.height;
662
- return r ? /* @__PURE__ */ v("div", {
751
+ function F() {
752
+ let { finderStatus: e, detectorStatus: t, settings: n, usingSystemCamera: r, captureMethod: i, phase: a, useCase: o, licenseSide: s } = D(), c = n?.width, l = n?.height, u = o === "drivers-license" ? ` · ${s === "back" ? "back" : "front"}` : "";
753
+ return r ? /* @__PURE__ */ b("div", {
663
754
  className: "scanner-camera-overlay__status",
664
755
  "aria-live": "polite",
665
- children: /* @__PURE__ */ y("div", {
756
+ children: /* @__PURE__ */ x("div", {
666
757
  className: "scanner-camera-overlay__status-line",
667
758
  children: [
668
- /* @__PURE__ */ v("span", { className: a === "captured" ? "ready" : a === "error" ? "seeking" : "detecting" }),
759
+ /* @__PURE__ */ b("span", { className: a === "captured" ? "ready" : a === "error" ? "seeking" : "detecting" }),
669
760
  i === "system-camera" ? "system camera" : "system camera · waiting",
670
- o && s ? ` · ${o}×${s}` : ""
761
+ u,
762
+ c && l ? ` · ${c}×${l}` : ""
671
763
  ]
672
764
  })
673
- }) : /* @__PURE__ */ v("div", {
765
+ }) : /* @__PURE__ */ b("div", {
674
766
  className: "scanner-camera-overlay__status",
675
767
  "aria-live": "polite",
676
- children: /* @__PURE__ */ y("div", {
768
+ children: /* @__PURE__ */ x("div", {
677
769
  className: "scanner-camera-overlay__status-line",
678
770
  children: [
679
- /* @__PURE__ */ v("span", { className: e?.state ?? "detecting" }),
771
+ /* @__PURE__ */ b("span", { className: e?.state ?? "detecting" }),
680
772
  e?.state ?? "detecting",
773
+ u,
681
774
  e ? ` · ${Math.round(e.confidence * 100)}% · ${e.stableFrames}/${e.requiredStableFrames}` : "",
682
775
  ` · ${t}`,
683
776
  e?.inferenceMs === void 0 ? "" : ` · ${Math.round(e.inferenceMs)}ms`,
684
- o && s ? ` · ${o}×${s}` : ""
777
+ c && l ? ` · ${c}×${l}` : ""
685
778
  ]
686
779
  })
687
780
  });
688
781
  }
689
- function P() {
690
- let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: r, copyReport: i } = T(), a = e?.engine ?? s();
691
- return /* @__PURE__ */ y("dl", {
782
+ function I() {
783
+ let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: r, copyReport: i } = D(), a = e?.engine ?? l();
784
+ return /* @__PURE__ */ x("dl", {
692
785
  className: "scanner-camera-overlay__diagnostics",
693
786
  "aria-label": "Camera diagnostics",
694
787
  children: [
695
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "engine" }), /* @__PURE__ */ y("dd", { children: [
788
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "engine" }), /* @__PURE__ */ x("dd", { children: [
696
789
  a.engine,
697
790
  "/",
698
791
  a.browser,
699
792
  a.iosWebKit ? " ios" : ""
700
793
  ] })] }),
701
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "video" }), /* @__PURE__ */ v("dd", { children: e ? `${e.videoWidth}×${e.videoHeight} rs${e.readyState}${e.paused ? " paused" : ""}${e.rendered ? "" : " hidden"}` : "starting" })] }),
702
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "track" }), /* @__PURE__ */ v("dd", { children: e ? `${e.trackReadyState}${e.trackMuted ? " muted" : ""}${e.trackEnabled ? "" : " disabled"}` : "—" })] }),
703
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "torch" }), /* @__PURE__ */ v("dd", { children: e ? `${e.torch.mode} · ${e.torch.supported ? e.torch.on ? "on" : "off" : "unsupported"}` : "starting" })] }),
704
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "luma" }), /* @__PURE__ */ v("dd", { children: e ? `live ${e.liveLuminance.toFixed(1)} · mirror ${e.mirrorLuminance.toFixed(1)}${Number.isFinite(e.mirrorAgeMs) ? ` (${Math.round(e.mirrorAgeMs)}ms)` : " (none)"}` : "—" })] }),
705
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "path" }), /* @__PURE__ */ v("dd", { children: n ?? "video-frame / live-mirror" })] }),
706
- t ? /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "shutter" }), /* @__PURE__ */ v("dd", { children: `live ${t.liveLuminance.toFixed(1)} · mirror ${t.mirrorLuminance.toFixed(1)}${Number.isFinite(t.mirrorAgeMs) ? ` (${Math.round(t.mirrorAgeMs)}ms)` : " (none)"}` })] }) : null,
707
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", { children: "share" }), /* @__PURE__ */ v("dd", { children: /* @__PURE__ */ v("button", {
794
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "video" }), /* @__PURE__ */ b("dd", { children: e ? `${e.videoWidth}×${e.videoHeight} rs${e.readyState}${e.paused ? " paused" : ""}${e.rendered ? "" : " hidden"}` : "starting" })] }),
795
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "track" }), /* @__PURE__ */ b("dd", { children: e ? `${e.trackReadyState}${e.trackMuted ? " muted" : ""}${e.trackEnabled ? "" : " disabled"}` : "—" })] }),
796
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "torch" }), /* @__PURE__ */ b("dd", { children: e ? `${e.torch.mode} · ${e.torch.supported ? e.torch.on ? "on" : "off" : "unsupported"}` : "starting" })] }),
797
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "luma" }), /* @__PURE__ */ b("dd", { children: e ? `live ${e.liveLuminance.toFixed(1)} · mirror ${e.mirrorLuminance.toFixed(1)}${Number.isFinite(e.mirrorAgeMs) ? ` (${Math.round(e.mirrorAgeMs)}ms)` : " (none)"}` : "—" })] }),
798
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "path" }), /* @__PURE__ */ b("dd", { children: n ?? "video-frame / live-mirror" })] }),
799
+ t ? /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "shutter" }), /* @__PURE__ */ b("dd", { children: `live ${t.liveLuminance.toFixed(1)} · mirror ${t.mirrorLuminance.toFixed(1)}${Number.isFinite(t.mirrorAgeMs) ? ` (${Math.round(t.mirrorAgeMs)}ms)` : " (none)"}` })] }) : null,
800
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "share" }), /* @__PURE__ */ b("dd", { children: /* @__PURE__ */ b("button", {
708
801
  type: "button",
709
802
  className: "scanner-camera-overlay__copy",
710
803
  onClick: () => void i(),
@@ -713,35 +806,35 @@ function P() {
713
806
  ]
714
807
  });
715
808
  }
716
- function F() {
717
- let { autoCapture: e, phase: t, finderStatus: n, diagnostics: r, captureMethod: i, settings: a, cancel: o, capture: s, setAutoCapture: c, setTorch: l, usingSystemCamera: u } = T(), d = a?.width, f = a?.height;
718
- return /* @__PURE__ */ y("div", {
809
+ function L() {
810
+ let { autoCapture: e, phase: t, finderStatus: n, diagnostics: r, captureMethod: i, settings: a, cancel: o, capture: s, setAutoCapture: c, setTorch: l, usingSystemCamera: u, licenseBusy: d } = D(), f = a?.width, p = a?.height;
811
+ return /* @__PURE__ */ x("div", {
719
812
  className: "scanner-camera-overlay__controls",
720
813
  children: [
721
- /* @__PURE__ */ v("button", {
814
+ /* @__PURE__ */ b("button", {
722
815
  type: "button",
723
816
  className: "scanner-camera-overlay__cancel",
724
817
  onClick: o,
725
818
  children: "Cancel"
726
819
  }),
727
- /* @__PURE__ */ y("div", {
820
+ /* @__PURE__ */ x("div", {
728
821
  className: "scanner-camera-overlay__capture",
729
- children: [(u ? t === "ready" : e !== "only") && /* @__PURE__ */ v("button", {
822
+ children: [(u ? t === "ready" : e !== "only") && /* @__PURE__ */ b("button", {
730
823
  type: "button",
731
824
  className: "scanner-camera-overlay__shutter",
732
825
  onClick: () => void s(),
733
- disabled: t !== "ready",
826
+ disabled: t !== "ready" || !!d,
734
827
  "aria-label": u ? "Take a photo with the system camera" : "Capture full-resolution photo",
735
- children: /* @__PURE__ */ v("span", {})
736
- }), !u && /* @__PURE__ */ y("div", {
828
+ children: /* @__PURE__ */ b("span", {})
829
+ }), !u && /* @__PURE__ */ x("div", {
737
830
  className: "scanner-camera-overlay__toggles",
738
- children: [n?.autoCapture.visible && /* @__PURE__ */ y("label", { children: [/* @__PURE__ */ v("input", {
831
+ children: [n?.autoCapture.visible && /* @__PURE__ */ x("label", { children: [/* @__PURE__ */ b("input", {
739
832
  type: "checkbox",
740
833
  checked: n.autoCapture.checked,
741
834
  onChange: (e) => c(e.target.checked)
742
- }), "Auto-capture"] }), r?.torch.visible && /* @__PURE__ */ y("label", {
835
+ }), "Auto-capture"] }), r?.torch.visible && /* @__PURE__ */ x("label", {
743
836
  title: r.torch.automatic ? "Torch is controlled automatically from scene brightness" : void 0,
744
- children: [/* @__PURE__ */ v("input", {
837
+ children: [/* @__PURE__ */ b("input", {
745
838
  type: "checkbox",
746
839
  checked: r.torch.on,
747
840
  disabled: !r.torch.mutable,
@@ -750,18 +843,18 @@ function F() {
750
843
  })]
751
844
  })]
752
845
  }),
753
- /* @__PURE__ */ y("div", {
846
+ /* @__PURE__ */ x("div", {
754
847
  className: "scanner-camera-overlay__quality",
755
- children: [/* @__PURE__ */ v("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ v("strong", { children: d && f ? `${d} × ${f}` : u ? "Tap to photograph" : "Measuring…" })]
848
+ children: [/* @__PURE__ */ b("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ b("strong", { children: f && p ? `${f} × ${p}` : u ? "Tap to photograph" : "Measuring…" })]
756
849
  })
757
850
  ]
758
851
  });
759
852
  }
760
- function I({ snapshot: e }) {
761
- let { modelDownload: t } = T();
762
- return /* @__PURE__ */ v(E, { snapshot: e ?? t });
853
+ function R({ snapshot: e }) {
854
+ let { modelDownload: t } = D();
855
+ return /* @__PURE__ */ b(oe, { snapshot: e ?? t });
763
856
  }
764
857
  //#endregion
765
- export { F as ScannerControls, P as ScannerDiagnostics, O as ScannerFrame, I as ScannerModelDownload, M as ScannerNotice, k as ScannerPreview, C as ScannerProvider, A as ScannerQuad, N as ScannerStatus, j as ScannerTopBar, T as useScanner, w as useScannerRef };
858
+ export { L as ScannerControls, I as ScannerDiagnostics, A as ScannerFrame, R as ScannerModelDownload, P as ScannerNotice, j as ScannerPreview, T as ScannerProvider, M as ScannerQuad, F as ScannerStatus, N as ScannerTopBar, D as useScanner, E as useScannerRef };
766
859
 
767
860
  //# sourceMappingURL=react.js.map