idmission-web-sdk 2.2.30 → 2.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +2 -3
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/FaceDetection.d.ts +3 -4
- package/dist/lib/models/FaceDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +2 -3
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +91 -110
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +91 -110
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +91 -110
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentDetectionModelProvider.d.ts","sourceRoot":"","sources":["../../../src/components/id_capture/DocumentDetectionModelProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAOV,MAAM,OAAO,CAAA;AAId,OAAO,EAKL,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAM5B,MAAM,oCAAoC,CAAA;AAG3C,KAAK,iBAAiB,GAAG,CACvB,UAAU,EAAE,2BAA2B,KACpC,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB,KAAK,2BAA2B,GAAG;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,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,cAAsC,EACtC,uBAAwD,EACxD,iBAAiB,EACjB,YAAoB,GACrB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"FocusModelProvider.d.ts","sourceRoot":"","sources":["../../../src/components/id_capture/FocusModelProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,SAAS,EAKV,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAA;AAE1D,OAAO,EAGL,eAAe,EACf,eAAe,EAKhB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAEtE,KAAK,eAAe,GAAG;IACrB,eAAe,EAAE,OAAO,CAAA;IACxB,0BAA0B,EAAE,MAAM,CAAA;IAClC,eAAe,EAAE,KAAK,GAAG,IAAI,CAAA;IAE7B,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAEpD,mBAAmB,EAAE,CACnB,KAAK,EAAE,KAAK,EACZ,GAAG,CAAC,EAAE,iBAAiB,KACpB,eAAe,GAAG,IAAI,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,iBAAiB,gCAU5B,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,cAAsC,EACtC,uBAAwD,EACxD,iBAAiB,EACjB,YAAoB,GACrB,EAAE,uBAAuB,qBA6DzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieGuidanceModelsProvider.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_capture/SelfieGuidanceModelsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAA;AAId,OAAO,EAEL,uBAAuB,EAKxB,MAAM,gCAAgC,CAAA;AAGvC,MAAM,MAAM,+BAA+B,GAAG,CAC5C,UAAU,EAAE,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAEzB,KAAK,yBAAyB,GAAG;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,gBAAgB,EAAE,CAAC,OAAO,EAAE,+BAA+B,KAAK,IAAI,CAAA;IACpE,SAAS,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACrD,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,qBAAqB,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,2BAA2B,0CASpC,CAAA;AAEJ,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,SAAgB,EAChB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,kBAA2D,EAC3D,4BAAmC,GACpC,EAAE,iCAAiC,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"SelfieGuidanceModelsProvider.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_capture/SelfieGuidanceModelsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAA;AAId,OAAO,EAEL,uBAAuB,EAKxB,MAAM,gCAAgC,CAAA;AAGvC,MAAM,MAAM,+BAA+B,GAAG,CAC5C,UAAU,EAAE,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAEzB,KAAK,yBAAyB,GAAG;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,gBAAgB,EAAE,CAAC,OAAO,EAAE,+BAA+B,KAAK,IAAI,CAAA;IACpE,SAAS,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACrD,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,qBAAqB,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,2BAA2B,0CASpC,CAAA;AAEJ,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,SAAgB,EAChB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,kBAA2D,EAC3D,4BAAmC,GACpC,EAAE,iCAAiC,GAAG,YAAY,CAsFlD"}
|
|
@@ -33,14 +33,13 @@ export type DocumentDetectionThresholds = DocumentThresholds & {
|
|
|
33
33
|
stability?: DocumentThresholds;
|
|
34
34
|
};
|
|
35
35
|
export declare function loadDocumentDetector(modelAssetPath?: string, scoreThreshold?: number): Promise<ObjectDetector>;
|
|
36
|
-
export declare function closeDocumentDetector(
|
|
36
|
+
export declare function closeDocumentDetector(): void;
|
|
37
37
|
export declare function useLoadDocumentDetector({ modelPath, modelLoadTimeoutMs, scoreThreshold, onModelError, }: {
|
|
38
38
|
modelPath?: string;
|
|
39
39
|
modelLoadTimeoutMs?: number;
|
|
40
40
|
scoreThreshold?: number;
|
|
41
41
|
onModelError?: (error: Error) => void;
|
|
42
42
|
}): {
|
|
43
|
-
detector: import("react").MutableRefObject<ObjectDetector | null>;
|
|
44
43
|
ready: boolean;
|
|
45
44
|
modelDownloadProgress: number;
|
|
46
45
|
modelError: Error | null;
|
|
@@ -73,7 +72,7 @@ export type ObjectDetectorPrediction = ObjectDetectorResult & {
|
|
|
73
72
|
frameWidth: number;
|
|
74
73
|
frameHeight: number;
|
|
75
74
|
};
|
|
76
|
-
export declare function makeDocumentDetectorPrediction(
|
|
75
|
+
export declare function makeDocumentDetectorPrediction(frame: HTMLCanvasElement): Promise<ObjectDetectorPrediction | null>;
|
|
77
76
|
export declare let lastDetectionAt: number;
|
|
78
77
|
export declare let lastDetectionTime: number;
|
|
79
78
|
export declare function setLastDetectionAt(time: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/DocumentDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,o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AgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,QAG9C;AA8BD,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,kCAAkC,EAAE,2BAKhD,CAAA;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,wBAAwB,EACpC,UAAU,EAAE,2BAA2B,EACvC,UAAU,GAAE,2BAAgE,GAC3E,2BAA2B,CA4H7B"}
|
|
@@ -30,12 +30,11 @@ export type FaceDetectionPrediction = {
|
|
|
30
30
|
faceIsStable: boolean;
|
|
31
31
|
};
|
|
32
32
|
export declare function loadFaceDetector(modelAssetPath?: string): Promise<FaceDetector>;
|
|
33
|
-
export declare function closeFaceDetector(
|
|
33
|
+
export declare function closeFaceDetector(): void;
|
|
34
34
|
export declare function useLoadFaceDetector({ onModelError, modelLoadTimeoutMs, }: {
|
|
35
35
|
onModelError?: (error: Error) => void;
|
|
36
36
|
modelLoadTimeoutMs?: number;
|
|
37
37
|
}): {
|
|
38
|
-
detector: import("react").MutableRefObject<FaceDetector | null>;
|
|
39
38
|
ready: boolean;
|
|
40
39
|
modelDownloadProgress: number;
|
|
41
40
|
modelError: Error | null;
|
|
@@ -43,9 +42,9 @@ export declare function useLoadFaceDetector({ onModelError, modelLoadTimeoutMs,
|
|
|
43
42
|
export declare let lastFaceDetectionAt: number;
|
|
44
43
|
export declare let lastFaceDetectionTime: number;
|
|
45
44
|
export declare function setLastFaceDetectionAt(time: number): void;
|
|
46
|
-
export declare function makeFaceDetectorPrediction(
|
|
45
|
+
export declare function makeFaceDetectorPrediction(imageData: Frame): (FaceDetectorResult & {
|
|
47
46
|
faces: Face[];
|
|
48
|
-
};
|
|
47
|
+
}) | null;
|
|
49
48
|
export declare function processFaceDetectorPrediction({ faces, videoWidth, videoHeight, requireVerticalFaceCentering, stabilityThreshold, }: {
|
|
50
49
|
faces: Face[];
|
|
51
50
|
videoWidth: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaceDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/FaceDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAEnB,MAAM,yBAAyB,CAAA;AAQhC,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAWnD,cAAc,yBAAyB,CAAA;AACvC,eAAO,MAAM,sCAAsC,QAAQ,CAAA;AAE3D,MAAM,MAAM,YAAY,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACjE,MAAM,MAAM,IAAI,GAAG;IACjB,SAAS,EAAE,YAAY,EAAE,CAAA;IACzB,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;IACxB,eAAe,EAAE,OAAO,CAAA;IACxB,eAAe,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;
|
|
1
|
+
{"version":3,"file":"FaceDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/FaceDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YA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AAI,mBAAmB,QAAI,CAAA;AAClC,eAAO,IAAI,qBAAqB,QAAI,CAAA;AAEpC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,QAGlD;AA8BD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,KAAK,GACf,CAAC,kBAAkB,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,GAAG,IAAI,CAgBjD;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,KAAK,EACL,UAAU,EACV,WAAW,EACX,4BAAmC,EACnC,kBAAyB,GAC1B,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,GAAG,uBAAuB,CA0E1B"}
|
|
@@ -23,13 +23,12 @@ export type FocusThresholds = {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const defaultFocusThresholds: FocusThresholds;
|
|
25
25
|
export declare function loadFocusModel(modelAssetPath?: string): Promise<ImageClassifier>;
|
|
26
|
-
export declare function closeFocusModel(
|
|
26
|
+
export declare function closeFocusModel(): void;
|
|
27
27
|
export declare function useLoadFocusModel({ modelPath, modelLoadTimeoutMs, onModelError, }: {
|
|
28
28
|
modelPath?: string;
|
|
29
29
|
modelLoadTimeoutMs?: number;
|
|
30
30
|
onModelError?: (error: Error) => void;
|
|
31
31
|
}): {
|
|
32
|
-
model: import("react").MutableRefObject<ImageClassifier | null>;
|
|
33
32
|
ready: boolean;
|
|
34
33
|
modelDownloadProgress: number;
|
|
35
34
|
modelError: Error | null;
|
|
@@ -37,5 +36,5 @@ export declare function useLoadFocusModel({ modelPath, modelLoadTimeoutMs, onMod
|
|
|
37
36
|
export declare let lastFocusPredictionAt: number;
|
|
38
37
|
export declare let lastFocusPredictionTime: number;
|
|
39
38
|
export declare function setLastFocusPredictionAt(time: number): void;
|
|
40
|
-
export declare function makeFocusModelPrediction(
|
|
39
|
+
export declare function makeFocusModelPrediction(imageData: Frame, cropCanvas: HTMLCanvasElement, rotateCanvas: HTMLCanvasElement, box?: DetectedObjectBox): FocusPrediction | null;
|
|
41
40
|
//# sourceMappingURL=Focus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Focus.d.ts","sourceRoot":"","sources":["../../../src/lib/models/Focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAM1E,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AASvD,cAAc,kBAAkB,CAAA;AAChC,eAAO,MAAM,8BAA8B,QAAQ,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,UAAU,CAAC,EAAE;QACX,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,eAapC,CAAA;
|
|
1
|
+
{"version":3,"file":"Focus.d.ts","sourceRoot":"","sources":["../../../src/lib/models/Focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAM1E,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACnD,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,eAAe,GAAG,IAAI,CAWxB"}
|
|
@@ -232,7 +232,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
232
232
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
var webSdkVersion = '2.2.
|
|
235
|
+
var webSdkVersion = '2.2.31';
|
|
236
236
|
|
|
237
237
|
function getPlatform() {
|
|
238
238
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2814,30 +2814,29 @@ var defaultFocusThresholds = {
|
|
|
2814
2814
|
mobile: 0.3
|
|
2815
2815
|
}
|
|
2816
2816
|
};
|
|
2817
|
-
var
|
|
2817
|
+
var classifier = null;
|
|
2818
|
+
var classifierSettings = null;
|
|
2818
2819
|
function loadFocusModel() {
|
|
2819
2820
|
return __awaiter(this, arguments, void 0, function (modelAssetPath) {
|
|
2820
|
-
var
|
|
2821
|
+
var _a, _b;
|
|
2821
2822
|
if (modelAssetPath === void 0) {
|
|
2822
2823
|
modelAssetPath = defaultFocusModelPath;
|
|
2823
2824
|
}
|
|
2824
|
-
return __generator(this, function (
|
|
2825
|
-
switch (
|
|
2825
|
+
return __generator(this, function (_c) {
|
|
2826
|
+
switch (_c.label) {
|
|
2826
2827
|
case 0:
|
|
2827
|
-
|
|
2828
|
-
|
|
2828
|
+
if (classifier && (classifierSettings === null || classifierSettings === void 0 ? void 0 : classifierSettings.modelAssetPath) === modelAssetPath) return [2 /*return*/, classifier];
|
|
2829
|
+
closeFocusModel();
|
|
2829
2830
|
return [4 /*yield*/, preloadFocusModelDependencies()];
|
|
2830
2831
|
case 1:
|
|
2831
|
-
|
|
2832
|
+
_c.sent();
|
|
2832
2833
|
if (modelCapabilities.delegate === 'NONE') {
|
|
2833
2834
|
throw new Error('No available delegate for focus detector.');
|
|
2834
2835
|
}
|
|
2835
|
-
_a =
|
|
2836
|
-
_b = id;
|
|
2837
|
-
_d = (_c = tasksVision.ImageClassifier).createFromOptions;
|
|
2836
|
+
_b = (_a = tasksVision.ImageClassifier).createFromOptions;
|
|
2838
2837
|
return [4 /*yield*/, tasksVision.FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
2839
2838
|
case 2:
|
|
2840
|
-
return [4 /*yield*/,
|
|
2839
|
+
return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
|
|
2841
2840
|
baseOptions: {
|
|
2842
2841
|
modelAssetPath: modelAssetPath,
|
|
2843
2842
|
delegate: modelCapabilities.delegate
|
|
@@ -2846,20 +2845,19 @@ function loadFocusModel() {
|
|
|
2846
2845
|
runningMode: 'VIDEO'
|
|
2847
2846
|
}])];
|
|
2848
2847
|
case 3:
|
|
2849
|
-
|
|
2850
|
-
|
|
2848
|
+
classifier = _c.sent();
|
|
2849
|
+
classifierSettings = {
|
|
2850
|
+
modelAssetPath: modelAssetPath
|
|
2851
|
+
};
|
|
2852
|
+
return [2 /*return*/, classifier];
|
|
2851
2853
|
}
|
|
2852
2854
|
});
|
|
2853
2855
|
});
|
|
2854
2856
|
}
|
|
2855
|
-
function closeFocusModel(
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
var id = "".concat(modelAssetPath);
|
|
2860
|
-
if (!models[id]) return;
|
|
2861
|
-
models[id].close();
|
|
2862
|
-
delete models[id];
|
|
2857
|
+
function closeFocusModel() {
|
|
2858
|
+
classifier === null || classifier === void 0 ? void 0 : classifier.close();
|
|
2859
|
+
classifier = null;
|
|
2860
|
+
classifierSettings = null;
|
|
2863
2861
|
}
|
|
2864
2862
|
function useLoadFocusModel(_a) {
|
|
2865
2863
|
var _b = _a.modelPath,
|
|
@@ -2867,7 +2865,6 @@ function useLoadFocusModel(_a) {
|
|
|
2867
2865
|
_c = _a.modelLoadTimeoutMs,
|
|
2868
2866
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
2869
2867
|
onModelError = _a.onModelError;
|
|
2870
|
-
var model = React.useRef(null);
|
|
2871
2868
|
var _d = React.useState(false),
|
|
2872
2869
|
ready = _d[0],
|
|
2873
2870
|
setReady = _d[1];
|
|
@@ -2893,7 +2890,6 @@ function useLoadFocusModel(_a) {
|
|
|
2893
2890
|
return __generator(this, function (_a) {
|
|
2894
2891
|
switch (_a.label) {
|
|
2895
2892
|
case 0:
|
|
2896
|
-
model.current = loadedModel;
|
|
2897
2893
|
setModelDownloadProgress(100);
|
|
2898
2894
|
clearTimeout(modelLoadTimeout);
|
|
2899
2895
|
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
@@ -2913,9 +2909,8 @@ function useLoadFocusModel(_a) {
|
|
|
2913
2909
|
clearTimeout(modelLoadTimeout);
|
|
2914
2910
|
});
|
|
2915
2911
|
return function () {
|
|
2916
|
-
log('unloading focus model'
|
|
2917
|
-
|
|
2918
|
-
closeFocusModel(modelPath);
|
|
2912
|
+
log('unloading focus model');
|
|
2913
|
+
closeFocusModel();
|
|
2919
2914
|
clearTimeout(modelLoadTimeout);
|
|
2920
2915
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
2921
2916
|
};
|
|
@@ -2924,7 +2919,6 @@ function useLoadFocusModel(_a) {
|
|
|
2924
2919
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
2925
2920
|
}, [modelError, onModelError]);
|
|
2926
2921
|
return {
|
|
2927
|
-
model: model,
|
|
2928
2922
|
ready: ready,
|
|
2929
2923
|
modelDownloadProgress: modelDownloadProgress,
|
|
2930
2924
|
modelError: modelError
|
|
@@ -2936,11 +2930,12 @@ function setLastFocusPredictionAt(time) {
|
|
|
2936
2930
|
lastFocusPredictionTime = time - lastFocusPredictionAt;
|
|
2937
2931
|
lastFocusPredictionAt = time;
|
|
2938
2932
|
}
|
|
2939
|
-
function makeFocusModelPrediction(
|
|
2933
|
+
function makeFocusModelPrediction(imageData, cropCanvas, rotateCanvas, box) {
|
|
2940
2934
|
var _a, _b, _c, _d, _e;
|
|
2935
|
+
if (!classifier) return null;
|
|
2941
2936
|
var startedAt = new Date();
|
|
2942
2937
|
var image = cropIfNecessary(imageData, cropCanvas, rotateCanvas, box);
|
|
2943
|
-
var result =
|
|
2938
|
+
var result = classifier.classifyForVideo(image, performance.now());
|
|
2944
2939
|
var score = (_e = (_d = (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.classifications) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.categories) === null || _c === void 0 ? void 0 : _c.find(function (c) {
|
|
2945
2940
|
return c.categoryName === 'focused';
|
|
2946
2941
|
})) === null || _d === void 0 ? void 0 : _d.score) !== null && _e !== void 0 ? _e : 0;
|
|
@@ -2969,30 +2964,29 @@ function cropIfNecessary(imageData, cropCanvas, rotateCanvas, box) {
|
|
|
2969
2964
|
}
|
|
2970
2965
|
|
|
2971
2966
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
2972
|
-
var
|
|
2967
|
+
var detector$1 = null;
|
|
2968
|
+
var detectorSettings$1 = null;
|
|
2973
2969
|
function loadFaceDetector() {
|
|
2974
2970
|
return __awaiter(this, arguments, void 0, function (modelAssetPath) {
|
|
2975
|
-
var
|
|
2971
|
+
var _a, _b;
|
|
2976
2972
|
if (modelAssetPath === void 0) {
|
|
2977
2973
|
modelAssetPath = defaultFaceDetectorModelPath;
|
|
2978
2974
|
}
|
|
2979
|
-
return __generator(this, function (
|
|
2980
|
-
switch (
|
|
2975
|
+
return __generator(this, function (_c) {
|
|
2976
|
+
switch (_c.label) {
|
|
2981
2977
|
case 0:
|
|
2982
|
-
|
|
2983
|
-
|
|
2978
|
+
if (detector$1 && (detectorSettings$1 === null || detectorSettings$1 === void 0 ? void 0 : detectorSettings$1.modelAssetPath) === modelAssetPath) return [2 /*return*/, detector$1];
|
|
2979
|
+
closeFaceDetector();
|
|
2984
2980
|
return [4 /*yield*/, preloadFaceDetectorDependencies()];
|
|
2985
2981
|
case 1:
|
|
2986
|
-
|
|
2982
|
+
_c.sent();
|
|
2987
2983
|
if (modelCapabilities.delegate === 'NONE') {
|
|
2988
2984
|
throw new Error('No available delegate for face detector.');
|
|
2989
2985
|
}
|
|
2990
|
-
_a =
|
|
2991
|
-
_b = id;
|
|
2992
|
-
_d = (_c = tasksVision.FaceDetector).createFromOptions;
|
|
2986
|
+
_b = (_a = tasksVision.FaceDetector).createFromOptions;
|
|
2993
2987
|
return [4 /*yield*/, tasksVision.FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
2994
2988
|
case 2:
|
|
2995
|
-
return [4 /*yield*/,
|
|
2989
|
+
return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
|
|
2996
2990
|
// canvas: document.createElement('canvas'),
|
|
2997
2991
|
baseOptions: {
|
|
2998
2992
|
modelAssetPath: modelAssetPath,
|
|
@@ -3001,26 +2995,24 @@ function loadFaceDetector() {
|
|
|
3001
2995
|
runningMode: 'VIDEO'
|
|
3002
2996
|
}])];
|
|
3003
2997
|
case 3:
|
|
3004
|
-
|
|
3005
|
-
|
|
2998
|
+
detector$1 = _c.sent();
|
|
2999
|
+
detectorSettings$1 = {
|
|
3000
|
+
modelAssetPath: modelAssetPath
|
|
3001
|
+
};
|
|
3002
|
+
return [2 /*return*/, detector$1];
|
|
3006
3003
|
}
|
|
3007
3004
|
});
|
|
3008
3005
|
});
|
|
3009
3006
|
}
|
|
3010
|
-
function closeFaceDetector(
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
var id = "".concat(modelAssetPath);
|
|
3015
|
-
if (!detectors$1[id]) return;
|
|
3016
|
-
detectors$1[id].close();
|
|
3017
|
-
delete detectors$1[id];
|
|
3007
|
+
function closeFaceDetector() {
|
|
3008
|
+
detector$1 === null || detector$1 === void 0 ? void 0 : detector$1.close();
|
|
3009
|
+
detector$1 = null;
|
|
3010
|
+
detectorSettings$1 = null;
|
|
3018
3011
|
}
|
|
3019
3012
|
function useLoadFaceDetector(_a) {
|
|
3020
3013
|
var onModelError = _a.onModelError,
|
|
3021
3014
|
_b = _a.modelLoadTimeoutMs,
|
|
3022
3015
|
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b;
|
|
3023
|
-
var detector = React.useRef(null);
|
|
3024
3016
|
var _c = React.useState(false),
|
|
3025
3017
|
ready = _c[0],
|
|
3026
3018
|
setReady = _c[1];
|
|
@@ -3046,7 +3038,6 @@ function useLoadFaceDetector(_a) {
|
|
|
3046
3038
|
return __generator(this, function (_a) {
|
|
3047
3039
|
switch (_a.label) {
|
|
3048
3040
|
case 0:
|
|
3049
|
-
detector.current = model;
|
|
3050
3041
|
setModelDownloadProgress(100);
|
|
3051
3042
|
clearTimeout(modelLoadTimeout);
|
|
3052
3043
|
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
@@ -3064,8 +3055,7 @@ function useLoadFaceDetector(_a) {
|
|
|
3064
3055
|
clearTimeout(modelLoadTimeout);
|
|
3065
3056
|
});
|
|
3066
3057
|
return function () {
|
|
3067
|
-
log('unloading face detection model'
|
|
3068
|
-
detector.current = null;
|
|
3058
|
+
log('unloading face detection model');
|
|
3069
3059
|
closeFaceDetector();
|
|
3070
3060
|
clearTimeout(modelLoadTimeout);
|
|
3071
3061
|
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
@@ -3075,7 +3065,6 @@ function useLoadFaceDetector(_a) {
|
|
|
3075
3065
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3076
3066
|
}, [modelError, onModelError]);
|
|
3077
3067
|
return {
|
|
3078
|
-
detector: detector,
|
|
3079
3068
|
ready: ready,
|
|
3080
3069
|
modelDownloadProgress: modelDownloadProgress,
|
|
3081
3070
|
modelError: modelError
|
|
@@ -3114,8 +3103,9 @@ function trackFace(face, framesNeeded) {
|
|
|
3114
3103
|
if (lastNPairs$1.length > framesNeeded - 1) lastNPairs$1.length = framesNeeded - 1;
|
|
3115
3104
|
}
|
|
3116
3105
|
}
|
|
3117
|
-
function makeFaceDetectorPrediction(
|
|
3118
|
-
|
|
3106
|
+
function makeFaceDetectorPrediction(imageData) {
|
|
3107
|
+
if (!detector$1) return null;
|
|
3108
|
+
var prediction = detector$1.detectForVideo(imageData, performance.now());
|
|
3119
3109
|
var faces = prediction.detections.map(function (d) {
|
|
3120
3110
|
return {
|
|
3121
3111
|
box: convertBoundingBox(d.boundingBox),
|
|
@@ -3447,33 +3437,32 @@ var documentTypeDisplayNames = {
|
|
|
3447
3437
|
passport: 'Passport',
|
|
3448
3438
|
none: 'None'
|
|
3449
3439
|
};
|
|
3450
|
-
var
|
|
3440
|
+
var detector = null;
|
|
3441
|
+
var detectorSettings = null;
|
|
3451
3442
|
function loadDocumentDetector() {
|
|
3452
3443
|
return __awaiter(this, arguments, void 0, function (modelAssetPath, scoreThreshold) {
|
|
3453
|
-
var
|
|
3444
|
+
var _a, _b;
|
|
3454
3445
|
if (modelAssetPath === void 0) {
|
|
3455
3446
|
modelAssetPath = defaultDocumentDetectorModelPath;
|
|
3456
3447
|
}
|
|
3457
3448
|
if (scoreThreshold === void 0) {
|
|
3458
3449
|
scoreThreshold = defaultDocumentDetectionScoreThreshold;
|
|
3459
3450
|
}
|
|
3460
|
-
return __generator(this, function (
|
|
3461
|
-
switch (
|
|
3451
|
+
return __generator(this, function (_c) {
|
|
3452
|
+
switch (_c.label) {
|
|
3462
3453
|
case 0:
|
|
3463
|
-
|
|
3464
|
-
|
|
3454
|
+
if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.scoreThreshold) === scoreThreshold) return [2 /*return*/, detector];
|
|
3455
|
+
closeDocumentDetector();
|
|
3465
3456
|
return [4 /*yield*/, preloadDocumentDetectorDependencies()];
|
|
3466
3457
|
case 1:
|
|
3467
|
-
|
|
3458
|
+
_c.sent();
|
|
3468
3459
|
if (modelCapabilities.delegate === 'NONE') {
|
|
3469
3460
|
throw new Error('No available delegate for document detector.');
|
|
3470
3461
|
}
|
|
3471
|
-
_a =
|
|
3472
|
-
_b = id;
|
|
3473
|
-
_d = (_c = tasksVision.ObjectDetector).createFromOptions;
|
|
3462
|
+
_b = (_a = tasksVision.ObjectDetector).createFromOptions;
|
|
3474
3463
|
return [4 /*yield*/, tasksVision.FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
3475
3464
|
case 2:
|
|
3476
|
-
return [4 /*yield*/,
|
|
3465
|
+
return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
|
|
3477
3466
|
baseOptions: {
|
|
3478
3467
|
modelAssetPath: modelAssetPath,
|
|
3479
3468
|
delegate: modelCapabilities.delegate
|
|
@@ -3483,23 +3472,20 @@ function loadDocumentDetector() {
|
|
|
3483
3472
|
runningMode: 'VIDEO'
|
|
3484
3473
|
}])];
|
|
3485
3474
|
case 3:
|
|
3486
|
-
|
|
3487
|
-
|
|
3475
|
+
detector = _c.sent();
|
|
3476
|
+
detectorSettings = {
|
|
3477
|
+
modelAssetPath: modelAssetPath,
|
|
3478
|
+
scoreThreshold: scoreThreshold
|
|
3479
|
+
};
|
|
3480
|
+
return [2 /*return*/, detector];
|
|
3488
3481
|
}
|
|
3489
3482
|
});
|
|
3490
3483
|
});
|
|
3491
3484
|
}
|
|
3492
|
-
function closeDocumentDetector(
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
if (scoreThreshold === void 0) {
|
|
3497
|
-
scoreThreshold = defaultDocumentDetectionScoreThreshold;
|
|
3498
|
-
}
|
|
3499
|
-
var id = "".concat(modelAssetPath, ":").concat(scoreThreshold);
|
|
3500
|
-
if (!detectors[id]) return;
|
|
3501
|
-
detectors[id].close();
|
|
3502
|
-
delete detectors[id];
|
|
3485
|
+
function closeDocumentDetector() {
|
|
3486
|
+
detector === null || detector === void 0 ? void 0 : detector.close();
|
|
3487
|
+
detector = null;
|
|
3488
|
+
detectorSettings = null;
|
|
3503
3489
|
}
|
|
3504
3490
|
function useLoadDocumentDetector(_a) {
|
|
3505
3491
|
var _b = _a.modelPath,
|
|
@@ -3509,7 +3495,6 @@ function useLoadDocumentDetector(_a) {
|
|
|
3509
3495
|
_d = _a.scoreThreshold,
|
|
3510
3496
|
scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
|
|
3511
3497
|
onModelError = _a.onModelError;
|
|
3512
|
-
var detector = React.useRef(null);
|
|
3513
3498
|
var _e = React.useState(false),
|
|
3514
3499
|
ready = _e[0],
|
|
3515
3500
|
setReady = _e[1];
|
|
@@ -3535,7 +3520,6 @@ function useLoadDocumentDetector(_a) {
|
|
|
3535
3520
|
return __generator(this, function (_a) {
|
|
3536
3521
|
switch (_a.label) {
|
|
3537
3522
|
case 0:
|
|
3538
|
-
detector.current = model;
|
|
3539
3523
|
setModelDownloadProgress(100);
|
|
3540
3524
|
clearTimeout(modelLoadTimeout);
|
|
3541
3525
|
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
@@ -3556,8 +3540,7 @@ function useLoadDocumentDetector(_a) {
|
|
|
3556
3540
|
});
|
|
3557
3541
|
return function () {
|
|
3558
3542
|
log('unloading document detection model');
|
|
3559
|
-
|
|
3560
|
-
closeDocumentDetector(modelPath, scoreThreshold);
|
|
3543
|
+
closeDocumentDetector();
|
|
3561
3544
|
clearTimeout(modelLoadTimeout);
|
|
3562
3545
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
3563
3546
|
};
|
|
@@ -3566,17 +3549,17 @@ function useLoadDocumentDetector(_a) {
|
|
|
3566
3549
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3567
3550
|
}, [modelError, onModelError]);
|
|
3568
3551
|
return {
|
|
3569
|
-
detector: detector,
|
|
3570
3552
|
ready: ready,
|
|
3571
3553
|
modelDownloadProgress: modelDownloadProgress,
|
|
3572
3554
|
modelError: modelError,
|
|
3573
3555
|
setModelError: setModelError
|
|
3574
3556
|
};
|
|
3575
3557
|
}
|
|
3576
|
-
function makeDocumentDetectorPrediction(
|
|
3558
|
+
function makeDocumentDetectorPrediction(frame) {
|
|
3577
3559
|
return __awaiter(this, void 0, void 0, function () {
|
|
3578
3560
|
var startedAt, prediction, time, frameWidth, frameHeight;
|
|
3579
3561
|
return __generator(this, function (_a) {
|
|
3562
|
+
if (!detector) return [2 /*return*/, null];
|
|
3580
3563
|
startedAt = new Date();
|
|
3581
3564
|
// Detectors can throw errors, for example when using custom URLs that
|
|
3582
3565
|
// contain a model that doesn't provide the expected output.
|
|
@@ -3900,7 +3883,6 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3900
3883
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
3901
3884
|
onModelError: onDocumentDetectionModelError
|
|
3902
3885
|
}),
|
|
3903
|
-
detector = _o.detector,
|
|
3904
3886
|
ready = _o.ready,
|
|
3905
3887
|
modelDownloadProgress = _o.modelDownloadProgress,
|
|
3906
3888
|
modelError = _o.modelError,
|
|
@@ -3912,7 +3894,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3912
3894
|
return __generator(this, function (_b) {
|
|
3913
3895
|
switch (_b.label) {
|
|
3914
3896
|
case 0:
|
|
3915
|
-
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !
|
|
3897
|
+
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
|
|
3916
3898
|
stopDetectionAtStart = stopDetection.current;
|
|
3917
3899
|
vw = videoRef.current.videoWidth;
|
|
3918
3900
|
vh = videoRef.current.videoHeight;
|
|
@@ -3922,7 +3904,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3922
3904
|
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
|
|
3923
3905
|
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
3924
3906
|
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
3925
|
-
return [4 /*yield*/, makeDocumentDetectorPrediction(
|
|
3907
|
+
return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
|
|
3926
3908
|
case 1:
|
|
3927
3909
|
prediction = _b.sent();
|
|
3928
3910
|
if (!prediction) return [3 /*break*/, 3];
|
|
@@ -3944,7 +3926,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3944
3926
|
}
|
|
3945
3927
|
});
|
|
3946
3928
|
});
|
|
3947
|
-
}, [cameraReady, delayAfterStartMs,
|
|
3929
|
+
}, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
|
|
3948
3930
|
throttleMs: throttleMs,
|
|
3949
3931
|
autoStart: autoStart
|
|
3950
3932
|
}),
|
|
@@ -4021,16 +4003,16 @@ function FocusModelProvider(_a) {
|
|
|
4021
4003
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4022
4004
|
onModelError: onFocusModelError
|
|
4023
4005
|
}),
|
|
4024
|
-
model = _f.model,
|
|
4025
4006
|
ready = _f.ready,
|
|
4026
4007
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
4027
4008
|
modelError = _f.modelError;
|
|
4028
4009
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
4029
|
-
if (!
|
|
4030
|
-
var prediction = makeFocusModelPrediction(
|
|
4010
|
+
if (!ready) return null;
|
|
4011
|
+
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
4012
|
+
if (!prediction) return null;
|
|
4031
4013
|
setLastFocusPredictionAt(prediction.predictionTime);
|
|
4032
4014
|
return prediction;
|
|
4033
|
-
}, [
|
|
4015
|
+
}, [ready]);
|
|
4034
4016
|
var value = React.useMemo(function () {
|
|
4035
4017
|
return {
|
|
4036
4018
|
focusModelReady: ready,
|
|
@@ -9253,18 +9235,17 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9253
9235
|
onModelError: onModelError,
|
|
9254
9236
|
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
9255
9237
|
}),
|
|
9256
|
-
detector = _f.detector,
|
|
9257
9238
|
ready = _f.ready,
|
|
9258
9239
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
9259
9240
|
modelError = _f.modelError;
|
|
9260
9241
|
var _g = useFrameLoop(React.useCallback(function () {
|
|
9261
9242
|
return __awaiter(_this, void 0, void 0, function () {
|
|
9262
|
-
var vw, vh, ctx,
|
|
9263
|
-
var _a;
|
|
9264
|
-
return __generator(this, function (
|
|
9265
|
-
switch (
|
|
9243
|
+
var vw, vh, ctx, prediction, processed, e_1;
|
|
9244
|
+
var _a, _b;
|
|
9245
|
+
return __generator(this, function (_c) {
|
|
9246
|
+
switch (_c.label) {
|
|
9266
9247
|
case 0:
|
|
9267
|
-
if (!videoLoaded || !cameraReady || !ready || modelError || !videoRef.current || !
|
|
9248
|
+
if (!videoLoaded || !cameraReady || !ready || modelError || !videoRef.current || !canvasRef.current) return [2 /*return*/];
|
|
9268
9249
|
vw = videoRef.current.videoWidth;
|
|
9269
9250
|
vh = videoRef.current.videoHeight;
|
|
9270
9251
|
ctx = canvasRef.current.getContext('2d');
|
|
@@ -9274,23 +9255,23 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9274
9255
|
ctx.translate(vw, 0);
|
|
9275
9256
|
ctx.scale(-1, 1);
|
|
9276
9257
|
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
9277
|
-
|
|
9258
|
+
_c.label = 1;
|
|
9278
9259
|
case 1:
|
|
9279
|
-
|
|
9280
|
-
|
|
9260
|
+
_c.trys.push([1, 3,, 4]);
|
|
9261
|
+
prediction = makeFaceDetectorPrediction(canvasRef.current);
|
|
9281
9262
|
processed = processFaceDetectorPrediction({
|
|
9282
|
-
faces: faces,
|
|
9263
|
+
faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
|
|
9283
9264
|
videoWidth: vw,
|
|
9284
9265
|
videoHeight: vh,
|
|
9285
9266
|
requireVerticalFaceCentering: requireVerticalFaceCentering
|
|
9286
9267
|
});
|
|
9287
9268
|
setLastFaceDetectionAt(new Date().getTime());
|
|
9288
|
-
return [4 /*yield*/, (
|
|
9269
|
+
return [4 /*yield*/, (_b = onPredictionHandler.current) === null || _b === void 0 ? void 0 : _b.call(onPredictionHandler, processed)];
|
|
9289
9270
|
case 2:
|
|
9290
|
-
|
|
9271
|
+
_c.sent();
|
|
9291
9272
|
return [3 /*break*/, 4];
|
|
9292
9273
|
case 3:
|
|
9293
|
-
e_1 =
|
|
9274
|
+
e_1 = _c.sent();
|
|
9294
9275
|
error('caught face detection error', e_1);
|
|
9295
9276
|
return [3 /*break*/, 4];
|
|
9296
9277
|
case 4:
|
|
@@ -9298,7 +9279,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9298
9279
|
}
|
|
9299
9280
|
});
|
|
9300
9281
|
});
|
|
9301
|
-
}, [cameraReady,
|
|
9282
|
+
}, [cameraReady, modelError, ready, requireVerticalFaceCentering, videoLoaded, videoRef]), {
|
|
9302
9283
|
throttleMs: throttleMs,
|
|
9303
9284
|
autoStart: autoStart
|
|
9304
9285
|
}),
|