@microblink/blinkid-verify-core 3.20.0-rc.0
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 +71 -0
- package/dist/blinkid-verify-core.js +1229 -0
- package/dist/resources/DO_NOT_MODIFY_THIS_DIRECTORY.md +2 -0
- package/dist/resources/advanced/BlinkIdVerifyModule.data +0 -0
- package/dist/resources/advanced/BlinkIdVerifyModule.js +125 -0
- package/dist/resources/advanced/BlinkIdVerifyModule.wasm +0 -0
- package/dist/resources/advanced-threads/BlinkIdVerifyModule.data +0 -0
- package/dist/resources/advanced-threads/BlinkIdVerifyModule.js +146 -0
- package/dist/resources/advanced-threads/BlinkIdVerifyModule.wasm +0 -0
- package/dist/resources/blinkid-verify-worker.js +924 -0
- package/dist/resources/size-manifest.json +10 -0
- package/package.json +33 -0
- package/types/BlinkIdVerifyCore.d.ts +30 -0
- package/types/BlinkIdVerifyCore.d.ts.map +1 -0
- package/types/generatePayloadForBlinkIdVerifyCloudApi.d.ts +238 -0
- package/types/generatePayloadForBlinkIdVerifyCloudApi.d.ts.map +1 -0
- package/types/index.d.ts +28 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.rollup.d.ts +1537 -0
|
@@ -0,0 +1,1229 @@
|
|
|
1
|
+
class We {
|
|
2
|
+
/**
|
|
3
|
+
* Injected function for queing ping events.
|
|
4
|
+
*/
|
|
5
|
+
#t;
|
|
6
|
+
/**
|
|
7
|
+
* Injected function for triggering sending of queued pinglets.
|
|
8
|
+
*/
|
|
9
|
+
#a;
|
|
10
|
+
constructor({ pingFn: r, sendPingletsFn: n }) {
|
|
11
|
+
this.#t = r, this.#a = n;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Safely send a ping event, handling errors gracefully
|
|
15
|
+
*/
|
|
16
|
+
async #e(r) {
|
|
17
|
+
try {
|
|
18
|
+
await this.#t(r);
|
|
19
|
+
} catch (n) {
|
|
20
|
+
console.warn("UX analytics ping failed:", n);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Safely send queued pinglets, handling errors gracefully
|
|
25
|
+
*/
|
|
26
|
+
async sendPinglets() {
|
|
27
|
+
try {
|
|
28
|
+
await this.#a();
|
|
29
|
+
} catch (r) {
|
|
30
|
+
console.warn("Send pinglets failed:", r);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a camera permission ping
|
|
35
|
+
*/
|
|
36
|
+
#n(r) {
|
|
37
|
+
return {
|
|
38
|
+
schemaName: "ping.sdk.camera.permission",
|
|
39
|
+
schemaVersion: "1.0.0",
|
|
40
|
+
data: r
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a standardized UX event ping
|
|
45
|
+
*/
|
|
46
|
+
#r(r) {
|
|
47
|
+
return {
|
|
48
|
+
schemaName: "ping.sdk.ux.event",
|
|
49
|
+
schemaVersion: "1.0.0",
|
|
50
|
+
data: r
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
#o(r) {
|
|
54
|
+
if (r instanceof Error)
|
|
55
|
+
return r.message;
|
|
56
|
+
if (typeof r == "object" && r !== null)
|
|
57
|
+
try {
|
|
58
|
+
return JSON.stringify(r);
|
|
59
|
+
} catch {
|
|
60
|
+
return String(r);
|
|
61
|
+
}
|
|
62
|
+
return String(r);
|
|
63
|
+
}
|
|
64
|
+
logCameraStartedEvent() {
|
|
65
|
+
return this.#e(this.#r({
|
|
66
|
+
eventType: "CameraStarted"
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
logCameraClosedEvent() {
|
|
70
|
+
return this.#e(this.#r({
|
|
71
|
+
eventType: "CameraClosed"
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
logHelpOpenedEvent() {
|
|
75
|
+
return this.#e(this.#r({
|
|
76
|
+
eventType: "HelpOpened"
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
logHelpClosedEvent(r) {
|
|
80
|
+
return this.#e(this.#r({
|
|
81
|
+
eventType: "HelpClosed",
|
|
82
|
+
helpCloseType: r ? "ContentFullyViewed" : "ContentSkipped"
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
logHelpTooltipDisplayedEvent() {
|
|
86
|
+
return this.#e(this.#r({
|
|
87
|
+
eventType: "HelpTooltipDisplayed"
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
logCloseButtonClickedEvent() {
|
|
91
|
+
return this.#e(this.#r({
|
|
92
|
+
eventType: "CloseButtonClicked"
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
logOnboardingDisplayedEvent() {
|
|
96
|
+
return this.#e(this.#r({
|
|
97
|
+
eventType: "OnboardingInfoDisplayed"
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
logAlertDisplayedEvent(r) {
|
|
101
|
+
return this.#e(this.#r({
|
|
102
|
+
eventType: "AlertDisplayed",
|
|
103
|
+
alertType: r
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
logErrorMessageEvent(r) {
|
|
107
|
+
return this.#e(this.#r({
|
|
108
|
+
eventType: "ErrorMessage",
|
|
109
|
+
errorMessageType: r
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
logAppMovedToBackgroundEvent() {
|
|
113
|
+
return this.#e(this.#r({
|
|
114
|
+
eventType: "AppMovedToBackground"
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
logStepTimeoutEvent() {
|
|
118
|
+
return this.#e(this.#r({
|
|
119
|
+
eventType: "StepTimeout"
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
logCameraInputInfo(r) {
|
|
123
|
+
return this.#e({
|
|
124
|
+
schemaName: "ping.sdk.camera.input.info",
|
|
125
|
+
schemaVersion: "1.0.2",
|
|
126
|
+
data: r
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
logHardwareCameraInfo(r) {
|
|
130
|
+
return this.#e({
|
|
131
|
+
schemaName: "ping.hardware.camera.info",
|
|
132
|
+
schemaVersion: "1.0.3",
|
|
133
|
+
data: {
|
|
134
|
+
availableCameras: r
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
logCameraPermissionCheck(r) {
|
|
139
|
+
return this.#e(this.#n({
|
|
140
|
+
eventType: "CameraPermissionCheck",
|
|
141
|
+
cameraPermissionGranted: r
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
logCameraPermissionRequest() {
|
|
145
|
+
return this.#e(this.#n({
|
|
146
|
+
eventType: "CameraPermissionRequest"
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
logCameraPermissionUserResponse(r) {
|
|
150
|
+
return this.#e(this.#n({
|
|
151
|
+
eventType: "CameraPermissionUserResponse",
|
|
152
|
+
cameraPermissionGranted: r
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
logDeviceOrientation(r) {
|
|
156
|
+
return this.#e({
|
|
157
|
+
schemaName: "ping.sdk.scan.conditions",
|
|
158
|
+
schemaVersion: "1.0.0",
|
|
159
|
+
data: {
|
|
160
|
+
updateType: "DeviceOrientation",
|
|
161
|
+
deviceOrientation: r
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
logFlashlightState(r) {
|
|
166
|
+
return this.#e({
|
|
167
|
+
schemaName: "ping.sdk.scan.conditions",
|
|
168
|
+
schemaVersion: "1.0.0",
|
|
169
|
+
data: {
|
|
170
|
+
updateType: "FlashlightState",
|
|
171
|
+
flashlightOn: r
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
logDeviceInfo(r) {
|
|
176
|
+
return this.#e({
|
|
177
|
+
schemaName: "ping.browser.device.info",
|
|
178
|
+
schemaVersion: "1.0.0",
|
|
179
|
+
data: r
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
logErrorEvent({ origin: r, error: n, errorType: t, sessionNumber: a }) {
|
|
183
|
+
return this.#e({
|
|
184
|
+
schemaName: "ping.error",
|
|
185
|
+
schemaVersion: "1.0.0",
|
|
186
|
+
sessionNumber: a,
|
|
187
|
+
data: {
|
|
188
|
+
errorType: t,
|
|
189
|
+
errorMessage: `${r}: ${this.#o(n)}`,
|
|
190
|
+
stackTrace: n instanceof Error ? n.stack : void 0
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @license
|
|
197
|
+
* Copyright 2019 Google LLC
|
|
198
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
199
|
+
*/
|
|
200
|
+
const D = Symbol("Comlink.proxy"), ee = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"), k = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), H = (e) => typeof e == "object" && e !== null || typeof e == "function", re = {
|
|
201
|
+
canHandle: (e) => H(e) && e[D],
|
|
202
|
+
serialize(e) {
|
|
203
|
+
const { port1: r, port2: n } = new MessageChannel();
|
|
204
|
+
return U(e, r), [n, [n]];
|
|
205
|
+
},
|
|
206
|
+
deserialize(e) {
|
|
207
|
+
return e.start(), $(e);
|
|
208
|
+
}
|
|
209
|
+
}, ne = {
|
|
210
|
+
canHandle: (e) => H(e) && C in e,
|
|
211
|
+
serialize({ value: e }) {
|
|
212
|
+
let r;
|
|
213
|
+
return e instanceof Error ? r = {
|
|
214
|
+
isError: !0,
|
|
215
|
+
value: {
|
|
216
|
+
message: e.message,
|
|
217
|
+
name: e.name,
|
|
218
|
+
stack: e.stack
|
|
219
|
+
}
|
|
220
|
+
} : r = { isError: !1, value: e }, [r, []];
|
|
221
|
+
},
|
|
222
|
+
deserialize(e) {
|
|
223
|
+
throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
|
|
224
|
+
}
|
|
225
|
+
}, j = /* @__PURE__ */ new Map([
|
|
226
|
+
["proxy", re],
|
|
227
|
+
["throw", ne]
|
|
228
|
+
]);
|
|
229
|
+
function te(e, r) {
|
|
230
|
+
for (const n of e)
|
|
231
|
+
if (r === n || n === "*" || n instanceof RegExp && n.test(r))
|
|
232
|
+
return !0;
|
|
233
|
+
return !1;
|
|
234
|
+
}
|
|
235
|
+
function U(e, r = globalThis, n = ["*"]) {
|
|
236
|
+
r.addEventListener("message", function t(a) {
|
|
237
|
+
if (!a || !a.data)
|
|
238
|
+
return;
|
|
239
|
+
if (!te(n, a.origin)) {
|
|
240
|
+
console.warn(`Invalid origin '${a.origin}' for comlink proxy`);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const { id: o, type: i, path: s } = Object.assign({ path: [] }, a.data), l = (a.data.argumentList || []).map(w);
|
|
244
|
+
let c;
|
|
245
|
+
try {
|
|
246
|
+
const u = s.slice(0, -1).reduce((f, p) => f[p], e), m = s.reduce((f, p) => f[p], e);
|
|
247
|
+
switch (i) {
|
|
248
|
+
case "GET":
|
|
249
|
+
c = m;
|
|
250
|
+
break;
|
|
251
|
+
case "SET":
|
|
252
|
+
u[s.slice(-1)[0]] = w(a.data.value), c = !0;
|
|
253
|
+
break;
|
|
254
|
+
case "APPLY":
|
|
255
|
+
c = m.apply(u, l);
|
|
256
|
+
break;
|
|
257
|
+
case "CONSTRUCT":
|
|
258
|
+
{
|
|
259
|
+
const f = new m(...l);
|
|
260
|
+
c = q(f);
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
case "ENDPOINT":
|
|
264
|
+
{
|
|
265
|
+
const { port1: f, port2: p } = new MessageChannel();
|
|
266
|
+
U(e, p), c = Q(f, [f]);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "RELEASE":
|
|
270
|
+
c = void 0;
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
} catch (u) {
|
|
276
|
+
c = { value: u, [C]: 0 };
|
|
277
|
+
}
|
|
278
|
+
Promise.resolve(c).catch((u) => ({ value: u, [C]: 0 })).then((u) => {
|
|
279
|
+
const [m, f] = L(u);
|
|
280
|
+
r.postMessage(Object.assign(Object.assign({}, m), { id: o }), f), i === "RELEASE" && (r.removeEventListener("message", t), W(r), k in e && typeof e[k] == "function" && e[k]());
|
|
281
|
+
}).catch((u) => {
|
|
282
|
+
const [m, f] = L({
|
|
283
|
+
value: new TypeError("Unserializable return value"),
|
|
284
|
+
[C]: 0
|
|
285
|
+
});
|
|
286
|
+
r.postMessage(Object.assign(Object.assign({}, m), { id: o }), f);
|
|
287
|
+
});
|
|
288
|
+
}), r.start && r.start();
|
|
289
|
+
}
|
|
290
|
+
function ae(e) {
|
|
291
|
+
return e.constructor.name === "MessagePort";
|
|
292
|
+
}
|
|
293
|
+
function W(e) {
|
|
294
|
+
ae(e) && e.close();
|
|
295
|
+
}
|
|
296
|
+
function $(e, r) {
|
|
297
|
+
const n = /* @__PURE__ */ new Map();
|
|
298
|
+
return e.addEventListener("message", function(a) {
|
|
299
|
+
const { data: o } = a;
|
|
300
|
+
if (!o || !o.id)
|
|
301
|
+
return;
|
|
302
|
+
const i = n.get(o.id);
|
|
303
|
+
if (i)
|
|
304
|
+
try {
|
|
305
|
+
i(o);
|
|
306
|
+
} finally {
|
|
307
|
+
n.delete(o.id);
|
|
308
|
+
}
|
|
309
|
+
}), A(e, n, [], r);
|
|
310
|
+
}
|
|
311
|
+
function R(e) {
|
|
312
|
+
if (e)
|
|
313
|
+
throw new Error("Proxy has been released and is not useable");
|
|
314
|
+
}
|
|
315
|
+
function G(e) {
|
|
316
|
+
return b(e, /* @__PURE__ */ new Map(), {
|
|
317
|
+
type: "RELEASE"
|
|
318
|
+
}).then(() => {
|
|
319
|
+
W(e);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
const M = /* @__PURE__ */ new WeakMap(), x = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
323
|
+
const r = (M.get(e) || 0) - 1;
|
|
324
|
+
M.set(e, r), r === 0 && G(e);
|
|
325
|
+
});
|
|
326
|
+
function oe(e, r) {
|
|
327
|
+
const n = (M.get(r) || 0) + 1;
|
|
328
|
+
M.set(r, n), x && x.register(e, r, e);
|
|
329
|
+
}
|
|
330
|
+
function ie(e) {
|
|
331
|
+
x && x.unregister(e);
|
|
332
|
+
}
|
|
333
|
+
function A(e, r, n = [], t = function() {
|
|
334
|
+
}) {
|
|
335
|
+
let a = !1;
|
|
336
|
+
const o = new Proxy(t, {
|
|
337
|
+
get(i, s) {
|
|
338
|
+
if (R(a), s === B)
|
|
339
|
+
return () => {
|
|
340
|
+
ie(o), G(e), r.clear(), a = !0;
|
|
341
|
+
};
|
|
342
|
+
if (s === "then") {
|
|
343
|
+
if (n.length === 0)
|
|
344
|
+
return { then: () => o };
|
|
345
|
+
const l = b(e, r, {
|
|
346
|
+
type: "GET",
|
|
347
|
+
path: n.map((c) => c.toString())
|
|
348
|
+
}).then(w);
|
|
349
|
+
return l.then.bind(l);
|
|
350
|
+
}
|
|
351
|
+
return A(e, r, [...n, s]);
|
|
352
|
+
},
|
|
353
|
+
set(i, s, l) {
|
|
354
|
+
R(a);
|
|
355
|
+
const [c, u] = L(l);
|
|
356
|
+
return b(e, r, {
|
|
357
|
+
type: "SET",
|
|
358
|
+
path: [...n, s].map((m) => m.toString()),
|
|
359
|
+
value: c
|
|
360
|
+
}, u).then(w);
|
|
361
|
+
},
|
|
362
|
+
apply(i, s, l) {
|
|
363
|
+
R(a);
|
|
364
|
+
const c = n[n.length - 1];
|
|
365
|
+
if (c === ee)
|
|
366
|
+
return b(e, r, {
|
|
367
|
+
type: "ENDPOINT"
|
|
368
|
+
}).then(w);
|
|
369
|
+
if (c === "bind")
|
|
370
|
+
return A(e, r, n.slice(0, -1));
|
|
371
|
+
const [u, m] = I(l);
|
|
372
|
+
return b(e, r, {
|
|
373
|
+
type: "APPLY",
|
|
374
|
+
path: n.map((f) => f.toString()),
|
|
375
|
+
argumentList: u
|
|
376
|
+
}, m).then(w);
|
|
377
|
+
},
|
|
378
|
+
construct(i, s) {
|
|
379
|
+
R(a);
|
|
380
|
+
const [l, c] = I(s);
|
|
381
|
+
return b(e, r, {
|
|
382
|
+
type: "CONSTRUCT",
|
|
383
|
+
path: n.map((u) => u.toString()),
|
|
384
|
+
argumentList: l
|
|
385
|
+
}, c).then(w);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return oe(o, e), o;
|
|
389
|
+
}
|
|
390
|
+
function se(e) {
|
|
391
|
+
return Array.prototype.concat.apply([], e);
|
|
392
|
+
}
|
|
393
|
+
function I(e) {
|
|
394
|
+
const r = e.map(L);
|
|
395
|
+
return [r.map((n) => n[0]), se(r.map((n) => n[1]))];
|
|
396
|
+
}
|
|
397
|
+
const z = /* @__PURE__ */ new WeakMap();
|
|
398
|
+
function Q(e, r) {
|
|
399
|
+
return z.set(e, r), e;
|
|
400
|
+
}
|
|
401
|
+
function q(e) {
|
|
402
|
+
return Object.assign(e, { [D]: !0 });
|
|
403
|
+
}
|
|
404
|
+
function L(e) {
|
|
405
|
+
for (const [r, n] of j)
|
|
406
|
+
if (n.canHandle(e)) {
|
|
407
|
+
const [t, a] = n.serialize(e);
|
|
408
|
+
return [
|
|
409
|
+
{
|
|
410
|
+
type: "HANDLER",
|
|
411
|
+
name: r,
|
|
412
|
+
value: t
|
|
413
|
+
},
|
|
414
|
+
a
|
|
415
|
+
];
|
|
416
|
+
}
|
|
417
|
+
return [
|
|
418
|
+
{
|
|
419
|
+
type: "RAW",
|
|
420
|
+
value: e
|
|
421
|
+
},
|
|
422
|
+
z.get(e) || []
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
function w(e) {
|
|
426
|
+
switch (e.type) {
|
|
427
|
+
case "HANDLER":
|
|
428
|
+
return j.get(e.name).deserialize(e.value);
|
|
429
|
+
case "RAW":
|
|
430
|
+
return e.value;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function b(e, r, n, t) {
|
|
434
|
+
return new Promise((a) => {
|
|
435
|
+
const o = ce();
|
|
436
|
+
r.set(o, a), e.start && e.start(), e.postMessage(Object.assign({ id: o }, n), t);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function ce() {
|
|
440
|
+
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
441
|
+
}
|
|
442
|
+
var le = /* @__PURE__ */ function() {
|
|
443
|
+
function e(r, n) {
|
|
444
|
+
for (var t = 0; t < n.length; t++) {
|
|
445
|
+
var a = n[t];
|
|
446
|
+
a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(r, a.key, a);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return function(r, n, t) {
|
|
450
|
+
return n && e(r.prototype, n), t && e(r, t), r;
|
|
451
|
+
};
|
|
452
|
+
}(), ue = fe(["", ""], ["", ""]);
|
|
453
|
+
function fe(e, r) {
|
|
454
|
+
return Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(r) } }));
|
|
455
|
+
}
|
|
456
|
+
function de(e, r) {
|
|
457
|
+
if (!(e instanceof r))
|
|
458
|
+
throw new TypeError("Cannot call a class as a function");
|
|
459
|
+
}
|
|
460
|
+
var d = function() {
|
|
461
|
+
function e() {
|
|
462
|
+
for (var r = this, n = arguments.length, t = Array(n), a = 0; a < n; a++)
|
|
463
|
+
t[a] = arguments[a];
|
|
464
|
+
return de(this, e), this.tag = function(o) {
|
|
465
|
+
for (var i = arguments.length, s = Array(i > 1 ? i - 1 : 0), l = 1; l < i; l++)
|
|
466
|
+
s[l - 1] = arguments[l];
|
|
467
|
+
return typeof o == "function" ? r.interimTag.bind(r, o) : typeof o == "string" ? r.transformEndResult(o) : (o = o.map(r.transformString.bind(r)), r.transformEndResult(o.reduce(r.processSubstitutions.bind(r, s))));
|
|
468
|
+
}, t.length > 0 && Array.isArray(t[0]) && (t = t[0]), this.transformers = t.map(function(o) {
|
|
469
|
+
return typeof o == "function" ? o() : o;
|
|
470
|
+
}), this.tag;
|
|
471
|
+
}
|
|
472
|
+
return le(e, [{
|
|
473
|
+
key: "interimTag",
|
|
474
|
+
/**
|
|
475
|
+
* An intermediary template tag that receives a template tag and passes the result of calling the template with the received
|
|
476
|
+
* template tag to our own template tag.
|
|
477
|
+
* @param {Function} nextTag - the received template tag
|
|
478
|
+
* @param {Array<String>} template - the template to process
|
|
479
|
+
* @param {...*} ...substitutions - `substitutions` is an array of all substitutions in the template
|
|
480
|
+
* @return {*} - the final processed value
|
|
481
|
+
*/
|
|
482
|
+
value: function(n, t) {
|
|
483
|
+
for (var a = arguments.length, o = Array(a > 2 ? a - 2 : 0), i = 2; i < a; i++)
|
|
484
|
+
o[i - 2] = arguments[i];
|
|
485
|
+
return this.tag(ue, n.apply(void 0, [t].concat(o)));
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Performs bulk processing on the tagged template, transforming each substitution and then
|
|
489
|
+
* concatenating the resulting values into a string.
|
|
490
|
+
* @param {Array<*>} substitutions - an array of all remaining substitutions present in this template
|
|
491
|
+
* @param {String} resultSoFar - this iteration's result string so far
|
|
492
|
+
* @param {String} remainingPart - the template chunk after the current substitution
|
|
493
|
+
* @return {String} - the result of joining this iteration's processed substitution with the result
|
|
494
|
+
*/
|
|
495
|
+
}, {
|
|
496
|
+
key: "processSubstitutions",
|
|
497
|
+
value: function(n, t, a) {
|
|
498
|
+
var o = this.transformSubstitution(n.shift(), t);
|
|
499
|
+
return "".concat(t, o, a);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Iterate through each transformer, applying the transformer's `onString` method to the template
|
|
503
|
+
* strings before all substitutions are processed.
|
|
504
|
+
* @param {String} str - The input string
|
|
505
|
+
* @return {String} - The final results of processing each transformer
|
|
506
|
+
*/
|
|
507
|
+
}, {
|
|
508
|
+
key: "transformString",
|
|
509
|
+
value: function(n) {
|
|
510
|
+
var t = function(o, i) {
|
|
511
|
+
return i.onString ? i.onString(o) : o;
|
|
512
|
+
};
|
|
513
|
+
return this.transformers.reduce(t, n);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* When a substitution is encountered, iterates through each transformer and applies the transformer's
|
|
517
|
+
* `onSubstitution` method to the substitution.
|
|
518
|
+
* @param {*} substitution - The current substitution
|
|
519
|
+
* @param {String} resultSoFar - The result up to and excluding this substitution.
|
|
520
|
+
* @return {*} - The final result of applying all substitution transformations.
|
|
521
|
+
*/
|
|
522
|
+
}, {
|
|
523
|
+
key: "transformSubstitution",
|
|
524
|
+
value: function(n, t) {
|
|
525
|
+
var a = function(i, s) {
|
|
526
|
+
return s.onSubstitution ? s.onSubstitution(i, t) : i;
|
|
527
|
+
};
|
|
528
|
+
return this.transformers.reduce(a, n);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Iterates through each transformer, applying the transformer's `onEndResult` method to the
|
|
532
|
+
* template literal after all substitutions have finished processing.
|
|
533
|
+
* @param {String} endResult - The processed template, just before it is returned from the tag
|
|
534
|
+
* @return {String} - The final results of processing each transformer
|
|
535
|
+
*/
|
|
536
|
+
}, {
|
|
537
|
+
key: "transformEndResult",
|
|
538
|
+
value: function(n) {
|
|
539
|
+
var t = function(o, i) {
|
|
540
|
+
return i.onEndResult ? i.onEndResult(o) : o;
|
|
541
|
+
};
|
|
542
|
+
return this.transformers.reduce(t, n);
|
|
543
|
+
}
|
|
544
|
+
}]), e;
|
|
545
|
+
}(), g = function() {
|
|
546
|
+
var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
547
|
+
return {
|
|
548
|
+
onEndResult: function(t) {
|
|
549
|
+
if (r === "")
|
|
550
|
+
return t.trim();
|
|
551
|
+
if (r = r.toLowerCase(), r === "start" || r === "left")
|
|
552
|
+
return t.replace(/^\s*/, "");
|
|
553
|
+
if (r === "end" || r === "right")
|
|
554
|
+
return t.replace(/\s*$/, "");
|
|
555
|
+
throw new Error("Side not supported: " + r);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
function ge(e) {
|
|
560
|
+
if (Array.isArray(e)) {
|
|
561
|
+
for (var r = 0, n = Array(e.length); r < e.length; r++)
|
|
562
|
+
n[r] = e[r];
|
|
563
|
+
return n;
|
|
564
|
+
} else
|
|
565
|
+
return Array.from(e);
|
|
566
|
+
}
|
|
567
|
+
var y = function() {
|
|
568
|
+
var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "initial";
|
|
569
|
+
return {
|
|
570
|
+
onEndResult: function(t) {
|
|
571
|
+
if (r === "initial") {
|
|
572
|
+
var a = t.match(/^[^\S\n]*(?=\S)/gm), o = a && Math.min.apply(Math, ge(a.map(function(s) {
|
|
573
|
+
return s.length;
|
|
574
|
+
})));
|
|
575
|
+
if (o) {
|
|
576
|
+
var i = new RegExp("^.{" + o + "}", "gm");
|
|
577
|
+
return t.replace(i, "");
|
|
578
|
+
}
|
|
579
|
+
return t;
|
|
580
|
+
}
|
|
581
|
+
if (r === "all")
|
|
582
|
+
return t.replace(/^[^\S\n]+/gm, "");
|
|
583
|
+
throw new Error("Unknown type: " + r);
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
}, E = function(r, n) {
|
|
587
|
+
return {
|
|
588
|
+
onEndResult: function(a) {
|
|
589
|
+
if (r == null || n == null)
|
|
590
|
+
throw new Error("replaceResultTransformer requires at least 2 arguments.");
|
|
591
|
+
return a.replace(r, n);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}, S = function(r, n) {
|
|
595
|
+
return {
|
|
596
|
+
onSubstitution: function(a, o) {
|
|
597
|
+
if (r == null || n == null)
|
|
598
|
+
throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");
|
|
599
|
+
return a == null ? a : a.toString().replace(r, n);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
}, me = {
|
|
603
|
+
separator: "",
|
|
604
|
+
conjunction: "",
|
|
605
|
+
serial: !1
|
|
606
|
+
}, v = function() {
|
|
607
|
+
var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : me;
|
|
608
|
+
return {
|
|
609
|
+
onSubstitution: function(t, a) {
|
|
610
|
+
if (Array.isArray(t)) {
|
|
611
|
+
var o = t.length, i = r.separator, s = r.conjunction, l = r.serial, c = a.match(/(\n?[^\S\n]+)$/);
|
|
612
|
+
if (c ? t = t.join(i + c[1]) : t = t.join(i + " "), s && o > 1) {
|
|
613
|
+
var u = t.lastIndexOf(i);
|
|
614
|
+
t = t.slice(0, u) + (l ? i : "") + " " + s + t.slice(u + 1);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return t;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}, Y = function(r) {
|
|
621
|
+
return {
|
|
622
|
+
onSubstitution: function(t, a) {
|
|
623
|
+
return typeof t == "string" && t.includes(r) && (t = t.split(r)), t;
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
}, O = function(r) {
|
|
627
|
+
return r != null && !Number.isNaN(r) && typeof r != "boolean";
|
|
628
|
+
}, he = function() {
|
|
629
|
+
return {
|
|
630
|
+
onSubstitution: function(n) {
|
|
631
|
+
return Array.isArray(n) ? n.filter(O) : O(n) ? n : "";
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
new d(v({ separator: "," }), y, g);
|
|
636
|
+
new d(v({ separator: ",", conjunction: "and" }), y, g);
|
|
637
|
+
new d(v({ separator: ",", conjunction: "or" }), y, g);
|
|
638
|
+
new d(Y(`
|
|
639
|
+
`), he, v, y, g);
|
|
640
|
+
new d(Y(`
|
|
641
|
+
`), v, y, g, S(/&/g, "&"), S(/</g, "<"), S(/>/g, ">"), S(/"/g, """), S(/'/g, "'"), S(/`/g, "`"));
|
|
642
|
+
new d(E(/(?:\n(?:\s*))+/g, " "), g);
|
|
643
|
+
var ve = new d(E(/(?:\n\s*)/g, ""), g);
|
|
644
|
+
new d(v({ separator: "," }), E(/(?:\s+)/g, " "), g);
|
|
645
|
+
new d(v({ separator: ",", conjunction: "or" }), E(/(?:\s+)/g, " "), g);
|
|
646
|
+
new d(v({ separator: ",", conjunction: "and" }), E(/(?:\s+)/g, " "), g);
|
|
647
|
+
new d(v, y, g);
|
|
648
|
+
new d(v, E(/(?:\s+)/g, " "), g);
|
|
649
|
+
new d(y, g);
|
|
650
|
+
new d(y("all"), g);
|
|
651
|
+
const F = "application/javascript", pe = (e, r = {}) => {
|
|
652
|
+
const n = {
|
|
653
|
+
skipSameOrigin: !0,
|
|
654
|
+
useBlob: !0,
|
|
655
|
+
...r
|
|
656
|
+
};
|
|
657
|
+
if (n.skipSameOrigin && new URL(e).origin === self.location.origin)
|
|
658
|
+
return Promise.resolve(e);
|
|
659
|
+
let t;
|
|
660
|
+
try {
|
|
661
|
+
const a = new AbortController();
|
|
662
|
+
t = a.signal;
|
|
663
|
+
const o = setTimeout(() => {
|
|
664
|
+
a.abort();
|
|
665
|
+
}, 3e3), i = () => {
|
|
666
|
+
clearTimeout(o), a.abort();
|
|
667
|
+
};
|
|
668
|
+
t.addEventListener("abort", i);
|
|
669
|
+
} catch {
|
|
670
|
+
}
|
|
671
|
+
return new Promise((a, o) => void fetch(e, {
|
|
672
|
+
// abort if the worker is not fetched in a reasonable time
|
|
673
|
+
signal: t
|
|
674
|
+
}).then((i) => i.text()).then((i) => {
|
|
675
|
+
let s = "";
|
|
676
|
+
if (n.useBlob) {
|
|
677
|
+
const l = new Blob([i], { type: F });
|
|
678
|
+
s = URL.createObjectURL(l);
|
|
679
|
+
} else
|
|
680
|
+
s = `data:${F},` + encodeURIComponent(i);
|
|
681
|
+
a(s);
|
|
682
|
+
}).catch(() => {
|
|
683
|
+
o(new Error(`Failed to fetch worker from ${e}`));
|
|
684
|
+
}));
|
|
685
|
+
}, ye = "FrameTransferError";
|
|
686
|
+
class N extends Error {
|
|
687
|
+
constructor(r, n) {
|
|
688
|
+
super(r, n), this.name = ye;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
const we = (e, r) => {
|
|
692
|
+
const n = r instanceof Error && r.message ? `: ${r.message}` : "";
|
|
693
|
+
return r instanceof Error ? new N(`${e}${n}`, {
|
|
694
|
+
cause: r
|
|
695
|
+
}) : new N(`${e}${n}`);
|
|
696
|
+
}, Se = (e) => e.startsWith("data:"), be = (e) => e.startsWith("blob:"), Ee = (e) => !Se(e) && !be(e), Te = async (e) => {
|
|
697
|
+
const r = await fetch(e, { method: "HEAD" }), n = r.headers.get("content-type"), t = n?.includes("javascript");
|
|
698
|
+
if (n?.includes("html"))
|
|
699
|
+
throw new Error(ve`${e} resolved to a resource with the content type ${n}.
|
|
700
|
+
This is likely an issue with the server configuration redirecting to an index.html file.
|
|
701
|
+
Check that your resources are properly hosted`);
|
|
702
|
+
if (!t)
|
|
703
|
+
throw new Error(`Worker file is not a JavaScript file: ${n}`);
|
|
704
|
+
if (!r.ok)
|
|
705
|
+
throw new Error(`Worker file not found or inaccessible: ${r.status} ${r.statusText}`);
|
|
706
|
+
};
|
|
707
|
+
async function Re(e, r) {
|
|
708
|
+
const n = await pe(new URL(`resources/${r}`, e).toString());
|
|
709
|
+
Ee(n) && await Te(n);
|
|
710
|
+
const t = new Worker(n, {
|
|
711
|
+
type: "module"
|
|
712
|
+
}), a = $(t);
|
|
713
|
+
return t.onerror = (i) => {
|
|
714
|
+
console.error("Worker error:", i), a[B]();
|
|
715
|
+
}, new Proxy(a, {
|
|
716
|
+
get(i, s, l) {
|
|
717
|
+
return s === "createScanningSession" ? async (...c) => {
|
|
718
|
+
const u = await i.createScanningSession(...c);
|
|
719
|
+
return new Proxy(u, {
|
|
720
|
+
get(f, p, X) {
|
|
721
|
+
return p === "process" ? (T) => {
|
|
722
|
+
const J = {
|
|
723
|
+
data: T.data,
|
|
724
|
+
width: T.width,
|
|
725
|
+
height: T.height,
|
|
726
|
+
colorSpace: T.colorSpace ?? "srgb"
|
|
727
|
+
};
|
|
728
|
+
let V;
|
|
729
|
+
try {
|
|
730
|
+
V = Q(J, [
|
|
731
|
+
T.data.buffer
|
|
732
|
+
]);
|
|
733
|
+
} catch (Z) {
|
|
734
|
+
throw we("Failed to transfer frame to worker", Z);
|
|
735
|
+
}
|
|
736
|
+
return f.process(V);
|
|
737
|
+
} : Reflect.get(f, p, X);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
} : Reflect.get(i, s, l);
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function Ce() {
|
|
745
|
+
const e = navigator.userAgent;
|
|
746
|
+
if (/iPad/.test(e) || /Macintosh/.test(e) && navigator.maxTouchPoints > 1)
|
|
747
|
+
return "iPad";
|
|
748
|
+
if (/iPhone/.test(e))
|
|
749
|
+
return "iPhone";
|
|
750
|
+
if (/Macintosh/.test(e))
|
|
751
|
+
return "Mac";
|
|
752
|
+
}
|
|
753
|
+
const Me = [
|
|
754
|
+
// 1. In-App Browsers
|
|
755
|
+
{
|
|
756
|
+
name: "Facebook In-App",
|
|
757
|
+
regex: /FBAV\/([\d.]+)/,
|
|
758
|
+
getVersion: (e) => e[1]
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
name: "Instagram In-App",
|
|
762
|
+
regex: /Instagram ([\d.]+)/,
|
|
763
|
+
getVersion: (e) => e[1]
|
|
764
|
+
},
|
|
765
|
+
{ name: "TikTok In-App", regex: /TikTok/, getVersion: () => "" },
|
|
766
|
+
// 2. Niche/Alternate Browsers (must be checked before generic Chrome)
|
|
767
|
+
{ name: "Edge", regex: /Edg\/([\d.]+)/, getVersion: (e) => e[1] },
|
|
768
|
+
{
|
|
769
|
+
name: "DuckDuckGo",
|
|
770
|
+
regex: /DuckDuckGo\/([\d.]+)/,
|
|
771
|
+
getVersion: (e) => e[1]
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: "Vivaldi",
|
|
775
|
+
regex: /Vivaldi\/([\d.]+)/,
|
|
776
|
+
getVersion: (e) => e[1]
|
|
777
|
+
},
|
|
778
|
+
{ name: "Opera", regex: /OPR\/([\d.]+)/, getVersion: (e) => e[1] },
|
|
779
|
+
{
|
|
780
|
+
name: "Samsung Browser",
|
|
781
|
+
regex: /SamsungBrowser\/([\d.]+)/,
|
|
782
|
+
getVersion: (e) => e[1]
|
|
783
|
+
},
|
|
784
|
+
// 3. Platform-specific browsers (e.g., on iOS)
|
|
785
|
+
{
|
|
786
|
+
name: "Firefox",
|
|
787
|
+
regex: /FxiOS\/([\S]+)/,
|
|
788
|
+
// Firefox on iOS
|
|
789
|
+
getVersion: (e) => e[1]
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
name: "Chrome",
|
|
793
|
+
regex: /CriOS\/([\S]+)/,
|
|
794
|
+
// Chrome on iOS
|
|
795
|
+
getVersion: (e) => e[1]
|
|
796
|
+
},
|
|
797
|
+
// 4. WebViews (must be checked before generic Chrome/Safari)
|
|
798
|
+
{
|
|
799
|
+
name: "Android WebView",
|
|
800
|
+
regex: /; wv\)/,
|
|
801
|
+
getVersion: (e, r) => r.match(/Chrome\/([\d.]+)/)?.[1] ?? ""
|
|
802
|
+
},
|
|
803
|
+
// 5. Major Mainstream Browsers (the final fallbacks)
|
|
804
|
+
{
|
|
805
|
+
name: "Brave",
|
|
806
|
+
regex: /Brave/,
|
|
807
|
+
getVersion: (e, r) => r.match(/Chrome\/([\d.]+)/)?.[1] ?? ""
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
name: "Chrome",
|
|
811
|
+
regex: /Chrome\/([\d.]+)/,
|
|
812
|
+
getVersion: (e) => e[1]
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "Firefox",
|
|
816
|
+
regex: /Firefox\/([\d.]+)/,
|
|
817
|
+
getVersion: (e) => e[1]
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: "Safari",
|
|
821
|
+
regex: /Version\/([\d.]+).*Safari/,
|
|
822
|
+
getVersion: (e) => e[1]
|
|
823
|
+
}
|
|
824
|
+
];
|
|
825
|
+
function xe() {
|
|
826
|
+
const e = navigator.userAgent;
|
|
827
|
+
for (const r of Me) {
|
|
828
|
+
const n = e.match(r.regex);
|
|
829
|
+
if (n)
|
|
830
|
+
return {
|
|
831
|
+
name: r.name,
|
|
832
|
+
version: r.getVersion(n, e)
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
if (window.webkit?.messageHandlers) {
|
|
836
|
+
const r = e.match(/OS ([\d_]+)/);
|
|
837
|
+
return {
|
|
838
|
+
name: "iOS WebView",
|
|
839
|
+
version: r ? r[1].replace(/_/g, ".") : ""
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
return { name: "Unknown", version: "" };
|
|
843
|
+
}
|
|
844
|
+
function Le(e, r) {
|
|
845
|
+
if (!r.versionRegex)
|
|
846
|
+
return "";
|
|
847
|
+
const n = e.match(r.versionRegex);
|
|
848
|
+
return n?.[1] ? r.versionTransform ? r.versionTransform(n[1]) : n[1] : "";
|
|
849
|
+
}
|
|
850
|
+
function ke() {
|
|
851
|
+
const e = navigator.userAgent, r = {
|
|
852
|
+
"10.0": "10 or 11",
|
|
853
|
+
"6.3": "8.1",
|
|
854
|
+
"6.2": "8",
|
|
855
|
+
"6.1": "7"
|
|
856
|
+
}, n = [
|
|
857
|
+
{
|
|
858
|
+
os: "iPadOS",
|
|
859
|
+
condition: /Macintosh/.test(e) && navigator.maxTouchPoints > 1,
|
|
860
|
+
versionRegex: /Mac OS X ([\d_]+)/,
|
|
861
|
+
versionTransform: (t) => t.replace(/_/g, ".")
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
os: "iOS",
|
|
865
|
+
condition: /iPhone/.test(e),
|
|
866
|
+
versionRegex: /iPhone OS ([\d_]+)/,
|
|
867
|
+
versionTransform: (t) => t.replace(/_/g, ".")
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
os: "macOS",
|
|
871
|
+
condition: /Macintosh/.test(e),
|
|
872
|
+
versionRegex: /Mac OS X ([\d_]+)/,
|
|
873
|
+
versionTransform: (t) => t.replace(/_/g, ".")
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
os: "Windows",
|
|
877
|
+
condition: /Win/.test(e),
|
|
878
|
+
versionRegex: /Windows NT ([\d.]+)/,
|
|
879
|
+
versionTransform: (t) => r[t] || t
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
os: "Android",
|
|
883
|
+
condition: /Android/.test(e),
|
|
884
|
+
versionRegex: /Android ([\d.]+)/
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
os: "Linux",
|
|
888
|
+
condition: /Linux/.test(e)
|
|
889
|
+
}
|
|
890
|
+
];
|
|
891
|
+
for (const t of n)
|
|
892
|
+
if (t.condition) {
|
|
893
|
+
const a = Le(e, t);
|
|
894
|
+
return { os: t.os, version: a };
|
|
895
|
+
}
|
|
896
|
+
return { os: "", version: "" };
|
|
897
|
+
}
|
|
898
|
+
function Pe(e, r) {
|
|
899
|
+
const n = Ce();
|
|
900
|
+
let t = "";
|
|
901
|
+
if (r?.model)
|
|
902
|
+
t = r.model;
|
|
903
|
+
else if (n)
|
|
904
|
+
t = n;
|
|
905
|
+
else {
|
|
906
|
+
const l = e.match(/Android.*?; ([^)]+)\)/);
|
|
907
|
+
l?.[1] && (t = l[1]);
|
|
908
|
+
}
|
|
909
|
+
let a = ["Desktop"];
|
|
910
|
+
r?.formFactors?.length ? a = r.formFactors : r?.mobile ? a = ["Mobile"] : n && (n === "iPhone" ? a = ["Mobile"] : n === "iPad" && (a = ["Tablet"]));
|
|
911
|
+
let o = "";
|
|
912
|
+
r?.platform ? o = r.platform : o = ke().os;
|
|
913
|
+
let i = "", s = "";
|
|
914
|
+
if (r?.brands?.length)
|
|
915
|
+
i = (r.brands.find((c) => !/not.a.brand/i.test(c.brand) && c.brand !== "Chromium") ?? r.brands.find((c) => !/not.a.brand/i.test(c.brand)))?.brand ?? "", r.fullVersionList ? s = r.fullVersionList.find((c) => c.brand === i)?.version ?? "" : s = r.brands.find((c) => c.brand === i)?.version ?? "";
|
|
916
|
+
else {
|
|
917
|
+
const l = xe();
|
|
918
|
+
i = l.name, s = l.version;
|
|
919
|
+
}
|
|
920
|
+
return t === "" && o === "macOS" && (t = "Mac"), {
|
|
921
|
+
model: t,
|
|
922
|
+
formFactors: a,
|
|
923
|
+
platform: o,
|
|
924
|
+
browser: {
|
|
925
|
+
brand: i,
|
|
926
|
+
version: s
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
function Ae() {
|
|
931
|
+
const r = document.createElement("canvas").getContext("webgl");
|
|
932
|
+
if (r && r instanceof WebGLRenderingContext) {
|
|
933
|
+
const n = r.getExtension("WEBGL_debug_renderer_info");
|
|
934
|
+
return {
|
|
935
|
+
renderer: n ? r.getParameter(n.UNMASKED_RENDERER_WEBGL) : r.getParameter(r.RENDERER),
|
|
936
|
+
shadingLanguageVersion: r.getParameter(r.SHADING_LANGUAGE_VERSION),
|
|
937
|
+
vendor: n ? r.getParameter(n.UNMASKED_VENDOR_WEBGL) : r.getParameter(r.VENDOR),
|
|
938
|
+
version: r.getParameter(r.VERSION)
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function Ve() {
|
|
943
|
+
try {
|
|
944
|
+
const e = "__storage_test__";
|
|
945
|
+
return window.localStorage.setItem(e, e), window.localStorage.removeItem(e), !0;
|
|
946
|
+
} catch {
|
|
947
|
+
return !1;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
async function Ie() {
|
|
951
|
+
let e;
|
|
952
|
+
try {
|
|
953
|
+
e = await navigator.userAgentData?.getHighEntropyValues([
|
|
954
|
+
"brands",
|
|
955
|
+
"mobile",
|
|
956
|
+
"platform",
|
|
957
|
+
"architecture",
|
|
958
|
+
"bitness",
|
|
959
|
+
"formFactors",
|
|
960
|
+
"model",
|
|
961
|
+
"platformVersion",
|
|
962
|
+
"fullVersionList",
|
|
963
|
+
"wow64"
|
|
964
|
+
]);
|
|
965
|
+
} catch {
|
|
966
|
+
}
|
|
967
|
+
return e;
|
|
968
|
+
}
|
|
969
|
+
async function $e() {
|
|
970
|
+
const e = await Ie();
|
|
971
|
+
return {
|
|
972
|
+
userAgentData: e,
|
|
973
|
+
userAgent: navigator.userAgent,
|
|
974
|
+
threads: navigator.hardwareConcurrency,
|
|
975
|
+
memory: navigator.deviceMemory,
|
|
976
|
+
gpu: Ae(),
|
|
977
|
+
screen: {
|
|
978
|
+
screenWidth: window.screen.width,
|
|
979
|
+
screenHeight: window.screen.height,
|
|
980
|
+
devicePixelRatio: window.devicePixelRatio,
|
|
981
|
+
physicalScreenWidth: window.screen.width * window.devicePixelRatio,
|
|
982
|
+
physicalScreenHeight: window.screen.height * window.devicePixelRatio,
|
|
983
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
984
|
+
},
|
|
985
|
+
browserStorageSupport: {
|
|
986
|
+
cookieEnabled: navigator.cookieEnabled,
|
|
987
|
+
localStorageEnabled: Ve()
|
|
988
|
+
},
|
|
989
|
+
derivedDeviceInfo: Pe(navigator.userAgent, e)
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
let _ = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((r, n) => (n &= 63, n < 36 ? r += n.toString(36) : n < 62 ? r += (n - 26).toString(36).toUpperCase() : n > 62 ? r += "-" : r += "_", r), "");
|
|
993
|
+
function Oe(e) {
|
|
994
|
+
if (!Fe())
|
|
995
|
+
return _();
|
|
996
|
+
const n = localStorage.getItem(e);
|
|
997
|
+
if (n)
|
|
998
|
+
return n;
|
|
999
|
+
const t = _();
|
|
1000
|
+
return localStorage.setItem(e, t), t;
|
|
1001
|
+
}
|
|
1002
|
+
function Fe() {
|
|
1003
|
+
try {
|
|
1004
|
+
return localStorage.setItem("test", "test"), localStorage.removeItem("test"), !0;
|
|
1005
|
+
} catch {
|
|
1006
|
+
return !1;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
const Ne = "blinkid-verify-userid";
|
|
1010
|
+
async function Ge(e, r) {
|
|
1011
|
+
e.resourcesLocation ??= window.location.href;
|
|
1012
|
+
const n = await Re(
|
|
1013
|
+
e.resourcesLocation,
|
|
1014
|
+
"blinkid-verify-worker.js"
|
|
1015
|
+
);
|
|
1016
|
+
e.userId ??= Oe(Ne);
|
|
1017
|
+
const t = r ? q(r) : void 0;
|
|
1018
|
+
try {
|
|
1019
|
+
return await n.initBlinkIdVerify(
|
|
1020
|
+
e,
|
|
1021
|
+
t
|
|
1022
|
+
), n;
|
|
1023
|
+
} catch (a) {
|
|
1024
|
+
throw new Error("Failed to initialize BlinkID Verify", {
|
|
1025
|
+
cause: a
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
function ze(e, r, n, t) {
|
|
1030
|
+
return {
|
|
1031
|
+
imageFront: P(e.frontFrame),
|
|
1032
|
+
imageBack: P(e.backFrame),
|
|
1033
|
+
imageBarcode: P(e.barcodeFrame),
|
|
1034
|
+
options: {
|
|
1035
|
+
treatExpirationAsFraud: n.treatExpirationAsFraud,
|
|
1036
|
+
screenMatchLevel: h(n.screenAnalysisMatchLevel),
|
|
1037
|
+
photocopyMatchLevel: t?.photocopyMatchLevel,
|
|
1038
|
+
photoForgeryMatchLevel: t?.photoForgeryMatchLevel,
|
|
1039
|
+
staticSecurityFeaturesMatchLevel: h(
|
|
1040
|
+
n.staticSecurityFeaturesMatchLevel
|
|
1041
|
+
),
|
|
1042
|
+
barcodeAnomalyMatchLevel: h(
|
|
1043
|
+
n.barcodeAnomalyMatchLevel
|
|
1044
|
+
),
|
|
1045
|
+
dataMatchMatchLevel: h(n.dataMatchMatchLevel),
|
|
1046
|
+
blurMatchLevel: h(
|
|
1047
|
+
n.imageQualitySettings?.blurMatchLevel
|
|
1048
|
+
),
|
|
1049
|
+
glareMatchLevel: h(
|
|
1050
|
+
n.imageQualitySettings?.glareMatchLevel
|
|
1051
|
+
),
|
|
1052
|
+
lightingMatchLevel: h(
|
|
1053
|
+
n.imageQualitySettings?.lightingMatchLevel
|
|
1054
|
+
),
|
|
1055
|
+
sharpnessMatchLevel: h(
|
|
1056
|
+
n.imageQualitySettings?.sharpnessMatchLevel
|
|
1057
|
+
),
|
|
1058
|
+
handOcclusionMatchLevel: h(
|
|
1059
|
+
n.imageQualitySettings?.handOcclusionMatchLevel
|
|
1060
|
+
),
|
|
1061
|
+
dpiMatchLevel: h(
|
|
1062
|
+
n.imageQualitySettings?.dpiMatchLevel
|
|
1063
|
+
),
|
|
1064
|
+
tiltMatchLevel: h(
|
|
1065
|
+
n.imageQualitySettings?.tiltMatchLevel
|
|
1066
|
+
),
|
|
1067
|
+
imageQualityInterpretation: He(
|
|
1068
|
+
n.imageQualitySettings?.interpretation
|
|
1069
|
+
),
|
|
1070
|
+
anonymizationMode: t?.anonymizationMode,
|
|
1071
|
+
returnFaceImage: t?.returnFaceImage,
|
|
1072
|
+
returnFullDocumentImage: t?.returnFullDocumentImage,
|
|
1073
|
+
returnSignatureImage: t?.returnSignatureImage,
|
|
1074
|
+
returnImageFormat: t?.returnImageFormat,
|
|
1075
|
+
generativeAiMatchLevel: t?.generativeAiMatchLevel
|
|
1076
|
+
},
|
|
1077
|
+
useCase: {
|
|
1078
|
+
documentVerificationPolicy: Be(
|
|
1079
|
+
n.useCase?.verificationPolicy
|
|
1080
|
+
),
|
|
1081
|
+
verificationContext: je(
|
|
1082
|
+
n.useCase?.verificationContext
|
|
1083
|
+
),
|
|
1084
|
+
manualReviewStrategy: De(
|
|
1085
|
+
n.useCase?.manualReviewStrategy
|
|
1086
|
+
),
|
|
1087
|
+
manualReviewSensitivity: _e(
|
|
1088
|
+
n.useCase?.manualReviewSensitivity
|
|
1089
|
+
),
|
|
1090
|
+
captureConditions: Ue(
|
|
1091
|
+
n.useCase?.captureConditions
|
|
1092
|
+
)
|
|
1093
|
+
},
|
|
1094
|
+
captureSessionId: r
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
function _e(e) {
|
|
1098
|
+
switch (e) {
|
|
1099
|
+
case "low":
|
|
1100
|
+
return "Low";
|
|
1101
|
+
case "default":
|
|
1102
|
+
return "Default";
|
|
1103
|
+
case "high":
|
|
1104
|
+
return "High";
|
|
1105
|
+
default:
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
function De(e) {
|
|
1110
|
+
switch (e) {
|
|
1111
|
+
case "never":
|
|
1112
|
+
return "Never";
|
|
1113
|
+
case "rejected-and-accepted":
|
|
1114
|
+
return "RejectedAndAccepted";
|
|
1115
|
+
case "rejected-only":
|
|
1116
|
+
return "RejectedOnly";
|
|
1117
|
+
case "accepted-only":
|
|
1118
|
+
return "AcceptedOnly";
|
|
1119
|
+
default:
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
function Be(e) {
|
|
1124
|
+
switch (e) {
|
|
1125
|
+
case "permissive":
|
|
1126
|
+
return "Permissive";
|
|
1127
|
+
case "standard":
|
|
1128
|
+
return "Standard";
|
|
1129
|
+
case "strict":
|
|
1130
|
+
return "Strict";
|
|
1131
|
+
case "very-strict":
|
|
1132
|
+
return "VeryStrict";
|
|
1133
|
+
default:
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
function He(e) {
|
|
1138
|
+
switch (e) {
|
|
1139
|
+
case "ignore":
|
|
1140
|
+
return "Ignore";
|
|
1141
|
+
case "conservative":
|
|
1142
|
+
return "Conservative";
|
|
1143
|
+
case "high-assurance":
|
|
1144
|
+
return "HighAssurance";
|
|
1145
|
+
case "high-conversion":
|
|
1146
|
+
return "HighConversion";
|
|
1147
|
+
case "very-high-conversion":
|
|
1148
|
+
return "VeryHighConversion";
|
|
1149
|
+
default:
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
function je(e) {
|
|
1154
|
+
switch (e) {
|
|
1155
|
+
case "in-person":
|
|
1156
|
+
return "InPerson";
|
|
1157
|
+
case "remote":
|
|
1158
|
+
return "Remote";
|
|
1159
|
+
default:
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function Ue(e) {
|
|
1164
|
+
switch (e) {
|
|
1165
|
+
case "no-control":
|
|
1166
|
+
return "NoControl";
|
|
1167
|
+
case "basic":
|
|
1168
|
+
return "Basic";
|
|
1169
|
+
case "hybrid":
|
|
1170
|
+
return "Hybrid";
|
|
1171
|
+
default:
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
function h(e) {
|
|
1176
|
+
switch (e) {
|
|
1177
|
+
case "disabled":
|
|
1178
|
+
return "Disabled";
|
|
1179
|
+
case "level-1":
|
|
1180
|
+
return "Level1";
|
|
1181
|
+
case "level-2":
|
|
1182
|
+
return "Level2";
|
|
1183
|
+
case "level-3":
|
|
1184
|
+
return "Level3";
|
|
1185
|
+
case "level-4":
|
|
1186
|
+
return "Level4";
|
|
1187
|
+
case "level-5":
|
|
1188
|
+
return "Level5";
|
|
1189
|
+
case "level-6":
|
|
1190
|
+
return "Level6";
|
|
1191
|
+
case "level-7":
|
|
1192
|
+
return "Level7";
|
|
1193
|
+
case "level-8":
|
|
1194
|
+
return "Level8";
|
|
1195
|
+
case "level-9":
|
|
1196
|
+
return "Level9";
|
|
1197
|
+
case "level-10":
|
|
1198
|
+
return "Level10";
|
|
1199
|
+
default:
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
function P(e) {
|
|
1204
|
+
if (e?.jpegBytes)
|
|
1205
|
+
return {
|
|
1206
|
+
base64: btoa(
|
|
1207
|
+
new Uint8Array(e.jpegBytes).reduce(
|
|
1208
|
+
(r, n) => r + String.fromCharCode(n),
|
|
1209
|
+
""
|
|
1210
|
+
)
|
|
1211
|
+
)
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
const K = Symbol();
|
|
1215
|
+
globalThis.__BLINKID_VERIFY_CORE__ ||= K;
|
|
1216
|
+
globalThis.__BLINKID_VERIFY_CORE__ !== K && console.warn(
|
|
1217
|
+
"Detected multiple instances of @microblink/blinkid-core. This can lead to unexpected behavior."
|
|
1218
|
+
);
|
|
1219
|
+
export {
|
|
1220
|
+
We as AnalyticService,
|
|
1221
|
+
ze as GeneratePayloadForBlinkidVerifyRequest,
|
|
1222
|
+
Pe as createDerivedDeviceInfo,
|
|
1223
|
+
Re as createProxyWorker,
|
|
1224
|
+
pe as getCrossOriginWorkerURL,
|
|
1225
|
+
$e as getDeviceInfo,
|
|
1226
|
+
Ie as getUserAgentData,
|
|
1227
|
+
Oe as getUserId,
|
|
1228
|
+
Ge as loadBlinkIdVerifyCore
|
|
1229
|
+
};
|