@microblink/blinkid-core 7.6.1 → 7.6.3
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 +89 -84
- package/dist/resources/blinkid-worker.js +209 -206
- package/dist/resources/full/advanced/BlinkIdModule.js +2 -2
- package/dist/resources/full/advanced/BlinkIdModule.wasm +0 -0
- package/dist/resources/full/advanced-threads/BlinkIdModule.js +3 -3
- package/dist/resources/full/advanced-threads/BlinkIdModule.wasm +0 -0
- package/dist/resources/full/basic/BlinkIdModule.js +3 -3
- package/dist/resources/full/basic/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/advanced/BlinkIdModule.js +2 -2
- package/dist/resources/lightweight/advanced/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/advanced-threads/BlinkIdModule.js +4 -4
- package/dist/resources/lightweight/advanced-threads/BlinkIdModule.wasm +0 -0
- package/dist/resources/lightweight/basic/BlinkIdModule.js +3 -3
- package/dist/resources/lightweight/basic/BlinkIdModule.wasm +0 -0
- package/dist/resources/size-manifest.json +6 -6
- package/package.json +1 -1
- package/types/BlinkIdCore.d.ts.map +1 -1
- package/types/index.rollup.d.ts +4 -2
- package/types/shouldUseLightweightBuild.d.ts +16 -0
- package/types/shouldUseLightweightBuild.d.ts.map +1 -0
- package/types/shouldUseLightweightBuild.test.d.ts +5 -0
- package/types/shouldUseLightweightBuild.test.d.ts.map +1 -0
package/dist/blinkid-core.js
CHANGED
|
@@ -10,7 +10,7 @@ const C = Symbol("Comlink.proxy"), $ = Symbol("Comlink.endpoint"), _ = Symbol("C
|
|
|
10
10
|
return F(e, n), [r, [r]];
|
|
11
11
|
},
|
|
12
12
|
deserialize(e) {
|
|
13
|
-
return e.start(),
|
|
13
|
+
return e.start(), U(e);
|
|
14
14
|
}
|
|
15
15
|
}, K = {
|
|
16
16
|
canHandle: (e) => D(e) && I in e,
|
|
@@ -99,7 +99,7 @@ function J(e) {
|
|
|
99
99
|
function N(e) {
|
|
100
100
|
J(e) && e.close();
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function U(e, n) {
|
|
103
103
|
const r = /* @__PURE__ */ new Map();
|
|
104
104
|
return e.addEventListener("message", function(o) {
|
|
105
105
|
const { data: a } = o;
|
|
@@ -118,7 +118,7 @@ function E(e) {
|
|
|
118
118
|
if (e)
|
|
119
119
|
throw new Error("Proxy has been released and is not useable");
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function W(e) {
|
|
122
122
|
return v(e, /* @__PURE__ */ new Map(), {
|
|
123
123
|
type: "RELEASE"
|
|
124
124
|
}).then(() => {
|
|
@@ -127,7 +127,7 @@ function U(e) {
|
|
|
127
127
|
}
|
|
128
128
|
const x = /* @__PURE__ */ new WeakMap(), R = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
129
129
|
const n = (x.get(e) || 0) - 1;
|
|
130
|
-
x.set(e, n), n === 0 &&
|
|
130
|
+
x.set(e, n), n === 0 && W(e);
|
|
131
131
|
});
|
|
132
132
|
function Y(e, n) {
|
|
133
133
|
const r = (x.get(n) || 0) + 1;
|
|
@@ -143,7 +143,7 @@ function P(e, n, r = [], t = function() {
|
|
|
143
143
|
get(i, s) {
|
|
144
144
|
if (E(o), s === _)
|
|
145
145
|
return () => {
|
|
146
|
-
Q(a),
|
|
146
|
+
Q(a), W(e), n.clear(), o = !0;
|
|
147
147
|
};
|
|
148
148
|
if (s === "then") {
|
|
149
149
|
if (r.length === 0)
|
|
@@ -174,7 +174,7 @@ function P(e, n, r = [], t = function() {
|
|
|
174
174
|
}).then(p);
|
|
175
175
|
if (c === "bind")
|
|
176
176
|
return P(e, n, r.slice(0, -1));
|
|
177
|
-
const [l, m] =
|
|
177
|
+
const [l, m] = V(u);
|
|
178
178
|
return v(e, n, {
|
|
179
179
|
type: "APPLY",
|
|
180
180
|
path: r.map((f) => f.toString()),
|
|
@@ -183,7 +183,7 @@ function P(e, n, r = [], t = function() {
|
|
|
183
183
|
},
|
|
184
184
|
construct(i, s) {
|
|
185
185
|
E(o);
|
|
186
|
-
const [u, c] =
|
|
186
|
+
const [u, c] = V(s);
|
|
187
187
|
return v(e, n, {
|
|
188
188
|
type: "CONSTRUCT",
|
|
189
189
|
path: r.map((l) => l.toString()),
|
|
@@ -196,7 +196,7 @@ function P(e, n, r = [], t = function() {
|
|
|
196
196
|
function Z(e) {
|
|
197
197
|
return Array.prototype.concat.apply([], e);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function V(e) {
|
|
200
200
|
const n = e.map(T);
|
|
201
201
|
return [n.map((r) => r[0]), Z(n.map((r) => r[1]))];
|
|
202
202
|
}
|
|
@@ -245,7 +245,7 @@ function v(e, n, r, t) {
|
|
|
245
245
|
function ne() {
|
|
246
246
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const A = "application/javascript", re = (e, n = {}) => {
|
|
249
249
|
const r = {
|
|
250
250
|
skipSameOrigin: !0,
|
|
251
251
|
useBlob: !0,
|
|
@@ -272,10 +272,10 @@ const V = "application/javascript", re = (e, n = {}) => {
|
|
|
272
272
|
}).then((i) => i.text()).then((i) => {
|
|
273
273
|
let s = "";
|
|
274
274
|
if (r.useBlob) {
|
|
275
|
-
const u = new Blob([i], { type:
|
|
275
|
+
const u = new Blob([i], { type: A });
|
|
276
276
|
s = URL.createObjectURL(u);
|
|
277
277
|
} else
|
|
278
|
-
s = `data:${
|
|
278
|
+
s = `data:${A},` + encodeURIComponent(i);
|
|
279
279
|
o(s);
|
|
280
280
|
}).catch(() => {
|
|
281
281
|
a(new Error(`Failed to fetch worker from ${e}`));
|
|
@@ -516,7 +516,7 @@ const fe = (e) => e.startsWith("data:"), ge = (e) => e.startsWith("blob:"), de =
|
|
|
516
516
|
r.onerror = (o) => {
|
|
517
517
|
console.error("Worker error:", o), t[_]();
|
|
518
518
|
};
|
|
519
|
-
const t =
|
|
519
|
+
const t = U(r);
|
|
520
520
|
return t;
|
|
521
521
|
};
|
|
522
522
|
let O = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((n, r) => (r &= 63, r < 36 ? n += r.toString(36) : r < 62 ? n += (r - 26).toString(36).toUpperCase() : r > 62 ? n += "-" : n += "_", n), "");
|
|
@@ -578,69 +578,6 @@ const be = {
|
|
|
578
578
|
anonymizationMode: "full-result"
|
|
579
579
|
}
|
|
580
580
|
};
|
|
581
|
-
async function Pe(e, n) {
|
|
582
|
-
const r = await he(e.resourcesLocation);
|
|
583
|
-
e.userId || (e.userId = we()), e.resourcesLocation || (e.resourcesLocation = window.location.href), e.useLightweightBuild === void 0 && (e.useLightweightBuild = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
584
|
-
navigator.userAgent
|
|
585
|
-
));
|
|
586
|
-
const t = n ? z(n) : void 0;
|
|
587
|
-
try {
|
|
588
|
-
return await r.initBlinkId(
|
|
589
|
-
e,
|
|
590
|
-
be,
|
|
591
|
-
t
|
|
592
|
-
), r;
|
|
593
|
-
} catch (o) {
|
|
594
|
-
throw new Error("Failed to initialize BlinkID", {
|
|
595
|
-
cause: o
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
function Ae(e) {
|
|
600
|
-
return {
|
|
601
|
-
/**
|
|
602
|
-
* Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
|
|
603
|
-
*
|
|
604
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/data)
|
|
605
|
-
*/
|
|
606
|
-
data: e.data,
|
|
607
|
-
/**
|
|
608
|
-
* Returns the actual dimensions of the data in the ImageData object, in pixels.
|
|
609
|
-
*
|
|
610
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/width)
|
|
611
|
-
*/
|
|
612
|
-
width: e.width,
|
|
613
|
-
/**
|
|
614
|
-
* Returns the actual dimensions of the data in the ImageData object, in pixels.
|
|
615
|
-
*
|
|
616
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/height)
|
|
617
|
-
*/
|
|
618
|
-
height: e.height,
|
|
619
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/colorSpace) */
|
|
620
|
-
colorSpace: e.colorSpace
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
function Ve(e, n) {
|
|
624
|
-
const r = n === "first" ? 0 : 1;
|
|
625
|
-
return e.subResults[r]?.inputImage ?? null;
|
|
626
|
-
}
|
|
627
|
-
function Me(e) {
|
|
628
|
-
return e.subResults.find(
|
|
629
|
-
(n) => n.barcodeInputImage
|
|
630
|
-
)?.barcodeInputImage ?? null;
|
|
631
|
-
}
|
|
632
|
-
function Oe(e, n) {
|
|
633
|
-
const r = n === "first" ? 0 : 1;
|
|
634
|
-
return e.subResults[r]?.documentImage ?? null;
|
|
635
|
-
}
|
|
636
|
-
function Le(e) {
|
|
637
|
-
return e.subResults.find((n) => n.faceImage)?.faceImage?.image ?? null;
|
|
638
|
-
}
|
|
639
|
-
function Ce(e) {
|
|
640
|
-
return e.subResults.find(
|
|
641
|
-
(n) => n.signatureImage
|
|
642
|
-
)?.signatureImage?.image ?? null;
|
|
643
|
-
}
|
|
644
581
|
function ve() {
|
|
645
582
|
const e = navigator.userAgent;
|
|
646
583
|
if (/iPad/.test(e) || /Macintosh/.test(e) && navigator.maxTouchPoints > 1)
|
|
@@ -868,7 +805,7 @@ async function ke() {
|
|
|
868
805
|
}
|
|
869
806
|
return e;
|
|
870
807
|
}
|
|
871
|
-
async function
|
|
808
|
+
async function Pe() {
|
|
872
809
|
const e = await ke();
|
|
873
810
|
return {
|
|
874
811
|
userAgentData: e,
|
|
@@ -894,24 +831,92 @@ async function _e() {
|
|
|
894
831
|
)
|
|
895
832
|
};
|
|
896
833
|
}
|
|
834
|
+
async function Ve() {
|
|
835
|
+
const e = await Pe();
|
|
836
|
+
if (e.derivedDeviceInfo.formFactors.some(
|
|
837
|
+
(r) => r === "Mobile" || r === "Tablet"
|
|
838
|
+
) && e.memory !== void 0)
|
|
839
|
+
return e.memory < 4;
|
|
840
|
+
}
|
|
841
|
+
async function Ae(e, n) {
|
|
842
|
+
const r = await he(e.resourcesLocation);
|
|
843
|
+
e.userId || (e.userId = we()), e.resourcesLocation || (e.resourcesLocation = window.location.href), e.useLightweightBuild === void 0 && (e.useLightweightBuild = await Ve());
|
|
844
|
+
const t = n ? z(n) : void 0;
|
|
845
|
+
try {
|
|
846
|
+
return await r.initBlinkId(
|
|
847
|
+
e,
|
|
848
|
+
be,
|
|
849
|
+
t
|
|
850
|
+
), r;
|
|
851
|
+
} catch (o) {
|
|
852
|
+
throw new Error("Failed to initialize BlinkID", {
|
|
853
|
+
cause: o
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
function Me(e) {
|
|
858
|
+
return {
|
|
859
|
+
/**
|
|
860
|
+
* Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
|
|
861
|
+
*
|
|
862
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/data)
|
|
863
|
+
*/
|
|
864
|
+
data: e.data,
|
|
865
|
+
/**
|
|
866
|
+
* Returns the actual dimensions of the data in the ImageData object, in pixels.
|
|
867
|
+
*
|
|
868
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/width)
|
|
869
|
+
*/
|
|
870
|
+
width: e.width,
|
|
871
|
+
/**
|
|
872
|
+
* Returns the actual dimensions of the data in the ImageData object, in pixels.
|
|
873
|
+
*
|
|
874
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/height)
|
|
875
|
+
*/
|
|
876
|
+
height: e.height,
|
|
877
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ImageData/colorSpace) */
|
|
878
|
+
colorSpace: e.colorSpace
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function Oe(e, n) {
|
|
882
|
+
const r = n === "first" ? 0 : 1;
|
|
883
|
+
return e.subResults[r]?.inputImage ?? null;
|
|
884
|
+
}
|
|
885
|
+
function Le(e) {
|
|
886
|
+
return e.subResults.find(
|
|
887
|
+
(n) => n.barcodeInputImage
|
|
888
|
+
)?.barcodeInputImage ?? null;
|
|
889
|
+
}
|
|
890
|
+
function Ce(e, n) {
|
|
891
|
+
const r = n === "first" ? 0 : 1;
|
|
892
|
+
return e.subResults[r]?.documentImage ?? null;
|
|
893
|
+
}
|
|
894
|
+
function _e(e) {
|
|
895
|
+
return e.subResults.find((n) => n.faceImage)?.faceImage?.image ?? null;
|
|
896
|
+
}
|
|
897
|
+
function De(e) {
|
|
898
|
+
return e.subResults.find(
|
|
899
|
+
(n) => n.signatureImage
|
|
900
|
+
)?.signatureImage?.image ?? null;
|
|
901
|
+
}
|
|
897
902
|
const G = Symbol();
|
|
898
903
|
globalThis.__BLINKID_CORE__ ||= G;
|
|
899
904
|
globalThis.__BLINKID_CORE__ !== G && console.warn(
|
|
900
905
|
"Detected multiple instances of @microblink/blinkid-core. This can lead to unexpected behavior."
|
|
901
906
|
);
|
|
902
907
|
export {
|
|
903
|
-
|
|
908
|
+
Me as createCustomImageData,
|
|
904
909
|
he as createProxyWorker,
|
|
905
910
|
be as defaultSessionSettings,
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
+
Le as extractBarcodeImage,
|
|
912
|
+
_e as extractFaceImage,
|
|
913
|
+
Ce as extractSideDocumentImage,
|
|
914
|
+
Oe as extractSideInputImage,
|
|
915
|
+
De as extractSignatureImage,
|
|
911
916
|
re as getCrossOriginWorkerURL,
|
|
912
|
-
|
|
917
|
+
Pe as getDeviceInfo,
|
|
913
918
|
ke as getUserAgentData,
|
|
914
919
|
we as getUserId,
|
|
915
|
-
|
|
920
|
+
Ae as loadBlinkIdCore,
|
|
916
921
|
pe as testLocalStorage
|
|
917
922
|
};
|