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