@exige/web-scanner-sdk 0.2.35 → 0.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{driver-license-CV0oawgf.js → driver-license-DWQiITx8.js} +572 -473
- package/dist/driver-license-DWQiITx8.js.map +1 -0
- package/dist/react.js +292 -284
- package/dist/react.js.map +1 -1
- package/dist/scanner-sdk.js +3 -3
- package/dist/sdk/barcode.d.ts +28 -5
- package/dist/sdk/camera.d.ts +6 -0
- package/dist/sdk/zxing-runtime.d.ts +5 -0
- package/package.json +3 -1
- package/dist/driver-license-CV0oawgf.js.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-DWQiITx8.js";
|
|
3
|
+
import { createContext as g, useCallback as _, useContext as v, useEffect as y, useLayoutEffect as ne, useMemo as re, useRef as b, useState as x } from "react";
|
|
4
|
+
import { Fragment as ie, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
5
5
|
//#region src/sdk/display-quad.ts
|
|
6
6
|
function w(e) {
|
|
7
7
|
return [
|
|
@@ -38,10 +38,10 @@ function T(e) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function E(e) {
|
|
42
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;
|
|
@@ -54,7 +54,7 @@ var ie = class {
|
|
|
54
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 = E(e), i && (this.current = E(e)), {
|
|
58
58
|
quad: this.current,
|
|
59
59
|
snapped: i
|
|
60
60
|
};
|
|
@@ -76,13 +76,13 @@ var ie = 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
|
|
85
|
+
function ce(e) {
|
|
86
86
|
try {
|
|
87
87
|
let t = e.toDataURL("image/jpeg", .92);
|
|
88
88
|
return t.startsWith("data:image/") ? t : void 0;
|
|
@@ -90,77 +90,77 @@ function se(e) {
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function le(e, t) {
|
|
94
94
|
if (typeof e == "function") return e(t);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
let
|
|
98
|
-
onCapture:
|
|
99
|
-
onDriverLicense:
|
|
100
|
-
onCancel:
|
|
101
|
-
onError:
|
|
102
|
-
onSettings:
|
|
103
|
-
onFinderStatus:
|
|
104
|
-
useCase:
|
|
105
|
-
}),
|
|
96
|
+
function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", captureMode: v = "auto", torch: ie = "defaultOff", onCapture: C, onDriverLicense: w, onCancel: T, onError: E, onSettings: ue, onFinderStatus: de, modelUrl: D, ortWasmPaths: O, detectionIntervalMs: fe, apiRef: k, children: pe }) {
|
|
97
|
+
let A = p(v), j = b(void 0), M = b(void 0), N = b(void 0), P = b(void 0), F = b({}), I = b(new ae()), L = b(!1), me = b(!1), R = b({
|
|
98
|
+
onCapture: C,
|
|
99
|
+
onDriverLicense: w,
|
|
100
|
+
onCancel: T,
|
|
101
|
+
onError: E,
|
|
102
|
+
onSettings: ue,
|
|
103
|
+
onFinderStatus: de,
|
|
104
|
+
useCase: h
|
|
105
|
+
}), he = b(void 0), ge = b(void 0), z = b(async () => void 0), B = b(!1), V = b(void 0), _e = b(null), [H, ve] = x(null), [ye, U] = x(A && m ? "capturing" : A ? "ready" : "starting"), [W, G] = x(), [be, K] = x(), [xe, Se] = x({
|
|
106
106
|
width: 1,
|
|
107
107
|
height: 1
|
|
108
|
-
}), [
|
|
108
|
+
}), [Ce, we] = x(), [Te, q] = x(), [Ee, J] = x(""), [De, Oe] = x(0), [ke, Y] = x(), [Ae, X] = x(), [je, Me] = x("idle"), [Ne, Pe] = x(), Fe = b(void 0), [Ie, Le] = x("front"), Re = b("front"), [ze, Be] = x(!1), [Ve, He] = x({
|
|
109
109
|
downloading: !1,
|
|
110
110
|
loaded: 0,
|
|
111
111
|
total: null
|
|
112
|
-
}), Z =
|
|
113
|
-
|
|
114
|
-
}, []), Q =
|
|
115
|
-
let n =
|
|
116
|
-
|
|
112
|
+
}), Z = _(() => {
|
|
113
|
+
se(Fe.current), Fe.current = void 0, Pe(void 0);
|
|
114
|
+
}, []), Q = _((e, t) => {
|
|
115
|
+
let n = ce(e);
|
|
116
|
+
se(Fe.current), Fe.current = n, Pe(n), t?.pause();
|
|
117
117
|
}, []);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
onCapture:
|
|
121
|
-
onDriverLicense:
|
|
122
|
-
onCancel:
|
|
123
|
-
onError:
|
|
124
|
-
onSettings:
|
|
125
|
-
onFinderStatus:
|
|
126
|
-
useCase:
|
|
118
|
+
ne(() => {
|
|
119
|
+
R.current = {
|
|
120
|
+
onCapture: C,
|
|
121
|
+
onDriverLicense: w,
|
|
122
|
+
onCancel: T,
|
|
123
|
+
onError: E,
|
|
124
|
+
onSettings: ue,
|
|
125
|
+
onFinderStatus: de,
|
|
126
|
+
useCase: h
|
|
127
127
|
};
|
|
128
128
|
}, [
|
|
129
|
-
x,
|
|
130
129
|
C,
|
|
131
130
|
w,
|
|
132
131
|
T,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
E,
|
|
133
|
+
ue,
|
|
134
|
+
de,
|
|
135
|
+
h
|
|
136
|
+
]), y(() => s(He), []), y(() => {
|
|
137
|
+
if (!m || h !== "drivers-license") {
|
|
138
|
+
ge.current = void 0, he.current = void 0, B.current = !1, Le("front"), Be(!1);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
let e =
|
|
142
|
-
modelUrl:
|
|
143
|
-
ortWasmPaths:
|
|
141
|
+
let e = c({ scan: {
|
|
142
|
+
modelUrl: D,
|
|
143
|
+
ortWasmPaths: O
|
|
144
144
|
} });
|
|
145
|
-
return
|
|
146
|
-
|
|
145
|
+
return ge.current = e, e.then((e) => {
|
|
146
|
+
he.current = e;
|
|
147
147
|
}), () => {
|
|
148
|
-
e.then((e) => e.cancel()),
|
|
148
|
+
e.then((e) => e.cancel()), he.current &&= void 0, ge.current = void 0;
|
|
149
149
|
};
|
|
150
150
|
}, [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
m,
|
|
152
|
+
h,
|
|
153
|
+
D,
|
|
154
|
+
O
|
|
155
155
|
]);
|
|
156
|
-
let
|
|
157
|
-
|
|
156
|
+
let Ue = _((e) => {
|
|
157
|
+
ve(e);
|
|
158
158
|
}, []);
|
|
159
|
-
|
|
160
|
-
if (!
|
|
159
|
+
y(() => {
|
|
160
|
+
if (!m || !H) return;
|
|
161
161
|
let e = () => {
|
|
162
162
|
let e = H.getBoundingClientRect();
|
|
163
|
-
|
|
163
|
+
Se({
|
|
164
164
|
width: e.width,
|
|
165
165
|
height: e.height
|
|
166
166
|
});
|
|
@@ -168,186 +168,192 @@ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", ca
|
|
|
168
168
|
if (e(), typeof ResizeObserver > "u") return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
169
169
|
let t = new ResizeObserver(e);
|
|
170
170
|
return t.observe(H), () => t.disconnect();
|
|
171
|
-
}, [
|
|
172
|
-
if (!
|
|
171
|
+
}, [m, H]), y(() => {
|
|
172
|
+
if (!m) return;
|
|
173
173
|
let e = window.setInterval(() => {
|
|
174
|
-
let e =
|
|
174
|
+
let e = j.current?.getDiagnostics();
|
|
175
175
|
e && Y(e);
|
|
176
176
|
}, 500);
|
|
177
177
|
return () => window.clearInterval(e);
|
|
178
|
-
}, [
|
|
179
|
-
if (!
|
|
178
|
+
}, [m, De]), y(() => {
|
|
179
|
+
if (!m) return;
|
|
180
180
|
let e = 0, t = performance.now(), n = (r) => {
|
|
181
|
-
let i =
|
|
181
|
+
let i = I.current.step(r - t);
|
|
182
182
|
t = r, i && K(i), e = requestAnimationFrame(n);
|
|
183
183
|
};
|
|
184
184
|
return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
|
|
185
|
-
}, [
|
|
186
|
-
if (!
|
|
187
|
-
let e = !1,
|
|
188
|
-
V.current =
|
|
189
|
-
let
|
|
190
|
-
|
|
185
|
+
}, [m]), y(() => {
|
|
186
|
+
if (!m || A || !H) return;
|
|
187
|
+
let e = !1, i = new AbortController();
|
|
188
|
+
V.current = i;
|
|
189
|
+
let o = () => {
|
|
190
|
+
i.abort(), V.current === i && (V.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();
|
|
191
191
|
};
|
|
192
192
|
return (async () => {
|
|
193
|
-
|
|
193
|
+
o(), i = new AbortController(), V.current = i, L.current = !1, U("starting"), J(""), G(void 0), q(void 0), X(void 0), Me("idle"), Z();
|
|
194
194
|
try {
|
|
195
|
-
let
|
|
195
|
+
let o = await t(H, { torch: ie });
|
|
196
196
|
if (e) {
|
|
197
|
-
|
|
197
|
+
o.stop();
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
if (
|
|
203
|
-
G(void 0), K(void 0),
|
|
200
|
+
j.current = o;
|
|
201
|
+
let s = o.getSettings();
|
|
202
|
+
if (we(s), R.current.onSettings?.(s), console.info("[ScannerProvider] camera settings", s), R.current.useCase === "drivers-license" && Re.current === "back") {
|
|
203
|
+
G(void 0), K(void 0), I.current.clear(), U("ready"), (async () => {
|
|
204
204
|
try {
|
|
205
|
-
let
|
|
205
|
+
let t = 0, a = await d(async () => {
|
|
206
|
+
t += 1;
|
|
207
|
+
let e = r();
|
|
208
|
+
if (t % 4 == 0 && n(e, "ImageCapture" in globalThis)) try {
|
|
209
|
+
let e = await o.capturePhoto();
|
|
210
|
+
if (e.frame && e.luminance > 10) return e.frame;
|
|
211
|
+
} catch {}
|
|
206
212
|
try {
|
|
207
|
-
return
|
|
213
|
+
return await o.captureLiveFrame(l);
|
|
208
214
|
} catch {
|
|
209
215
|
return;
|
|
210
216
|
}
|
|
211
217
|
}, {
|
|
212
|
-
intervalMs:
|
|
213
|
-
signal:
|
|
218
|
+
intervalMs: fe ?? 140,
|
|
219
|
+
signal: i.signal
|
|
214
220
|
});
|
|
215
|
-
if (e ||
|
|
216
|
-
B.current = !0, Q(
|
|
217
|
-
frame:
|
|
221
|
+
if (e || i.signal.aborted || B.current) return;
|
|
222
|
+
B.current = !0, Q(a, H), q("live-mirror"), U("captured"), await z.current({
|
|
223
|
+
frame: a,
|
|
218
224
|
reason: "auto",
|
|
219
|
-
method: "
|
|
220
|
-
settings:
|
|
225
|
+
method: "live-mirror",
|
|
226
|
+
settings: o.getSettings()
|
|
221
227
|
});
|
|
222
|
-
} catch (
|
|
223
|
-
if (e ||
|
|
224
|
-
let
|
|
225
|
-
|
|
228
|
+
} catch (t) {
|
|
229
|
+
if (e || i.signal.aborted || t instanceof DOMException && t.name === "AbortError") return;
|
|
230
|
+
let n = t instanceof Error ? t : /* @__PURE__ */ Error("Could not read the barcode.");
|
|
231
|
+
L.current = !0, J(n.message), U("error"), R.current.onError?.(n);
|
|
226
232
|
}
|
|
227
233
|
})();
|
|
228
234
|
return;
|
|
229
235
|
}
|
|
230
|
-
|
|
236
|
+
M.current = await a({
|
|
231
237
|
source: H,
|
|
232
|
-
autoCapture:
|
|
233
|
-
intervalMs:
|
|
238
|
+
autoCapture: g,
|
|
239
|
+
intervalMs: fe,
|
|
234
240
|
detection: {
|
|
235
|
-
modelUrl:
|
|
236
|
-
ortWasmPaths:
|
|
241
|
+
modelUrl: D,
|
|
242
|
+
ortWasmPaths: O
|
|
237
243
|
},
|
|
238
244
|
onStatus: (e) => {
|
|
239
|
-
if (
|
|
240
|
-
let t =
|
|
245
|
+
if (N.current = e, G(e), R.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
|
|
246
|
+
let t = I.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
|
|
241
247
|
K(t.quad);
|
|
242
|
-
} else
|
|
243
|
-
e.state !== "captured" && !
|
|
248
|
+
} else I.current.clear(), K(void 0);
|
|
249
|
+
e.state !== "captured" && !L.current && U("ready");
|
|
244
250
|
},
|
|
245
251
|
captureFrame: async () => {
|
|
246
|
-
U("capturing"),
|
|
247
|
-
quad:
|
|
248
|
-
sourceWidth:
|
|
249
|
-
sourceHeight:
|
|
252
|
+
U("capturing"), F.current = {
|
|
253
|
+
quad: I.current.getCurrent(),
|
|
254
|
+
sourceWidth: N.current?.sourceWidth,
|
|
255
|
+
sourceHeight: N.current?.sourceHeight
|
|
250
256
|
};
|
|
251
|
-
let e = await
|
|
252
|
-
if (
|
|
257
|
+
let e = await o.capturePhoto();
|
|
258
|
+
if (P.current = e, q(e.method), X(e.diagnostics), Y(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.`);
|
|
253
259
|
return Q(e.frame, H), U("captured"), e.frame;
|
|
254
260
|
},
|
|
255
261
|
onCaptureError: (e) => {
|
|
256
|
-
|
|
257
|
-
let t =
|
|
258
|
-
t && Y(t),
|
|
262
|
+
L.current = !0, U("error"), J(e.message);
|
|
263
|
+
let t = j.current?.getDiagnostics();
|
|
264
|
+
t && Y(t), R.current.onError?.(e);
|
|
259
265
|
},
|
|
260
266
|
onCapture: async (e) => {
|
|
261
|
-
let t =
|
|
267
|
+
let t = P.current;
|
|
262
268
|
await new Promise((e) => window.setTimeout(e, 140));
|
|
263
|
-
let
|
|
269
|
+
let n = {
|
|
264
270
|
...e,
|
|
265
271
|
method: t?.method ?? "video-frame",
|
|
266
|
-
settings: t?.settings ??
|
|
272
|
+
settings: t?.settings ?? o.getSettings(),
|
|
267
273
|
fallbackReason: t?.fallbackReason,
|
|
268
274
|
luminance: t?.luminance,
|
|
269
275
|
diagnostics: t?.diagnostics,
|
|
270
|
-
displayedQuad:
|
|
271
|
-
displaySourceWidth:
|
|
272
|
-
displaySourceHeight:
|
|
276
|
+
displayedQuad: F.current.quad,
|
|
277
|
+
displaySourceWidth: F.current.sourceWidth,
|
|
278
|
+
displaySourceHeight: F.current.sourceHeight
|
|
273
279
|
};
|
|
274
|
-
if (
|
|
275
|
-
await z.current(
|
|
280
|
+
if (R.current.useCase === "drivers-license") {
|
|
281
|
+
await z.current(n);
|
|
276
282
|
return;
|
|
277
283
|
}
|
|
278
|
-
await
|
|
284
|
+
await le(R.current.onCapture, n);
|
|
279
285
|
}
|
|
280
286
|
});
|
|
281
287
|
} catch (t) {
|
|
282
288
|
if (e) return;
|
|
283
|
-
|
|
284
|
-
let
|
|
285
|
-
J(
|
|
289
|
+
o();
|
|
290
|
+
let n = t instanceof Error ? t : /* @__PURE__ */ Error("Camera access failed.");
|
|
291
|
+
J(n.message), U("error"), R.current.onError?.(n);
|
|
286
292
|
}
|
|
287
293
|
})(), () => {
|
|
288
|
-
e = !0,
|
|
294
|
+
e = !0, o();
|
|
289
295
|
};
|
|
290
296
|
}, [
|
|
291
|
-
r,
|
|
292
|
-
H,
|
|
293
|
-
k,
|
|
294
297
|
m,
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
H,
|
|
299
|
+
A,
|
|
300
|
+
g,
|
|
301
|
+
ie,
|
|
297
302
|
D,
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
O,
|
|
304
|
+
fe,
|
|
305
|
+
De,
|
|
300
306
|
Z,
|
|
301
307
|
Q
|
|
302
308
|
]);
|
|
303
|
-
let
|
|
304
|
-
open:
|
|
305
|
-
phase:
|
|
306
|
-
autoCapture:
|
|
307
|
-
captureMode:
|
|
308
|
-
usingSystemCamera:
|
|
309
|
+
let We = {
|
|
310
|
+
open: m,
|
|
311
|
+
phase: ye,
|
|
312
|
+
autoCapture: g,
|
|
313
|
+
captureMode: v,
|
|
314
|
+
usingSystemCamera: A,
|
|
309
315
|
finderStatus: W,
|
|
310
|
-
displayQuad:
|
|
311
|
-
previewSize:
|
|
312
|
-
settings:
|
|
313
|
-
captureMethod:
|
|
314
|
-
error:
|
|
315
|
-
diagnostics:
|
|
316
|
-
shutterDiagnostics:
|
|
317
|
-
copyState:
|
|
318
|
-
guidanceHint: W ?
|
|
319
|
-
detectorStatus: W?.modelStatus === "failed" ? `ML failed${W.modelError ? `: ${W.modelError}` : ""}` : W?.detector === "ml" ? `ML ${W.modelProvider ?? ""}`.trim() : "ML loading",
|
|
320
|
-
modelDownload:
|
|
321
|
-
frozenPreviewUrl:
|
|
322
|
-
useCase:
|
|
323
|
-
licenseSide:
|
|
324
|
-
licenseBusy:
|
|
316
|
+
displayQuad: be,
|
|
317
|
+
previewSize: xe,
|
|
318
|
+
settings: Ce,
|
|
319
|
+
captureMethod: Te,
|
|
320
|
+
error: Ee,
|
|
321
|
+
diagnostics: ke,
|
|
322
|
+
shutterDiagnostics: Ae,
|
|
323
|
+
copyState: je,
|
|
324
|
+
guidanceHint: W ? ee(W.guidance, W.lighting) : void 0,
|
|
325
|
+
detectorStatus: h === "drivers-license" && Ie === "back" && !A ? "zxing" : W?.modelStatus === "failed" ? `ML failed${W.modelError ? `: ${W.modelError}` : ""}` : W?.detector === "ml" ? `ML ${W.modelProvider ?? ""}`.trim() : "ML loading",
|
|
326
|
+
modelDownload: Ve,
|
|
327
|
+
frozenPreviewUrl: Ne,
|
|
328
|
+
useCase: h,
|
|
329
|
+
licenseSide: h === "drivers-license" ? Ie : void 0,
|
|
330
|
+
licenseBusy: h === "drivers-license" ? ze : void 0
|
|
325
331
|
};
|
|
326
|
-
|
|
327
|
-
|
|
332
|
+
y(() => {
|
|
333
|
+
_e.current = We;
|
|
328
334
|
});
|
|
329
|
-
let
|
|
330
|
-
|
|
331
|
-
}, []), $ =
|
|
332
|
-
if (!
|
|
333
|
-
|
|
335
|
+
let Ge = _(() => {
|
|
336
|
+
R.current.onCancel();
|
|
337
|
+
}, []), $ = _(async () => {
|
|
338
|
+
if (!me.current) {
|
|
339
|
+
me.current = !0, L.current = !1, J(""), K(void 0), I.current.clear(), U("capturing");
|
|
334
340
|
try {
|
|
335
|
-
let t = await
|
|
341
|
+
let t = await o();
|
|
336
342
|
Q(t);
|
|
337
343
|
let n = {
|
|
338
344
|
width: t.width,
|
|
339
345
|
height: t.height
|
|
340
346
|
};
|
|
341
|
-
|
|
347
|
+
we(n), R.current.onSettings?.(n), q("system-camera");
|
|
342
348
|
let r;
|
|
343
349
|
try {
|
|
344
|
-
let
|
|
345
|
-
|
|
350
|
+
let n = t.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, t.width, t.height).data;
|
|
351
|
+
n && (r = e(n));
|
|
346
352
|
} catch {
|
|
347
353
|
r = void 0;
|
|
348
354
|
}
|
|
349
|
-
if (
|
|
350
|
-
K(void 0),
|
|
355
|
+
if (R.current.useCase === "drivers-license" && Re.current === "back") {
|
|
356
|
+
K(void 0), I.current.clear(), F.current = {}, U("captured"), await z.current({
|
|
351
357
|
frame: t,
|
|
352
358
|
reason: "manual",
|
|
353
359
|
method: "system-camera",
|
|
@@ -356,15 +362,15 @@ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", ca
|
|
|
356
362
|
});
|
|
357
363
|
return;
|
|
358
364
|
}
|
|
359
|
-
let i = await
|
|
360
|
-
modelUrl:
|
|
361
|
-
ortWasmPaths:
|
|
365
|
+
let i = await u(t, {
|
|
366
|
+
modelUrl: D,
|
|
367
|
+
ortWasmPaths: O
|
|
362
368
|
});
|
|
363
369
|
if (i.status !== "success" || !i.corners || !i.quad) {
|
|
364
|
-
|
|
370
|
+
L.current = !0, U("error"), J(i.message), R.current.onError?.(Error(i.message));
|
|
365
371
|
return;
|
|
366
372
|
}
|
|
367
|
-
|
|
373
|
+
F.current = {
|
|
368
374
|
quad: i.quad,
|
|
369
375
|
sourceWidth: i.sourceWidth,
|
|
370
376
|
sourceHeight: i.sourceHeight
|
|
@@ -380,75 +386,75 @@ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", ca
|
|
|
380
386
|
displaySourceWidth: i.sourceWidth,
|
|
381
387
|
displaySourceHeight: i.sourceHeight
|
|
382
388
|
};
|
|
383
|
-
if (
|
|
389
|
+
if (R.current.useCase === "drivers-license") {
|
|
384
390
|
await z.current(a);
|
|
385
391
|
return;
|
|
386
392
|
}
|
|
387
|
-
await
|
|
393
|
+
await le(R.current.onCapture, a);
|
|
388
394
|
} catch (e) {
|
|
389
395
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not take a photo.");
|
|
390
396
|
if (t.message === "No photo was selected.") {
|
|
391
|
-
if (
|
|
397
|
+
if (Fe.current) {
|
|
392
398
|
U("error");
|
|
393
399
|
return;
|
|
394
400
|
}
|
|
395
|
-
|
|
401
|
+
R.current.onCancel();
|
|
396
402
|
return;
|
|
397
403
|
}
|
|
398
|
-
|
|
404
|
+
L.current = !0, J(t.message), U("error"), R.current.onError?.(t);
|
|
399
405
|
} finally {
|
|
400
|
-
|
|
406
|
+
me.current = !1;
|
|
401
407
|
}
|
|
402
408
|
}
|
|
403
409
|
}, [
|
|
404
410
|
Q,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
]),
|
|
408
|
-
let t = await
|
|
411
|
+
D,
|
|
412
|
+
O
|
|
413
|
+
]), Ke = _(async (e) => {
|
|
414
|
+
let t = await ge.current;
|
|
409
415
|
if (t) {
|
|
410
|
-
|
|
416
|
+
Be(!0);
|
|
411
417
|
try {
|
|
412
418
|
let n = await t.submitStill(e.frame, e.detection);
|
|
413
419
|
if (n.kind === "need-back") {
|
|
414
|
-
if (
|
|
420
|
+
if (Re.current = "back", B.current = !1, Le("back"), L.current = !1, J(""), G(void 0), K(void 0), I.current.clear(), Z(), A) {
|
|
415
421
|
U("ready");
|
|
416
422
|
return;
|
|
417
423
|
}
|
|
418
|
-
H?.paused && H.play(), U("starting"),
|
|
424
|
+
H?.paused && H.play(), U("starting"), Oe((e) => e + 1);
|
|
419
425
|
return;
|
|
420
426
|
}
|
|
421
427
|
if (n.kind === "retry") {
|
|
422
|
-
|
|
428
|
+
L.current = !0, J(n.message), U("error");
|
|
423
429
|
return;
|
|
424
430
|
}
|
|
425
|
-
await
|
|
431
|
+
await le(R.current.onDriverLicense, n.result);
|
|
426
432
|
} catch (e) {
|
|
427
433
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Driver’s license scan failed.");
|
|
428
|
-
|
|
434
|
+
L.current = !0, J(t.message), U("error"), R.current.onError?.(t);
|
|
429
435
|
} finally {
|
|
430
|
-
|
|
436
|
+
Be(!1);
|
|
431
437
|
}
|
|
432
438
|
}
|
|
433
439
|
}, [
|
|
434
440
|
Z,
|
|
435
441
|
H,
|
|
436
|
-
|
|
442
|
+
A
|
|
437
443
|
]);
|
|
438
|
-
|
|
439
|
-
z.current =
|
|
440
|
-
}, [
|
|
441
|
-
let
|
|
442
|
-
if (
|
|
444
|
+
ne(() => {
|
|
445
|
+
z.current = Ke;
|
|
446
|
+
}, [Ke]);
|
|
447
|
+
let qe = _(async () => {
|
|
448
|
+
if (A) {
|
|
443
449
|
await $();
|
|
444
450
|
return;
|
|
445
451
|
}
|
|
446
|
-
let e =
|
|
447
|
-
if (e &&
|
|
452
|
+
let e = j.current;
|
|
453
|
+
if (e && R.current.useCase === "drivers-license" && Re.current === "back") {
|
|
448
454
|
try {
|
|
449
455
|
let t = await e.capturePhoto();
|
|
450
|
-
if (!(await
|
|
451
|
-
B.current = !0, V.current?.abort(),
|
|
456
|
+
if (!(await f(t.frame))?.text || B.current) return;
|
|
457
|
+
B.current = !0, V.current?.abort(), P.current = t, q(t.method), X(t.diagnostics), Y(t.diagnostics), Q(t.frame, H), U("captured"), await z.current({
|
|
452
458
|
frame: t.frame,
|
|
453
459
|
reason: "manual",
|
|
454
460
|
method: t.method,
|
|
@@ -459,74 +465,74 @@ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", ca
|
|
|
459
465
|
});
|
|
460
466
|
} catch (e) {
|
|
461
467
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
|
|
462
|
-
|
|
463
|
-
let n =
|
|
464
|
-
n && Y(n),
|
|
468
|
+
L.current = !0, J(t.message);
|
|
469
|
+
let n = j.current?.getDiagnostics();
|
|
470
|
+
n && Y(n), P.current?.diagnostics && X(P.current.diagnostics), U("error"), R.current.onError?.(t);
|
|
465
471
|
}
|
|
466
472
|
return;
|
|
467
473
|
}
|
|
468
474
|
try {
|
|
469
|
-
await
|
|
475
|
+
await M.current?.capture();
|
|
470
476
|
} catch (e) {
|
|
471
477
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
|
|
472
|
-
|
|
473
|
-
let n =
|
|
474
|
-
n && Y(n),
|
|
478
|
+
L.current = !0, J(t.message);
|
|
479
|
+
let n = j.current?.getDiagnostics();
|
|
480
|
+
n && Y(n), P.current?.diagnostics && X(P.current.diagnostics), U("error"), R.current.onError?.(t);
|
|
475
481
|
}
|
|
476
482
|
}, [
|
|
477
483
|
$,
|
|
478
484
|
Q,
|
|
479
485
|
H,
|
|
480
|
-
|
|
481
|
-
]),
|
|
482
|
-
|
|
483
|
-
let
|
|
484
|
-
|
|
485
|
-
if (!
|
|
486
|
-
|
|
486
|
+
A
|
|
487
|
+
]), Je = b($);
|
|
488
|
+
Je.current = $;
|
|
489
|
+
let Ye = b(!1);
|
|
490
|
+
ne(() => {
|
|
491
|
+
if (!m || !A) {
|
|
492
|
+
Ye.current = !1;
|
|
487
493
|
return;
|
|
488
494
|
}
|
|
489
|
-
if (!
|
|
490
|
-
if (
|
|
495
|
+
if (!Ye.current) {
|
|
496
|
+
if (Ye.current = !0, L.current = !1, J(""), G(void 0), q(void 0), X(void 0), Me("idle"), K(void 0), I.current.clear(), Z(), !te()) {
|
|
491
497
|
U("ready");
|
|
492
498
|
return;
|
|
493
499
|
}
|
|
494
|
-
|
|
500
|
+
Je.current();
|
|
495
501
|
}
|
|
496
502
|
}, [
|
|
497
|
-
|
|
498
|
-
|
|
503
|
+
m,
|
|
504
|
+
A,
|
|
499
505
|
Z
|
|
500
506
|
]);
|
|
501
|
-
let
|
|
502
|
-
if (
|
|
507
|
+
let Xe = _(() => {
|
|
508
|
+
if (L.current = !1, B.current = !1, J(""), X(void 0), Me("idle"), G(void 0), K(void 0), I.current.clear(), A) {
|
|
503
509
|
$();
|
|
504
510
|
return;
|
|
505
511
|
}
|
|
506
|
-
if (Z(),
|
|
507
|
-
U("starting"),
|
|
512
|
+
if (Z(), h === "drivers-license") {
|
|
513
|
+
U("starting"), Oe((e) => e + 1);
|
|
508
514
|
return;
|
|
509
515
|
}
|
|
510
|
-
let e =
|
|
511
|
-
H?.paused && H.play(), U(e ? "ready" : "starting"), e ||
|
|
516
|
+
let e = j.current;
|
|
517
|
+
H?.paused && H.play(), U(e ? "ready" : "starting"), e || Oe((e) => e + 1);
|
|
512
518
|
}, [
|
|
513
519
|
$,
|
|
514
520
|
Z,
|
|
515
521
|
H,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
]),
|
|
519
|
-
let t =
|
|
522
|
+
h,
|
|
523
|
+
A
|
|
524
|
+
]), Ze = _(async (e) => {
|
|
525
|
+
let t = j.current;
|
|
520
526
|
t && (await t.setTorch(e), Y(t.getDiagnostics()));
|
|
521
|
-
}, []),
|
|
522
|
-
|
|
523
|
-
}, []),
|
|
524
|
-
let e =
|
|
527
|
+
}, []), Qe = _((e) => {
|
|
528
|
+
M.current?.setAutoCapture(e);
|
|
529
|
+
}, []), $e = _(async () => {
|
|
530
|
+
let e = _e.current, t = j.current?.getDiagnostics() ?? e.diagnostics, n = e.finderStatus, r = i({
|
|
525
531
|
error: e.error || void 0,
|
|
526
532
|
captureMethod: e.captureMethod,
|
|
527
|
-
luminance:
|
|
528
|
-
fallbackReason:
|
|
529
|
-
shutter: e.shutterDiagnostics ??
|
|
533
|
+
luminance: P.current?.luminance,
|
|
534
|
+
fallbackReason: P.current?.fallbackReason,
|
|
535
|
+
shutter: e.shutterDiagnostics ?? P.current?.diagnostics,
|
|
530
536
|
live: t,
|
|
531
537
|
finder: n ? {
|
|
532
538
|
state: n.state,
|
|
@@ -551,55 +557,55 @@ function le({ open: r, useCase: p = "document", autoCapture: m = "defaultOn", ca
|
|
|
551
557
|
let t = document.execCommand("copy");
|
|
552
558
|
if (e.remove(), !t) throw Error("Clipboard copy is unavailable.");
|
|
553
559
|
}
|
|
554
|
-
|
|
560
|
+
Me("copied");
|
|
555
561
|
} catch {
|
|
556
|
-
|
|
562
|
+
Me("failed");
|
|
557
563
|
}
|
|
558
|
-
}, []),
|
|
559
|
-
capture:
|
|
560
|
-
cancel:
|
|
561
|
-
retry:
|
|
562
|
-
setTorch:
|
|
563
|
-
setAutoCapture:
|
|
564
|
-
copyReport:
|
|
565
|
-
getState:
|
|
564
|
+
}, []), et = _(() => _e.current, []), tt = re(() => ({
|
|
565
|
+
capture: qe,
|
|
566
|
+
cancel: Ge,
|
|
567
|
+
retry: Xe,
|
|
568
|
+
setTorch: Ze,
|
|
569
|
+
setAutoCapture: Qe,
|
|
570
|
+
copyReport: $e,
|
|
571
|
+
getState: et
|
|
566
572
|
}), [
|
|
567
|
-
We,
|
|
568
|
-
He,
|
|
569
573
|
qe,
|
|
570
|
-
|
|
571
|
-
Ye,
|
|
574
|
+
Ge,
|
|
572
575
|
Xe,
|
|
573
|
-
Ze
|
|
576
|
+
Ze,
|
|
577
|
+
Qe,
|
|
578
|
+
$e,
|
|
579
|
+
et
|
|
574
580
|
]);
|
|
575
|
-
|
|
576
|
-
if (
|
|
577
|
-
|
|
581
|
+
y(() => {
|
|
582
|
+
if (k) return k.current = tt, () => {
|
|
583
|
+
k.current = null;
|
|
578
584
|
};
|
|
579
|
-
}, [
|
|
580
|
-
let
|
|
581
|
-
...
|
|
582
|
-
...
|
|
583
|
-
bindPreview:
|
|
585
|
+
}, [tt, k]);
|
|
586
|
+
let nt = {
|
|
587
|
+
...We,
|
|
588
|
+
...tt,
|
|
589
|
+
bindPreview: Ue
|
|
584
590
|
};
|
|
585
|
-
return /* @__PURE__ */ S(
|
|
586
|
-
value:
|
|
587
|
-
children:
|
|
591
|
+
return /* @__PURE__ */ S(oe.Provider, {
|
|
592
|
+
value: nt,
|
|
593
|
+
children: pe
|
|
588
594
|
});
|
|
589
595
|
}
|
|
590
596
|
//#endregion
|
|
591
597
|
//#region src/react/hooks.ts
|
|
592
|
-
function
|
|
593
|
-
return
|
|
598
|
+
function de() {
|
|
599
|
+
return b(null);
|
|
594
600
|
}
|
|
595
601
|
function D() {
|
|
596
|
-
let e =
|
|
602
|
+
let e = v(oe);
|
|
597
603
|
if (!e) throw Error("useScanner must be used within ScannerProvider.");
|
|
598
604
|
return e;
|
|
599
605
|
}
|
|
600
606
|
//#endregion
|
|
601
607
|
//#region src/live-overlay-geometry.ts
|
|
602
|
-
function
|
|
608
|
+
function O(e, t, n, r, i) {
|
|
603
609
|
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;
|
|
604
610
|
if (i === "contain") return {
|
|
605
611
|
viewBox: `0 0 ${a} ${o}`,
|
|
@@ -619,7 +625,7 @@ function ue(e, t, n, r, i) {
|
|
|
619
625
|
}
|
|
620
626
|
//#endregion
|
|
621
627
|
//#region src/components/ModelDownloadRing.tsx
|
|
622
|
-
function
|
|
628
|
+
function fe({ snapshot: e }) {
|
|
623
629
|
if (!e.downloading) return null;
|
|
624
630
|
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;
|
|
625
631
|
return /* @__PURE__ */ C("div", {
|
|
@@ -655,12 +661,12 @@ function O({ snapshot: e }) {
|
|
|
655
661
|
}
|
|
656
662
|
//#endregion
|
|
657
663
|
//#region src/react/guidance.ts
|
|
658
|
-
function
|
|
659
|
-
if (!(e.usingSystemCamera || e.licenseBusy) && e.phase !== "error") return e.phase === "starting" ? e.licenseHeadline : e.phase === "capturing" ? "Capturing full resolution…" : e.phase === "captured" ? "Document captured" : e.holdStillSeconds && e.holdStillSeconds > 0 ?
|
|
664
|
+
function k(e) {
|
|
665
|
+
if (!(e.usingSystemCamera || e.licenseBusy) && e.phase !== "error") return e.phase === "starting" ? e.licenseHeadline : e.phase === "capturing" ? "Capturing full resolution…" : e.phase === "captured" ? "Document captured" : e.holdStillSeconds && e.holdStillSeconds > 0 ? h(e.holdStillSeconds) : e.guidanceHint && e.guidanceReason && e.guidanceReason !== "place-document" ? e.guidanceHint : e.licenseHeadline ?? e.guidanceHint ?? "Place the document in the frame";
|
|
660
666
|
}
|
|
661
667
|
//#endregion
|
|
662
668
|
//#region src/react/parts.tsx
|
|
663
|
-
var
|
|
669
|
+
var pe = {
|
|
664
670
|
primaryColorHex: "--scanner-overlay-primary",
|
|
665
671
|
seekingColorHex: "--scanner-overlay-seeking",
|
|
666
672
|
detectingColorHex: "--scanner-overlay-detecting",
|
|
@@ -671,7 +677,7 @@ var k = {
|
|
|
671
677
|
function A(e) {
|
|
672
678
|
if (!e) return;
|
|
673
679
|
let t = {};
|
|
674
|
-
for (let [n, r] of Object.entries(
|
|
680
|
+
for (let [n, r] of Object.entries(pe)) {
|
|
675
681
|
let i = e[n]?.trim();
|
|
676
682
|
i && (t[r] = i);
|
|
677
683
|
}
|
|
@@ -694,10 +700,10 @@ function j({ theme: e, style: t, title: n, children: r }) {
|
|
|
694
700
|
});
|
|
695
701
|
}
|
|
696
702
|
function M() {
|
|
697
|
-
let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = D(), r =
|
|
703
|
+
let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = D(), r = b(null), i = _((t) => {
|
|
698
704
|
r.current = t, e(t);
|
|
699
705
|
}, [e]);
|
|
700
|
-
return
|
|
706
|
+
return y(() => {
|
|
701
707
|
t && r.current?.pause();
|
|
702
708
|
}, [t]), n ? t ? /* @__PURE__ */ S("img", {
|
|
703
709
|
src: t,
|
|
@@ -707,7 +713,7 @@ function M() {
|
|
|
707
713
|
}) : /* @__PURE__ */ S("div", {
|
|
708
714
|
className: "scanner-camera-overlay__video",
|
|
709
715
|
"aria-hidden": "true"
|
|
710
|
-
}) : /* @__PURE__ */ C(
|
|
716
|
+
}) : /* @__PURE__ */ C(ie, { children: [/* @__PURE__ */ S("video", {
|
|
711
717
|
ref: i,
|
|
712
718
|
className: "scanner-camera-overlay__video",
|
|
713
719
|
muted: !0,
|
|
@@ -726,7 +732,7 @@ function M() {
|
|
|
726
732
|
function N() {
|
|
727
733
|
let { finderStatus: e, displayQuad: t, previewSize: n } = D();
|
|
728
734
|
if (!t || !e?.sourceWidth || !e.sourceHeight) return null;
|
|
729
|
-
let r =
|
|
735
|
+
let r = O(e.sourceWidth, e.sourceHeight, n.width, n.height, "cover");
|
|
730
736
|
return /* @__PURE__ */ S("svg", {
|
|
731
737
|
className: `scanner-camera-overlay__quad ${e.state}`,
|
|
732
738
|
viewBox: r.viewBox,
|
|
@@ -736,7 +742,7 @@ function N() {
|
|
|
736
742
|
});
|
|
737
743
|
}
|
|
738
744
|
function P({ title: e }) {
|
|
739
|
-
let { phase: t, cancel: n, usingSystemCamera: r, useCase: i, licenseSide: a, licenseBusy: o } = D(), s = i === "drivers-license" ?
|
|
745
|
+
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";
|
|
740
746
|
return /* @__PURE__ */ C("div", {
|
|
741
747
|
className: "scanner-camera-overlay__topbar",
|
|
742
748
|
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("strong", { children: c }), /* @__PURE__ */ C("span", {
|
|
@@ -744,7 +750,7 @@ function P({ title: e }) {
|
|
|
744
750
|
children: [
|
|
745
751
|
o && (a === "back" ? "Reading the barcode…" : "Reading the front…"),
|
|
746
752
|
!o && s && t === "error" && (a === "back" ? "Could not read the back" : "Could not read the front"),
|
|
747
|
-
!o && !s && r && /* @__PURE__ */ C(
|
|
753
|
+
!o && !s && r && /* @__PURE__ */ C(ie, { children: [
|
|
748
754
|
t === "starting" && "Preparing the system camera…",
|
|
749
755
|
t === "ready" && "Take a photo. There is no live document guide.",
|
|
750
756
|
t === "capturing" && "Looking for a document…",
|
|
@@ -762,7 +768,7 @@ function P({ title: e }) {
|
|
|
762
768
|
});
|
|
763
769
|
}
|
|
764
770
|
function F() {
|
|
765
|
-
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 } = D(), f = l === "drivers-license" ?
|
|
771
|
+
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 } = D(), f = l === "drivers-license" ? m(u ?? "front", s) : void 0;
|
|
766
772
|
return e === "error" ? /* @__PURE__ */ C("div", {
|
|
767
773
|
className: "scanner-camera-overlay__message",
|
|
768
774
|
role: "alert",
|
|
@@ -819,7 +825,7 @@ function F() {
|
|
|
819
825
|
}
|
|
820
826
|
function I() {
|
|
821
827
|
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" : "front"}` : "";
|
|
822
|
-
|
|
828
|
+
if (r) return /* @__PURE__ */ S("div", {
|
|
823
829
|
className: "scanner-camera-overlay__status",
|
|
824
830
|
"aria-live": "polite",
|
|
825
831
|
children: /* @__PURE__ */ C("div", {
|
|
@@ -831,14 +837,16 @@ function I() {
|
|
|
831
837
|
c && l ? ` · ${c}×${l}` : ""
|
|
832
838
|
]
|
|
833
839
|
})
|
|
834
|
-
})
|
|
840
|
+
});
|
|
841
|
+
let d = o === "drivers-license" && s === "back", f = d && !e ? "reading" : e?.state ?? "detecting";
|
|
842
|
+
return /* @__PURE__ */ S("div", {
|
|
835
843
|
className: "scanner-camera-overlay__status",
|
|
836
844
|
"aria-live": "polite",
|
|
837
845
|
children: /* @__PURE__ */ C("div", {
|
|
838
846
|
className: "scanner-camera-overlay__status-line",
|
|
839
847
|
children: [
|
|
840
|
-
/* @__PURE__ */ S("span", { className: e?.state ?? "detecting" }),
|
|
841
|
-
|
|
848
|
+
/* @__PURE__ */ S("span", { className: d && !e ? "detecting" : e?.state ?? "detecting" }),
|
|
849
|
+
f,
|
|
842
850
|
u,
|
|
843
851
|
e ? ` · ${Math.round(e.confidence * 100)}% · ${e.stableFrames}/${e.requiredStableFrames}` : "",
|
|
844
852
|
` · ${t}`,
|
|
@@ -848,7 +856,7 @@ function I() {
|
|
|
848
856
|
})
|
|
849
857
|
});
|
|
850
858
|
}
|
|
851
|
-
function
|
|
859
|
+
function L() {
|
|
852
860
|
let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: i, copyReport: a } = D(), o = e?.engine ?? r();
|
|
853
861
|
return /* @__PURE__ */ C("dl", {
|
|
854
862
|
className: "scanner-camera-overlay__diagnostics",
|
|
@@ -875,8 +883,8 @@ function fe() {
|
|
|
875
883
|
]
|
|
876
884
|
});
|
|
877
885
|
}
|
|
878
|
-
function
|
|
879
|
-
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:
|
|
886
|
+
function me() {
|
|
887
|
+
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 } = D(), h = a?.width, te = a?.height, g = u ? t === "ready" : e !== "only", _ = f === "drivers-license" ? m(p ?? "front", u) : void 0, v = k({
|
|
880
888
|
usingSystemCamera: u,
|
|
881
889
|
phase: t,
|
|
882
890
|
licenseBusy: d,
|
|
@@ -884,7 +892,7 @@ function L() {
|
|
|
884
892
|
guidanceHint: ee,
|
|
885
893
|
guidanceReason: n?.guidance.reason,
|
|
886
894
|
licenseHeadline: _?.headline
|
|
887
|
-
}),
|
|
895
|
+
}), y = !!n?.holdStillSeconds;
|
|
888
896
|
return /* @__PURE__ */ C("div", {
|
|
889
897
|
className: "scanner-camera-overlay__controls",
|
|
890
898
|
children: [
|
|
@@ -898,11 +906,11 @@ function L() {
|
|
|
898
906
|
className: "scanner-camera-overlay__capture",
|
|
899
907
|
children: [
|
|
900
908
|
v && /* @__PURE__ */ S("p", {
|
|
901
|
-
className: `scanner-camera-overlay__guidance${
|
|
909
|
+
className: `scanner-camera-overlay__guidance${y ? " is-ready" : ""}`,
|
|
902
910
|
"aria-live": "polite",
|
|
903
911
|
children: v
|
|
904
912
|
}),
|
|
905
|
-
|
|
913
|
+
g && /* @__PURE__ */ S("button", {
|
|
906
914
|
type: "button",
|
|
907
915
|
className: "scanner-camera-overlay__shutter",
|
|
908
916
|
onClick: () => void s(),
|
|
@@ -930,16 +938,16 @@ function L() {
|
|
|
930
938
|
}),
|
|
931
939
|
/* @__PURE__ */ C("div", {
|
|
932
940
|
className: "scanner-camera-overlay__quality",
|
|
933
|
-
children: [/* @__PURE__ */ S("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ S("strong", { children: h &&
|
|
941
|
+
children: [/* @__PURE__ */ S("span", { children: u ? "System camera" : i === "live-mirror" ? "Mirror" : "Camera" }), /* @__PURE__ */ S("strong", { children: h && te ? `${h} × ${te}` : u ? "Tap to photograph" : "Measuring…" })]
|
|
934
942
|
})
|
|
935
943
|
]
|
|
936
944
|
});
|
|
937
945
|
}
|
|
938
946
|
function R({ snapshot: e }) {
|
|
939
947
|
let { modelDownload: t } = D();
|
|
940
|
-
return /* @__PURE__ */ S(
|
|
948
|
+
return /* @__PURE__ */ S(fe, { snapshot: e ?? t });
|
|
941
949
|
}
|
|
942
950
|
//#endregion
|
|
943
|
-
export {
|
|
951
|
+
export { me as ScannerControls, L as ScannerDiagnostics, j as ScannerFrame, R as ScannerModelDownload, F as ScannerNotice, M as ScannerPreview, ue as ScannerProvider, N as ScannerQuad, I as ScannerStatus, P as ScannerTopBar, D as useScanner, de as useScannerRef };
|
|
944
952
|
|
|
945
953
|
//# sourceMappingURL=react.js.map
|