@microblink/blinkid-core 7.4.3 → 7.6.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/dist/blinkid-core.js +18 -18
- package/dist/resources/blinkid-worker.js +445 -399
- package/dist/resources/full/advanced/BlinkIdModule.data +0 -0
- package/dist/resources/full/advanced/BlinkIdModule.js +124 -138
- package/dist/resources/full/advanced/BlinkIdModule.wasm +0 -0
- package/dist/resources/full/advanced-threads/BlinkIdModule.data +0 -0
- package/dist/resources/full/advanced-threads/BlinkIdModule.js +145 -162
- package/dist/resources/full/advanced-threads/BlinkIdModule.wasm +0 -0
- package/dist/resources/full/basic/BlinkIdModule.data +0 -0
- package/dist/resources/full/basic/BlinkIdModule.js +120 -134
- package/dist/resources/full/basic/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/advanced/BlinkIdModule.data +0 -0
- package/dist/resources/lightweight/advanced/BlinkIdModule.js +124 -137
- package/dist/resources/lightweight/advanced/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/advanced-threads/BlinkIdModule.data +0 -0
- package/dist/resources/lightweight/advanced-threads/BlinkIdModule.js +145 -162
- package/dist/resources/lightweight/advanced-threads/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/basic/BlinkIdModule.data +0 -0
- package/dist/resources/lightweight/basic/BlinkIdModule.js +120 -133
- package/dist/resources/lightweight/basic/BlinkIdModule.wasm +0 -0
- package/dist/resources/size-manifest.json +12 -12
- package/package.json +1 -1
- package/types/deviceInfo/createDerivedDeviceInfo.d.ts +1 -1
- package/types/deviceInfo/createDerivedDeviceInfo.d.ts.map +1 -1
- package/types/deviceInfo/deviceInfo.d.ts +1 -1
- package/types/deviceInfo/deviceInfo.d.ts.map +1 -1
- package/types/deviceInfo/getBrowserFromUserAgent.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/index.rollup.d.ts +180 -25
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
2
|
var J = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var Oe = (e, t, r) => t in e ? Le(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
6
|
+
var x = (e, t, r) => Oe(e, typeof t != "symbol" ? t + "" : t, r), $ = (e, t, r) => t.has(e) || J("Cannot " + r);
|
|
7
|
+
var d = (e, t, r) => ($(e, t, "read from private field"), r ? r.call(e) : t.get(e)), p = (e, t, r) => t.has(e) ? J("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), y = (e, t, r, s) => ($(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r), R = (e, t, r) => ($(e, t, "access private method"), r);
|
|
8
|
+
var Q = (e, t, r, s) => ({
|
|
9
|
+
set _(n) {
|
|
10
|
+
y(e, t, n, r);
|
|
11
|
+
},
|
|
12
|
+
get _() {
|
|
13
|
+
return d(e, t, s);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
8
16
|
/**
|
|
9
17
|
* @license
|
|
10
18
|
* Copyright 2019 Google LLC
|
|
11
19
|
* SPDX-License-Identifier: Apache-2.0
|
|
12
20
|
*/
|
|
13
|
-
const
|
|
14
|
-
canHandle: (e) =>
|
|
21
|
+
const ae = Symbol("Comlink.proxy"), Re = Symbol("Comlink.endpoint"), ve = Symbol("Comlink.releaseProxy"), z = Symbol("Comlink.finalizer"), W = Symbol("Comlink.thrown"), ie = (e) => typeof e == "object" && e !== null || typeof e == "function", Ae = {
|
|
22
|
+
canHandle: (e) => ie(e) && e[ae],
|
|
15
23
|
serialize(e) {
|
|
16
24
|
const { port1: t, port2: r } = new MessageChannel();
|
|
17
|
-
return
|
|
25
|
+
return H(e, t), [r, [r]];
|
|
18
26
|
},
|
|
19
27
|
deserialize(e) {
|
|
20
|
-
return e.start(),
|
|
28
|
+
return e.start(), Ie(e);
|
|
21
29
|
}
|
|
22
30
|
}, Ue = {
|
|
23
|
-
canHandle: (e) =>
|
|
31
|
+
canHandle: (e) => ie(e) && W in e,
|
|
24
32
|
serialize({ value: e }) {
|
|
25
33
|
let t;
|
|
26
34
|
return e instanceof Error ? t = {
|
|
@@ -35,48 +43,48 @@ const re = Symbol("Comlink.proxy"), Ae = Symbol("Comlink.endpoint"), Re = Symbol
|
|
|
35
43
|
deserialize(e) {
|
|
36
44
|
throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
|
|
37
45
|
}
|
|
38
|
-
},
|
|
39
|
-
["proxy",
|
|
46
|
+
}, ce = /* @__PURE__ */ new Map([
|
|
47
|
+
["proxy", Ae],
|
|
40
48
|
["throw", Ue]
|
|
41
49
|
]);
|
|
42
|
-
function
|
|
50
|
+
function Te(e, t) {
|
|
43
51
|
for (const r of e)
|
|
44
52
|
if (t === r || r === "*" || r instanceof RegExp && r.test(t))
|
|
45
53
|
return !0;
|
|
46
54
|
return !1;
|
|
47
55
|
}
|
|
48
|
-
function
|
|
49
|
-
t.addEventListener("message", function
|
|
50
|
-
if (!
|
|
56
|
+
function H(e, t = globalThis, r = ["*"]) {
|
|
57
|
+
t.addEventListener("message", function s(n) {
|
|
58
|
+
if (!n || !n.data)
|
|
51
59
|
return;
|
|
52
|
-
if (!
|
|
53
|
-
console.warn(`Invalid origin '${
|
|
60
|
+
if (!Te(r, n.origin)) {
|
|
61
|
+
console.warn(`Invalid origin '${n.origin}' for comlink proxy`);
|
|
54
62
|
return;
|
|
55
63
|
}
|
|
56
|
-
const { id:
|
|
64
|
+
const { id: o, type: c, path: a } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(k);
|
|
57
65
|
let i;
|
|
58
66
|
try {
|
|
59
|
-
const
|
|
60
|
-
switch (
|
|
67
|
+
const u = a.slice(0, -1).reduce((h, w) => h[w], e), f = a.reduce((h, w) => h[w], e);
|
|
68
|
+
switch (c) {
|
|
61
69
|
case "GET":
|
|
62
|
-
i =
|
|
70
|
+
i = f;
|
|
63
71
|
break;
|
|
64
72
|
case "SET":
|
|
65
|
-
|
|
73
|
+
u[a.slice(-1)[0]] = k(n.data.value), i = !0;
|
|
66
74
|
break;
|
|
67
75
|
case "APPLY":
|
|
68
|
-
i =
|
|
76
|
+
i = f.apply(u, l);
|
|
69
77
|
break;
|
|
70
78
|
case "CONSTRUCT":
|
|
71
79
|
{
|
|
72
|
-
const
|
|
73
|
-
i =
|
|
80
|
+
const h = new f(...l);
|
|
81
|
+
i = me(h);
|
|
74
82
|
}
|
|
75
83
|
break;
|
|
76
84
|
case "ENDPOINT":
|
|
77
85
|
{
|
|
78
|
-
const { port1:
|
|
79
|
-
|
|
86
|
+
const { port1: h, port2: w } = new MessageChannel();
|
|
87
|
+
H(e, w), i = fe(h, [h]);
|
|
80
88
|
}
|
|
81
89
|
break;
|
|
82
90
|
case "RELEASE":
|
|
@@ -85,146 +93,146 @@ function V(e, t = globalThis, r = ["*"]) {
|
|
|
85
93
|
default:
|
|
86
94
|
return;
|
|
87
95
|
}
|
|
88
|
-
} catch (
|
|
89
|
-
i = { value:
|
|
96
|
+
} catch (u) {
|
|
97
|
+
i = { value: u, [W]: 0 };
|
|
90
98
|
}
|
|
91
|
-
Promise.resolve(i).catch((
|
|
92
|
-
const [
|
|
93
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
94
|
-
}).catch((
|
|
95
|
-
const [
|
|
99
|
+
Promise.resolve(i).catch((u) => ({ value: u, [W]: 0 })).then((u) => {
|
|
100
|
+
const [f, h] = j(u);
|
|
101
|
+
t.postMessage(Object.assign(Object.assign({}, f), { id: o }), h), c === "RELEASE" && (t.removeEventListener("message", s), le(t), z in e && typeof e[z] == "function" && e[z]());
|
|
102
|
+
}).catch((u) => {
|
|
103
|
+
const [f, h] = j({
|
|
96
104
|
value: new TypeError("Unserializable return value"),
|
|
97
|
-
[
|
|
105
|
+
[W]: 0
|
|
98
106
|
});
|
|
99
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
107
|
+
t.postMessage(Object.assign(Object.assign({}, f), { id: o }), h);
|
|
100
108
|
});
|
|
101
109
|
}), t.start && t.start();
|
|
102
110
|
}
|
|
103
|
-
function
|
|
111
|
+
function Me(e) {
|
|
104
112
|
return e.constructor.name === "MessagePort";
|
|
105
113
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
114
|
+
function le(e) {
|
|
115
|
+
Me(e) && e.close();
|
|
108
116
|
}
|
|
109
|
-
function
|
|
117
|
+
function Ie(e, t) {
|
|
110
118
|
const r = /* @__PURE__ */ new Map();
|
|
111
|
-
return e.addEventListener("message", function(
|
|
112
|
-
const { data:
|
|
113
|
-
if (!
|
|
119
|
+
return e.addEventListener("message", function(n) {
|
|
120
|
+
const { data: o } = n;
|
|
121
|
+
if (!o || !o.id)
|
|
114
122
|
return;
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
123
|
+
const c = r.get(o.id);
|
|
124
|
+
if (c)
|
|
117
125
|
try {
|
|
118
|
-
|
|
126
|
+
c(o);
|
|
119
127
|
} finally {
|
|
120
|
-
r.delete(
|
|
128
|
+
r.delete(o.id);
|
|
121
129
|
}
|
|
122
|
-
}),
|
|
130
|
+
}), _(e, r, [], t);
|
|
123
131
|
}
|
|
124
|
-
function
|
|
132
|
+
function M(e) {
|
|
125
133
|
if (e)
|
|
126
134
|
throw new Error("Proxy has been released and is not useable");
|
|
127
135
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
136
|
+
function ue(e) {
|
|
137
|
+
return L(e, /* @__PURE__ */ new Map(), {
|
|
130
138
|
type: "RELEASE"
|
|
131
139
|
}).then(() => {
|
|
132
|
-
|
|
140
|
+
le(e);
|
|
133
141
|
});
|
|
134
142
|
}
|
|
135
|
-
const
|
|
136
|
-
const t = (
|
|
137
|
-
|
|
143
|
+
const B = /* @__PURE__ */ new WeakMap(), C = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
144
|
+
const t = (B.get(e) || 0) - 1;
|
|
145
|
+
B.set(e, t), t === 0 && ue(e);
|
|
138
146
|
});
|
|
139
147
|
function Ne(e, t) {
|
|
140
|
-
const r = (
|
|
141
|
-
|
|
148
|
+
const r = (B.get(t) || 0) + 1;
|
|
149
|
+
B.set(t, r), C && C.register(e, t, e);
|
|
142
150
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
151
|
+
function ze(e) {
|
|
152
|
+
C && C.unregister(e);
|
|
145
153
|
}
|
|
146
|
-
function
|
|
154
|
+
function _(e, t, r = [], s = function() {
|
|
147
155
|
}) {
|
|
148
|
-
let
|
|
149
|
-
const
|
|
150
|
-
get(
|
|
151
|
-
if (
|
|
156
|
+
let n = !1;
|
|
157
|
+
const o = new Proxy(s, {
|
|
158
|
+
get(c, a) {
|
|
159
|
+
if (M(n), a === ve)
|
|
152
160
|
return () => {
|
|
153
|
-
|
|
161
|
+
ze(o), ue(e), t.clear(), n = !0;
|
|
154
162
|
};
|
|
155
163
|
if (a === "then") {
|
|
156
164
|
if (r.length === 0)
|
|
157
|
-
return { then: () =>
|
|
158
|
-
const
|
|
165
|
+
return { then: () => o };
|
|
166
|
+
const l = L(e, t, {
|
|
159
167
|
type: "GET",
|
|
160
168
|
path: r.map((i) => i.toString())
|
|
161
|
-
}).then(
|
|
162
|
-
return
|
|
169
|
+
}).then(k);
|
|
170
|
+
return l.then.bind(l);
|
|
163
171
|
}
|
|
164
|
-
return
|
|
172
|
+
return _(e, t, [...r, a]);
|
|
165
173
|
},
|
|
166
|
-
set(
|
|
167
|
-
|
|
168
|
-
const [i,
|
|
169
|
-
return
|
|
174
|
+
set(c, a, l) {
|
|
175
|
+
M(n);
|
|
176
|
+
const [i, u] = j(l);
|
|
177
|
+
return L(e, t, {
|
|
170
178
|
type: "SET",
|
|
171
|
-
path: [...r, a].map((
|
|
179
|
+
path: [...r, a].map((f) => f.toString()),
|
|
172
180
|
value: i
|
|
173
|
-
},
|
|
181
|
+
}, u).then(k);
|
|
174
182
|
},
|
|
175
|
-
apply(
|
|
176
|
-
|
|
183
|
+
apply(c, a, l) {
|
|
184
|
+
M(n);
|
|
177
185
|
const i = r[r.length - 1];
|
|
178
|
-
if (i ===
|
|
179
|
-
return
|
|
186
|
+
if (i === Re)
|
|
187
|
+
return L(e, t, {
|
|
180
188
|
type: "ENDPOINT"
|
|
181
|
-
}).then(
|
|
189
|
+
}).then(k);
|
|
182
190
|
if (i === "bind")
|
|
183
|
-
return
|
|
184
|
-
const [
|
|
185
|
-
return
|
|
191
|
+
return _(e, t, r.slice(0, -1));
|
|
192
|
+
const [u, f] = Z(l);
|
|
193
|
+
return L(e, t, {
|
|
186
194
|
type: "APPLY",
|
|
187
|
-
path: r.map((
|
|
188
|
-
argumentList:
|
|
189
|
-
},
|
|
195
|
+
path: r.map((h) => h.toString()),
|
|
196
|
+
argumentList: u
|
|
197
|
+
}, f).then(k);
|
|
190
198
|
},
|
|
191
|
-
construct(
|
|
192
|
-
|
|
193
|
-
const [
|
|
194
|
-
return
|
|
199
|
+
construct(c, a) {
|
|
200
|
+
M(n);
|
|
201
|
+
const [l, i] = Z(a);
|
|
202
|
+
return L(e, t, {
|
|
195
203
|
type: "CONSTRUCT",
|
|
196
|
-
path: r.map((
|
|
197
|
-
argumentList:
|
|
198
|
-
}, i).then(
|
|
204
|
+
path: r.map((u) => u.toString()),
|
|
205
|
+
argumentList: l
|
|
206
|
+
}, i).then(k);
|
|
199
207
|
}
|
|
200
208
|
});
|
|
201
|
-
return Ne(
|
|
209
|
+
return Ne(o, e), o;
|
|
202
210
|
}
|
|
203
211
|
function We(e) {
|
|
204
212
|
return Array.prototype.concat.apply([], e);
|
|
205
213
|
}
|
|
206
|
-
function
|
|
214
|
+
function Z(e) {
|
|
207
215
|
const t = e.map(j);
|
|
208
216
|
return [t.map((r) => r[0]), We(t.map((r) => r[1]))];
|
|
209
217
|
}
|
|
210
|
-
const
|
|
211
|
-
function
|
|
212
|
-
return
|
|
218
|
+
const de = /* @__PURE__ */ new WeakMap();
|
|
219
|
+
function fe(e, t) {
|
|
220
|
+
return de.set(e, t), e;
|
|
213
221
|
}
|
|
214
|
-
function
|
|
215
|
-
return Object.assign(e, { [
|
|
222
|
+
function me(e) {
|
|
223
|
+
return Object.assign(e, { [ae]: !0 });
|
|
216
224
|
}
|
|
217
225
|
function j(e) {
|
|
218
|
-
for (const [t, r] of
|
|
226
|
+
for (const [t, r] of ce)
|
|
219
227
|
if (r.canHandle(e)) {
|
|
220
|
-
const [
|
|
228
|
+
const [s, n] = r.serialize(e);
|
|
221
229
|
return [
|
|
222
230
|
{
|
|
223
231
|
type: "HANDLER",
|
|
224
232
|
name: t,
|
|
225
|
-
value:
|
|
233
|
+
value: s
|
|
226
234
|
},
|
|
227
|
-
|
|
235
|
+
n
|
|
228
236
|
];
|
|
229
237
|
}
|
|
230
238
|
return [
|
|
@@ -232,79 +240,79 @@ function j(e) {
|
|
|
232
240
|
type: "RAW",
|
|
233
241
|
value: e
|
|
234
242
|
},
|
|
235
|
-
|
|
243
|
+
de.get(e) || []
|
|
236
244
|
];
|
|
237
245
|
}
|
|
238
|
-
function
|
|
246
|
+
function k(e) {
|
|
239
247
|
switch (e.type) {
|
|
240
248
|
case "HANDLER":
|
|
241
|
-
return
|
|
249
|
+
return ce.get(e.name).deserialize(e.value);
|
|
242
250
|
case "RAW":
|
|
243
251
|
return e.value;
|
|
244
252
|
}
|
|
245
253
|
}
|
|
246
|
-
function
|
|
247
|
-
return new Promise((
|
|
248
|
-
const
|
|
249
|
-
t.set(
|
|
254
|
+
function L(e, t, r, s) {
|
|
255
|
+
return new Promise((n) => {
|
|
256
|
+
const o = De();
|
|
257
|
+
t.set(o, n), e.start && e.start(), e.postMessage(Object.assign({ id: o }, r), s);
|
|
250
258
|
});
|
|
251
259
|
}
|
|
252
|
-
function
|
|
260
|
+
function De() {
|
|
253
261
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
254
262
|
}
|
|
255
|
-
const
|
|
263
|
+
const Be = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 1, 10, 14, 1, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11])), Ce = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 2, 8, 1, 1, 97, 1, 98, 3, 127, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 5, 1, 1, 97, 3, 1])), je = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 7, 1, 5, 0, 208, 112, 26, 11])), Ve = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 12, 1, 10, 0, 67, 0, 0, 0, 0, 252, 0, 26, 11])), $e = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 192, 26, 11])), Fe = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11])), _e = () => (async (e) => {
|
|
256
264
|
try {
|
|
257
265
|
return typeof MessageChannel < "u" && new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)), WebAssembly.validate(e);
|
|
258
266
|
} catch {
|
|
259
267
|
return !1;
|
|
260
268
|
}
|
|
261
269
|
})(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11]));
|
|
262
|
-
function
|
|
270
|
+
function He() {
|
|
263
271
|
const e = navigator.userAgent.toLowerCase();
|
|
264
272
|
return e.includes("safari") && !e.includes("chrome");
|
|
265
273
|
}
|
|
266
274
|
async function qe() {
|
|
267
|
-
if (!await
|
|
275
|
+
if (!await _e()) return !1;
|
|
268
276
|
if (!("importScripts" in self))
|
|
269
277
|
throw Error("Not implemented");
|
|
270
|
-
return
|
|
278
|
+
return He() ? !1 : "Worker" in self;
|
|
271
279
|
}
|
|
272
280
|
async function Ge() {
|
|
273
281
|
const e = [
|
|
274
|
-
Be(),
|
|
275
|
-
$e(),
|
|
276
282
|
Ce(),
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
je(),
|
|
284
|
+
Be(),
|
|
285
|
+
Ve(),
|
|
286
|
+
$e()
|
|
279
287
|
];
|
|
280
288
|
if (!(await Promise.all(e)).every(Boolean))
|
|
281
289
|
throw new Error("Browser doesn't meet minimum requirements!");
|
|
282
290
|
return await Fe() ? await qe() ? "advanced-threads" : "advanced" : "basic";
|
|
283
291
|
}
|
|
284
|
-
const
|
|
292
|
+
const ee = "application/javascript", Ye = (e, t = {}) => {
|
|
285
293
|
const r = {
|
|
286
294
|
skipSameOrigin: !0,
|
|
287
295
|
useBlob: !0,
|
|
288
296
|
...t
|
|
289
297
|
};
|
|
290
298
|
return r.skipSameOrigin && new URL(e).origin === self.location.origin ? Promise.resolve(e) : new Promise(
|
|
291
|
-
(
|
|
299
|
+
(s, n) => void fetch(e).then((o) => o.text()).then((o) => {
|
|
292
300
|
new URL(e).href.split("/").pop();
|
|
293
301
|
let a = "";
|
|
294
302
|
if (r.useBlob) {
|
|
295
|
-
const
|
|
296
|
-
a = URL.createObjectURL(
|
|
303
|
+
const l = new Blob([o], { type: ee });
|
|
304
|
+
a = URL.createObjectURL(l);
|
|
297
305
|
} else
|
|
298
|
-
a = `data:${
|
|
299
|
-
|
|
300
|
-
}).catch(
|
|
306
|
+
a = `data:${ee},` + encodeURIComponent(o);
|
|
307
|
+
s(a);
|
|
308
|
+
}).catch(n)
|
|
301
309
|
);
|
|
302
310
|
};
|
|
303
311
|
function Ke() {
|
|
304
312
|
const e = self.navigator.userAgent.toLowerCase();
|
|
305
313
|
return /iphone|ipad|ipod/.test(e);
|
|
306
314
|
}
|
|
307
|
-
function
|
|
315
|
+
function Xe(e) {
|
|
308
316
|
return {
|
|
309
317
|
licenseId: e.licenseId,
|
|
310
318
|
licensee: e.licensee,
|
|
@@ -315,7 +323,7 @@ function Ye(e) {
|
|
|
315
323
|
sdkVersion: e.sdkVersion
|
|
316
324
|
};
|
|
317
325
|
}
|
|
318
|
-
async function
|
|
326
|
+
async function te(e, t = "https://baltazar.microblink.com/api/v2/status/check") {
|
|
319
327
|
if (!t || typeof t != "string")
|
|
320
328
|
throw new Error("Invalid baltazarUrl: must be a non-empty string");
|
|
321
329
|
try {
|
|
@@ -330,67 +338,21 @@ async function X(e, t = "https://baltazar.microblink.com/api/v2/status/check") {
|
|
|
330
338
|
"Content-Type": "application/json"
|
|
331
339
|
},
|
|
332
340
|
cache: "no-cache",
|
|
333
|
-
body: JSON.stringify(
|
|
341
|
+
body: JSON.stringify(Xe(e))
|
|
334
342
|
});
|
|
335
343
|
if (!r.ok)
|
|
336
344
|
throw new Error(
|
|
337
345
|
`Server returned error: ${r.status} ${r.statusText}`
|
|
338
346
|
);
|
|
339
|
-
return await r.
|
|
347
|
+
return await r.text();
|
|
340
348
|
} catch (r) {
|
|
341
349
|
throw console.error("Server permission request failed:", r), r;
|
|
342
350
|
}
|
|
343
351
|
}
|
|
344
|
-
function
|
|
352
|
+
function re(e) {
|
|
345
353
|
return Math.ceil(e * 1024 * 1024 / 64 / 1024);
|
|
346
354
|
}
|
|
347
|
-
|
|
348
|
-
wasm: Xe,
|
|
349
|
-
data: Qe
|
|
350
|
-
};
|
|
351
|
-
function et(e, t, r) {
|
|
352
|
-
return Ze[e][t][r];
|
|
353
|
-
}
|
|
354
|
-
async function Z(e, t, r, o, s) {
|
|
355
|
-
var d;
|
|
356
|
-
const n = await fetch(e);
|
|
357
|
-
if (!s)
|
|
358
|
-
return n.arrayBuffer();
|
|
359
|
-
const u = n.headers.get("Content-Length"), a = u ? parseInt(u, 10) : et(t, r, o);
|
|
360
|
-
if (isNaN(a) || a <= 0)
|
|
361
|
-
throw new Error(
|
|
362
|
-
`Invalid content length for ${t} file: ${a}`
|
|
363
|
-
);
|
|
364
|
-
let c = 0;
|
|
365
|
-
const i = new TransformStream({
|
|
366
|
-
transform(f, p) {
|
|
367
|
-
c += f.length;
|
|
368
|
-
const C = Math.min(
|
|
369
|
-
Math.round(c / a * 100),
|
|
370
|
-
100
|
|
371
|
-
);
|
|
372
|
-
s({
|
|
373
|
-
loaded: c,
|
|
374
|
-
contentLength: a,
|
|
375
|
-
progress: C,
|
|
376
|
-
finished: !1
|
|
377
|
-
}), p.enqueue(f);
|
|
378
|
-
},
|
|
379
|
-
flush() {
|
|
380
|
-
s({
|
|
381
|
-
loaded: c,
|
|
382
|
-
contentLength: a,
|
|
383
|
-
progress: 100,
|
|
384
|
-
finished: !0
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
return new Response(
|
|
389
|
-
(d = n.body) == null ? void 0 : d.pipeThrough(i),
|
|
390
|
-
n
|
|
391
|
-
).arrayBuffer();
|
|
392
|
-
}
|
|
393
|
-
function U(...e) {
|
|
355
|
+
function I(...e) {
|
|
394
356
|
const t = e.filter((r) => r).join("/").replace(/([^:]\/)\/+/g, "$1");
|
|
395
357
|
try {
|
|
396
358
|
new URL(t, "http://example.com");
|
|
@@ -399,162 +361,285 @@ function U(...e) {
|
|
|
399
361
|
}
|
|
400
362
|
return t;
|
|
401
363
|
}
|
|
402
|
-
function
|
|
364
|
+
function he(e) {
|
|
403
365
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
404
366
|
}
|
|
405
|
-
function
|
|
406
|
-
if (
|
|
367
|
+
function N(e) {
|
|
368
|
+
if (he(e) !== "Object")
|
|
407
369
|
return !1;
|
|
408
370
|
const t = Object.getPrototypeOf(e);
|
|
409
371
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
410
372
|
}
|
|
411
|
-
function
|
|
412
|
-
return
|
|
373
|
+
function ne(e) {
|
|
374
|
+
return he(e) === "Symbol";
|
|
413
375
|
}
|
|
414
|
-
function
|
|
415
|
-
const
|
|
416
|
-
|
|
376
|
+
function se(e, t, r, s) {
|
|
377
|
+
const n = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
378
|
+
n === "enumerable" && (e[t] = r), n === "nonenumerable" && Object.defineProperty(e, t, {
|
|
417
379
|
value: r,
|
|
418
380
|
enumerable: !1,
|
|
419
381
|
writable: !0,
|
|
420
382
|
configurable: !0
|
|
421
383
|
});
|
|
422
384
|
}
|
|
423
|
-
function
|
|
424
|
-
if (!
|
|
385
|
+
function ge(e, t, r) {
|
|
386
|
+
if (!N(t))
|
|
425
387
|
return t;
|
|
426
|
-
let
|
|
427
|
-
if (
|
|
428
|
-
const a = Object.getOwnPropertyNames(e),
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
return (!
|
|
388
|
+
let s = {};
|
|
389
|
+
if (N(e)) {
|
|
390
|
+
const a = Object.getOwnPropertyNames(e), l = Object.getOwnPropertySymbols(e);
|
|
391
|
+
s = [...a, ...l].reduce((i, u) => {
|
|
392
|
+
const f = e[u];
|
|
393
|
+
return (!ne(u) && !Object.getOwnPropertyNames(t).includes(u) || ne(u) && !Object.getOwnPropertySymbols(t).includes(u)) && se(i, u, f, e), i;
|
|
432
394
|
}, {});
|
|
433
395
|
}
|
|
434
|
-
const
|
|
435
|
-
return [...
|
|
436
|
-
let i = t[
|
|
437
|
-
const
|
|
438
|
-
return
|
|
439
|
-
},
|
|
396
|
+
const n = Object.getOwnPropertyNames(t), o = Object.getOwnPropertySymbols(t);
|
|
397
|
+
return [...n, ...o].reduce((a, l) => {
|
|
398
|
+
let i = t[l];
|
|
399
|
+
const u = N(e) ? e[l] : void 0;
|
|
400
|
+
return u !== void 0 && N(i) && (i = ge(u, i)), se(a, l, i, t), a;
|
|
401
|
+
}, s);
|
|
440
402
|
}
|
|
441
|
-
function
|
|
442
|
-
return t.reduce((r,
|
|
403
|
+
function Je(e, ...t) {
|
|
404
|
+
return t.reduce((r, s) => ge(r, s), e);
|
|
443
405
|
}
|
|
444
|
-
function
|
|
406
|
+
function pe(e) {
|
|
445
407
|
return {
|
|
446
408
|
country: (e == null ? void 0 : e.country) ?? void 0,
|
|
447
409
|
region: (e == null ? void 0 : e.region) ?? void 0,
|
|
448
410
|
type: (e == null ? void 0 : e.type) ?? void 0
|
|
449
411
|
};
|
|
450
412
|
}
|
|
451
|
-
const
|
|
452
|
-
documentFilter:
|
|
413
|
+
const Qe = (e) => ({
|
|
414
|
+
documentFilter: pe(e.documentFilter),
|
|
453
415
|
fields: e.fields ?? []
|
|
454
|
-
}),
|
|
455
|
-
documentFilter:
|
|
416
|
+
}), Ze = (e) => ({
|
|
417
|
+
documentFilter: pe(e.documentFilter),
|
|
456
418
|
fields: e.fields || [],
|
|
457
419
|
documentNumberAnonymizationSettings: e.documentNumberAnonymizationSettings ? {
|
|
458
420
|
prefixDigitsVisible: e.documentNumberAnonymizationSettings.prefixDigitsVisible,
|
|
459
421
|
suffixDigitsVisible: e.documentNumberAnonymizationSettings.suffixDigitsVisible
|
|
460
422
|
} : void 0
|
|
461
423
|
});
|
|
462
|
-
function
|
|
463
|
-
var
|
|
424
|
+
function et(e = {}, t) {
|
|
425
|
+
var c, a, l, i;
|
|
464
426
|
e && (e = Object.fromEntries(
|
|
465
|
-
Object.entries(e).filter(([
|
|
427
|
+
Object.entries(e).filter(([u, f]) => f !== void 0)
|
|
466
428
|
));
|
|
467
|
-
const r = ((a = (
|
|
468
|
-
|
|
469
|
-
)) ?? [],
|
|
470
|
-
|
|
471
|
-
)) ?? [],
|
|
429
|
+
const r = ((a = (c = e == null ? void 0 : e.scanningSettings) == null ? void 0 : c.customDocumentRules) == null ? void 0 : a.map(
|
|
430
|
+
Qe
|
|
431
|
+
)) ?? [], s = ((i = (l = e == null ? void 0 : e.scanningSettings) == null ? void 0 : l.customDocumentAnonymizationSettings) == null ? void 0 : i.map(
|
|
432
|
+
Ze
|
|
433
|
+
)) ?? [], n = {
|
|
472
434
|
...e == null ? void 0 : e.scanningSettings,
|
|
473
435
|
customDocumentRules: r,
|
|
474
|
-
customDocumentAnonymizationSettings:
|
|
436
|
+
customDocumentAnonymizationSettings: s
|
|
475
437
|
};
|
|
476
|
-
return
|
|
438
|
+
return Je(t, {
|
|
477
439
|
...e,
|
|
478
|
-
scanningSettings:
|
|
440
|
+
scanningSettings: n
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
const tt = { basic: { full: 3242579, lightweight: 3280109 }, advanced: { full: 3261412, lightweight: 3297593 }, "advanced-threads": { full: 3308419, lightweight: 3343699 } }, rt = { basic: { full: 13393962, lightweight: 11761277 }, advanced: { full: 13393962, lightweight: 11761277 }, "advanced-threads": { full: 13393962, lightweight: 11761277 } }, nt = {
|
|
444
|
+
wasm: tt,
|
|
445
|
+
data: rt
|
|
446
|
+
};
|
|
447
|
+
function st(e, t, r) {
|
|
448
|
+
return nt[e][t][r];
|
|
449
|
+
}
|
|
450
|
+
async function oe(e, t, r, s, n) {
|
|
451
|
+
var f;
|
|
452
|
+
const o = await fetch(e);
|
|
453
|
+
if (!n)
|
|
454
|
+
return o.arrayBuffer();
|
|
455
|
+
const c = o.headers.get("Content-Length"), a = c ? parseInt(c, 10) : st(t, r, s);
|
|
456
|
+
if (isNaN(a) || a <= 0)
|
|
457
|
+
throw new Error(
|
|
458
|
+
`Invalid content length for ${t} file: ${a}`
|
|
459
|
+
);
|
|
460
|
+
let l = 0;
|
|
461
|
+
const i = new TransformStream({
|
|
462
|
+
transform(h, w) {
|
|
463
|
+
l += h.length;
|
|
464
|
+
const V = Math.min(
|
|
465
|
+
Math.round(l / a * 100),
|
|
466
|
+
100
|
|
467
|
+
);
|
|
468
|
+
n({
|
|
469
|
+
loaded: l,
|
|
470
|
+
contentLength: a,
|
|
471
|
+
progress: V,
|
|
472
|
+
finished: !1
|
|
473
|
+
}), w.enqueue(h);
|
|
474
|
+
},
|
|
475
|
+
flush() {
|
|
476
|
+
n({
|
|
477
|
+
loaded: l,
|
|
478
|
+
contentLength: a,
|
|
479
|
+
progress: 100,
|
|
480
|
+
finished: !0
|
|
481
|
+
});
|
|
482
|
+
}
|
|
479
483
|
});
|
|
484
|
+
return new Response(
|
|
485
|
+
(f = o.body) == null ? void 0 : f.pipeThrough(i),
|
|
486
|
+
o
|
|
487
|
+
).arrayBuffer();
|
|
480
488
|
}
|
|
481
|
-
class
|
|
482
|
-
constructor(t, r) {
|
|
483
|
-
super(`Proxy URL validation failed for "${
|
|
489
|
+
class F extends Error {
|
|
490
|
+
constructor(t, r, s) {
|
|
491
|
+
super(`Proxy URL validation failed for "${s}": ${r}`), this.code = t, this.url = s, this.name = "ProxyUrlValidationError";
|
|
484
492
|
}
|
|
485
493
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
494
|
+
function ot(e) {
|
|
495
|
+
const t = e.unlockResult === "requires-server-permission", { allowPingProxy: r, allowBaltazarProxy: s, hasPing: n } = e;
|
|
496
|
+
if (!r && !s)
|
|
497
|
+
throw new Error(
|
|
498
|
+
"Microblink proxy URL is set but your license doesn't permit proxy usage. Check your license."
|
|
499
|
+
);
|
|
500
|
+
if (!t && !n)
|
|
501
|
+
throw new Error(
|
|
502
|
+
"Microblink proxy URL is set but your license doesn't permit proxy usage. Check your license."
|
|
503
|
+
);
|
|
504
|
+
if (!t && n && s && !r || t && !n && !s && r)
|
|
505
|
+
throw new Error(
|
|
506
|
+
"Microblink proxy URL is set but your license doesn't permit proxy usage. Check your license."
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
function at(e) {
|
|
510
|
+
let t;
|
|
511
|
+
try {
|
|
512
|
+
t = new URL(e);
|
|
513
|
+
} catch {
|
|
514
|
+
throw new F(
|
|
515
|
+
"INVALID_PROXY_URL",
|
|
516
|
+
`Failed to create URL instance for provided Microblink proxy URL "${e}". Expected format: https://your-proxy.com or https://your-proxy.com/`,
|
|
517
|
+
e
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
if (t.protocol !== "https:")
|
|
521
|
+
throw new F(
|
|
522
|
+
"HTTPS_REQUIRED",
|
|
523
|
+
`Proxy URL validation failed for "${e}": HTTPS protocol must be used. Expected format: https://your-proxy.com or https://your-proxy.com/`,
|
|
524
|
+
e
|
|
525
|
+
);
|
|
526
|
+
const r = t.origin;
|
|
527
|
+
try {
|
|
528
|
+
const s = new URL("/api/v2/status/check", r).toString();
|
|
529
|
+
return {
|
|
530
|
+
ping: r,
|
|
531
|
+
baltazar: s
|
|
532
|
+
};
|
|
533
|
+
} catch {
|
|
534
|
+
throw new F(
|
|
535
|
+
"INVALID_PROXY_URL",
|
|
536
|
+
"Failed to build baltazar service URL",
|
|
537
|
+
e
|
|
538
|
+
);
|
|
491
539
|
}
|
|
492
540
|
}
|
|
493
|
-
var
|
|
494
|
-
class
|
|
541
|
+
var m, v, A, U, T, b, O, P, ye, D;
|
|
542
|
+
class it {
|
|
495
543
|
constructor() {
|
|
496
|
-
|
|
544
|
+
p(this, P);
|
|
497
545
|
/**
|
|
498
546
|
* The Wasm module.
|
|
499
547
|
*/
|
|
500
|
-
|
|
548
|
+
p(this, m);
|
|
501
549
|
/**
|
|
502
550
|
* The default session settings.
|
|
503
551
|
*
|
|
504
552
|
* Must be initialized when calling initBlinkId.
|
|
505
553
|
*/
|
|
506
|
-
|
|
554
|
+
p(this, v);
|
|
507
555
|
/**
|
|
508
556
|
* The progress status callback.
|
|
509
557
|
*/
|
|
510
|
-
|
|
558
|
+
x(this, "progressStatusCallback");
|
|
511
559
|
/**
|
|
512
560
|
* Whether the demo overlay is shown.
|
|
513
561
|
*/
|
|
514
|
-
|
|
562
|
+
p(this, A, !0);
|
|
515
563
|
/**
|
|
516
564
|
* Whether the production overlay is shown.
|
|
517
565
|
*/
|
|
518
|
-
|
|
566
|
+
p(this, U, !0);
|
|
567
|
+
/**
|
|
568
|
+
* Current session number.
|
|
569
|
+
*/
|
|
570
|
+
p(this, T, 0);
|
|
519
571
|
/**
|
|
520
572
|
* Sanitized proxy URLs for Microblink services.
|
|
521
573
|
*/
|
|
522
|
-
|
|
574
|
+
p(this, b);
|
|
575
|
+
p(this, O);
|
|
576
|
+
}
|
|
577
|
+
reportPinglet(t) {
|
|
578
|
+
if (!d(this, m))
|
|
579
|
+
throw new Error("Wasm module not loaded");
|
|
580
|
+
d(this, m).isPingEnabled() && d(this, m).queuePinglet(
|
|
581
|
+
JSON.stringify(t.data),
|
|
582
|
+
t.schemaName,
|
|
583
|
+
t.schemaVersion,
|
|
584
|
+
// session number can be overriden by pinglet, otherwise use current
|
|
585
|
+
// session count
|
|
586
|
+
t.sessionNumber ?? d(this, T)
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
sendPinglets() {
|
|
590
|
+
if (!d(this, m))
|
|
591
|
+
throw new Error("Wasm module not loaded");
|
|
592
|
+
d(this, m).sendPinglets();
|
|
523
593
|
}
|
|
524
594
|
/**
|
|
525
595
|
* This method initializes everything.
|
|
526
596
|
*/
|
|
527
|
-
async initBlinkId(t, r,
|
|
528
|
-
var
|
|
529
|
-
const
|
|
597
|
+
async initBlinkId(t, r, s) {
|
|
598
|
+
var a;
|
|
599
|
+
const n = new URL(
|
|
530
600
|
"resources/",
|
|
531
601
|
t.resourcesLocation
|
|
532
602
|
).toString();
|
|
533
|
-
if (
|
|
534
|
-
resourceUrl:
|
|
603
|
+
if (y(this, v, r), this.progressStatusCallback = s, y(this, O, t.userId), await R(this, P, ye).call(this, {
|
|
604
|
+
resourceUrl: n,
|
|
535
605
|
variant: t.wasmVariant,
|
|
536
606
|
initialMemory: t.initialMemory,
|
|
537
607
|
useLightweightBuild: t.useLightweightBuild
|
|
538
|
-
}), !
|
|
608
|
+
}), !d(this, m))
|
|
539
609
|
throw new Error("Wasm module not loaded");
|
|
540
|
-
const
|
|
610
|
+
const o = new lt({
|
|
611
|
+
packageName: self.location.hostname,
|
|
612
|
+
platform: "Emscripten",
|
|
613
|
+
product: "BlinkID",
|
|
614
|
+
userId: d(this, O)
|
|
615
|
+
});
|
|
616
|
+
this.reportPinglet(o), this.sendPinglets();
|
|
617
|
+
const c = d(this, m).initializeWithLicenseKey(
|
|
541
618
|
t.licenseKey,
|
|
542
619
|
t.userId,
|
|
543
620
|
!1
|
|
544
621
|
);
|
|
545
|
-
if (
|
|
546
|
-
throw
|
|
547
|
-
|
|
622
|
+
if (this.sendPinglets(), c.licenseError)
|
|
623
|
+
throw R(this, P, D).call(this, {
|
|
624
|
+
errorType: "Crash",
|
|
625
|
+
errorMessage: c.licenseError
|
|
626
|
+
}), this.sendPinglets(), new ut(
|
|
627
|
+
"License unlock error: " + c.licenseError,
|
|
548
628
|
"LICENSE_ERROR"
|
|
549
629
|
);
|
|
550
|
-
if (t.microblinkProxyUrl &&
|
|
551
|
-
const
|
|
552
|
-
|
|
630
|
+
if (t.microblinkProxyUrl && (ot(c), y(this, b, at(t.microblinkProxyUrl)), c.allowPingProxy && c.hasPing && (d(this, m).setPingProxyUrl(d(this, b).ping), console.debug(`Using ping proxy URL: ${d(this, b).ping}`))), c.unlockResult === "requires-server-permission") {
|
|
631
|
+
const i = ((a = d(this, b)) == null ? void 0 : a.baltazar) && c.allowBaltazarProxy ? d(this, b).baltazar : void 0;
|
|
632
|
+
i && console.debug(`Using Baltazar proxy URL: ${i}`);
|
|
633
|
+
const u = i ? await te(c, i) : await te(c), f = d(this, m).submitServerPermission(
|
|
634
|
+
u
|
|
553
635
|
);
|
|
554
|
-
if (
|
|
555
|
-
throw
|
|
636
|
+
if (f != null && f.error)
|
|
637
|
+
throw R(this, P, D).call(this, {
|
|
638
|
+
errorType: "Crash",
|
|
639
|
+
errorMessage: f.error
|
|
640
|
+
}), this.sendPinglets(), new Error("Server unlock error: " + f.error);
|
|
556
641
|
}
|
|
557
|
-
|
|
642
|
+
console.debug(`BlinkID SDK ${c.sdkVersion} unlocked`), y(this, A, c.showDemoOverlay), y(this, U, c.showProductionOverlay), d(this, m).initializeSdk(t.userId), this.sendPinglets();
|
|
558
643
|
}
|
|
559
644
|
/**
|
|
560
645
|
* This method creates a BlinkID scanning session.
|
|
@@ -563,13 +648,16 @@ class at {
|
|
|
563
648
|
* @returns The session.
|
|
564
649
|
*/
|
|
565
650
|
createBlinkIdScanningSession(t) {
|
|
566
|
-
if (!
|
|
651
|
+
if (!d(this, m))
|
|
567
652
|
throw new Error("Wasm module not loaded");
|
|
568
|
-
const r =
|
|
653
|
+
const r = et(
|
|
569
654
|
t,
|
|
570
|
-
|
|
571
|
-
),
|
|
572
|
-
|
|
655
|
+
d(this, v)
|
|
656
|
+
), s = d(this, m).createBlinkIdScanningSession(
|
|
657
|
+
r,
|
|
658
|
+
d(this, O)
|
|
659
|
+
);
|
|
660
|
+
return this.sendPinglets(), Q(this, T)._++, this.createProxySession(s, r);
|
|
573
661
|
}
|
|
574
662
|
/**
|
|
575
663
|
* This method creates a proxy session.
|
|
@@ -579,28 +667,33 @@ class at {
|
|
|
579
667
|
* @returns The proxy session.
|
|
580
668
|
*/
|
|
581
669
|
createProxySession(t, r) {
|
|
582
|
-
return
|
|
670
|
+
return me({
|
|
583
671
|
getResult: () => t.getResult(),
|
|
584
|
-
process: (
|
|
585
|
-
const
|
|
586
|
-
if ("error" in
|
|
587
|
-
throw
|
|
588
|
-
|
|
672
|
+
process: (n) => {
|
|
673
|
+
const o = t.process(n);
|
|
674
|
+
if ("error" in o)
|
|
675
|
+
throw R(this, P, D).call(this, {
|
|
676
|
+
errorType: "NonFatal",
|
|
677
|
+
errorMessage: o.error
|
|
678
|
+
}), new Error(`Error processing frame: ${o.error}`);
|
|
679
|
+
return fe(
|
|
589
680
|
{
|
|
590
|
-
...
|
|
591
|
-
arrayBuffer:
|
|
681
|
+
...o,
|
|
682
|
+
arrayBuffer: n.data.buffer
|
|
592
683
|
},
|
|
593
|
-
[
|
|
684
|
+
[n.data.buffer]
|
|
594
685
|
);
|
|
595
686
|
},
|
|
687
|
+
ping: (n) => this.reportPinglet(n),
|
|
688
|
+
sendPinglets: () => this.sendPinglets(),
|
|
596
689
|
getSettings: () => r,
|
|
597
690
|
reset: () => t.reset(),
|
|
598
691
|
delete: () => t.delete(),
|
|
599
692
|
deleteLater: () => t.deleteLater(),
|
|
600
693
|
isDeleted: () => t.isDeleted(),
|
|
601
|
-
isAliasOf: (
|
|
602
|
-
showDemoOverlay: () =>
|
|
603
|
-
showProductionOverlay: () =>
|
|
694
|
+
isAliasOf: (n) => t.isAliasOf(n),
|
|
695
|
+
showDemoOverlay: () => d(this, A),
|
|
696
|
+
showProductionOverlay: () => d(this, U)
|
|
604
697
|
});
|
|
605
698
|
}
|
|
606
699
|
/**
|
|
@@ -611,171 +704,124 @@ class at {
|
|
|
611
704
|
/**
|
|
612
705
|
* Terminates the workers and the Wasm runtime.
|
|
613
706
|
*/
|
|
614
|
-
terminate() {
|
|
615
|
-
self.close()
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
707
|
+
async terminate() {
|
|
708
|
+
if (self.setTimeout(() => self.close, 5e3), !d(this, m)) {
|
|
709
|
+
console.warn(
|
|
710
|
+
"No Wasm module loaded during worker termination. Skipping cleanup."
|
|
711
|
+
), self.close();
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
d(this, m).terminateSdk(), await new Promise((s) => setTimeout(s, 0)), this.sendPinglets();
|
|
715
|
+
const r = Date.now();
|
|
716
|
+
for (; d(this, m).arePingRequestsInProgress() && Date.now() - r < 5e3; )
|
|
717
|
+
await new Promise((s) => setTimeout(s, 100));
|
|
718
|
+
y(this, m, void 0), console.debug("BlinkIdWorker terminated 🔴"), self.close();
|
|
624
719
|
}
|
|
625
720
|
}
|
|
626
|
-
|
|
721
|
+
m = new WeakMap(), v = new WeakMap(), A = new WeakMap(), U = new WeakMap(), T = new WeakMap(), b = new WeakMap(), O = new WeakMap(), P = new WeakSet(), ye = async function({
|
|
627
722
|
resourceUrl: t,
|
|
628
723
|
variant: r,
|
|
629
|
-
useLightweightBuild:
|
|
630
|
-
initialMemory:
|
|
724
|
+
useLightweightBuild: s,
|
|
725
|
+
initialMemory: n
|
|
631
726
|
}) {
|
|
632
|
-
if (
|
|
727
|
+
if (d(this, m)) {
|
|
633
728
|
console.log("Wasm already loaded");
|
|
634
729
|
return;
|
|
635
730
|
}
|
|
636
|
-
const
|
|
731
|
+
const o = r ?? await Ge(), c = s ? "lightweight" : "full", a = "BlinkIdModule", l = I(
|
|
637
732
|
t,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
), i =
|
|
733
|
+
c,
|
|
734
|
+
o
|
|
735
|
+
), i = I(l, `${a}.js`), u = I(l, `${a}.wasm`), f = I(l, `${a}.data`), h = await Ye(i), V = (await import(
|
|
641
736
|
/* @vite-ignore */
|
|
642
|
-
|
|
737
|
+
h
|
|
643
738
|
)).default;
|
|
644
|
-
|
|
739
|
+
n || (n = Ke() ? 700 : 200);
|
|
645
740
|
const we = new WebAssembly.Memory({
|
|
646
|
-
initial:
|
|
647
|
-
maximum:
|
|
648
|
-
shared:
|
|
741
|
+
initial: re(n),
|
|
742
|
+
maximum: re(2048),
|
|
743
|
+
shared: o === "advanced-threads"
|
|
649
744
|
});
|
|
650
|
-
let
|
|
651
|
-
const be = 32,
|
|
652
|
-
if (!this.progressStatusCallback || !
|
|
745
|
+
let S, E, q = 0;
|
|
746
|
+
const be = 32, G = () => {
|
|
747
|
+
if (!this.progressStatusCallback || !S || !E)
|
|
653
748
|
return;
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
loaded:
|
|
657
|
-
contentLength:
|
|
658
|
-
progress:
|
|
659
|
-
finished:
|
|
749
|
+
const g = S.finished && E.finished, Y = S.loaded + E.loaded, K = S.contentLength + E.contentLength, ke = g ? 100 : Math.min(Math.round(Y / K * 100), 100), X = performance.now();
|
|
750
|
+
X - q < be || (q = X, this.progressStatusCallback({
|
|
751
|
+
loaded: Y,
|
|
752
|
+
contentLength: K,
|
|
753
|
+
progress: ke,
|
|
754
|
+
finished: g
|
|
660
755
|
}));
|
|
661
|
-
}, Pe = (
|
|
662
|
-
|
|
663
|
-
}, Se = (
|
|
664
|
-
|
|
756
|
+
}, Pe = (g) => {
|
|
757
|
+
S = g, G();
|
|
758
|
+
}, Se = (g) => {
|
|
759
|
+
E = g, G();
|
|
665
760
|
}, [Ee, xe] = await Promise.all([
|
|
666
|
-
|
|
667
|
-
l,
|
|
668
|
-
"wasm",
|
|
669
|
-
n,
|
|
761
|
+
oe(
|
|
670
762
|
u,
|
|
763
|
+
"wasm",
|
|
764
|
+
o,
|
|
765
|
+
c,
|
|
671
766
|
Pe
|
|
672
767
|
),
|
|
673
|
-
|
|
674
|
-
|
|
768
|
+
oe(
|
|
769
|
+
f,
|
|
675
770
|
"data",
|
|
676
|
-
|
|
677
|
-
|
|
771
|
+
o,
|
|
772
|
+
c,
|
|
678
773
|
Se
|
|
679
774
|
)
|
|
680
775
|
]);
|
|
681
|
-
if (this.progressStatusCallback &&
|
|
682
|
-
const
|
|
776
|
+
if (this.progressStatusCallback && S && E) {
|
|
777
|
+
const g = S.contentLength + E.contentLength;
|
|
683
778
|
this.progressStatusCallback({
|
|
684
|
-
loaded:
|
|
685
|
-
contentLength:
|
|
779
|
+
loaded: g,
|
|
780
|
+
contentLength: g,
|
|
686
781
|
progress: 100,
|
|
687
782
|
finished: !0
|
|
688
783
|
});
|
|
689
784
|
}
|
|
690
|
-
if (
|
|
691
|
-
locateFile: (
|
|
785
|
+
if (y(this, m, await V({
|
|
786
|
+
locateFile: (g) => `${l}/${o}/${g}`,
|
|
692
787
|
// pthreads build breaks without this:
|
|
693
788
|
// "Failed to execute 'createObjectURL' on 'URL': Overload resolution failed."
|
|
694
|
-
mainScriptUrlOrBlob:
|
|
789
|
+
mainScriptUrlOrBlob: h,
|
|
695
790
|
wasmBinary: Ee,
|
|
696
791
|
getPreloadedPackage() {
|
|
697
792
|
return xe;
|
|
698
793
|
},
|
|
699
794
|
wasmMemory: we,
|
|
700
795
|
noExitRuntime: !0
|
|
701
|
-
})), !
|
|
796
|
+
})), !d(this, m))
|
|
702
797
|
throw new Error("Failed to load Wasm module");
|
|
703
|
-
},
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
v(this, g, ge).call(this, r, t);
|
|
714
|
-
try {
|
|
715
|
-
x(this, w, v(this, g, ye).call(this, t)), r.allowPingProxy && m(this, h).setPingProxyUrl(m(this, w).ping), console.debug("Proxy URLs configured successfully:", {
|
|
716
|
-
ping: m(this, w).ping,
|
|
717
|
-
baltazar: m(this, w).baltazar
|
|
718
|
-
});
|
|
719
|
-
} catch (o) {
|
|
720
|
-
throw o instanceof T ? new Error(
|
|
721
|
-
`${o.message}
|
|
722
|
-
|
|
723
|
-
Troubleshooting:
|
|
724
|
-
- Ensure the URL is accessible
|
|
725
|
-
- Check HTTPS requirements
|
|
726
|
-
- Verify proxy server implementation`
|
|
727
|
-
) : o;
|
|
728
|
-
}
|
|
729
|
-
}, /**
|
|
730
|
-
* Validates that the license allows proxy usage.
|
|
731
|
-
*/
|
|
732
|
-
ge = function(t, r) {
|
|
733
|
-
if (!t.allowPingProxy && !t.allowBaltazarProxy)
|
|
734
|
-
throw new Error(
|
|
735
|
-
`Proxy URL "${r}" was provided, but your license does not permit proxy usage.
|
|
736
|
-
License permissions: pingProxy=${t.allowPingProxy}, baltazarProxy=${t.allowBaltazarProxy}
|
|
737
|
-
Check your license.`
|
|
738
|
-
);
|
|
739
|
-
if (!t.hasPing && t.unlockResult !== "requires-server-permission")
|
|
740
|
-
throw new Error(
|
|
741
|
-
`Microblink proxy URL is set but cannot be used because ping and online license check are disabled in your license.
|
|
742
|
-
Check your license.`
|
|
743
|
-
);
|
|
744
|
-
}, /**
|
|
745
|
-
* Validates and sanitizes proxy URLs for different Microblink services.
|
|
746
|
-
*/
|
|
747
|
-
ye = function(t) {
|
|
748
|
-
let r;
|
|
749
|
-
try {
|
|
750
|
-
r = new URL(t);
|
|
751
|
-
} catch {
|
|
752
|
-
throw new T(
|
|
753
|
-
`Failed to create URL instance for provided Microblink proxy URL "${t}". Expected format: https://your-proxy.com or https://your-proxy.com/`,
|
|
754
|
-
t
|
|
755
|
-
);
|
|
756
|
-
}
|
|
757
|
-
if (r.protocol !== "https:")
|
|
758
|
-
throw new T(
|
|
759
|
-
`Proxy URL validation failed for "${t}": HTTPS protocol must be used. Expected format: https://your-proxy.com or https://your-proxy.com/`,
|
|
760
|
-
t
|
|
761
|
-
);
|
|
762
|
-
const o = r.origin, s = v(this, g, pe).call(this, o, "/api/v2/status/check");
|
|
763
|
-
return {
|
|
764
|
-
ping: o,
|
|
765
|
-
baltazar: s
|
|
798
|
+
}, D = function(t) {
|
|
799
|
+
const r = {
|
|
800
|
+
data: {
|
|
801
|
+
errorType: t.errorType,
|
|
802
|
+
errorMessage: t.errorMessage
|
|
803
|
+
},
|
|
804
|
+
schemaName: "ping.error",
|
|
805
|
+
schemaVersion: "1.0.0"
|
|
766
806
|
};
|
|
767
|
-
|
|
768
|
-
* Builds a service URL by combining base URL with service path.
|
|
769
|
-
*/
|
|
770
|
-
pe = function(t, r) {
|
|
771
|
-
try {
|
|
772
|
-
return new URL(r, t).toString();
|
|
773
|
-
} catch {
|
|
774
|
-
throw new T(
|
|
775
|
-
`Failed to build service URL for path "${r}"`,
|
|
776
|
-
t
|
|
777
|
-
);
|
|
778
|
-
}
|
|
807
|
+
this.reportPinglet(r);
|
|
779
808
|
};
|
|
780
|
-
const
|
|
781
|
-
|
|
809
|
+
const ct = new it();
|
|
810
|
+
H(ct);
|
|
811
|
+
class lt {
|
|
812
|
+
constructor(t) {
|
|
813
|
+
x(this, "data");
|
|
814
|
+
/** Needs to be 0 for sorting purposes */
|
|
815
|
+
x(this, "sessionNumber", 0);
|
|
816
|
+
x(this, "schemaName", "ping.sdk.init.start");
|
|
817
|
+
x(this, "schemaVersion", "1.0.0");
|
|
818
|
+
this.data = t;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
class ut extends Error {
|
|
822
|
+
constructor(r, s) {
|
|
823
|
+
super(r);
|
|
824
|
+
x(this, "code");
|
|
825
|
+
this.name = "LicenseError", this.code = s;
|
|
826
|
+
}
|
|
827
|
+
}
|