@incodetech/core 0.0.0-dev-20260407-4580f1c → 0.0.0-dev-20260407-4677d7f
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/{BaseWasmProvider--AzPfwOm.esm.js → BaseWasmProvider-CQgeReKV.esm.js} +1 -785
- package/dist/MotionSensorProvider-BTDLt08l.esm.js +254 -0
- package/dist/StateMachine-8d441d6x.d.ts +2 -0
- package/dist/{WasmUtilProvider-BonqBWdj.esm.js → WasmUtilProvider-C45HStLj.esm.js} +1 -1
- package/dist/{addressSearch-B8Fo4v9V.esm.js → addressSearch-C5qzDvkN.esm.js} +4 -4
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +3 -3
- package/dist/authentication.d.ts +11 -9
- package/dist/authentication.esm.js +18 -13
- package/dist/{authenticationManager-B4gSCgrO.esm.js → authenticationManager-CW4qxgcq.esm.js} +7 -6
- package/dist/{authenticationManager-Bd10YGSO.d.ts → authenticationManager-CiXsOTdM.d.ts} +2 -2
- package/dist/{backCameraStream-DF_d7hTz.esm.js → backCameraStream-CUo1USCT.esm.js} +2 -2
- package/dist/camera.d.ts +16 -0
- package/dist/camera.esm.js +5 -0
- package/dist/consent.d.ts +54 -54
- package/dist/consent.esm.js +3 -3
- package/dist/curp-validation.d.ts +5 -5
- package/dist/curp-validation.esm.js +3 -3
- package/dist/{deepsightLoader-DKgEdLIS.esm.js → deepsightLoader-Bs5jHgca.esm.js} +10 -7
- package/dist/deepsightService-C3gQ_9Ml.esm.js +493 -0
- package/dist/{deepsightService-Ciu0atv5.d.ts → deepsightService-CMAtxAC9.d.ts} +193 -197
- package/dist/device.d.ts +46 -0
- package/dist/device.esm.js +106 -0
- package/dist/document-capture.d.ts +79 -79
- package/dist/document-capture.esm.js +6 -6
- package/dist/document-upload.d.ts +50 -50
- package/dist/document-upload.esm.js +6 -6
- package/dist/ekyb.d.ts +3 -3
- package/dist/ekyb.esm.js +9 -9
- package/dist/ekyc.d.ts +3 -3
- package/dist/ekyc.esm.js +5 -5
- package/dist/email.d.ts +3 -3
- package/dist/email.esm.js +5 -5
- package/dist/{emailManager-CpAwvP3v.esm.js → emailManager-CZ2IGW0g.esm.js} +4 -4
- package/dist/{emailManager-BQPIJR_O.d.ts → emailManager-DEIxY7l6.d.ts} +2 -2
- package/dist/events-BlVGS-8F.esm.js +472 -0
- package/dist/events.d.ts +232 -0
- package/dist/events.esm.js +4 -0
- package/dist/extensibility.d.ts +15 -13
- package/dist/extensibility.esm.js +32 -20
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +3 -3
- package/dist/{faceCaptureManagerFactory-CdwpYykv.d.ts → faceCaptureManagerFactory-CWj-nXdx.d.ts} +8 -6
- package/dist/{faceCaptureSetup-DbXgtcp7.esm.js → faceCaptureSetup-DIE5cftl.esm.js} +13 -10
- package/dist/flow.d.ts +7 -6
- package/dist/flow.esm.js +8 -8
- package/dist/{flowCompletionService-TnWijsSw.esm.js → flowCompletionService-N6-xypy-.esm.js} +2 -2
- package/dist/{flowServices-D5ugKT5n.esm.js → flowServices-xgqnJ64L.esm.js} +3 -3
- package/dist/geolocation.d.ts +2 -2
- package/dist/geolocation.esm.js +4 -4
- package/dist/getBrowser-B800KRAi.esm.js +41 -0
- package/dist/getDeviceClass-BKd2FOAf.esm.js +14 -0
- package/dist/government-validation.d.ts +2 -2
- package/dist/government-validation.esm.js +4 -4
- package/dist/http.d.ts +57 -0
- package/dist/http.esm.js +3 -0
- package/dist/id.d.ts +11 -10
- package/dist/id.esm.js +19 -15
- package/dist/{idCaptureManager-IdqsAASp.d.ts → idCaptureManager-H-rkXnbK.d.ts} +7 -6
- package/dist/{idCaptureManager-DUZxcSP_.esm.js → idCaptureManager-SHBRQ-X_.esm.js} +15 -11
- package/dist/index.d.ts +3 -611
- package/dist/index.esm.js +10 -562
- package/dist/{lib-i-4qLKdG.esm.js → lib-Cq5Wc-Hd.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +57 -57
- package/dist/mandatory-consent.esm.js +3 -3
- package/dist/permissionServices-CDqkkway.esm.js +50 -0
- package/dist/phone.d.ts +3 -3
- package/dist/phone.esm.js +5 -5
- package/dist/{phoneManager-DA8WUJtl.d.ts → phoneManager-Clfbrs6b.d.ts} +2 -2
- package/dist/{phoneManager-BAPHSXx8.esm.js → phoneManager-CscgaER2.esm.js} +4 -4
- package/dist/{StreamCanvasCapture-DkpkIgyL.esm.js → recordingsRepository-blYn-iKZ.esm.js} +157 -215
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/redirect-to-mobile.esm.js +4 -4
- package/dist/selfie.d.ts +11 -9
- package/dist/selfie.esm.js +18 -13
- package/dist/{selfieManager-BSkzncsa.esm.js → selfieManager-DeGqD5aN.esm.js} +5 -4
- package/dist/{selfieManager-Dft5wZQ_.d.ts → selfieManager-h_hhEefT.d.ts} +2 -2
- package/dist/{session-DqNrvO4r.esm.js → session-PLjFj_T3.esm.js} +5 -26
- package/dist/session.d.ts +46 -2
- package/dist/session.esm.js +7 -4
- package/dist/setup-DJ3dFl5k.d.ts +120 -0
- package/dist/setup-fvDWE7f8.esm.js +450 -0
- package/dist/signature.d.ts +2 -2
- package/dist/signature.esm.js +3 -3
- package/dist/{stats-BVigf5Rn.esm.js → stats-BZ1kFW4p.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{types-CiLyvJGb.d.ts → types-T0VjZW3T.d.ts} +1 -1
- package/dist/types-qhLxpptI.d.ts +5 -0
- package/dist/{types-D8Y1faI5.d.ts → types-zH5PDmSe.d.ts} +1 -1
- package/dist/{StateMachine-CM_aOfNL.d.ts → warmup-CEOVQKby.d.ts} +1 -4
- package/dist/wasm.d.ts +15 -0
- package/dist/wasm.esm.js +10 -0
- package/dist/{Manager-C6AGXEq_.esm.js → xstate.esm-BXrcOcSC.esm.js} +103 -507
- package/package.json +17 -1
- package/dist/endpoints-CI5-28jT.esm.js +0 -69
- package/dist/id-CzDAG_kM.esm.js +0 -0
- package/dist/index-BuVKc9bv.d.ts +0 -1
- /package/dist/{Actor-By8WNHi-.d.ts → Actor-C-jivmFF.d.ts} +0 -0
- /package/dist/{BrowserEnvironmentProvider-BECjyw3_.esm.js → BrowserEnvironmentProvider--xQUs3sg.esm.js} +0 -0
- /package/dist/{BrowserTimerProvider-CIqH6hJp.esm.js → BrowserTimerProvider-CkHEwJFa.esm.js} +0 -0
- /package/dist/{Manager-CCT_-HuZ.d.ts → Manager-BqFybBV-.d.ts} +0 -0
- /package/dist/{api-C2uzxrpN.esm.js → api-CyI8qTie.esm.js} +0 -0
- /package/dist/{browserSimulation-DYAk0Ipe.esm.js → browserSimulation-yzDdWSBf.esm.js} +0 -0
- /package/dist/{camera-6XJdOeBF.d.ts → camera-CKsQVNlH.d.ts} +0 -0
- /package/dist/{camera-DAuRUvnp.esm.js → camera-CsT06Zqy.esm.js} +0 -0
- /package/dist/{chunk-D6hkk-hd.esm.js → chunk-BcQWkoAq.esm.js} +0 -0
- /package/dist/{displayErrors-CGJwvrTl.d.ts → displayErrors-CjMXlBnu.d.ts} +0 -0
- /package/dist/{flowCompletionService-BOd4Rk8n.d.ts → flowCompletionService-BV6ThEJ1.d.ts} +0 -0
- /package/dist/{platform-DdhkonXk.esm.js → platform-Dcuv6w60.esm.js} +0 -0
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { t as isBrowserSimulation } from "./browserSimulation-DYAk0Ipe.esm.js";
|
|
2
|
-
import { t as api } from "./api-C2uzxrpN.esm.js";
|
|
3
|
-
import { i as stopCameraStream, r as requestCameraAccess } from "./camera-DAuRUvnp.esm.js";
|
|
4
|
-
import { t as addDeviceStats } from "./stats-BVigf5Rn.esm.js";
|
|
5
|
-
|
|
6
1
|
//#region ../infra/src/wasm/IdCaptureModelType.ts
|
|
7
2
|
let IdCaptureModelType = /* @__PURE__ */ function(IdCaptureModelType$1) {
|
|
8
3
|
IdCaptureModelType$1[IdCaptureModelType$1["IdCaptureV1x"] = 0] = "IdCaptureV1x";
|
|
@@ -670,785 +665,6 @@ function waitForWasm() {
|
|
|
670
665
|
return Promise.reject(/* @__PURE__ */ new Error("WASM warmup was not started. Call warmupWasm() first."));
|
|
671
666
|
}
|
|
672
667
|
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region ../infra/src/device/getBrowser.ts
|
|
675
|
-
function getUserAgent() {
|
|
676
|
-
if (typeof navigator === "undefined") return "";
|
|
677
|
-
return navigator.userAgent;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
//#endregion
|
|
681
|
-
//#region ../infra/src/device/getDeviceClass.ts
|
|
682
|
-
function getDeviceInfo() {
|
|
683
|
-
if (typeof navigator === "undefined") return {
|
|
684
|
-
userAgent: "",
|
|
685
|
-
platform: "",
|
|
686
|
-
maxTouchPoints: 0
|
|
687
|
-
};
|
|
688
|
-
return {
|
|
689
|
-
userAgent: navigator.userAgent,
|
|
690
|
-
platform: navigator.platform,
|
|
691
|
-
maxTouchPoints: navigator.maxTouchPoints
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Gets the current window dimensions.
|
|
696
|
-
* Returns default values (1280x720) in non-browser environments.
|
|
697
|
-
*/
|
|
698
|
-
function getWindowDimensions(defaultWidth = 1280, defaultHeight = 720) {
|
|
699
|
-
if (typeof window === "undefined") return {
|
|
700
|
-
outerWidth: defaultWidth,
|
|
701
|
-
outerHeight: defaultHeight,
|
|
702
|
-
innerWidth: defaultWidth,
|
|
703
|
-
innerHeight: defaultHeight
|
|
704
|
-
};
|
|
705
|
-
return {
|
|
706
|
-
outerWidth: window.outerWidth,
|
|
707
|
-
outerHeight: window.outerHeight,
|
|
708
|
-
innerWidth: window.innerWidth,
|
|
709
|
-
innerHeight: window.innerHeight
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
//#endregion
|
|
714
|
-
//#region ../infra/src/media/canvas.ts
|
|
715
|
-
/**
|
|
716
|
-
* Class representing a canvas element for image capture and manipulation.
|
|
717
|
-
*/
|
|
718
|
-
var IncodeCanvas = class IncodeCanvas {
|
|
719
|
-
/**
|
|
720
|
-
* Creates an {@link IncodeCanvas} from a raw {@link ImageData} frame.
|
|
721
|
-
* @param imageData - Frame pixels in RGBA format
|
|
722
|
-
* @returns An {@link IncodeCanvas} containing the provided pixels
|
|
723
|
-
*/
|
|
724
|
-
static fromImageData(imageData) {
|
|
725
|
-
const canvas = document.createElement("canvas");
|
|
726
|
-
canvas.width = imageData.width;
|
|
727
|
-
canvas.height = imageData.height;
|
|
728
|
-
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
729
|
-
if (!context) return new IncodeCanvas(canvas);
|
|
730
|
-
if ("putImageData" in context) context.putImageData(imageData, 0, 0);
|
|
731
|
-
return new IncodeCanvas(canvas);
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Create a new canvas element.
|
|
735
|
-
* @param canvas_ - The canvas element to clone.
|
|
736
|
-
*/
|
|
737
|
-
constructor(canvas_) {
|
|
738
|
-
this.base64Image = null;
|
|
739
|
-
this.blobData = null;
|
|
740
|
-
this.canvas = document.createElement("canvas");
|
|
741
|
-
this.canvas.width = canvas_.width;
|
|
742
|
-
this.canvas.height = canvas_.height;
|
|
743
|
-
const context = this.canvas.getContext("2d");
|
|
744
|
-
if (context) context.drawImage(canvas_, 0, 0);
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Check if the current canvas is valid.
|
|
748
|
-
*/
|
|
749
|
-
checkCanvas() {
|
|
750
|
-
return this.canvas && this.canvas.width > 1 && this.canvas.height > 1;
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Disposes of resources, including revoking object URLs to prevent memory leaks.
|
|
754
|
-
*/
|
|
755
|
-
dispose() {
|
|
756
|
-
if (this.blobData?.url) {
|
|
757
|
-
URL.revokeObjectURL(this.blobData.url);
|
|
758
|
-
this.blobData = null;
|
|
759
|
-
}
|
|
760
|
-
this.base64Image = null;
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Release the data stored by IncodeCanvas.
|
|
764
|
-
*/
|
|
765
|
-
release() {
|
|
766
|
-
if (!this.checkCanvas()) return;
|
|
767
|
-
this.canvas.width = 1;
|
|
768
|
-
this.canvas.height = 1;
|
|
769
|
-
this.canvas.getContext("2d")?.clearRect(0, 0, 1, 1);
|
|
770
|
-
this.base64Image = null;
|
|
771
|
-
if (this.blobData?.url) URL.revokeObjectURL(this.blobData.url);
|
|
772
|
-
this.blobData = null;
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Revokes the object URL if one exists, preventing memory leaks.
|
|
776
|
-
* Use this when you no longer need the preview image URL.
|
|
777
|
-
*/
|
|
778
|
-
revokeObjectURL() {
|
|
779
|
-
if (this.blobData?.url) {
|
|
780
|
-
URL.revokeObjectURL(this.blobData.url);
|
|
781
|
-
this.blobData = {
|
|
782
|
-
...this.blobData,
|
|
783
|
-
url: ""
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* Get the width of the canvas.
|
|
789
|
-
*/
|
|
790
|
-
width() {
|
|
791
|
-
if (!this.checkCanvas()) return null;
|
|
792
|
-
return this.canvas.width;
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Get the height of the canvas.
|
|
796
|
-
*/
|
|
797
|
-
height() {
|
|
798
|
-
if (!this.checkCanvas()) return null;
|
|
799
|
-
return this.canvas.height;
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* Set the width of the canvas.
|
|
803
|
-
*/
|
|
804
|
-
setWidth(width) {
|
|
805
|
-
if (!this.checkCanvas()) return;
|
|
806
|
-
this.canvas.width = width;
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Set the height of the canvas.
|
|
810
|
-
*/
|
|
811
|
-
setHeight(height) {
|
|
812
|
-
if (!this.checkCanvas()) return;
|
|
813
|
-
this.canvas.height = height;
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Clone the current canvas.
|
|
817
|
-
*/
|
|
818
|
-
clone() {
|
|
819
|
-
if (!this.checkCanvas()) return null;
|
|
820
|
-
const cloned = new IncodeCanvas(this.canvas);
|
|
821
|
-
cloned.setBase64Image(this.base64Image);
|
|
822
|
-
return cloned;
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* Deep clone the current IncodeCanvas including blob data.
|
|
826
|
-
*/
|
|
827
|
-
async deepClone() {
|
|
828
|
-
const cloned = this.clone();
|
|
829
|
-
if (!cloned) return null;
|
|
830
|
-
if (this.blobData) await cloned.setBlobData(this.blobData);
|
|
831
|
-
return cloned;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Returns the drawing context on the canvas.
|
|
835
|
-
*/
|
|
836
|
-
getContext(contextId, contextAttributes) {
|
|
837
|
-
if (!this.checkCanvas()) return null;
|
|
838
|
-
const context = this.canvas.getContext(contextId, contextAttributes);
|
|
839
|
-
return context instanceof CanvasRenderingContext2D ? context : null;
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Retrieves the image data from the canvas.
|
|
843
|
-
*/
|
|
844
|
-
getImageData() {
|
|
845
|
-
if (!this.checkCanvas()) return null;
|
|
846
|
-
const context = this.canvas.getContext("2d", { willReadFrequently: true });
|
|
847
|
-
if (!context) return null;
|
|
848
|
-
return context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
849
|
-
}
|
|
850
|
-
/**
|
|
851
|
-
* Updates the base64 representation of the current canvas image.
|
|
852
|
-
*/
|
|
853
|
-
updateBase64Image(jpegQuality = 1) {
|
|
854
|
-
if (!this.checkCanvas()) return;
|
|
855
|
-
this.base64Image = this.canvas.toDataURL("image/jpeg", jpegQuality);
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* Converts the current canvas element to a base64 string.
|
|
859
|
-
*/
|
|
860
|
-
getBase64Image(jpegQuality = 1, includeDataURLPrefix = false) {
|
|
861
|
-
if (!this.checkCanvas()) return null;
|
|
862
|
-
if (this.base64Image === null) this.updateBase64Image(jpegQuality);
|
|
863
|
-
const base64Image = this.base64Image;
|
|
864
|
-
if (base64Image === null) return null;
|
|
865
|
-
if (includeDataURLPrefix) return base64Image;
|
|
866
|
-
const commaIndex = base64Image.indexOf(",");
|
|
867
|
-
if (commaIndex === -1) return base64Image;
|
|
868
|
-
return base64Image.slice(commaIndex + 1);
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* Sets the base64 representation of the current canvas image.
|
|
872
|
-
*/
|
|
873
|
-
setBase64Image(base64Image) {
|
|
874
|
-
this.base64Image = base64Image;
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Updates the Blob representation of the current canvas image.
|
|
878
|
-
*/
|
|
879
|
-
updateBlob(jpegQuality = 1, includeDataURLPrefix = false) {
|
|
880
|
-
if (!this.checkCanvas()) return;
|
|
881
|
-
if (this.base64Image === null) this.updateBase64Image(jpegQuality);
|
|
882
|
-
const base64 = this.getBase64Image(jpegQuality, includeDataURLPrefix);
|
|
883
|
-
if (base64) this.blobData = IncodeCanvas.base64ToBlob(base64);
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* Converts a base64 string to a Blob and creates a URL for it.
|
|
887
|
-
*/
|
|
888
|
-
static base64ToBlob(base64) {
|
|
889
|
-
try {
|
|
890
|
-
const binary = atob(base64);
|
|
891
|
-
const array = [];
|
|
892
|
-
for (let i = 0; i < binary.length; i++) array.push(binary.charCodeAt(i));
|
|
893
|
-
const blob = new Blob([new Uint8Array(array)]);
|
|
894
|
-
return {
|
|
895
|
-
blob,
|
|
896
|
-
url: URL.createObjectURL(blob)
|
|
897
|
-
};
|
|
898
|
-
} catch (error) {
|
|
899
|
-
console.error("Failed to convert base64 string to Blob:", error);
|
|
900
|
-
}
|
|
901
|
-
return null;
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Retrieves the Blob data and its URL from the current canvas.
|
|
905
|
-
*/
|
|
906
|
-
getBlobData(jpegQuality = 1, includeDataURLPrefix = false) {
|
|
907
|
-
if (!this.checkCanvas()) return null;
|
|
908
|
-
if (this.blobData === null) this.updateBlob(jpegQuality, includeDataURLPrefix);
|
|
909
|
-
return this.blobData;
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Sets the Blob data of the current canvas image.
|
|
913
|
-
*/
|
|
914
|
-
async setBlobData(blobData) {
|
|
915
|
-
const blobDataArrayBuffer = await blobData.blob.arrayBuffer();
|
|
916
|
-
this.blobData = {
|
|
917
|
-
blob: new Blob([blobDataArrayBuffer], { type: blobData.blob.type }),
|
|
918
|
-
url: blobData.url
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Returns a resized canvas according to video element size.
|
|
923
|
-
*/
|
|
924
|
-
getResizedCanvas(videoElementWidth, videoElementHeight) {
|
|
925
|
-
if (!this.checkCanvas()) return null;
|
|
926
|
-
const cameraOffsetX = Math.abs(videoElementWidth - window.innerWidth);
|
|
927
|
-
const resized = new IncodeCanvas(document.createElement("canvas"));
|
|
928
|
-
const canvasHeight = this.height();
|
|
929
|
-
if (!canvasHeight) return null;
|
|
930
|
-
const ratio = canvasHeight / videoElementHeight;
|
|
931
|
-
const newWidth = window.innerWidth;
|
|
932
|
-
const newHeight = window.innerHeight;
|
|
933
|
-
resized.setWidth(newWidth);
|
|
934
|
-
resized.setHeight(newHeight);
|
|
935
|
-
const context = resized.getContext("2d");
|
|
936
|
-
if (!context) return null;
|
|
937
|
-
context.drawImage(this.canvas, ratio * cameraOffsetX / 2, 0, ratio * newWidth, ratio * newHeight, 0, 0, newWidth, newHeight);
|
|
938
|
-
return resized;
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
//#endregion
|
|
943
|
-
//#region ../infra/src/media/video.ts
|
|
944
|
-
/**
|
|
945
|
-
* Creates a hidden video element for a stream and appends it to document.body.
|
|
946
|
-
*/
|
|
947
|
-
function createHiddenVideoElement(stream) {
|
|
948
|
-
if (typeof document === "undefined") throw new Error("Document not available");
|
|
949
|
-
const video = document.createElement("video");
|
|
950
|
-
video.autoplay = true;
|
|
951
|
-
video.playsInline = true;
|
|
952
|
-
video.muted = true;
|
|
953
|
-
video.srcObject = stream;
|
|
954
|
-
video.style.width = "0px";
|
|
955
|
-
video.style.height = "0px";
|
|
956
|
-
video.style.position = "absolute";
|
|
957
|
-
video.style.top = "0";
|
|
958
|
-
video.style.left = "0";
|
|
959
|
-
video.style.zIndex = "-1";
|
|
960
|
-
document.body.appendChild(video);
|
|
961
|
-
return {
|
|
962
|
-
element: video,
|
|
963
|
-
dispose: () => {
|
|
964
|
-
video.srcObject = null;
|
|
965
|
-
if (video.parentElement) video.parentElement.removeChild(video);
|
|
966
|
-
}
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
//#endregion
|
|
971
|
-
//#region src/internal/deepsight/metadataService.ts
|
|
972
|
-
const IP_PROVIDER_URL = "https://api.ipify.org?format=json";
|
|
973
|
-
async function fetchPublicIp(browserEnv) {
|
|
974
|
-
return (await browserEnv.fetchJson(IP_PROVIDER_URL, 3e3))?.ip || "";
|
|
975
|
-
}
|
|
976
|
-
function createMetadataService(wasmUtil, visibility, browserEnv) {
|
|
977
|
-
return {
|
|
978
|
-
async initialize(sdkVersion, disableIpify = false) {
|
|
979
|
-
wasmUtil.setSdkPlatform("WEBAPP");
|
|
980
|
-
wasmUtil.setSdkVersion(sdkVersion);
|
|
981
|
-
const ua = getUserAgent();
|
|
982
|
-
const isMobile = /Android|iPhone|iPad|iPod/i.test(ua);
|
|
983
|
-
const deviceInfo = getDeviceInfo();
|
|
984
|
-
const visitorId = browserEnv.generateCanvasFingerprint();
|
|
985
|
-
const ip = disableIpify ? "" : await fetchPublicIp(browserEnv);
|
|
986
|
-
const screenDimensions = browserEnv.getScreenDimensions();
|
|
987
|
-
const deviceMetadata = {
|
|
988
|
-
kind: isMobile ? "mobile" : "desktop",
|
|
989
|
-
model: "",
|
|
990
|
-
os: void 0,
|
|
991
|
-
osVersion: void 0,
|
|
992
|
-
screenDimensions,
|
|
993
|
-
numTouchPoints: deviceInfo.maxTouchPoints,
|
|
994
|
-
fingerprintHash: visitorId,
|
|
995
|
-
ip,
|
|
996
|
-
backgroundMode: false
|
|
997
|
-
};
|
|
998
|
-
wasmUtil.setDeviceInfo(deviceMetadata);
|
|
999
|
-
const navigatorPrefixes = browserEnv.getNavigatorPrefixes();
|
|
1000
|
-
const browserInfo = {
|
|
1001
|
-
userAgent: ua,
|
|
1002
|
-
getUserMediaAvailability: {
|
|
1003
|
-
webkit: navigatorPrefixes.webkit,
|
|
1004
|
-
moz: navigatorPrefixes.moz,
|
|
1005
|
-
o: navigatorPrefixes.o,
|
|
1006
|
-
ms: navigatorPrefixes.ms
|
|
1007
|
-
},
|
|
1008
|
-
webglFingerprint: browserEnv.getWebGLRenderer(),
|
|
1009
|
-
inspectorOpened: false,
|
|
1010
|
-
isMockedBrowser: isBrowserSimulation(browserEnv)
|
|
1011
|
-
};
|
|
1012
|
-
wasmUtil.setBrowserInfo(browserInfo, false);
|
|
1013
|
-
},
|
|
1014
|
-
updateCameraInfo(videoTrack) {
|
|
1015
|
-
const settings = videoTrack.getSettings();
|
|
1016
|
-
const capabilities = videoTrack.getCapabilities?.() ?? {};
|
|
1017
|
-
const labels = videoTrack.label ? [videoTrack.label] : [];
|
|
1018
|
-
const cameraInfo = {
|
|
1019
|
-
facingMode: settings.facingMode === "user" ? "frontal" : settings.facingMode === "environment" ? "back" : settings.facingMode || "unknown",
|
|
1020
|
-
settings,
|
|
1021
|
-
capabilities,
|
|
1022
|
-
labels
|
|
1023
|
-
};
|
|
1024
|
-
wasmUtil.setCameraInfo(cameraInfo);
|
|
1025
|
-
},
|
|
1026
|
-
async checkForVirtualCameraByLabel(videoTrack = null) {
|
|
1027
|
-
try {
|
|
1028
|
-
if (!videoTrack) {
|
|
1029
|
-
const labels = await browserEnv.enumerateVideoDeviceLabels();
|
|
1030
|
-
for (const label of labels) if (wasmUtil.isVirtualCamera(label)) return true;
|
|
1031
|
-
}
|
|
1032
|
-
if (videoTrack && wasmUtil.isVirtualCamera(videoTrack.label)) return true;
|
|
1033
|
-
return false;
|
|
1034
|
-
} catch {
|
|
1035
|
-
return false;
|
|
1036
|
-
}
|
|
1037
|
-
},
|
|
1038
|
-
async analyzeFrame(imageData) {
|
|
1039
|
-
await wasmUtil.analyzeFrame(imageData);
|
|
1040
|
-
},
|
|
1041
|
-
setMotionStatus(status) {
|
|
1042
|
-
wasmUtil.setMotionStatus(status);
|
|
1043
|
-
},
|
|
1044
|
-
setBackgroundMode(backgroundMode) {
|
|
1045
|
-
wasmUtil.setBackgroundMode(backgroundMode || visibility.wasBackgrounded);
|
|
1046
|
-
visibility.reset();
|
|
1047
|
-
},
|
|
1048
|
-
estimatePerformance() {
|
|
1049
|
-
return wasmUtil.estimatePerformance();
|
|
1050
|
-
},
|
|
1051
|
-
getMetadata() {
|
|
1052
|
-
return wasmUtil.getMetadata();
|
|
1053
|
-
},
|
|
1054
|
-
getCheck() {
|
|
1055
|
-
return wasmUtil.getCheck();
|
|
1056
|
-
},
|
|
1057
|
-
getPipelineState() {
|
|
1058
|
-
return wasmUtil.getPipelineState();
|
|
1059
|
-
},
|
|
1060
|
-
preparePipelineState() {
|
|
1061
|
-
wasmUtil.getPipelineState();
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
//#endregion
|
|
1067
|
-
//#region src/internal/deepsight/motionStatusService.ts
|
|
1068
|
-
function createMotionStatusService(motionSensor) {
|
|
1069
|
-
return {
|
|
1070
|
-
async requestPermission() {
|
|
1071
|
-
return motionSensor.requestPermission();
|
|
1072
|
-
},
|
|
1073
|
-
async start() {
|
|
1074
|
-
await motionSensor.start();
|
|
1075
|
-
},
|
|
1076
|
-
stop() {
|
|
1077
|
-
motionSensor.stop();
|
|
1078
|
-
},
|
|
1079
|
-
check() {
|
|
1080
|
-
return motionSensor.check();
|
|
1081
|
-
},
|
|
1082
|
-
get isRunning() {
|
|
1083
|
-
return motionSensor.isRunning;
|
|
1084
|
-
},
|
|
1085
|
-
get hasPermission() {
|
|
1086
|
-
return motionSensor.hasPermission;
|
|
1087
|
-
}
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
//#endregion
|
|
1092
|
-
//#region src/internal/virtualCameraCheck.ts
|
|
1093
|
-
/**
|
|
1094
|
-
* Sends the analyzed frame image to the backend for logging.
|
|
1095
|
-
*/
|
|
1096
|
-
async function logFrame({ source, base64Image, token }) {
|
|
1097
|
-
try {
|
|
1098
|
-
return (await api.post("/omni/log/frame/v2", { base64Image }, {
|
|
1099
|
-
query: { source },
|
|
1100
|
-
headers: { "X-Incode-Hardware-Id": token }
|
|
1101
|
-
})).data;
|
|
1102
|
-
} catch {
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* Runs the WASM virtual camera check and handles logging and stats.
|
|
1108
|
-
*/
|
|
1109
|
-
async function runVirtualCameraCheck({ wasmUtil, source, token }) {
|
|
1110
|
-
const output = {
|
|
1111
|
-
canvas: null,
|
|
1112
|
-
itr: null,
|
|
1113
|
-
skipped: null
|
|
1114
|
-
};
|
|
1115
|
-
await wasmUtil.poc(output);
|
|
1116
|
-
if (output.skipped !== false) return;
|
|
1117
|
-
if (output.canvas && token) {
|
|
1118
|
-
const base64Image = new IncodeCanvas(output.canvas).getBase64Image();
|
|
1119
|
-
if (base64Image) await logFrame({
|
|
1120
|
-
source,
|
|
1121
|
-
base64Image,
|
|
1122
|
-
token
|
|
1123
|
-
});
|
|
1124
|
-
}
|
|
1125
|
-
if (output.itr === true) {
|
|
1126
|
-
addDeviceStats({ virtualCameraDetected: true });
|
|
1127
|
-
wasmUtil.setZc("FAIL");
|
|
1128
|
-
} else if (output.itr === false) wasmUtil.setZc("PASS");
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
//#endregion
|
|
1132
|
-
//#region src/internal/deepsight/deepsightService.ts
|
|
1133
|
-
function createDeepsightService(config) {
|
|
1134
|
-
const metadata = createMetadataService(config.wasmUtil, config.visibility, config.browserEnv);
|
|
1135
|
-
const motion = createMotionStatusService(config.motionSensor);
|
|
1136
|
-
return {
|
|
1137
|
-
metadata,
|
|
1138
|
-
motion,
|
|
1139
|
-
async initialize(disableIpify = false) {
|
|
1140
|
-
await metadata.initialize(config.sdkVersion, disableIpify);
|
|
1141
|
-
metadata.estimatePerformance();
|
|
1142
|
-
},
|
|
1143
|
-
async requestMotionPermission() {
|
|
1144
|
-
return motion.requestPermission();
|
|
1145
|
-
},
|
|
1146
|
-
async startMotionSensors() {
|
|
1147
|
-
await motion.start();
|
|
1148
|
-
},
|
|
1149
|
-
stopMotionSensors() {
|
|
1150
|
-
motion.stop();
|
|
1151
|
-
},
|
|
1152
|
-
async checkVirtualCamera(videoTrack) {
|
|
1153
|
-
metadata.updateCameraInfo(videoTrack);
|
|
1154
|
-
return metadata.checkForVirtualCameraByLabel(videoTrack);
|
|
1155
|
-
},
|
|
1156
|
-
async performVirtualCameraCheck(sessionToken, source) {
|
|
1157
|
-
await runVirtualCameraCheck({
|
|
1158
|
-
wasmUtil: config.wasmUtil,
|
|
1159
|
-
source,
|
|
1160
|
-
token: sessionToken
|
|
1161
|
-
});
|
|
1162
|
-
},
|
|
1163
|
-
async performPrcCheck(params) {
|
|
1164
|
-
const prcStream = await requestCameraAccess(params.constraints);
|
|
1165
|
-
const hiddenVideo = createHiddenVideoElement(prcStream);
|
|
1166
|
-
try {
|
|
1167
|
-
await config.wasmUtil.prc();
|
|
1168
|
-
} finally {
|
|
1169
|
-
hiddenVideo.dispose();
|
|
1170
|
-
stopCameraStream(prcStream);
|
|
1171
|
-
}
|
|
1172
|
-
},
|
|
1173
|
-
async analyzeFrame(imageData) {
|
|
1174
|
-
await metadata.analyzeFrame(imageData);
|
|
1175
|
-
metadata.preparePipelineState();
|
|
1176
|
-
const motionStatus = motion.check();
|
|
1177
|
-
metadata.setMotionStatus(motionStatus);
|
|
1178
|
-
metadata.getCheck();
|
|
1179
|
-
metadata.setBackgroundMode(false);
|
|
1180
|
-
},
|
|
1181
|
-
getMetadata() {
|
|
1182
|
-
return metadata.getMetadata();
|
|
1183
|
-
},
|
|
1184
|
-
getMotionStatus() {
|
|
1185
|
-
return motion.check();
|
|
1186
|
-
},
|
|
1187
|
-
getAnalysisStatus() {
|
|
1188
|
-
return metadata.getCheck();
|
|
1189
|
-
},
|
|
1190
|
-
getPipelineState() {
|
|
1191
|
-
return metadata.getPipelineState();
|
|
1192
|
-
},
|
|
1193
|
-
cleanup() {
|
|
1194
|
-
motion.stop();
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
//#endregion
|
|
1200
|
-
//#region ../infra/src/providers/browser/MotionSensorProvider.ts
|
|
1201
|
-
var MotionSensorProvider = class {
|
|
1202
|
-
constructor(thresholds) {
|
|
1203
|
-
this._isRunning = false;
|
|
1204
|
-
this._hasPermission = true;
|
|
1205
|
-
this.acl = null;
|
|
1206
|
-
this.gyro = null;
|
|
1207
|
-
this.minNumberOfFrames = 3;
|
|
1208
|
-
this.maxFrequency = 60;
|
|
1209
|
-
this.emptyParams = {
|
|
1210
|
-
meanX: 0,
|
|
1211
|
-
meanY: 0,
|
|
1212
|
-
meanZ: 0,
|
|
1213
|
-
m2X: 0,
|
|
1214
|
-
m2Y: 0,
|
|
1215
|
-
m2Z: 0,
|
|
1216
|
-
cumulativeAbsErrorX: 0,
|
|
1217
|
-
cumulativeAbsErrorY: 0,
|
|
1218
|
-
cumulativeAbsErrorZ: 0,
|
|
1219
|
-
ptsNum: 0
|
|
1220
|
-
};
|
|
1221
|
-
this.paramsAcc = { ...this.emptyParams };
|
|
1222
|
-
this.paramsGyro = { ...this.emptyParams };
|
|
1223
|
-
this.paramsAccGrOld = { ...this.emptyParams };
|
|
1224
|
-
this.paramsAccOld = { ...this.emptyParams };
|
|
1225
|
-
this.paramsGyroscopeOld = { ...this.emptyParams };
|
|
1226
|
-
this.paramsOrientationOld = { ...this.emptyParams };
|
|
1227
|
-
this.deviceMotionListener = (event) => {
|
|
1228
|
-
if (event.accelerationIncludingGravity) {
|
|
1229
|
-
const accGrVal = {
|
|
1230
|
-
x: event.accelerationIncludingGravity.x,
|
|
1231
|
-
y: event.accelerationIncludingGravity.y,
|
|
1232
|
-
z: event.accelerationIncludingGravity.z
|
|
1233
|
-
};
|
|
1234
|
-
if (this.checkFields(accGrVal)) {
|
|
1235
|
-
this.paramsAccGrOld.ptsNum += 1;
|
|
1236
|
-
this.updateParams(this.paramsAccGrOld, accGrVal);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
if (event.acceleration) {
|
|
1240
|
-
const accVal = {
|
|
1241
|
-
x: event.acceleration.x,
|
|
1242
|
-
y: event.acceleration.y,
|
|
1243
|
-
z: event.acceleration.z
|
|
1244
|
-
};
|
|
1245
|
-
if (this.checkFields(accVal)) {
|
|
1246
|
-
this.paramsAccOld.ptsNum += 1;
|
|
1247
|
-
this.updateParams(this.paramsAccOld, accVal);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
if (event.rotationRate) {
|
|
1251
|
-
const gyroVal = {
|
|
1252
|
-
x: event.rotationRate.alpha,
|
|
1253
|
-
y: event.rotationRate.beta,
|
|
1254
|
-
z: event.rotationRate.gamma
|
|
1255
|
-
};
|
|
1256
|
-
if (this.checkFields(gyroVal)) {
|
|
1257
|
-
this.paramsGyroscopeOld.ptsNum += 1;
|
|
1258
|
-
this.updateParams(this.paramsGyroscopeOld, gyroVal);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
this.deviceOrientationListener = (event) => {
|
|
1263
|
-
const orientationVal = {
|
|
1264
|
-
x: event.alpha,
|
|
1265
|
-
y: event.beta,
|
|
1266
|
-
z: event.gamma
|
|
1267
|
-
};
|
|
1268
|
-
if (this.checkFields(orientationVal)) {
|
|
1269
|
-
this.paramsOrientationOld.ptsNum += 1;
|
|
1270
|
-
this.updateParams(this.paramsOrientationOld, orientationVal);
|
|
1271
|
-
}
|
|
1272
|
-
};
|
|
1273
|
-
this.thresholds = {
|
|
1274
|
-
accThreshold: thresholds?.accThreshold ?? .3,
|
|
1275
|
-
gyroThreshold: thresholds?.gyroThreshold ?? .3,
|
|
1276
|
-
accGrOldThreshold: thresholds?.accGrOldThreshold ?? .3,
|
|
1277
|
-
accOldThreshold: thresholds?.accOldThreshold ?? .3,
|
|
1278
|
-
gyroscopeOldThreshold: thresholds?.gyroscopeOldThreshold ?? 10,
|
|
1279
|
-
orientationOldThreshold: thresholds?.orientationOldThreshold ?? 10,
|
|
1280
|
-
maeAccThreshold: thresholds?.maeAccThreshold ?? .3,
|
|
1281
|
-
maeGyroThreshold: thresholds?.maeGyroThreshold ?? .3,
|
|
1282
|
-
maeAccGrOldThreshold: thresholds?.maeAccGrOldThreshold ?? .3,
|
|
1283
|
-
maeAccOldThreshold: thresholds?.maeAccOldThreshold ?? .3,
|
|
1284
|
-
maeGyroscopeOldThreshold: thresholds?.maeGyroscopeOldThreshold ?? 10,
|
|
1285
|
-
maeOrientationOldThreshold: thresholds?.maeOrientationOldThreshold ?? 10
|
|
1286
|
-
};
|
|
1287
|
-
}
|
|
1288
|
-
get isRunning() {
|
|
1289
|
-
return this._isRunning;
|
|
1290
|
-
}
|
|
1291
|
-
get hasPermission() {
|
|
1292
|
-
return this._hasPermission;
|
|
1293
|
-
}
|
|
1294
|
-
async requestPermission() {
|
|
1295
|
-
if (typeof DeviceMotionEvent !== "undefined" && typeof DeviceMotionEvent.requestPermission === "function") {
|
|
1296
|
-
sessionStorage.setItem("motionSensorsPermissionsRequested", String(true));
|
|
1297
|
-
try {
|
|
1298
|
-
if (await DeviceMotionEvent.requestPermission() !== "granted") {
|
|
1299
|
-
this._hasPermission = false;
|
|
1300
|
-
return "denied";
|
|
1301
|
-
}
|
|
1302
|
-
return "granted";
|
|
1303
|
-
} catch {
|
|
1304
|
-
this._hasPermission = false;
|
|
1305
|
-
return "denied";
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
return "not-required";
|
|
1309
|
-
}
|
|
1310
|
-
initializeAccelerometer() {
|
|
1311
|
-
if (!("Accelerometer" in window)) return;
|
|
1312
|
-
try {
|
|
1313
|
-
const AccelerometerConstructor = window.Accelerometer;
|
|
1314
|
-
if (AccelerometerConstructor) {
|
|
1315
|
-
this.acl = new AccelerometerConstructor({ frequency: this.maxFrequency });
|
|
1316
|
-
this.acl.addEventListener("reading", () => this.updateAcc());
|
|
1317
|
-
}
|
|
1318
|
-
} catch {}
|
|
1319
|
-
}
|
|
1320
|
-
initializeGyroscope() {
|
|
1321
|
-
if (!("Gyroscope" in window)) return;
|
|
1322
|
-
try {
|
|
1323
|
-
const GyroscopeConstructor = window.Gyroscope;
|
|
1324
|
-
if (GyroscopeConstructor) {
|
|
1325
|
-
this.gyro = new GyroscopeConstructor({ frequency: this.maxFrequency });
|
|
1326
|
-
this.gyro.addEventListener("reading", () => this.updateGyro());
|
|
1327
|
-
}
|
|
1328
|
-
} catch {}
|
|
1329
|
-
}
|
|
1330
|
-
async start() {
|
|
1331
|
-
if (this._isRunning || !this._hasPermission) return;
|
|
1332
|
-
try {
|
|
1333
|
-
this.initializeAccelerometer();
|
|
1334
|
-
if (this.acl) this.acl.start();
|
|
1335
|
-
} catch {}
|
|
1336
|
-
try {
|
|
1337
|
-
this.initializeGyroscope();
|
|
1338
|
-
if (this.gyro) this.gyro.start();
|
|
1339
|
-
} catch {}
|
|
1340
|
-
window.addEventListener("devicemotion", this.deviceMotionListener);
|
|
1341
|
-
window.addEventListener("deviceorientation", this.deviceOrientationListener);
|
|
1342
|
-
this._isRunning = true;
|
|
1343
|
-
}
|
|
1344
|
-
stop() {
|
|
1345
|
-
this._isRunning = false;
|
|
1346
|
-
if (this.acl) this.acl.stop();
|
|
1347
|
-
if (this.gyro) this.gyro.stop();
|
|
1348
|
-
window.removeEventListener("devicemotion", this.deviceMotionListener);
|
|
1349
|
-
window.removeEventListener("deviceorientation", this.deviceOrientationListener);
|
|
1350
|
-
this.paramsAcc = { ...this.emptyParams };
|
|
1351
|
-
this.paramsGyro = { ...this.emptyParams };
|
|
1352
|
-
this.paramsAccGrOld = { ...this.emptyParams };
|
|
1353
|
-
this.paramsAccOld = { ...this.emptyParams };
|
|
1354
|
-
this.paramsGyroscopeOld = { ...this.emptyParams };
|
|
1355
|
-
this.paramsOrientationOld = { ...this.emptyParams };
|
|
1356
|
-
}
|
|
1357
|
-
updateAcc() {
|
|
1358
|
-
if (!this._isRunning || !this.acl) return;
|
|
1359
|
-
this.paramsAcc.ptsNum += 1;
|
|
1360
|
-
const val = {
|
|
1361
|
-
x: this.acl.x,
|
|
1362
|
-
y: this.acl.y,
|
|
1363
|
-
z: this.acl.z
|
|
1364
|
-
};
|
|
1365
|
-
if (this.checkFields(val)) this.updateParams(this.paramsAcc, val);
|
|
1366
|
-
}
|
|
1367
|
-
updateGyro() {
|
|
1368
|
-
if (!this._isRunning || !this.gyro) return;
|
|
1369
|
-
this.paramsGyro.ptsNum += 1;
|
|
1370
|
-
const val = {
|
|
1371
|
-
x: this.gyro.x,
|
|
1372
|
-
y: this.gyro.y,
|
|
1373
|
-
z: this.gyro.z
|
|
1374
|
-
};
|
|
1375
|
-
if (this.checkFields(val)) this.updateParams(this.paramsGyro, val);
|
|
1376
|
-
}
|
|
1377
|
-
check() {
|
|
1378
|
-
if (!this._hasPermission) return "UNCLEAR";
|
|
1379
|
-
const result = this.checkStability();
|
|
1380
|
-
return result === null ? "UNCLEAR" : result ? "FAIL" : "PASS";
|
|
1381
|
-
}
|
|
1382
|
-
checkStability() {
|
|
1383
|
-
if (!this._isRunning) return null;
|
|
1384
|
-
const filteredStdChecks = [
|
|
1385
|
-
this.gyro ? this.isBelowStdThreshold(this.paramsGyro, this.thresholds.gyroThreshold) : null,
|
|
1386
|
-
this.acl ? this.isBelowStdThreshold(this.paramsAcc, this.thresholds.accThreshold) : null,
|
|
1387
|
-
this.isBelowStdThreshold(this.paramsAccGrOld, this.thresholds.accGrOldThreshold),
|
|
1388
|
-
this.isBelowStdThreshold(this.paramsAccOld, this.thresholds.accOldThreshold),
|
|
1389
|
-
this.isBelowStdThreshold(this.paramsGyroscopeOld, this.thresholds.gyroscopeOldThreshold),
|
|
1390
|
-
this.isBelowStdThreshold(this.paramsOrientationOld, this.thresholds.orientationOldThreshold)
|
|
1391
|
-
].filter((check) => check !== null);
|
|
1392
|
-
const finalStdCheck = filteredStdChecks.length > 0 ? filteredStdChecks.every((check) => check) : null;
|
|
1393
|
-
const filteredMaeChecks = [
|
|
1394
|
-
this.gyro ? this.isBelowMaeThreshold(this.paramsGyro, this.thresholds.maeGyroThreshold) : null,
|
|
1395
|
-
this.acl ? this.isBelowMaeThreshold(this.paramsAcc, this.thresholds.maeAccThreshold) : null,
|
|
1396
|
-
this.isBelowMaeThreshold(this.paramsAccGrOld, this.thresholds.maeAccGrOldThreshold),
|
|
1397
|
-
this.isBelowMaeThreshold(this.paramsAccOld, this.thresholds.maeAccOldThreshold),
|
|
1398
|
-
this.isBelowMaeThreshold(this.paramsGyroscopeOld, this.thresholds.maeGyroscopeOldThreshold),
|
|
1399
|
-
this.isBelowMaeThreshold(this.paramsOrientationOld, this.thresholds.maeOrientationOldThreshold)
|
|
1400
|
-
].filter((check) => check !== null);
|
|
1401
|
-
const finalMaeCheck = filteredMaeChecks.length > 0 ? filteredMaeChecks.every((check) => check) : null;
|
|
1402
|
-
return finalStdCheck === null ? finalMaeCheck === null ? null : finalMaeCheck : finalMaeCheck !== null ? finalStdCheck && finalMaeCheck : finalStdCheck;
|
|
1403
|
-
}
|
|
1404
|
-
updateParams(params, val) {
|
|
1405
|
-
const deltaX = val.x - params.meanX;
|
|
1406
|
-
const deltaY = val.y - params.meanY;
|
|
1407
|
-
const deltaZ = val.z - params.meanZ;
|
|
1408
|
-
params.meanX += deltaX / params.ptsNum;
|
|
1409
|
-
params.meanY += deltaY / params.ptsNum;
|
|
1410
|
-
params.meanZ += deltaZ / params.ptsNum;
|
|
1411
|
-
params.m2X += deltaX * (val.x - params.meanX);
|
|
1412
|
-
params.m2Y += deltaY * (val.y - params.meanY);
|
|
1413
|
-
params.m2Z += deltaZ * (val.z - params.meanZ);
|
|
1414
|
-
params.cumulativeAbsErrorX += Math.abs(val.x - params.meanX);
|
|
1415
|
-
params.cumulativeAbsErrorY += Math.abs(val.y - params.meanY);
|
|
1416
|
-
params.cumulativeAbsErrorZ += Math.abs(val.z - params.meanZ);
|
|
1417
|
-
}
|
|
1418
|
-
calculateStd(params) {
|
|
1419
|
-
const variance = {
|
|
1420
|
-
x: params.m2X / params.ptsNum,
|
|
1421
|
-
y: params.m2Y / params.ptsNum,
|
|
1422
|
-
z: params.m2Z / params.ptsNum
|
|
1423
|
-
};
|
|
1424
|
-
return {
|
|
1425
|
-
x: Math.sqrt(variance.x),
|
|
1426
|
-
y: Math.sqrt(variance.y),
|
|
1427
|
-
z: Math.sqrt(variance.z)
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
calculateMae(params) {
|
|
1431
|
-
return {
|
|
1432
|
-
x: params.cumulativeAbsErrorX / params.ptsNum,
|
|
1433
|
-
y: params.cumulativeAbsErrorY / params.ptsNum,
|
|
1434
|
-
z: params.cumulativeAbsErrorZ / params.ptsNum
|
|
1435
|
-
};
|
|
1436
|
-
}
|
|
1437
|
-
checkFields(point) {
|
|
1438
|
-
return point.x !== null && point.y !== null && point.z !== null;
|
|
1439
|
-
}
|
|
1440
|
-
isBelowStdThreshold(params, threshold) {
|
|
1441
|
-
if (params.ptsNum < this.minNumberOfFrames) return null;
|
|
1442
|
-
const std = this.calculateStd(params);
|
|
1443
|
-
return std.x < threshold && std.y < threshold && std.z < threshold;
|
|
1444
|
-
}
|
|
1445
|
-
isBelowMaeThreshold(params, threshold) {
|
|
1446
|
-
if (params.ptsNum < this.minNumberOfFrames) return null;
|
|
1447
|
-
const mae = this.calculateMae(params);
|
|
1448
|
-
return mae.x < threshold && mae.y < threshold && mae.z < threshold;
|
|
1449
|
-
}
|
|
1450
|
-
};
|
|
1451
|
-
|
|
1452
668
|
//#endregion
|
|
1453
669
|
//#region ../infra/src/providers/wasm/BaseWasmProvider.ts
|
|
1454
670
|
/**
|
|
@@ -1533,4 +749,4 @@ var BaseWasmProvider = class {
|
|
|
1533
749
|
};
|
|
1534
750
|
|
|
1535
751
|
//#endregion
|
|
1536
|
-
export {
|
|
752
|
+
export { IdCaptureModelType as a, WasmPipelineType as i, warmupWasm as n, mlWasmJSApi_default as r, BaseWasmProvider as t };
|