@incodetech/core 0.0.0-dev-20260403-10f7d94 → 0.0.0-dev-20260403-eccc51c

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.
Files changed (89) hide show
  1. package/dist/{BaseWasmProvider-BFXU7jj8.esm.js → BaseWasmProvider--AzPfwOm.esm.js} +4 -4
  2. package/dist/{Manager-9L3Rmc6X.esm.js → Manager-C6AGXEq_.esm.js} +4 -3
  3. package/dist/{StreamCanvasCapture-BowJVbkC.esm.js → StreamCanvasCapture-DkpkIgyL.esm.js} +6 -6
  4. package/dist/{WasmUtilProvider-DctESPCy.esm.js → WasmUtilProvider-BonqBWdj.esm.js} +1 -1
  5. package/dist/{addressSearch-uoJHvUT9.esm.js → addressSearch-DC5By0cC.esm.js} +4 -4
  6. package/dist/antifraud.d.ts +57 -0
  7. package/dist/antifraud.esm.js +77 -0
  8. package/dist/authentication.d.ts +9 -9
  9. package/dist/authentication.esm.js +13 -13
  10. package/dist/{authenticationManager-xQrUkboA.esm.js → authenticationManager-B4gSCgrO.esm.js} +6 -6
  11. package/dist/{authenticationManager-B5Yv9bDw.d.ts → authenticationManager-Bd10YGSO.d.ts} +2 -2
  12. package/dist/{backCameraStream-BJwEXNl4.esm.js → backCameraStream-DF_d7hTz.esm.js} +50 -21
  13. package/dist/consent.d.ts +52 -52
  14. package/dist/consent.esm.js +3 -3
  15. package/dist/curp-validation.d.ts +5 -5
  16. package/dist/curp-validation.esm.js +3 -3
  17. package/dist/{deepsightLoader-D2MKmB5z.esm.js → deepsightLoader-DKgEdLIS.esm.js} +7 -7
  18. package/dist/{deepsightService-CWnhwXLw.d.ts → deepsightService-Ciu0atv5.d.ts} +2 -2
  19. package/dist/document-capture.d.ts +73 -73
  20. package/dist/document-capture.esm.js +8 -7
  21. package/dist/document-upload.d.ts +50 -50
  22. package/dist/document-upload.esm.js +8 -7
  23. package/dist/ekyb.d.ts +3 -3
  24. package/dist/ekyb.esm.js +9 -9
  25. package/dist/ekyc.d.ts +3 -3
  26. package/dist/ekyc.esm.js +5 -5
  27. package/dist/email.d.ts +3 -3
  28. package/dist/email.esm.js +5 -5
  29. package/dist/{emailManager-BIq6pJa8.d.ts → emailManager-BQPIJR_O.d.ts} +2 -2
  30. package/dist/{emailManager-DDioJ_AQ.esm.js → emailManager-CpAwvP3v.esm.js} +4 -4
  31. package/dist/{endpoints-DEXxYYFi.esm.js → endpoints-CI5-28jT.esm.js} +2 -1
  32. package/dist/extensibility.d.ts +13 -13
  33. package/dist/extensibility.esm.js +20 -20
  34. package/dist/face-match.d.ts +1 -1
  35. package/dist/face-match.esm.js +3 -3
  36. package/dist/{faceCaptureManagerFactory-CN5-GRxP.d.ts → faceCaptureManagerFactory-CdwpYykv.d.ts} +6 -6
  37. package/dist/{faceCaptureSetup-Bq4TPX5D.esm.js → faceCaptureSetup-DbXgtcp7.esm.js} +11 -11
  38. package/dist/flow.d.ts +6 -6
  39. package/dist/flow.esm.js +8 -8
  40. package/dist/{flowCompletionService-CUT-cibE.esm.js → flowCompletionService-TnWijsSw.esm.js} +2 -2
  41. package/dist/{flowServices-Bi3F1654.esm.js → flowServices-CO2sIR3D.esm.js} +3 -3
  42. package/dist/geolocation.d.ts +2 -2
  43. package/dist/geolocation.esm.js +4 -4
  44. package/dist/government-validation.d.ts +2 -2
  45. package/dist/government-validation.esm.js +4 -4
  46. package/dist/id.d.ts +9 -9
  47. package/dist/id.esm.js +15 -15
  48. package/dist/{idCaptureManager-DlZXRwne.esm.js → idCaptureManager-DaLU1ug7.esm.js} +53 -24
  49. package/dist/{idCaptureManager-B1RWflj0.d.ts → idCaptureManager-IdqsAASp.d.ts} +14 -6
  50. package/dist/index.d.ts +10 -9
  51. package/dist/index.esm.js +16 -16
  52. package/dist/{lib-B5byelWf.esm.js → lib-i-4qLKdG.esm.js} +1 -1
  53. package/dist/mandatory-consent.d.ts +55 -55
  54. package/dist/mandatory-consent.esm.js +3 -3
  55. package/dist/phone.d.ts +3 -3
  56. package/dist/phone.esm.js +5 -5
  57. package/dist/{phoneManager-DXxuWtoy.esm.js → phoneManager-BAPHSXx8.esm.js} +4 -4
  58. package/dist/{phoneManager-Ba66ysK2.d.ts → phoneManager-DA8WUJtl.d.ts} +2 -2
  59. package/dist/redirect-to-mobile.d.ts +2 -2
  60. package/dist/redirect-to-mobile.esm.js +4 -4
  61. package/dist/selfie.d.ts +9 -9
  62. package/dist/selfie.esm.js +13 -13
  63. package/dist/{selfieManager-DSEpKb7Q.esm.js → selfieManager-BSkzncsa.esm.js} +4 -4
  64. package/dist/{selfieManager-BnfnTPcx.d.ts → selfieManager-Dft5wZQ_.d.ts} +2 -2
  65. package/dist/{session-Cr89qxxK.esm.js → session-OglUYC9l.esm.js} +5 -5
  66. package/dist/session.d.ts +1 -1
  67. package/dist/session.esm.js +3 -3
  68. package/dist/signature.d.ts +2 -2
  69. package/dist/signature.esm.js +3 -3
  70. package/dist/{stats-D4C7iDy1.esm.js → stats-BVigf5Rn.esm.js} +1 -1
  71. package/dist/stats.esm.js +2 -2
  72. package/dist/{types-BWGxcjiZ.d.ts → types-CiLyvJGb.d.ts} +1 -1
  73. package/dist/{types-BX1ZlbSR.d.ts → types-D8Y1faI5.d.ts} +1 -1
  74. package/package.json +7 -3
  75. /package/dist/{Actor-phIcsUhv.d.ts → Actor-By8WNHi-.d.ts} +0 -0
  76. /package/dist/{BrowserEnvironmentProvider-DApG6lNu.esm.js → BrowserEnvironmentProvider-BECjyw3_.esm.js} +0 -0
  77. /package/dist/{BrowserTimerProvider-CRhCvln7.esm.js → BrowserTimerProvider-CIqH6hJp.esm.js} +0 -0
  78. /package/dist/{Manager-BndLda4_.d.ts → Manager-CCT_-HuZ.d.ts} +0 -0
  79. /package/dist/{StateMachine-CGAi8x_b.d.ts → StateMachine-CM_aOfNL.d.ts} +0 -0
  80. /package/dist/{api-3fZO5bmj.esm.js → api-C2uzxrpN.esm.js} +0 -0
  81. /package/dist/{browserSimulation-zWJAZ1vA.esm.js → browserSimulation-DYAk0Ipe.esm.js} +0 -0
  82. /package/dist/{camera-Dv2WEhGe.d.ts → camera-6XJdOeBF.d.ts} +0 -0
  83. /package/dist/{camera-D-MPXRbZ.esm.js → camera-DAuRUvnp.esm.js} +0 -0
  84. /package/dist/{chunk-Boje8faD.esm.js → chunk-D6hkk-hd.esm.js} +0 -0
  85. /package/dist/{displayErrors-DzzB3fcR.d.ts → displayErrors-CGJwvrTl.d.ts} +0 -0
  86. /package/dist/{flowCompletionService-C_CShl_d.d.ts → flowCompletionService-BOd4Rk8n.d.ts} +0 -0
  87. /package/dist/{id-Dv0it9CY.esm.js → id-CzDAG_kM.esm.js} +0 -0
  88. /package/dist/{index-CuY8tqBC.d.ts → index-BuVKc9bv.d.ts} +0 -0
  89. /package/dist/{platform-B3nGssGZ.esm.js → platform-DdhkonXk.esm.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { t as isBrowserSimulation } from "./browserSimulation-zWJAZ1vA.esm.js";
2
- import { t as api } from "./api-3fZO5bmj.esm.js";
3
- import { i as stopCameraStream, r as requestCameraAccess } from "./camera-D-MPXRbZ.esm.js";
4
- import { t as addDeviceStats } from "./stats-D4C7iDy1.esm.js";
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
5
 
6
6
  //#region ../infra/src/wasm/IdCaptureModelType.ts
7
7
  let IdCaptureModelType = /* @__PURE__ */ function(IdCaptureModelType$1) {
@@ -1,5 +1,5 @@
1
- import { i as isApiConfigured, r as getToken, t as api } from "./api-3fZO5bmj.esm.js";
2
- import { t as endpoints } from "./endpoints-DEXxYYFi.esm.js";
1
+ import { i as isApiConfigured, r as getToken, t as api } from "./api-C2uzxrpN.esm.js";
2
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
3
3
 
4
4
  //#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
5
5
  function getGlobal() {
@@ -3525,7 +3525,8 @@ const eventModuleNames = {
3525
3525
  forms: "FORMS",
3526
3526
  customModule: "CUSTOM_MODULE",
3527
3527
  geolocation: "GEOLOCATION",
3528
- ekyb: "EKYB"
3528
+ ekyb: "EKYB",
3529
+ antifraud: "ANTIFRAUD"
3529
3530
  };
3530
3531
  const eventScreenNames = {
3531
3532
  faceMatch: "FACE_MATCH",
@@ -1,8 +1,8 @@
1
- import { a as __toDynamicImportESM } from "./chunk-Boje8faD.esm.js";
2
- import { a as getDeviceInfo, i as IncodeCanvas, n as MotionSensorProvider } from "./BaseWasmProvider-BFXU7jj8.esm.js";
3
- import { t as api } from "./api-3fZO5bmj.esm.js";
4
- import { t as endpoints } from "./endpoints-DEXxYYFi.esm.js";
5
- import { i as stopCameraStream, r as requestCameraAccess } from "./camera-D-MPXRbZ.esm.js";
1
+ import { a as __toDynamicImportESM } from "./chunk-D6hkk-hd.esm.js";
2
+ import { a as getDeviceInfo, i as IncodeCanvas, n as MotionSensorProvider } from "./BaseWasmProvider--AzPfwOm.esm.js";
3
+ import { t as api } from "./api-C2uzxrpN.esm.js";
4
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
5
+ import { i as stopCameraStream, r as requestCameraAccess } from "./camera-DAuRUvnp.esm.js";
6
6
 
7
7
  //#region src/internal/device/getDeviceClass.ts
8
8
  function getDeviceClass() {
@@ -174,7 +174,7 @@ async function requestPermission() {
174
174
  let openViduImport;
175
175
  async function loadOpenVidu() {
176
176
  if (openViduImport) return openViduImport;
177
- openViduImport = import("./lib-B5byelWf.esm.js").then(__toDynamicImportESM(1));
177
+ openViduImport = import("./lib-i-4qLKdG.esm.js").then(__toDynamicImportESM(1));
178
178
  return openViduImport;
179
179
  }
180
180
 
@@ -1,4 +1,4 @@
1
- import { l as mlWasmJSApi_default, t as BaseWasmProvider } from "./BaseWasmProvider-BFXU7jj8.esm.js";
1
+ import { l as mlWasmJSApi_default, t as BaseWasmProvider } from "./BaseWasmProvider--AzPfwOm.esm.js";
2
2
 
3
3
  //#region ../infra/src/providers/wasm/WasmUtilProvider.ts
4
4
  var WasmUtilProvider = class WasmUtilProvider extends BaseWasmProvider {
@@ -1,7 +1,7 @@
1
- import { t as api } from "./api-3fZO5bmj.esm.js";
2
- import { x as fromCallback } from "./Manager-9L3Rmc6X.esm.js";
3
- import { t as endpoints } from "./endpoints-DEXxYYFi.esm.js";
4
- import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CRhCvln7.esm.js";
1
+ import { t as api } from "./api-C2uzxrpN.esm.js";
2
+ import { x as fromCallback } from "./Manager-C6AGXEq_.esm.js";
3
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
4
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CIqH6hJp.esm.js";
5
5
 
6
6
  //#region src/shared/usStates.ts
7
7
  const usStates = {
@@ -0,0 +1,57 @@
1
+ import { t as Manager } from "./Manager-CCT_-HuZ.js";
2
+
3
+ //#region src/modules/antifraud/antifraudManager.d.ts
4
+ type AntifraudIdleState = {
5
+ status: 'idle';
6
+ };
7
+ type AntifraudProcessingState = {
8
+ status: 'processing';
9
+ };
10
+ type AntifraudFinishedState = {
11
+ status: 'finished';
12
+ };
13
+ /**
14
+ * Union of all possible antifraud manager states.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const state = antifraudManager.getState();
19
+ * if (state.status === 'finished') {
20
+ * console.log('Antifraud check complete');
21
+ * }
22
+ * ```
23
+ */
24
+ type AntifraudState = AntifraudIdleState | AntifraudProcessingState | AntifraudFinishedState;
25
+ /**
26
+ * Creates an antifraud manager for headless or UI-driven usage.
27
+ *
28
+ * @example Headless usage
29
+ * ```typescript
30
+ * const manager = createAntifraudManager();
31
+ * manager.subscribe((state) => console.log(state.status));
32
+ * manager.load();
33
+ * ```
34
+ */
35
+ declare function createAntifraudManager(): Manager<AntifraudState> & {
36
+ /**
37
+ * Kicks off the antifraud process.
38
+ * Transitions from 'idle' to 'processing'.
39
+ */
40
+ load(): void;
41
+ };
42
+ type AntifraudManager = ReturnType<typeof createAntifraudManager>;
43
+ //#endregion
44
+ //#region src/modules/antifraud/antifraudStateMachine.d.ts
45
+ declare const antifraudMachine: any;
46
+ //#endregion
47
+ //#region src/modules/antifraud/types.d.ts
48
+ /**
49
+ * Configuration options for the antifraud module.
50
+ *
51
+ * The antifraud module requires no configuration — it is a fire-and-forget
52
+ * process that runs the backend antifraud check and completes regardless of
53
+ * the API outcome.
54
+ */
55
+ type AntifraudConfig = Record<string, never>;
56
+ //#endregion
57
+ export { type AntifraudConfig, type AntifraudManager, type AntifraudState, antifraudMachine, createAntifraudManager };
@@ -0,0 +1,77 @@
1
+ import { t as api } from "./api-C2uzxrpN.esm.js";
2
+ import { C as createActor, S as fromPromise, r as eventModuleNames, s as createManagerInstrumentation, t as createManager, y as setup } from "./Manager-C6AGXEq_.esm.js";
3
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
4
+
5
+ //#region src/modules/antifraud/antifraudServices.ts
6
+ async function processAntifraud(signal) {
7
+ const res = await api.get(endpoints.processAntifraud, { signal });
8
+ if (!res.ok) throw new Error(`GET ${endpoints.processAntifraud} failed: ${res.status} ${res.statusText}`);
9
+ return res.data;
10
+ }
11
+
12
+ //#endregion
13
+ //#region src/modules/antifraud/antifraudStateMachine.ts
14
+ const antifraudMachine = setup({
15
+ types: {
16
+ context: {},
17
+ events: {}
18
+ },
19
+ actors: { processAntifraud: fromPromise(async ({ signal }) => {
20
+ return processAntifraud(signal);
21
+ }) }
22
+ }).createMachine({
23
+ id: "antifraud",
24
+ initial: "idle",
25
+ context: {},
26
+ states: {
27
+ idle: { on: { LOAD: { target: "processing" } } },
28
+ processing: { invoke: {
29
+ id: "processAntifraud",
30
+ src: "processAntifraud",
31
+ onDone: { target: "finished" },
32
+ onError: { target: "finished" }
33
+ } },
34
+ finished: { type: "final" }
35
+ }
36
+ });
37
+
38
+ //#endregion
39
+ //#region src/modules/antifraud/antifraudActor.ts
40
+ function createAntifraudActor() {
41
+ return createActor(antifraudMachine).start();
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/modules/antifraud/antifraudManager.ts
46
+ function mapState(snapshot) {
47
+ const typedSnapshot = snapshot;
48
+ if (typedSnapshot.matches("processing")) return { status: "processing" };
49
+ if (typedSnapshot.matches("finished")) return { status: "finished" };
50
+ return { status: "idle" };
51
+ }
52
+ function createApi({ actor }) {
53
+ return { load() {
54
+ actor.send({ type: "LOAD" });
55
+ } };
56
+ }
57
+ /**
58
+ * Creates an antifraud manager for headless or UI-driven usage.
59
+ *
60
+ * @example Headless usage
61
+ * ```typescript
62
+ * const manager = createAntifraudManager();
63
+ * manager.subscribe((state) => console.log(state.status));
64
+ * manager.load();
65
+ * ```
66
+ */
67
+ function createAntifraudManager() {
68
+ return createManager({
69
+ actor: createAntifraudActor(),
70
+ mapState,
71
+ createApi,
72
+ instrumentation: createManagerInstrumentation(eventModuleNames.antifraud)
73
+ });
74
+ }
75
+
76
+ //#endregion
77
+ export { antifraudMachine, createAntifraudManager };
@@ -1,10 +1,10 @@
1
- import "./StateMachine-CGAi8x_b.js";
2
- import "./Actor-phIcsUhv.js";
3
- import "./deepsightService-CWnhwXLw.js";
4
- import "./camera-Dv2WEhGe.js";
5
- import "./types-BWGxcjiZ.js";
6
- import "./types-BX1ZlbSR.js";
7
- import "./Manager-BndLda4_.js";
8
- import { _ as AuthenticationConfig, b as authenticationMachine, g as createAuthenticationActor, h as CreateAuthenticationActorOptions, m as AuthenticationActor } from "./faceCaptureManagerFactory-CN5-GRxP.js";
9
- import { n as AuthenticationState, r as createAuthenticationManager, t as AuthenticationManager } from "./authenticationManager-B5Yv9bDw.js";
1
+ import "./StateMachine-CM_aOfNL.js";
2
+ import "./Actor-By8WNHi-.js";
3
+ import "./deepsightService-Ciu0atv5.js";
4
+ import "./camera-6XJdOeBF.js";
5
+ import "./types-CiLyvJGb.js";
6
+ import "./types-D8Y1faI5.js";
7
+ import "./Manager-CCT_-HuZ.js";
8
+ import { _ as AuthenticationConfig, b as authenticationMachine, g as createAuthenticationActor, h as CreateAuthenticationActorOptions, m as AuthenticationActor } from "./faceCaptureManagerFactory-CdwpYykv.js";
9
+ import { n as AuthenticationState, r as createAuthenticationManager, t as AuthenticationManager } from "./authenticationManager-Bd10YGSO.js";
10
10
  export { type AuthenticationActor, type AuthenticationConfig, type AuthenticationManager, type AuthenticationState, type CreateAuthenticationActorOptions, authenticationMachine, createAuthenticationActor, createAuthenticationManager };
@@ -1,15 +1,15 @@
1
- import "./platform-B3nGssGZ.esm.js";
2
- import "./BaseWasmProvider-BFXU7jj8.esm.js";
3
- import "./StreamCanvasCapture-BowJVbkC.esm.js";
4
- import "./browserSimulation-zWJAZ1vA.esm.js";
5
- import "./api-3fZO5bmj.esm.js";
6
- import "./Manager-9L3Rmc6X.esm.js";
7
- import "./endpoints-DEXxYYFi.esm.js";
8
- import "./camera-D-MPXRbZ.esm.js";
9
- import "./stats-D4C7iDy1.esm.js";
10
- import "./backCameraStream-BJwEXNl4.esm.js";
11
- import "./WasmUtilProvider-DctESPCy.esm.js";
12
- import "./faceCaptureSetup-Bq4TPX5D.esm.js";
13
- import { i as authenticationMachine, r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-xQrUkboA.esm.js";
1
+ import "./platform-DdhkonXk.esm.js";
2
+ import "./BaseWasmProvider--AzPfwOm.esm.js";
3
+ import "./StreamCanvasCapture-DkpkIgyL.esm.js";
4
+ import "./browserSimulation-DYAk0Ipe.esm.js";
5
+ import "./api-C2uzxrpN.esm.js";
6
+ import "./Manager-C6AGXEq_.esm.js";
7
+ import "./endpoints-CI5-28jT.esm.js";
8
+ import "./camera-DAuRUvnp.esm.js";
9
+ import "./stats-BVigf5Rn.esm.js";
10
+ import "./backCameraStream-DF_d7hTz.esm.js";
11
+ import "./WasmUtilProvider-BonqBWdj.esm.js";
12
+ import "./faceCaptureSetup-DbXgtcp7.esm.js";
13
+ import { i as authenticationMachine, r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-B4gSCgrO.esm.js";
14
14
 
15
15
  export { authenticationMachine, createAuthenticationActor, createAuthenticationManager };
@@ -1,9 +1,9 @@
1
- import { f as BrowserStorageProvider, p as getDeviceClass } from "./StreamCanvasCapture-BowJVbkC.esm.js";
2
- import { t as api } from "./api-3fZO5bmj.esm.js";
3
- import { C as createActor, S as fromPromise, b as assign, r as eventModuleNames } from "./Manager-9L3Rmc6X.esm.js";
4
- import { t as endpoints } from "./endpoints-DEXxYYFi.esm.js";
5
- import { t as WasmUtilProvider } from "./WasmUtilProvider-DctESPCy.esm.js";
6
- import { a as createFaceCaptureManagerFromActor, i as FACE_ERROR_CODES, t as faceCaptureMachine } from "./faceCaptureSetup-Bq4TPX5D.esm.js";
1
+ import { f as BrowserStorageProvider, p as getDeviceClass } from "./StreamCanvasCapture-DkpkIgyL.esm.js";
2
+ import { t as api } from "./api-C2uzxrpN.esm.js";
3
+ import { C as createActor, S as fromPromise, b as assign, r as eventModuleNames } from "./Manager-C6AGXEq_.esm.js";
4
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
5
+ import { t as WasmUtilProvider } from "./WasmUtilProvider-BonqBWdj.esm.js";
6
+ import { a as createFaceCaptureManagerFromActor, i as FACE_ERROR_CODES, t as faceCaptureMachine } from "./faceCaptureSetup-DbXgtcp7.esm.js";
7
7
 
8
8
  //#region src/modules/authentication/authenticationErrorUtils.ts
9
9
  const AUTH_ERROR_MAP = {
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-BndLda4_.js";
2
- import { h as CreateAuthenticationActorOptions, m as AuthenticationActor, n as FaceCaptureManagerState, t as FaceCaptureManager } from "./faceCaptureManagerFactory-CN5-GRxP.js";
1
+ import { t as Manager } from "./Manager-CCT_-HuZ.js";
2
+ import { h as CreateAuthenticationActorOptions, m as AuthenticationActor, n as FaceCaptureManagerState, t as FaceCaptureManager } from "./faceCaptureManagerFactory-CdwpYykv.js";
3
3
 
4
4
  //#region src/modules/authentication/authenticationManager.d.ts
5
5
  type AuthenticationState = FaceCaptureManagerState;
@@ -1,5 +1,5 @@
1
- import { a as isIPhone14OrHigher, o as isSafari, r as isIOS, t as isAndroid } from "./platform-B3nGssGZ.esm.js";
2
- import { i as stopCameraStream, n as enumerateVideoDevices, r as requestCameraAccess, t as applyTrackConstraints } from "./camera-D-MPXRbZ.esm.js";
1
+ import { a as isIPhone14OrHigher, o as isSafari, r as isIOS, t as isAndroid } from "./platform-DdhkonXk.esm.js";
2
+ import { i as stopCameraStream, n as enumerateVideoDevices, r as requestCameraAccess, t as applyTrackConstraints } from "./camera-DAuRUvnp.esm.js";
3
3
 
4
4
  //#region ../infra/src/capabilities/ITimerCapability.ts
5
5
  function sleep(ms) {
@@ -75,6 +75,26 @@ async function getCameras() {
75
75
  }
76
76
  return cameras;
77
77
  }
78
+ function selectBestBackCamera(track, backCameras) {
79
+ if (backCameras.length === 0) return void 0;
80
+ if (backCameras.length === 1) return backCameras[0];
81
+ const withMp = backCameras.map((c) => {
82
+ const match = c.label.match(/\b([0-9]+)\s*MP?\b/i);
83
+ return {
84
+ camera: c,
85
+ mp: match ? parseInt(match[1], 10) : 0
86
+ };
87
+ });
88
+ const maxMp = Math.max(...withMp.map((w) => w.mp));
89
+ if (maxMp > 0) {
90
+ const best = withMp.find((w) => w.mp === maxMp);
91
+ if (best) return best.camera;
92
+ }
93
+ const settings = track.getSettings();
94
+ const browserPick = backCameras.find((c) => c.deviceId === settings.deviceId || c.label === track.label);
95
+ if (browserPick) return browserPick;
96
+ return backCameras[0];
97
+ }
78
98
  function selectMainCameraFromStream(track, cameras) {
79
99
  const settings = track.getSettings();
80
100
  const activeCamera = cameras.find((c) => c.deviceId === settings.deviceId || c.label !== "" && c.label === track.label);
@@ -84,7 +104,7 @@ function selectMainCameraFromStream(track, cameras) {
84
104
  if (camera.deviceId === activeCamera.deviceId) camera.cameraType = "back";
85
105
  else if (!isBackCameraLabel(camera.label)) camera.cameraType = "front";
86
106
  });
87
- return cameras.filter((c) => c.cameraType === "back").sort((a, b) => a.label.localeCompare(b.label))[0];
107
+ return selectBestBackCamera(track, cameras.filter((c) => c.cameraType === "back"));
88
108
  }
89
109
  if (cameras.length === 1) return activeCamera;
90
110
  }
@@ -166,6 +186,23 @@ function getAndroidVideoConstraints(level) {
166
186
  default: return {};
167
187
  }
168
188
  }
189
+ function getAndroidFinalConstraints(mainCamera, fallbackLevel) {
190
+ const base = {
191
+ deviceId: { exact: mainCamera.deviceId },
192
+ resizeMode: "none"
193
+ };
194
+ if (fallbackLevel <= 1) return {
195
+ ...base,
196
+ width: { ideal: 1920 },
197
+ height: { ideal: 1080 }
198
+ };
199
+ const full = getAndroidVideoConstraints(fallbackLevel);
200
+ return {
201
+ ...base,
202
+ width: full.width,
203
+ height: full.height
204
+ };
205
+ }
169
206
  async function getAndroidBackCameraStream(fallbackLevel = 0) {
170
207
  if (fallbackLevel > 5) throw new Error("Failed to get camera after all fallback attempts");
171
208
  try {
@@ -174,20 +211,12 @@ async function getAndroidBackCameraStream(fallbackLevel = 0) {
174
211
  const mainCamera = selectMainCameraFromStream(track, await getCameras());
175
212
  stopCameraStream(initialStream);
176
213
  if (!mainCamera) throw new Error("Could not identify main camera");
177
- let idealWidth = 1280;
178
- let idealHeight = 720;
179
- if (fallbackLevel > 1) {
180
- const constraints = getAndroidVideoConstraints(fallbackLevel);
181
- const width = constraints.width;
182
- const height = constraints.height;
183
- idealWidth = width?.ideal ?? 1280;
184
- idealHeight = height?.ideal ?? 720;
185
- }
186
- return await requestCameraAccess({ video: {
187
- deviceId: { exact: mainCamera.deviceId },
188
- width: { ideal: idealWidth },
189
- height: { ideal: idealHeight }
190
- } });
214
+ const finalStream = await requestCameraAccess({ video: getAndroidFinalConstraints(mainCamera, fallbackLevel) });
215
+ await applyFocusHint(finalStream);
216
+ return {
217
+ stream: finalStream,
218
+ fallbackLevel
219
+ };
191
220
  } catch (error) {
192
221
  const errorName = error instanceof Error ? error.name : "UnknownError";
193
222
  const nextLevel = Math.min(fallbackLevel + 1, 5);
@@ -202,7 +231,7 @@ async function getAndroidBackCameraStream(fallbackLevel = 0) {
202
231
  return getAndroidBackCameraStream(nextLevel);
203
232
  }
204
233
  }
205
- async function applyIOSFocusHack(stream) {
234
+ async function applyFocusHint(stream) {
206
235
  const videoTrack = stream.getVideoTracks()[0];
207
236
  try {
208
237
  await applyTrackConstraints(videoTrack, { advanced: [{ focusDistance: 1 }] });
@@ -220,7 +249,7 @@ function getIOSConstraints() {
220
249
  }
221
250
  async function getIOSCameraStream() {
222
251
  const stream = await requestCameraAccess(getIOSConstraints());
223
- await applyIOSFocusHack(stream);
252
+ await applyFocusHint(stream);
224
253
  return stream;
225
254
  }
226
255
  function getDesktopVideoConstraints(level) {
@@ -313,9 +342,9 @@ async function getDesktopCameraStream(options, fallbackLevel = 0) {
313
342
  }
314
343
  }
315
344
  async function getBackCameraStream(deviceId) {
316
- if (isIOS()) return getIOSCameraStream();
345
+ if (isIOS()) return { stream: await getIOSCameraStream() };
317
346
  if (isAndroid()) return getAndroidBackCameraStream(0);
318
- return getDesktopCameraStream({ deviceId });
347
+ return { stream: await getDesktopCameraStream({ deviceId }) };
319
348
  }
320
349
 
321
350
  //#endregion