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