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