@exige/web-scanner-sdk 0.2.31 → 0.2.33

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,6 +1,6 @@
1
1
  "use client";
2
- import { F as e, I as t, K as n, O as r, P as i, S as a, U as o, V as s, W as c, g as l, i as u, n as d, x as f, z as p } from "./driver-license-yM6pBkNk.js";
3
- import { createContext as m, useCallback as h, useContext as g, useEffect as _, useLayoutEffect as v, useMemo as ee, useRef as y, useState as b } from "react";
2
+ import { A as e, C as t, G as n, I as r, J as i, K as a, L as o, R as s, U as c, V as l, a as u, f as d, o as f, r as p, v as m, w as ee } from "./driver-license-DBrWpI9w.js";
3
+ import { createContext as h, useCallback as g, useContext as te, useEffect as _, useLayoutEffect as v, useMemo as ne, useRef as y, useState as b } from "react";
4
4
  import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
5
5
  //#region src/sdk/display-quad.ts
6
6
  function w(e) {
@@ -38,10 +38,10 @@ function T(e) {
38
38
  }
39
39
  };
40
40
  }
41
- function E(e) {
41
+ function re(e) {
42
42
  return T(w(e).map((e) => ({ ...e })));
43
43
  }
44
- var te = class {
44
+ var ie = class {
45
45
  current;
46
46
  target;
47
47
  response;
@@ -54,7 +54,7 @@ var te = class {
54
54
  let n = w(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 = E(e), i && (this.current = E(e)), {
57
+ return this.target = re(e), i && (this.current = re(e)), {
58
58
  quad: this.current,
59
59
  snapped: i
60
60
  };
@@ -76,13 +76,13 @@ var te = class {
76
76
  getCurrent() {
77
77
  return this.current;
78
78
  }
79
- }, ne = m(null);
79
+ }, ae = h(null);
80
80
  //#endregion
81
81
  //#region src/react/context.tsx
82
- function re(e) {
82
+ function oe(e) {
83
83
  e?.startsWith("blob:") && URL.revokeObjectURL(e);
84
84
  }
85
- function ie(e) {
85
+ function se(e) {
86
86
  try {
87
87
  let t = e.toDataURL("image/jpeg", .92);
88
88
  return t.startsWith("data:image/") ? t : void 0;
@@ -90,77 +90,77 @@ function ie(e) {
90
90
  return;
91
91
  }
92
92
  }
93
- function ae(e, t) {
93
+ function ce(e, t) {
94
94
  if (typeof e == "function") return e(t);
95
95
  }
96
- function D({ open: i, useCase: l = "document", autoCapture: d = "defaultOn", captureMode: m = "auto", torch: g = "defaultOff", onCapture: x, onDriverLicense: C, onCancel: w, onError: T, onSettings: E, onFinderStatus: D, modelUrl: O, ortWasmPaths: k, detectionIntervalMs: oe, apiRef: A, children: se }) {
97
- let j = o(m), M = y(void 0), N = y(void 0), P = y(void 0), F = y(void 0), I = y({}), L = y(new te()), R = y(!1), ce = y(!1), z = y({
96
+ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", captureMode: h = "auto", torch: te = "defaultOff", onCapture: x, onDriverLicense: C, onCancel: w, onError: T, onSettings: re, onFinderStatus: le, modelUrl: E, ortWasmPaths: D, detectionIntervalMs: ue, apiRef: O, children: de }) {
97
+ let k = n(h), A = y(void 0), j = y(void 0), M = y(void 0), N = y(void 0), P = y({}), F = y(new ie()), I = y(!1), fe = y(!1), L = y({
98
98
  onCapture: x,
99
99
  onDriverLicense: C,
100
100
  onCancel: w,
101
101
  onError: T,
102
- onSettings: E,
103
- onFinderStatus: D,
104
- useCase: l
105
- }), B = y(void 0), V = y(void 0), le = y(async () => void 0), ue = y(null), [H, de] = b(null), [fe, U] = b(j && i ? "capturing" : j ? "ready" : "starting"), [W, pe] = b(), [me, G] = b(), [he, ge] = b({
102
+ onSettings: re,
103
+ onFinderStatus: le,
104
+ useCase: p
105
+ }), R = y(void 0), pe = y(void 0), z = y(async () => void 0), B = y(!1), V = y(void 0), me = y(null), [H, he] = b(null), [ge, U] = b(k && r ? "capturing" : k ? "ready" : "starting"), [W, G] = b(), [_e, K] = b(), [ve, ye] = b({
106
106
  width: 1,
107
107
  height: 1
108
- }), [_e, ve] = b(), [ye, K] = b(), [be, q] = b(""), [xe, Se] = b(0), [Ce, J] = b(), [we, Y] = b(), [Te, X] = b("idle"), [Ee, De] = b(), Z = y(void 0), [Oe, ke] = b("front"), Ae = y("front"), [je, Me] = b(!1), [Ne, Pe] = b({
108
+ }), [be, xe] = b(), [Se, q] = b(), [Ce, J] = b(""), [we, Te] = b(0), [Ee, Y] = b(), [De, X] = b(), [Oe, ke] = b("idle"), [Ae, je] = b(), Me = y(void 0), [Ne, Pe] = b("front"), Fe = y("front"), [Ie, Le] = b(!1), [Re, ze] = b({
109
109
  downloading: !1,
110
110
  loaded: 0,
111
111
  total: null
112
- }), Q = h(() => {
113
- re(Z.current), Z.current = void 0, De(void 0);
114
- }, []), Fe = h((e, t) => {
115
- let n = ie(e);
116
- re(Z.current), Z.current = n, De(n), t?.pause();
112
+ }), Z = g(() => {
113
+ oe(Me.current), Me.current = void 0, je(void 0);
114
+ }, []), Q = g((e, t) => {
115
+ let n = se(e);
116
+ oe(Me.current), Me.current = n, je(n), t?.pause();
117
117
  }, []);
118
118
  v(() => {
119
- z.current = {
119
+ L.current = {
120
120
  onCapture: x,
121
121
  onDriverLicense: C,
122
122
  onCancel: w,
123
123
  onError: T,
124
- onSettings: E,
125
- onFinderStatus: D,
126
- useCase: l
124
+ onSettings: re,
125
+ onFinderStatus: le,
126
+ useCase: p
127
127
  };
128
128
  }, [
129
129
  x,
130
130
  C,
131
131
  w,
132
132
  T,
133
- E,
134
- D,
135
- l
136
- ]), _(() => n(Pe), []), _(() => {
137
- if (!i || l !== "drivers-license") {
138
- V.current = void 0, B.current = void 0, ke("front"), Me(!1);
133
+ re,
134
+ le,
135
+ p
136
+ ]), _(() => i(ze), []), _(() => {
137
+ if (!r || p !== "drivers-license") {
138
+ pe.current = void 0, R.current = void 0, B.current = !1, Pe("front"), Le(!1);
139
139
  return;
140
140
  }
141
141
  let e = u({ scan: {
142
- modelUrl: O,
143
- ortWasmPaths: k
142
+ modelUrl: E,
143
+ ortWasmPaths: D
144
144
  } });
145
- return V.current = e, e.then((e) => {
146
- B.current = e;
145
+ return pe.current = e, e.then((e) => {
146
+ R.current = e;
147
147
  }), () => {
148
- e.then((e) => e.cancel()), B.current &&= void 0, V.current = void 0;
148
+ e.then((e) => e.cancel()), R.current &&= void 0, pe.current = void 0;
149
149
  };
150
150
  }, [
151
- i,
152
- l,
153
- O,
154
- k
151
+ r,
152
+ p,
153
+ E,
154
+ D
155
155
  ]);
156
- let Ie = h((e) => {
157
- de(e);
156
+ let Be = g((e) => {
157
+ he(e);
158
158
  }, []);
159
159
  _(() => {
160
- if (!i || !H) return;
160
+ if (!r || !H) return;
161
161
  let e = () => {
162
162
  let e = H.getBoundingClientRect();
163
- ge({
163
+ ye({
164
164
  width: e.width,
165
165
  height: e.height
166
166
  });
@@ -168,371 +168,438 @@ function D({ open: i, useCase: l = "document", autoCapture: d = "defaultOn", cap
168
168
  if (e(), typeof ResizeObserver > "u") return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
169
169
  let t = new ResizeObserver(e);
170
170
  return t.observe(H), () => t.disconnect();
171
- }, [i, H]), _(() => {
172
- if (!i) return;
171
+ }, [r, H]), _(() => {
172
+ if (!r) return;
173
173
  let e = window.setInterval(() => {
174
- let e = M.current?.getDiagnostics();
175
- e && J(e);
174
+ let e = A.current?.getDiagnostics();
175
+ e && Y(e);
176
176
  }, 500);
177
177
  return () => window.clearInterval(e);
178
- }, [i, xe]), _(() => {
179
- if (!i) return;
178
+ }, [r, we]), _(() => {
179
+ if (!r) return;
180
180
  let e = 0, t = performance.now(), n = (r) => {
181
- let i = L.current.step(r - t);
182
- t = r, i && G(i), e = requestAnimationFrame(n);
181
+ let i = F.current.step(r - t);
182
+ t = r, i && K(i), e = requestAnimationFrame(n);
183
183
  };
184
184
  return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
185
- }, [i]), _(() => {
186
- if (!i || j || !H) return;
187
- let e = !1, t = () => {
188
- N.current?.stop(), N.current = void 0, M.current?.stop(), M.current = void 0, F.current = void 0, P.current = void 0, I.current = {}, Q();
185
+ }, [r]), _(() => {
186
+ if (!r || k || !H) return;
187
+ let e = !1, t = new AbortController();
188
+ V.current = t;
189
+ let n = () => {
190
+ t.abort(), V.current === t && (V.current = void 0), j.current?.stop(), j.current = void 0, A.current?.stop(), A.current = void 0, N.current = void 0, M.current = void 0, P.current = {}, Z();
189
191
  };
190
192
  return (async () => {
191
- t(), R.current = !1, U("starting"), q(""), pe(void 0), K(void 0), Y(void 0), X("idle"), Q();
193
+ n(), t = new AbortController(), V.current = t, I.current = !1, U("starting"), J(""), G(void 0), q(void 0), X(void 0), ke("idle"), Z();
192
194
  try {
193
- let t = await c(H, { torch: g });
195
+ let n = await a(H, { torch: te });
194
196
  if (e) {
195
- t.stop();
197
+ n.stop();
196
198
  return;
197
199
  }
198
- M.current = t;
199
- let n = t.getSettings();
200
- ve(n), z.current.onSettings?.(n), console.info("[ScannerProvider] camera settings", n), N.current = await a({
200
+ A.current = n;
201
+ let r = n.getSettings();
202
+ if (xe(r), L.current.onSettings?.(r), console.info("[ScannerProvider] camera settings", r), L.current.useCase === "drivers-license" && Fe.current === "back") {
203
+ G(void 0), K(void 0), F.current.clear(), U("ready"), (async () => {
204
+ try {
205
+ let r = await f(() => {
206
+ try {
207
+ return n.capture();
208
+ } catch {
209
+ return;
210
+ }
211
+ }, {
212
+ intervalMs: ue ?? 140,
213
+ signal: t.signal
214
+ });
215
+ if (e || t.signal.aborted || B.current) return;
216
+ B.current = !0, Q(r, H), q("video-frame"), U("captured"), await z.current({
217
+ frame: r,
218
+ reason: "auto",
219
+ method: "video-frame",
220
+ settings: n.getSettings()
221
+ });
222
+ } catch (n) {
223
+ if (e || t.signal.aborted || n instanceof DOMException && n.name === "AbortError") return;
224
+ let r = n instanceof Error ? n : /* @__PURE__ */ Error("Could not read the barcode.");
225
+ I.current = !0, J(r.message), U("error"), L.current.onError?.(r);
226
+ }
227
+ })();
228
+ return;
229
+ }
230
+ j.current = await ee({
201
231
  source: H,
202
- autoCapture: d,
203
- intervalMs: oe,
232
+ autoCapture: m,
233
+ intervalMs: ue,
204
234
  detection: {
205
- modelUrl: O,
206
- ortWasmPaths: k
235
+ modelUrl: E,
236
+ ortWasmPaths: D
207
237
  },
208
238
  onStatus: (e) => {
209
- if (P.current = e, pe(e), z.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
210
- let t = L.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
211
- G(t.quad);
212
- } else L.current.clear(), G(void 0);
213
- e.state !== "captured" && !R.current && U("ready");
239
+ if (M.current = e, G(e), L.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
240
+ let t = F.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
241
+ K(t.quad);
242
+ } else F.current.clear(), K(void 0);
243
+ e.state !== "captured" && !I.current && U("ready");
214
244
  },
215
245
  captureFrame: async () => {
216
- U("capturing"), I.current = {
217
- quad: L.current.getCurrent(),
218
- sourceWidth: P.current?.sourceWidth,
219
- sourceHeight: P.current?.sourceHeight
246
+ U("capturing"), P.current = {
247
+ quad: F.current.getCurrent(),
248
+ sourceWidth: M.current?.sourceWidth,
249
+ sourceHeight: M.current?.sourceHeight
220
250
  };
221
- let e = await t.capturePhoto();
222
- if (F.current = e, K(e.method), Y(e.diagnostics), J(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.`);
223
- return Fe(e.frame, H), U("captured"), e.frame;
251
+ let e = await n.capturePhoto();
252
+ if (N.current = e, q(e.method), X(e.diagnostics), Y(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.`);
253
+ return Q(e.frame, H), U("captured"), e.frame;
224
254
  },
225
255
  onCaptureError: (e) => {
226
- R.current = !0, U("error"), q(e.message);
227
- let t = M.current?.getDiagnostics();
228
- t && J(t), z.current.onError?.(e);
256
+ I.current = !0, U("error"), J(e.message);
257
+ let t = A.current?.getDiagnostics();
258
+ t && Y(t), L.current.onError?.(e);
229
259
  },
230
260
  onCapture: async (e) => {
231
- let n = F.current;
261
+ let t = N.current;
232
262
  await new Promise((e) => window.setTimeout(e, 140));
233
263
  let r = {
234
264
  ...e,
235
- method: n?.method ?? "video-frame",
236
- settings: n?.settings ?? t.getSettings(),
237
- fallbackReason: n?.fallbackReason,
238
- luminance: n?.luminance,
239
- diagnostics: n?.diagnostics,
240
- displayedQuad: I.current.quad,
241
- displaySourceWidth: I.current.sourceWidth,
242
- displaySourceHeight: I.current.sourceHeight
265
+ method: t?.method ?? "video-frame",
266
+ settings: t?.settings ?? n.getSettings(),
267
+ fallbackReason: t?.fallbackReason,
268
+ luminance: t?.luminance,
269
+ diagnostics: t?.diagnostics,
270
+ displayedQuad: P.current.quad,
271
+ displaySourceWidth: P.current.sourceWidth,
272
+ displaySourceHeight: P.current.sourceHeight
243
273
  };
244
- if (z.current.useCase === "drivers-license") {
245
- await le.current(r);
274
+ if (L.current.useCase === "drivers-license") {
275
+ await z.current(r);
246
276
  return;
247
277
  }
248
- await ae(z.current.onCapture, r);
278
+ await ce(L.current.onCapture, r);
249
279
  }
250
280
  });
251
- } catch (n) {
281
+ } catch (t) {
252
282
  if (e) return;
253
- t();
254
- let r = n instanceof Error ? n : /* @__PURE__ */ Error("Camera access failed.");
255
- q(r.message), U("error"), z.current.onError?.(r);
283
+ n();
284
+ let r = t instanceof Error ? t : /* @__PURE__ */ Error("Camera access failed.");
285
+ J(r.message), U("error"), L.current.onError?.(r);
256
286
  }
257
287
  })(), () => {
258
- e = !0, t();
288
+ e = !0, n();
259
289
  };
260
290
  }, [
261
- i,
291
+ r,
262
292
  H,
263
- j,
264
- d,
265
- g,
266
- O,
267
293
  k,
268
- oe,
269
- xe,
270
- Q,
271
- Fe
294
+ m,
295
+ te,
296
+ E,
297
+ D,
298
+ ue,
299
+ we,
300
+ Z,
301
+ Q
272
302
  ]);
273
- let Le = {
274
- open: i,
275
- phase: fe,
276
- autoCapture: d,
277
- captureMode: m,
278
- usingSystemCamera: j,
303
+ let Ve = {
304
+ open: r,
305
+ phase: ge,
306
+ autoCapture: m,
307
+ captureMode: h,
308
+ usingSystemCamera: k,
279
309
  finderStatus: W,
280
- displayQuad: me,
281
- previewSize: he,
282
- settings: _e,
283
- captureMethod: ye,
284
- error: be,
285
- diagnostics: Ce,
286
- shutterDiagnostics: we,
287
- copyState: Te,
288
- guidanceHint: W ? f(W.guidance, W.lighting) : void 0,
310
+ displayQuad: _e,
311
+ previewSize: ve,
312
+ settings: be,
313
+ captureMethod: Se,
314
+ error: Ce,
315
+ diagnostics: Ee,
316
+ shutterDiagnostics: De,
317
+ copyState: Oe,
318
+ guidanceHint: W ? t(W.guidance, W.lighting) : void 0,
289
319
  detectorStatus: W?.modelStatus === "failed" ? `ML failed${W.modelError ? `: ${W.modelError}` : ""}` : W?.detector === "ml" ? `ML ${W.modelProvider ?? ""}`.trim() : "ML loading",
290
- modelDownload: Ne,
291
- frozenPreviewUrl: Ee,
292
- useCase: l,
293
- licenseSide: l === "drivers-license" ? Oe : void 0,
294
- licenseBusy: l === "drivers-license" ? je : void 0
320
+ modelDownload: Re,
321
+ frozenPreviewUrl: Ae,
322
+ useCase: p,
323
+ licenseSide: p === "drivers-license" ? Ne : void 0,
324
+ licenseBusy: p === "drivers-license" ? Ie : void 0
295
325
  };
296
326
  _(() => {
297
- ue.current = Le;
327
+ me.current = Ve;
298
328
  });
299
- let Re = h(() => {
300
- z.current.onCancel();
301
- }, []), $ = h(async () => {
302
- if (!ce.current) {
303
- ce.current = !0, R.current = !1, q(""), G(void 0), L.current.clear(), U("capturing");
329
+ let He = g(() => {
330
+ L.current.onCancel();
331
+ }, []), $ = g(async () => {
332
+ if (!fe.current) {
333
+ fe.current = !0, I.current = !1, J(""), K(void 0), F.current.clear(), U("capturing");
304
334
  try {
305
- let e = await s();
306
- Fe(e);
307
- let t = {
308
- width: e.width,
309
- height: e.height
335
+ let t = await c();
336
+ Q(t);
337
+ let n = {
338
+ width: t.width,
339
+ height: t.height
310
340
  };
311
- ve(t), z.current.onSettings?.(t), K("system-camera");
312
- let n;
341
+ xe(n), L.current.onSettings?.(n), q("system-camera");
342
+ let r;
313
343
  try {
314
- let t = e.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, e.width, e.height).data;
315
- t && (n = p(t));
344
+ let e = t.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, t.width, t.height).data;
345
+ e && (r = l(e));
316
346
  } catch {
317
- n = void 0;
347
+ r = void 0;
348
+ }
349
+ if (L.current.useCase === "drivers-license" && Fe.current === "back") {
350
+ K(void 0), F.current.clear(), P.current = {}, U("captured"), await z.current({
351
+ frame: t,
352
+ reason: "manual",
353
+ method: "system-camera",
354
+ settings: n,
355
+ luminance: r
356
+ });
357
+ return;
318
358
  }
319
- let i = await r(e, {
320
- modelUrl: O,
321
- ortWasmPaths: k
359
+ let i = await e(t, {
360
+ modelUrl: E,
361
+ ortWasmPaths: D
322
362
  });
323
- if ((z.current.useCase !== "drivers-license" || Ae.current !== "back") && (i.status !== "success" || !i.corners || !i.quad)) {
324
- R.current = !0, U("error"), q(i.message), z.current.onError?.(Error(i.message));
363
+ if (i.status !== "success" || !i.corners || !i.quad) {
364
+ I.current = !0, U("error"), J(i.message), L.current.onError?.(Error(i.message));
325
365
  return;
326
366
  }
327
- I.current = {
367
+ P.current = {
328
368
  quad: i.quad,
329
369
  sourceWidth: i.sourceWidth,
330
370
  sourceHeight: i.sourceHeight
331
- }, i.quad && G(i.quad), U("captured");
371
+ }, i.quad && K(i.quad), U("captured");
332
372
  let a = {
333
- frame: e,
373
+ frame: t,
334
374
  detection: i,
335
375
  reason: "manual",
336
376
  method: "system-camera",
337
- settings: t,
338
- luminance: n,
377
+ settings: n,
378
+ luminance: r,
339
379
  displayedQuad: i.quad,
340
380
  displaySourceWidth: i.sourceWidth,
341
381
  displaySourceHeight: i.sourceHeight
342
382
  };
343
- if (z.current.useCase === "drivers-license") {
344
- await le.current(a);
383
+ if (L.current.useCase === "drivers-license") {
384
+ await z.current(a);
345
385
  return;
346
386
  }
347
- await ae(z.current.onCapture, a);
387
+ await ce(L.current.onCapture, a);
348
388
  } catch (e) {
349
389
  let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not take a photo.");
350
390
  if (t.message === "No photo was selected.") {
351
- if (Z.current) {
391
+ if (Me.current) {
352
392
  U("error");
353
393
  return;
354
394
  }
355
- z.current.onCancel();
395
+ L.current.onCancel();
356
396
  return;
357
397
  }
358
- R.current = !0, q(t.message), U("error"), z.current.onError?.(t);
398
+ I.current = !0, J(t.message), U("error"), L.current.onError?.(t);
359
399
  } finally {
360
- ce.current = !1;
400
+ fe.current = !1;
361
401
  }
362
402
  }
363
403
  }, [
364
- Fe,
365
- O,
366
- k
367
- ]), ze = h(async (e) => {
368
- let t = await V.current;
404
+ Q,
405
+ E,
406
+ D
407
+ ]), Ue = g(async (e) => {
408
+ let t = await pe.current;
369
409
  if (t) {
370
- Me(!0);
410
+ Le(!0);
371
411
  try {
372
412
  let n = await t.submitStill(e.frame, e.detection);
373
413
  if (n.kind === "need-back") {
374
- if (Ae.current = "back", ke("back"), R.current = !1, q(""), G(void 0), L.current.clear(), Q(), j) {
414
+ if (Fe.current = "back", B.current = !1, Pe("back"), I.current = !1, J(""), G(void 0), K(void 0), F.current.clear(), Z(), k) {
375
415
  U("ready");
376
416
  return;
377
417
  }
378
- H?.paused && H.play(), U("starting"), Se((e) => e + 1);
418
+ H?.paused && H.play(), U("starting"), Te((e) => e + 1);
379
419
  return;
380
420
  }
381
421
  if (n.kind === "retry") {
382
- R.current = !0, q(n.message), U("error");
422
+ I.current = !0, J(n.message), U("error");
383
423
  return;
384
424
  }
385
- await ae(z.current.onDriverLicense, n.result);
425
+ await ce(L.current.onDriverLicense, n.result);
386
426
  } catch (e) {
387
427
  let t = e instanceof Error ? e : /* @__PURE__ */ Error("Driver’s license scan failed.");
388
- R.current = !0, q(t.message), U("error"), z.current.onError?.(t);
428
+ I.current = !0, J(t.message), U("error"), L.current.onError?.(t);
389
429
  } finally {
390
- Me(!1);
430
+ Le(!1);
391
431
  }
392
432
  }
393
433
  }, [
394
- Q,
434
+ Z,
395
435
  H,
396
- j
436
+ k
397
437
  ]);
398
438
  v(() => {
399
- le.current = ze;
400
- }, [ze]);
401
- let Be = h(async () => {
402
- if (j) {
439
+ z.current = Ue;
440
+ }, [Ue]);
441
+ let We = g(async () => {
442
+ if (k) {
403
443
  await $();
404
444
  return;
405
445
  }
446
+ let e = A.current;
447
+ if (e && L.current.useCase === "drivers-license" && Fe.current === "back") {
448
+ try {
449
+ let t = await e.capturePhoto();
450
+ if (!(await d(t.frame))?.text || B.current) return;
451
+ B.current = !0, V.current?.abort(), N.current = t, q(t.method), X(t.diagnostics), Y(t.diagnostics), Q(t.frame, H), U("captured"), await z.current({
452
+ frame: t.frame,
453
+ reason: "manual",
454
+ method: t.method,
455
+ settings: t.settings,
456
+ fallbackReason: t.fallbackReason,
457
+ luminance: t.luminance,
458
+ diagnostics: t.diagnostics
459
+ });
460
+ } catch (e) {
461
+ let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
462
+ I.current = !0, J(t.message);
463
+ let n = A.current?.getDiagnostics();
464
+ n && Y(n), N.current?.diagnostics && X(N.current.diagnostics), U("error"), L.current.onError?.(t);
465
+ }
466
+ return;
467
+ }
406
468
  try {
407
- await N.current?.capture();
469
+ await j.current?.capture();
408
470
  } catch (e) {
409
471
  let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
410
- R.current = !0, q(t.message);
411
- let n = M.current?.getDiagnostics();
412
- n && J(n), F.current?.diagnostics && Y(F.current.diagnostics), U("error"), z.current.onError?.(t);
472
+ I.current = !0, J(t.message);
473
+ let n = A.current?.getDiagnostics();
474
+ n && Y(n), N.current?.diagnostics && X(N.current.diagnostics), U("error"), L.current.onError?.(t);
413
475
  }
414
- }, [$, j]), Ve = y($);
415
- Ve.current = $;
416
- let He = y(!1);
476
+ }, [
477
+ $,
478
+ Q,
479
+ H,
480
+ k
481
+ ]), Ge = y($);
482
+ Ge.current = $;
483
+ let Ke = y(!1);
417
484
  v(() => {
418
- if (!i || !j) {
419
- He.current = !1;
485
+ if (!r || !k) {
486
+ Ke.current = !1;
420
487
  return;
421
488
  }
422
- if (!He.current) {
423
- if (He.current = !0, R.current = !1, q(""), pe(void 0), K(void 0), Y(void 0), X("idle"), G(void 0), L.current.clear(), Q(), !t()) {
489
+ if (!Ke.current) {
490
+ if (Ke.current = !0, I.current = !1, J(""), G(void 0), q(void 0), X(void 0), ke("idle"), K(void 0), F.current.clear(), Z(), !s()) {
424
491
  U("ready");
425
492
  return;
426
493
  }
427
- Ve.current();
494
+ Ge.current();
428
495
  }
429
496
  }, [
430
- i,
431
- j,
432
- Q
497
+ r,
498
+ k,
499
+ Z
433
500
  ]);
434
- let Ue = h(() => {
435
- if (R.current = !1, q(""), Y(void 0), X("idle"), G(void 0), L.current.clear(), j) {
501
+ let qe = g(() => {
502
+ if (I.current = !1, B.current = !1, J(""), X(void 0), ke("idle"), G(void 0), K(void 0), F.current.clear(), k) {
436
503
  $();
437
504
  return;
438
505
  }
439
- if (Q(), l === "drivers-license") {
440
- U("starting"), Se((e) => e + 1);
506
+ if (Z(), p === "drivers-license") {
507
+ U("starting"), Te((e) => e + 1);
441
508
  return;
442
509
  }
443
- let e = M.current;
444
- H?.paused && H.play(), U(e ? "ready" : "starting"), e || Se((e) => e + 1);
510
+ let e = A.current;
511
+ H?.paused && H.play(), U(e ? "ready" : "starting"), e || Te((e) => e + 1);
445
512
  }, [
446
513
  $,
447
- Q,
514
+ Z,
448
515
  H,
449
- l,
450
- j
451
- ]), We = h(async (e) => {
452
- let t = M.current;
453
- t && (await t.setTorch(e), J(t.getDiagnostics()));
454
- }, []), Ge = h((e) => {
455
- N.current?.setAutoCapture(e);
456
- }, []), Ke = h(async () => {
457
- let t = ue.current, n = M.current?.getDiagnostics() ?? t.diagnostics, r = t.finderStatus, i = e({
458
- error: t.error || void 0,
459
- captureMethod: t.captureMethod,
460
- luminance: F.current?.luminance,
461
- fallbackReason: F.current?.fallbackReason,
462
- shutter: t.shutterDiagnostics ?? F.current?.diagnostics,
463
- live: n,
464
- finder: r ? {
465
- state: r.state,
466
- confidence: r.confidence,
467
- stableFrames: r.stableFrames,
468
- requiredStableFrames: r.requiredStableFrames,
469
- detector: r.detector,
470
- modelStatus: r.modelStatus,
471
- modelError: r.modelError,
472
- modelProvider: r.modelProvider,
473
- modelNote: r.modelNote,
474
- inferenceMs: r.inferenceMs,
475
- sourceWidth: r.sourceWidth,
476
- sourceHeight: r.sourceHeight
516
+ p,
517
+ k
518
+ ]), Je = g(async (e) => {
519
+ let t = A.current;
520
+ t && (await t.setTorch(e), Y(t.getDiagnostics()));
521
+ }, []), Ye = g((e) => {
522
+ j.current?.setAutoCapture(e);
523
+ }, []), Xe = g(async () => {
524
+ let e = me.current, t = A.current?.getDiagnostics() ?? e.diagnostics, n = e.finderStatus, r = o({
525
+ error: e.error || void 0,
526
+ captureMethod: e.captureMethod,
527
+ luminance: N.current?.luminance,
528
+ fallbackReason: N.current?.fallbackReason,
529
+ shutter: e.shutterDiagnostics ?? N.current?.diagnostics,
530
+ live: t,
531
+ finder: n ? {
532
+ state: n.state,
533
+ confidence: n.confidence,
534
+ stableFrames: n.stableFrames,
535
+ requiredStableFrames: n.requiredStableFrames,
536
+ detector: n.detector,
537
+ modelStatus: n.modelStatus,
538
+ modelError: n.modelError,
539
+ modelProvider: n.modelProvider,
540
+ modelNote: n.modelNote,
541
+ inferenceMs: n.inferenceMs,
542
+ sourceWidth: n.sourceWidth,
543
+ sourceHeight: n.sourceHeight
477
544
  } : void 0
478
545
  });
479
546
  try {
480
- if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(i);
547
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(r);
481
548
  else {
482
549
  let e = document.createElement("textarea");
483
- e.value = i, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.left = "-9999px", document.body.append(e), e.select();
550
+ e.value = r, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.left = "-9999px", document.body.append(e), e.select();
484
551
  let t = document.execCommand("copy");
485
552
  if (e.remove(), !t) throw Error("Clipboard copy is unavailable.");
486
553
  }
487
- X("copied");
554
+ ke("copied");
488
555
  } catch {
489
- X("failed");
556
+ ke("failed");
490
557
  }
491
- }, []), qe = h(() => ue.current, []), Je = ee(() => ({
492
- capture: Be,
493
- cancel: Re,
494
- retry: Ue,
495
- setTorch: We,
496
- setAutoCapture: Ge,
497
- copyReport: Ke,
498
- getState: qe
558
+ }, []), Ze = g(() => me.current, []), Qe = ne(() => ({
559
+ capture: We,
560
+ cancel: He,
561
+ retry: qe,
562
+ setTorch: Je,
563
+ setAutoCapture: Ye,
564
+ copyReport: Xe,
565
+ getState: Ze
499
566
  }), [
500
- Be,
501
- Re,
502
- Ue,
503
567
  We,
504
- Ge,
505
- Ke,
506
- qe
568
+ He,
569
+ qe,
570
+ Je,
571
+ Ye,
572
+ Xe,
573
+ Ze
507
574
  ]);
508
575
  _(() => {
509
- if (A) return A.current = Je, () => {
510
- A.current = null;
576
+ if (O) return O.current = Qe, () => {
577
+ O.current = null;
511
578
  };
512
- }, [Je, A]);
513
- let Ye = {
514
- ...Le,
515
- ...Je,
516
- bindPreview: Ie
579
+ }, [Qe, O]);
580
+ let $e = {
581
+ ...Ve,
582
+ ...Qe,
583
+ bindPreview: Be
517
584
  };
518
- return /* @__PURE__ */ S(ne.Provider, {
519
- value: Ye,
520
- children: se
585
+ return /* @__PURE__ */ S(ae.Provider, {
586
+ value: $e,
587
+ children: de
521
588
  });
522
589
  }
523
590
  //#endregion
524
591
  //#region src/react/hooks.ts
525
- function O() {
592
+ function E() {
526
593
  return y(null);
527
594
  }
528
- function k() {
529
- let e = g(ne);
595
+ function D() {
596
+ let e = te(ae);
530
597
  if (!e) throw Error("useScanner must be used within ScannerProvider.");
531
598
  return e;
532
599
  }
533
600
  //#endregion
534
601
  //#region src/live-overlay-geometry.ts
535
- function oe(e, t, n, r, i) {
602
+ function ue(e, t, n, r, i) {
536
603
  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;
537
604
  if (i === "contain") return {
538
605
  viewBox: `0 0 ${a} ${o}`,
@@ -541,9 +608,9 @@ function oe(e, t, n, r, i) {
541
608
  offsetX: f,
542
609
  offsetY: p
543
610
  };
544
- let m = s / d, h = c / d;
611
+ let m = s / d, ee = c / d;
545
612
  return {
546
- viewBox: `${-f / d} ${-p / d} ${m} ${h}`,
613
+ viewBox: `${-f / d} ${-p / d} ${m} ${ee}`,
547
614
  preserveAspectRatio: "none",
548
615
  scale: d,
549
616
  offsetX: f,
@@ -552,7 +619,7 @@ function oe(e, t, n, r, i) {
552
619
  }
553
620
  //#endregion
554
621
  //#region src/components/ModelDownloadRing.tsx
555
- function A({ snapshot: e }) {
622
+ function O({ snapshot: e }) {
556
623
  if (!e.downloading) return null;
557
624
  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;
558
625
  return /* @__PURE__ */ C("div", {
@@ -588,12 +655,12 @@ function A({ snapshot: e }) {
588
655
  }
589
656
  //#endregion
590
657
  //#region src/react/guidance.ts
591
- function se(e) {
592
- if (!(e.usingSystemCamera || e.licenseBusy) && e.phase !== "starting" && e.phase !== "error") return e.phase === "capturing" ? "Capturing full resolution…" : e.phase === "captured" ? "Document captured" : e.holdStillSeconds && e.holdStillSeconds > 0 ? l(e.holdStillSeconds) : e.guidanceHint && e.guidanceReason && e.guidanceReason !== "place-document" ? e.guidanceHint : e.licenseHeadline ?? e.guidanceHint ?? "Place the document in the frame";
658
+ function de(e) {
659
+ if (!(e.usingSystemCamera || e.licenseBusy) && e.phase !== "error") return e.phase === "starting" ? e.licenseHeadline : e.phase === "capturing" ? "Capturing full resolution…" : e.phase === "captured" ? "Document captured" : e.holdStillSeconds && e.holdStillSeconds > 0 ? m(e.holdStillSeconds) : e.guidanceHint && e.guidanceReason && e.guidanceReason !== "place-document" ? e.guidanceHint : e.licenseHeadline ?? e.guidanceHint ?? "Place the document in the frame";
593
660
  }
594
661
  //#endregion
595
662
  //#region src/react/parts.tsx
596
- var j = {
663
+ var k = {
597
664
  primaryColorHex: "--scanner-overlay-primary",
598
665
  seekingColorHex: "--scanner-overlay-seeking",
599
666
  detectingColorHex: "--scanner-overlay-detecting",
@@ -601,19 +668,19 @@ var j = {
601
668
  readyColorHex: "--scanner-overlay-ready",
602
669
  capturedColorHex: "--scanner-overlay-captured"
603
670
  };
604
- function M(e) {
671
+ function A(e) {
605
672
  if (!e) return;
606
673
  let t = {};
607
- for (let [n, r] of Object.entries(j)) {
674
+ for (let [n, r] of Object.entries(k)) {
608
675
  let i = e[n]?.trim();
609
676
  i && (t[r] = i);
610
677
  }
611
678
  return Object.keys(t).length > 0 ? t : void 0;
612
679
  }
613
- function N({ theme: e, style: t, title: n, children: r }) {
614
- let i = k();
680
+ function j({ theme: e, style: t, title: n, children: r }) {
681
+ let i = D();
615
682
  if (!i.open) return null;
616
- let a = n ?? (i.useCase === "drivers-license" ? "Scan a driver’s license" : "Scan a document"), o = M(e), s = o ? {
683
+ let a = n ?? (i.useCase === "drivers-license" ? "Scan a driver’s license" : "Scan a document"), o = A(e), s = o ? {
617
684
  ...t,
618
685
  ...o
619
686
  } : t;
@@ -623,11 +690,11 @@ function N({ theme: e, style: t, title: n, children: r }) {
623
690
  role: "dialog",
624
691
  "aria-modal": "true",
625
692
  "aria-label": a,
626
- children: [r, /* @__PURE__ */ S(B, {})]
693
+ children: [r, /* @__PURE__ */ S(R, {})]
627
694
  });
628
695
  }
629
- function P() {
630
- let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = k(), r = y(null), i = h((t) => {
696
+ function M() {
697
+ let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = D(), r = y(null), i = g((t) => {
631
698
  r.current = t, e(t);
632
699
  }, [e]);
633
700
  return _(() => {
@@ -656,10 +723,10 @@ function P() {
656
723
  "aria-label": "Captured document"
657
724
  }) : null] });
658
725
  }
659
- function F() {
660
- let { finderStatus: e, displayQuad: t, previewSize: n } = k();
726
+ function N() {
727
+ let { finderStatus: e, displayQuad: t, previewSize: n } = D();
661
728
  if (!t || !e?.sourceWidth || !e.sourceHeight) return null;
662
- let r = oe(e.sourceWidth, e.sourceHeight, n.width, n.height, "cover");
729
+ let r = ue(e.sourceWidth, e.sourceHeight, n.width, n.height, "cover");
663
730
  return /* @__PURE__ */ S("svg", {
664
731
  className: `scanner-camera-overlay__quad ${e.state}`,
665
732
  viewBox: r.viewBox,
@@ -668,8 +735,8 @@ function F() {
668
735
  children: /* @__PURE__ */ S("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}` })
669
736
  });
670
737
  }
671
- function I({ title: e }) {
672
- let { phase: t, cancel: n, usingSystemCamera: r, useCase: i, licenseSide: a, licenseBusy: o } = k(), s = i === "drivers-license" ? d(a ?? "front", r) : void 0, c = e ?? s?.title ?? "Scan a document";
738
+ function P({ title: e }) {
739
+ let { phase: t, cancel: n, usingSystemCamera: r, useCase: i, licenseSide: a, licenseBusy: o } = D(), s = i === "drivers-license" ? p(a ?? "front", r) : void 0, c = e ?? s?.title ?? "Scan a document";
673
740
  return /* @__PURE__ */ C("div", {
674
741
  className: "scanner-camera-overlay__topbar",
675
742
  children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("strong", { children: c }), /* @__PURE__ */ C("span", {
@@ -694,13 +761,13 @@ function I({ title: e }) {
694
761
  })]
695
762
  });
696
763
  }
697
- function L() {
698
- let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c, useCase: l, licenseSide: u, licenseBusy: f } = k(), p = l === "drivers-license" ? d(u ?? "front", s) : void 0;
764
+ function F() {
765
+ let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c, useCase: l, licenseSide: u, licenseBusy: d } = D(), f = l === "drivers-license" ? p(u ?? "front", s) : void 0;
699
766
  return e === "error" ? /* @__PURE__ */ C("div", {
700
767
  className: "scanner-camera-overlay__message",
701
768
  role: "alert",
702
769
  children: [
703
- /* @__PURE__ */ S("strong", { children: p ? u === "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" }),
770
+ /* @__PURE__ */ S("strong", { children: f ? u === "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" }),
704
771
  /* @__PURE__ */ S("p", { children: t }),
705
772
  /* @__PURE__ */ C("div", { children: [
706
773
  /* @__PURE__ */ S("button", {
@@ -720,7 +787,7 @@ function L() {
720
787
  })
721
788
  ] })
722
789
  ]
723
- }) : f ? /* @__PURE__ */ C("div", {
790
+ }) : d ? /* @__PURE__ */ C("div", {
724
791
  className: "scanner-camera-overlay__message",
725
792
  "aria-live": "polite",
726
793
  children: [
@@ -733,13 +800,13 @@ function L() {
733
800
  "aria-live": "polite",
734
801
  children: [
735
802
  /* @__PURE__ */ S("span", { className: "scanner-camera-overlay__spinner" }),
736
- /* @__PURE__ */ S("strong", { children: p ? p.headline : "Opening the system camera" }),
737
- /* @__PURE__ */ S("p", { children: p ? p.detail : "There is no live document guide. We find the page after you take the photo." })
803
+ /* @__PURE__ */ S("strong", { children: f ? f.headline : "Opening the system camera" }),
804
+ /* @__PURE__ */ S("p", { children: f ? f.detail : "There is no live document guide. We find the page after you take the photo." })
738
805
  ]
739
806
  }) : s && e === "ready" && !c ? /* @__PURE__ */ C("div", {
740
807
  className: "scanner-camera-overlay__message",
741
808
  "aria-live": "polite",
742
- children: [/* @__PURE__ */ S("strong", { children: p ? p.headline : "System camera" }), /* @__PURE__ */ S("p", { children: p ? p.detail : "Tap the shutter to open the Camera app. There is no live document guide." })]
809
+ children: [/* @__PURE__ */ S("strong", { children: f ? f.headline : "System camera" }), /* @__PURE__ */ S("p", { children: f ? f.detail : "Tap the shutter to open the Camera app. There is no live document guide." })]
743
810
  }) : e === "starting" && !s ? /* @__PURE__ */ C("div", {
744
811
  className: "scanner-camera-overlay__message",
745
812
  "aria-live": "polite",
@@ -750,8 +817,8 @@ function L() {
750
817
  ]
751
818
  }) : null;
752
819
  }
753
- function R() {
754
- let { finderStatus: e, detectorStatus: t, settings: n, usingSystemCamera: r, captureMethod: i, phase: a, useCase: o, licenseSide: s } = k(), c = n?.width, l = n?.height, u = o === "drivers-license" ? ` · ${s === "back" ? "back" : "front"}` : "";
820
+ function I() {
821
+ 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"}` : "";
755
822
  return r ? /* @__PURE__ */ S("div", {
756
823
  className: "scanner-camera-overlay__status",
757
824
  "aria-live": "polite",
@@ -781,8 +848,8 @@ function R() {
781
848
  })
782
849
  });
783
850
  }
784
- function ce() {
785
- let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: r, copyReport: a } = k(), o = e?.engine ?? i();
851
+ function fe() {
852
+ let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: i, copyReport: a } = D(), o = e?.engine ?? r();
786
853
  return /* @__PURE__ */ C("dl", {
787
854
  className: "scanner-camera-overlay__diagnostics",
788
855
  "aria-label": "Camera diagnostics",
@@ -803,21 +870,21 @@ function ce() {
803
870
  type: "button",
804
871
  className: "scanner-camera-overlay__copy",
805
872
  onClick: () => void a(),
806
- children: r === "copied" ? "Copied report" : r === "failed" ? "Copy failed" : "Copy report"
873
+ children: i === "copied" ? "Copied report" : i === "failed" ? "Copy failed" : "Copy report"
807
874
  }) })] })
808
875
  ]
809
876
  });
810
877
  }
811
- function z() {
812
- let { autoCapture: e, phase: t, finderStatus: n, diagnostics: r, captureMethod: i, settings: a, cancel: o, capture: s, setAutoCapture: c, setTorch: l, usingSystemCamera: u, licenseBusy: f, useCase: p, licenseSide: m, guidanceHint: h } = k(), g = a?.width, _ = a?.height, v = u ? t === "ready" : e !== "only", ee = p === "drivers-license" ? d(m ?? "front", u) : void 0, y = se({
878
+ function L() {
879
+ 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, useCase: f, licenseSide: m, guidanceHint: ee } = D(), h = a?.width, g = a?.height, te = u ? t === "ready" : e !== "only", _ = f === "drivers-license" ? p(m ?? "front", u) : void 0, v = de({
813
880
  usingSystemCamera: u,
814
881
  phase: t,
815
- licenseBusy: f,
882
+ licenseBusy: d,
816
883
  holdStillSeconds: n?.holdStillSeconds,
817
- guidanceHint: h,
884
+ guidanceHint: ee,
818
885
  guidanceReason: n?.guidance.reason,
819
- licenseHeadline: ee?.headline
820
- }), b = !!n?.holdStillSeconds;
886
+ licenseHeadline: _?.headline
887
+ }), ne = !!n?.holdStillSeconds;
821
888
  return /* @__PURE__ */ C("div", {
822
889
  className: "scanner-camera-overlay__controls",
823
890
  children: [
@@ -830,16 +897,16 @@ function z() {
830
897
  /* @__PURE__ */ C("div", {
831
898
  className: "scanner-camera-overlay__capture",
832
899
  children: [
833
- y && /* @__PURE__ */ S("p", {
834
- className: `scanner-camera-overlay__guidance${b ? " is-ready" : ""}`,
900
+ v && /* @__PURE__ */ S("p", {
901
+ className: `scanner-camera-overlay__guidance${ne ? " is-ready" : ""}`,
835
902
  "aria-live": "polite",
836
- children: y
903
+ children: v
837
904
  }),
838
- v && /* @__PURE__ */ S("button", {
905
+ te && /* @__PURE__ */ S("button", {
839
906
  type: "button",
840
907
  className: "scanner-camera-overlay__shutter",
841
908
  onClick: () => void s(),
842
- disabled: t !== "ready" || !!f,
909
+ disabled: t !== "ready" || !!d,
843
910
  "aria-label": u ? "Take a photo with the system camera" : "Capture full-resolution photo",
844
911
  children: /* @__PURE__ */ S("span", {})
845
912
  }),
@@ -863,16 +930,16 @@ function z() {
863
930
  }),
864
931
  /* @__PURE__ */ C("div", {
865
932
  className: "scanner-camera-overlay__quality",
866
- children: [/* @__PURE__ */ S("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ S("strong", { children: g && _ ? `${g} × ${_}` : u ? "Tap to photograph" : "Measuring…" })]
933
+ children: [/* @__PURE__ */ S("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ S("strong", { children: h && g ? `${h} × ${g}` : u ? "Tap to photograph" : "Measuring…" })]
867
934
  })
868
935
  ]
869
936
  });
870
937
  }
871
- function B({ snapshot: e }) {
872
- let { modelDownload: t } = k();
873
- return /* @__PURE__ */ S(A, { snapshot: e ?? t });
938
+ function R({ snapshot: e }) {
939
+ let { modelDownload: t } = D();
940
+ return /* @__PURE__ */ S(O, { snapshot: e ?? t });
874
941
  }
875
942
  //#endregion
876
- export { z as ScannerControls, ce as ScannerDiagnostics, N as ScannerFrame, B as ScannerModelDownload, L as ScannerNotice, P as ScannerPreview, D as ScannerProvider, F as ScannerQuad, R as ScannerStatus, I as ScannerTopBar, k as useScanner, O as useScannerRef };
943
+ export { L as ScannerControls, fe as ScannerDiagnostics, j as ScannerFrame, R as ScannerModelDownload, F as ScannerNotice, M as ScannerPreview, le as ScannerProvider, N as ScannerQuad, I as ScannerStatus, P as ScannerTopBar, D as useScanner, E as useScannerRef };
877
944
 
878
945
  //# sourceMappingURL=react.js.map