@exige/web-scanner-sdk 0.2.25 → 0.2.27

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