@exige/web-scanner-sdk 0.2.26 → 0.2.28

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