@sekyro/web 0.1.0-rc.23 → 0.1.0-rc.24

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 (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -0
  3. package/dist/{capture-session-doc-BBDKMEAP.js → capture-session-doc-RIBBH3M4.js} +1 -1
  4. package/dist/{capture-session-v3-CFXYS0Pg.d.cts → capture-session-v3-CPHzDT7E.d.cts} +1 -1
  5. package/dist/{capture-session-v3-DID39wUZ.d.ts → capture-session-v3-TUPtnvmu.d.ts} +1 -1
  6. package/dist/{chunk-PBLZ5W7P.js → chunk-5YVQIHQA.js} +1 -1
  7. package/dist/chunk-DMOGKGDS.js +1 -0
  8. package/dist/{chunk-LFMIFR6T.js → chunk-FLA42JCK.js} +1 -1
  9. package/dist/chunk-IC6TI6GV.js +1 -0
  10. package/dist/{chunk-JYU5YHXN.js → chunk-IFLOS5OT.js} +1 -1
  11. package/dist/{chunk-5DTWBDCP.js → chunk-LBH6KGTV.js} +1 -1
  12. package/dist/{chunk-YWGW63B3.js → chunk-MQBX4DQQ.js} +1 -1
  13. package/dist/{chunk-X6UIO5E3.js → chunk-QY6TJCOJ.js} +1 -1
  14. package/dist/chunk-TDCLQRT4.js +1 -0
  15. package/dist/{chunk-JWEHH2MS.js → chunk-XI5FXEKC.js} +1 -1
  16. package/dist/client/index.cjs +1 -1
  17. package/dist/client/index.d.cts +3 -3
  18. package/dist/client/index.d.ts +3 -3
  19. package/dist/client/index.js +1 -1
  20. package/dist/core/index.cjs +1 -1
  21. package/dist/core/index.d.cts +3 -3
  22. package/dist/core/index.d.ts +3 -3
  23. package/dist/core/index.js +1 -1
  24. package/dist/{create-document-capture-K5PDVOGV.js → create-document-capture-XQURFZZK.js} +1 -1
  25. package/dist/{create-verification-BP2L4rzV.d.cts → create-verification-DF60lg8Y.d.cts} +3 -3
  26. package/dist/{create-verification-Dc1Rd-4T.d.ts → create-verification-acQzNRiB.d.ts} +3 -3
  27. package/dist/{icao-gate-CIXjbPCL.d.cts → icao-gate-CX0chQMM.d.cts} +1 -1
  28. package/dist/{icao-gate-COt4O4h_.d.ts → icao-gate-VwsQo8Bq.d.ts} +1 -1
  29. package/dist/{icao-policy-DI4kU6Mv.d.ts → icao-policy-B02jDiox.d.ts} +2 -2
  30. package/dist/{icao-policy-Cizs5guu.d.cts → icao-policy-WnG2OSyp.d.cts} +2 -2
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +7 -7
  33. package/dist/index.d.ts +7 -7
  34. package/dist/index.js +1 -1
  35. package/dist/internal/index.cjs +1 -1
  36. package/dist/internal/index.d.cts +16 -12
  37. package/dist/internal/index.d.ts +16 -12
  38. package/dist/internal/index.js +1 -1
  39. package/dist/{plan-runner-AD2JTMC7.js → plan-runner-LDV4PYN7.js} +1 -1
  40. package/dist/{turnstile-F4DS2L3F.js → turnstile-52B3RFXD.js} +1 -1
  41. package/dist/{types-Cjnp1o8i.d.cts → types-1s8CQrEN.d.cts} +4 -4
  42. package/dist/{types-Cjnp1o8i.d.ts → types-1s8CQrEN.d.ts} +4 -4
  43. package/package.json +1 -1
  44. package/sbom.cdx.json +10 -10
  45. package/dist/chunk-72LG73YL.js +0 -1
  46. package/dist/chunk-RPVI2OGR.js +0 -1
  47. package/dist/chunk-U3NYGTX7.js +0 -1
@@ -1,11 +1,11 @@
1
- import { b1 as DocCatalogEntry, b2 as LiveMrzTuning, b3 as TextLockTuning, b4 as OcrEngineClient, b5 as DocAssistReport, b6 as ReadyInfo, b7 as LoadFailure, b8 as OcrEngineOptions, b9 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aM as VerificationStep, aK as VerificationResult, aB as StepSnapshot, _ as LivePhotoGateUpdate, ba as HostedClientLike } from '../create-verification-BP2L4rzV.cjs';
2
- export { bb as ANALYSIS_LONG_EDGE, bc as ASPECT_BANDS, bd as AttestationError, be as BLUR_REFUSE_SHARPNESS_MAX, bf as BlurStatus, bg as CAPTURE_CANDIDATE_SPACING_MS, bh as CAPTURE_EXTRA_CANDIDATES, bi as CLIP_MIME_ALLOWLIST, bj as CaptureEngine, bk as CaptureSessionDoc, bl as CaptureSessionDocEvents, bm as CaptureSessionDocOptions, bn as DOC_ANALYSIS_DEFAULTS, bo as DOC_BLACK_FRAME_LUMA, bp as DOC_BLACK_FRAME_TICKS, bq as DOC_CADENCE_HZ, br as DOC_CAMERA_TUNING_DEFAULTS, bs as DOC_CATALOG, bt as DOC_DETECT_WIDTH, bu as DOC_FEEDBACK_STATES, bv as DOC_FIRST_FRAME_MS, bw as DOC_GATE_V1_DEFAULTS, bx as DOC_SHUTTER_DEFAULTS, by as DeviceReadHint, bz as DocArtifacts, bA as DocAssist, bB as DocAssistEngine, bC as DocAssistTick, bD as DocCameraTuning, bE as DocCaptureReport, bF as DocCaptureVia, bG as DocChecksPayload, bH as DocEngineLike, bI as DocFeedbackAggregator, bJ as DocFeedbackKey, bK as DocFeedbackState, bL as DocFormat, bM as DocFrameAnalysis, bN as DocFrameMeasures, bO as DocGateQuality, bP as DocGateThresholds, bQ as DocGateTick, bR as DocGateTickInput, bS as DocGateV1, bT as DocQuad, bU as DocQuadPoint, bV as DocShutterReason, bW as DocShutterTuning, bX as DocSide, bY as DocumentCaptureController, bZ as DocumentCaptureInternals, b_ as EMPTY_GUIDE_METRICS, b$ as EncodedDocument, c0 as FLIP_FILL_MIN, c1 as FLIP_GAP_MS, c2 as FLIP_TIMEOUT_MS, c3 as FocusCaps, c4 as FramingStatus, c5 as GUIDE_LOCK_DEFAULTS, c6 as GlareStatus, c7 as GrabbedFrame, c8 as GuideBlocker, c9 as GuideLock, ca as GuideLockTick, cb as GuideLockTuning, cc as GuideMetrics, cd as GuideRect, ce as INFERENCE_RETRY_ATTEMPTS, cf as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cg as LANDMARKER_MODEL, ch as LENS_STORAGE_KEY, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensSource, co as LightingStatus, cp as LiveMrzCapture, cq as LiveMrzState, cr as LivePhotoGate, cs as LivePhotoKit, ct as LivePhotoKitInternals, cu as LivePhotoKitOptions, cv as LivePhotoStill, cw as LivenessCaptureInternalHandle, cx as LivenessCaptureInternals, cy as LivenessFlowDeps, cz as LivenessFlowOutcome, cA as MANUAL_SHUTTER_MS, cB as MR_DOC_CATALOG, cC as NO_REPORT_MS, cD as OpenDocCameraDeps, cE as PORTRAIT_JPEG_QUALITY, cF as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cG as PRELOAD_BUDGET_MS, cH as PROCESSING_POLL_DELAY_MS, cI as PROCESSING_POLL_MAX, cJ as PortraitCaptureController, cK as PortraitCaptureInternals, cL as REGISTRY_RETRY_DELAY_MS, cM as ReticleType, cN as SAME_FACE_MAX_DROPS, cO as ScanEvent, cP as ScanLayout, cQ as ScanNotice, cR as ScanPhase, cS as ScanReport, cT as ScanSide, cU as ScanState, cV as SubmitExecutor, cW as TEXT_LOCK_DEFAULTS, cX as TRANSPORT_REPLAY_ATTEMPTS, cY as TRANSPORT_REPLAY_DELAY_MS, cZ as VerificationInternals, c_ as analyzeDocFrame, c$ as analyzeGuide, d0 as aspectBand, d1 as aspectFits, d2 as buildDeviceReadHint, d3 as coverPointToVideo, d4 as createDocumentCaptureInternal, d5 as createFaceLandmarker, d6 as createLivePhotoKit, d7 as createLivenessCaptureInternal, d8 as createPortraitCaptureInternal, d9 as createVerificationInternal, da as docZoomFor, db as encodeDocumentImage, dc as facesOf, dd as feedbackVoteOf, de as focusOk, df as guideQuad, dg as guideRegionInFrame, dh as initialScanState, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as readStoredLens, dy as resetLivenessAssetsForTests, dz as resolveDocCameraTuning, dA as resolveDocShutterTuning, dB as resolveGuideLockTuning, dC as runLivenessFlow, dD as runSubmission, dE as scannerFormatFor, dF as setPreloadLoaderForTests, dG as settledHint, dH as singleShotFocusAt, dI as specularFraction, dJ as supportsFocusMode, dK as warmDocDetector, dL as writeStoredLens } from '../create-verification-BP2L4rzV.cjs';
1
+ import { b1 as DocCatalogEntry, b2 as LiveMrzTuning, b3 as TextLockTuning, b4 as OcrEngineClient, b5 as DocAssistReport, b6 as ReadyInfo, b7 as LoadFailure, b8 as OcrEngineOptions, b9 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aM as VerificationStep, aK as VerificationResult, aB as StepSnapshot, _ as LivePhotoGateUpdate, ba as HostedClientLike } from '../create-verification-DF60lg8Y.cjs';
2
+ export { bb as ANALYSIS_LONG_EDGE, bc as ASPECT_BANDS, bd as AttestationError, be as BLUR_REFUSE_SHARPNESS_MAX, bf as BlurStatus, bg as CAPTURE_CANDIDATE_SPACING_MS, bh as CAPTURE_EXTRA_CANDIDATES, bi as CLIP_MIME_ALLOWLIST, bj as CaptureEngine, bk as CaptureSessionDoc, bl as CaptureSessionDocEvents, bm as CaptureSessionDocOptions, bn as DOC_ANALYSIS_DEFAULTS, bo as DOC_BLACK_FRAME_LUMA, bp as DOC_BLACK_FRAME_TICKS, bq as DOC_CADENCE_HZ, br as DOC_CAMERA_TUNING_DEFAULTS, bs as DOC_CATALOG, bt as DOC_DETECT_WIDTH, bu as DOC_FEEDBACK_STATES, bv as DOC_FIRST_FRAME_MS, bw as DOC_GATE_V1_DEFAULTS, bx as DOC_SHUTTER_DEFAULTS, by as DeviceReadHint, bz as DocArtifacts, bA as DocAssist, bB as DocAssistEngine, bC as DocAssistTick, bD as DocCameraTuning, bE as DocCaptureReport, bF as DocCaptureVia, bG as DocChecksPayload, bH as DocEngineLike, bI as DocFeedbackAggregator, bJ as DocFeedbackKey, bK as DocFeedbackState, bL as DocFormat, bM as DocFrameAnalysis, bN as DocFrameMeasures, bO as DocGateQuality, bP as DocGateThresholds, bQ as DocGateTick, bR as DocGateTickInput, bS as DocGateV1, bT as DocQuad, bU as DocQuadPoint, bV as DocShutterReason, bW as DocShutterTuning, bX as DocSide, bY as DocumentCaptureController, bZ as DocumentCaptureInternals, b_ as EMPTY_GUIDE_METRICS, b$ as EncodedDocument, c0 as FLIP_FILL_MIN, c1 as FLIP_GAP_MS, c2 as FLIP_TIMEOUT_MS, c3 as FocusCaps, c4 as FramingStatus, c5 as GUIDE_LOCK_DEFAULTS, c6 as GlareStatus, c7 as GrabbedFrame, c8 as GuideBlocker, c9 as GuideLock, ca as GuideLockTick, cb as GuideLockTuning, cc as GuideMetrics, cd as GuideRect, ce as INFERENCE_RETRY_ATTEMPTS, cf as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cg as LANDMARKER_MODEL, ch as LENS_STORAGE_KEY, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensSource, co as LightingStatus, cp as LiveMrzCapture, cq as LiveMrzState, cr as LivePhotoGate, cs as LivePhotoKit, ct as LivePhotoKitInternals, cu as LivePhotoKitOptions, cv as LivePhotoStill, cw as LivenessCaptureInternalHandle, cx as LivenessCaptureInternals, cy as LivenessFlowDeps, cz as LivenessFlowOutcome, cA as MANUAL_SHUTTER_MS, cB as MR_DOC_CATALOG, cC as NO_REPORT_MS, cD as OpenDocCameraDeps, cE as PORTRAIT_JPEG_QUALITY, cF as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cG as PRELOAD_BUDGET_MS, cH as PROCESSING_POLL_DELAY_MS, cI as PROCESSING_POLL_MAX, cJ as PortraitCaptureController, cK as PortraitCaptureInternals, cL as REGISTRY_RETRY_DELAY_MS, cM as ReticleType, cN as SAME_FACE_MAX_DROPS, cO as ScanEvent, cP as ScanLayout, cQ as ScanNotice, cR as ScanPhase, cS as ScanReport, cT as ScanSide, cU as ScanState, cV as SubmitExecutor, cW as TEXT_LOCK_DEFAULTS, cX as TRANSPORT_REPLAY_ATTEMPTS, cY as TRANSPORT_REPLAY_DELAY_MS, cZ as VerificationInternals, c_ as analyzeDocFrame, c$ as analyzeGuide, d0 as aspectBand, d1 as aspectFits, d2 as buildDeviceReadHint, d3 as coverPointToVideo, d4 as createDocumentCaptureInternal, d5 as createFaceLandmarker, d6 as createLivePhotoKit, d7 as createLivenessCaptureInternal, d8 as createPortraitCaptureInternal, d9 as createVerificationInternal, da as docZoomFor, db as encodeDocumentImage, dc as facesOf, dd as feedbackVoteOf, de as focusOk, df as guideQuad, dg as guideRegionInFrame, dh as initialScanState, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as readStoredLens, dy as resetLivenessAssetsForTests, dz as resolveDocCameraTuning, dA as resolveDocShutterTuning, dB as resolveGuideLockTuning, dC as runLivenessFlow, dD as runSubmission, dE as scannerFormatFor, dF as setPreloadLoaderForTests, dG as settledHint, dH as singleShotFocusAt, dI as specularFraction, dJ as supportsFocusMode, dK as warmDocDetector, dL as writeStoredLens } from '../create-verification-DF60lg8Y.cjs';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-CVqpMNGA.cjs';
4
- import { S as HostedSessionView, h as CheckType, an as PlanStepView } from '../types-Cjnp1o8i.cjs';
5
- export { a$ as ICAO_FALLBACK, aV as IcaoCaptureTuning, b0 as IcaoProfile, b1 as ResolvedIcaoTuning, b2 as resolveIcaoTuning } from '../types-Cjnp1o8i.cjs';
6
- export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-CIXjbPCL.cjs';
4
+ import { S as HostedSessionView, h as CheckType, an as PlanStepView } from '../types-1s8CQrEN.cjs';
5
+ export { a$ as ICAO_FALLBACK, aV as IcaoCaptureTuning, b0 as IcaoProfile, b1 as ResolvedIcaoTuning, b2 as resolveIcaoTuning } from '../types-1s8CQrEN.cjs';
6
+ export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-CX0chQMM.cjs';
7
7
  import '../detect-worker-CHqsPJoM.cjs';
8
- import '../capture-session-v3-CFXYS0Pg.cjs';
8
+ import '../capture-session-v3-CPHzDT7E.cjs';
9
9
 
10
10
  /** At most this many ranked lenses are tried (each costs a camera reopen). */
11
11
  declare const LENS_TRY_MAX = 3;
@@ -368,10 +368,12 @@ interface ResultOptions {
368
368
  declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
369
369
  /**
370
370
  * Bound on a single execute round-trip (challenge fetch + solve). A healthy
371
- * invisible challenge settles in a few seconds; a stalled one is retried once by
372
- * the liveness submission, so a stall costs about this long, not a full minute.
371
+ * invisible challenge settles in a few seconds, but on slow phones and networks
372
+ * it routinely takes 10 to 20 s: 10 s failed a third of real sessions
373
+ * (incident 2026-11-10), so the bound is 30 s. A failed or timed-out challenge
374
+ * is retried once on a fresh widget.
373
375
  */
374
- declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 10000;
376
+ declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
375
377
  interface TurnstileRenderParams {
376
378
  sitekey: string;
377
379
  callback: (token: string) => void;
@@ -404,9 +406,11 @@ interface ExecuteTurnstileOptions {
404
406
  }
405
407
  /**
406
408
  * Run one invisible execute-mode challenge on the kept widget and resolve its
407
- * token. Rejects on challenge error, on `signal` abort, or after
408
- * {@link TURNSTILE_EXECUTE_TIMEOUT_MS} — the verification maps a failure to
409
- * `result {status:'unavailable', reason:'attestation'}` after one retry.
409
+ * token. A challenge error, a load/render failure or a challenge that does not
410
+ * settle within the timeout removes the widget and runs the challenge ONCE more
411
+ * on a freshly rendered widget; only then does the promise reject. An abort
412
+ * (`signal`) rejects at once, without the second attempt. The verification
413
+ * submits without a token when this rejects, so the server decides.
410
414
  */
411
415
  declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
412
416
 
@@ -1,11 +1,11 @@
1
- import { b1 as DocCatalogEntry, b2 as LiveMrzTuning, b3 as TextLockTuning, b4 as OcrEngineClient, b5 as DocAssistReport, b6 as ReadyInfo, b7 as LoadFailure, b8 as OcrEngineOptions, b9 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aM as VerificationStep, aK as VerificationResult, aB as StepSnapshot, _ as LivePhotoGateUpdate, ba as HostedClientLike } from '../create-verification-Dc1Rd-4T.js';
2
- export { bb as ANALYSIS_LONG_EDGE, bc as ASPECT_BANDS, bd as AttestationError, be as BLUR_REFUSE_SHARPNESS_MAX, bf as BlurStatus, bg as CAPTURE_CANDIDATE_SPACING_MS, bh as CAPTURE_EXTRA_CANDIDATES, bi as CLIP_MIME_ALLOWLIST, bj as CaptureEngine, bk as CaptureSessionDoc, bl as CaptureSessionDocEvents, bm as CaptureSessionDocOptions, bn as DOC_ANALYSIS_DEFAULTS, bo as DOC_BLACK_FRAME_LUMA, bp as DOC_BLACK_FRAME_TICKS, bq as DOC_CADENCE_HZ, br as DOC_CAMERA_TUNING_DEFAULTS, bs as DOC_CATALOG, bt as DOC_DETECT_WIDTH, bu as DOC_FEEDBACK_STATES, bv as DOC_FIRST_FRAME_MS, bw as DOC_GATE_V1_DEFAULTS, bx as DOC_SHUTTER_DEFAULTS, by as DeviceReadHint, bz as DocArtifacts, bA as DocAssist, bB as DocAssistEngine, bC as DocAssistTick, bD as DocCameraTuning, bE as DocCaptureReport, bF as DocCaptureVia, bG as DocChecksPayload, bH as DocEngineLike, bI as DocFeedbackAggregator, bJ as DocFeedbackKey, bK as DocFeedbackState, bL as DocFormat, bM as DocFrameAnalysis, bN as DocFrameMeasures, bO as DocGateQuality, bP as DocGateThresholds, bQ as DocGateTick, bR as DocGateTickInput, bS as DocGateV1, bT as DocQuad, bU as DocQuadPoint, bV as DocShutterReason, bW as DocShutterTuning, bX as DocSide, bY as DocumentCaptureController, bZ as DocumentCaptureInternals, b_ as EMPTY_GUIDE_METRICS, b$ as EncodedDocument, c0 as FLIP_FILL_MIN, c1 as FLIP_GAP_MS, c2 as FLIP_TIMEOUT_MS, c3 as FocusCaps, c4 as FramingStatus, c5 as GUIDE_LOCK_DEFAULTS, c6 as GlareStatus, c7 as GrabbedFrame, c8 as GuideBlocker, c9 as GuideLock, ca as GuideLockTick, cb as GuideLockTuning, cc as GuideMetrics, cd as GuideRect, ce as INFERENCE_RETRY_ATTEMPTS, cf as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cg as LANDMARKER_MODEL, ch as LENS_STORAGE_KEY, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensSource, co as LightingStatus, cp as LiveMrzCapture, cq as LiveMrzState, cr as LivePhotoGate, cs as LivePhotoKit, ct as LivePhotoKitInternals, cu as LivePhotoKitOptions, cv as LivePhotoStill, cw as LivenessCaptureInternalHandle, cx as LivenessCaptureInternals, cy as LivenessFlowDeps, cz as LivenessFlowOutcome, cA as MANUAL_SHUTTER_MS, cB as MR_DOC_CATALOG, cC as NO_REPORT_MS, cD as OpenDocCameraDeps, cE as PORTRAIT_JPEG_QUALITY, cF as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cG as PRELOAD_BUDGET_MS, cH as PROCESSING_POLL_DELAY_MS, cI as PROCESSING_POLL_MAX, cJ as PortraitCaptureController, cK as PortraitCaptureInternals, cL as REGISTRY_RETRY_DELAY_MS, cM as ReticleType, cN as SAME_FACE_MAX_DROPS, cO as ScanEvent, cP as ScanLayout, cQ as ScanNotice, cR as ScanPhase, cS as ScanReport, cT as ScanSide, cU as ScanState, cV as SubmitExecutor, cW as TEXT_LOCK_DEFAULTS, cX as TRANSPORT_REPLAY_ATTEMPTS, cY as TRANSPORT_REPLAY_DELAY_MS, cZ as VerificationInternals, c_ as analyzeDocFrame, c$ as analyzeGuide, d0 as aspectBand, d1 as aspectFits, d2 as buildDeviceReadHint, d3 as coverPointToVideo, d4 as createDocumentCaptureInternal, d5 as createFaceLandmarker, d6 as createLivePhotoKit, d7 as createLivenessCaptureInternal, d8 as createPortraitCaptureInternal, d9 as createVerificationInternal, da as docZoomFor, db as encodeDocumentImage, dc as facesOf, dd as feedbackVoteOf, de as focusOk, df as guideQuad, dg as guideRegionInFrame, dh as initialScanState, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as readStoredLens, dy as resetLivenessAssetsForTests, dz as resolveDocCameraTuning, dA as resolveDocShutterTuning, dB as resolveGuideLockTuning, dC as runLivenessFlow, dD as runSubmission, dE as scannerFormatFor, dF as setPreloadLoaderForTests, dG as settledHint, dH as singleShotFocusAt, dI as specularFraction, dJ as supportsFocusMode, dK as warmDocDetector, dL as writeStoredLens } from '../create-verification-Dc1Rd-4T.js';
1
+ import { b1 as DocCatalogEntry, b2 as LiveMrzTuning, b3 as TextLockTuning, b4 as OcrEngineClient, b5 as DocAssistReport, b6 as ReadyInfo, b7 as LoadFailure, b8 as OcrEngineOptions, b9 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aM as VerificationStep, aK as VerificationResult, aB as StepSnapshot, _ as LivePhotoGateUpdate, ba as HostedClientLike } from '../create-verification-acQzNRiB.js';
2
+ export { bb as ANALYSIS_LONG_EDGE, bc as ASPECT_BANDS, bd as AttestationError, be as BLUR_REFUSE_SHARPNESS_MAX, bf as BlurStatus, bg as CAPTURE_CANDIDATE_SPACING_MS, bh as CAPTURE_EXTRA_CANDIDATES, bi as CLIP_MIME_ALLOWLIST, bj as CaptureEngine, bk as CaptureSessionDoc, bl as CaptureSessionDocEvents, bm as CaptureSessionDocOptions, bn as DOC_ANALYSIS_DEFAULTS, bo as DOC_BLACK_FRAME_LUMA, bp as DOC_BLACK_FRAME_TICKS, bq as DOC_CADENCE_HZ, br as DOC_CAMERA_TUNING_DEFAULTS, bs as DOC_CATALOG, bt as DOC_DETECT_WIDTH, bu as DOC_FEEDBACK_STATES, bv as DOC_FIRST_FRAME_MS, bw as DOC_GATE_V1_DEFAULTS, bx as DOC_SHUTTER_DEFAULTS, by as DeviceReadHint, bz as DocArtifacts, bA as DocAssist, bB as DocAssistEngine, bC as DocAssistTick, bD as DocCameraTuning, bE as DocCaptureReport, bF as DocCaptureVia, bG as DocChecksPayload, bH as DocEngineLike, bI as DocFeedbackAggregator, bJ as DocFeedbackKey, bK as DocFeedbackState, bL as DocFormat, bM as DocFrameAnalysis, bN as DocFrameMeasures, bO as DocGateQuality, bP as DocGateThresholds, bQ as DocGateTick, bR as DocGateTickInput, bS as DocGateV1, bT as DocQuad, bU as DocQuadPoint, bV as DocShutterReason, bW as DocShutterTuning, bX as DocSide, bY as DocumentCaptureController, bZ as DocumentCaptureInternals, b_ as EMPTY_GUIDE_METRICS, b$ as EncodedDocument, c0 as FLIP_FILL_MIN, c1 as FLIP_GAP_MS, c2 as FLIP_TIMEOUT_MS, c3 as FocusCaps, c4 as FramingStatus, c5 as GUIDE_LOCK_DEFAULTS, c6 as GlareStatus, c7 as GrabbedFrame, c8 as GuideBlocker, c9 as GuideLock, ca as GuideLockTick, cb as GuideLockTuning, cc as GuideMetrics, cd as GuideRect, ce as INFERENCE_RETRY_ATTEMPTS, cf as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cg as LANDMARKER_MODEL, ch as LENS_STORAGE_KEY, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensSource, co as LightingStatus, cp as LiveMrzCapture, cq as LiveMrzState, cr as LivePhotoGate, cs as LivePhotoKit, ct as LivePhotoKitInternals, cu as LivePhotoKitOptions, cv as LivePhotoStill, cw as LivenessCaptureInternalHandle, cx as LivenessCaptureInternals, cy as LivenessFlowDeps, cz as LivenessFlowOutcome, cA as MANUAL_SHUTTER_MS, cB as MR_DOC_CATALOG, cC as NO_REPORT_MS, cD as OpenDocCameraDeps, cE as PORTRAIT_JPEG_QUALITY, cF as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cG as PRELOAD_BUDGET_MS, cH as PROCESSING_POLL_DELAY_MS, cI as PROCESSING_POLL_MAX, cJ as PortraitCaptureController, cK as PortraitCaptureInternals, cL as REGISTRY_RETRY_DELAY_MS, cM as ReticleType, cN as SAME_FACE_MAX_DROPS, cO as ScanEvent, cP as ScanLayout, cQ as ScanNotice, cR as ScanPhase, cS as ScanReport, cT as ScanSide, cU as ScanState, cV as SubmitExecutor, cW as TEXT_LOCK_DEFAULTS, cX as TRANSPORT_REPLAY_ATTEMPTS, cY as TRANSPORT_REPLAY_DELAY_MS, cZ as VerificationInternals, c_ as analyzeDocFrame, c$ as analyzeGuide, d0 as aspectBand, d1 as aspectFits, d2 as buildDeviceReadHint, d3 as coverPointToVideo, d4 as createDocumentCaptureInternal, d5 as createFaceLandmarker, d6 as createLivePhotoKit, d7 as createLivenessCaptureInternal, d8 as createPortraitCaptureInternal, d9 as createVerificationInternal, da as docZoomFor, db as encodeDocumentImage, dc as facesOf, dd as feedbackVoteOf, de as focusOk, df as guideQuad, dg as guideRegionInFrame, dh as initialScanState, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as readStoredLens, dy as resetLivenessAssetsForTests, dz as resolveDocCameraTuning, dA as resolveDocShutterTuning, dB as resolveGuideLockTuning, dC as runLivenessFlow, dD as runSubmission, dE as scannerFormatFor, dF as setPreloadLoaderForTests, dG as settledHint, dH as singleShotFocusAt, dI as specularFraction, dJ as supportsFocusMode, dK as warmDocDetector, dL as writeStoredLens } from '../create-verification-acQzNRiB.js';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-CVqpMNGA.js';
4
- import { S as HostedSessionView, h as CheckType, an as PlanStepView } from '../types-Cjnp1o8i.js';
5
- export { a$ as ICAO_FALLBACK, aV as IcaoCaptureTuning, b0 as IcaoProfile, b1 as ResolvedIcaoTuning, b2 as resolveIcaoTuning } from '../types-Cjnp1o8i.js';
6
- export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-COt4O4h_.js';
4
+ import { S as HostedSessionView, h as CheckType, an as PlanStepView } from '../types-1s8CQrEN.js';
5
+ export { a$ as ICAO_FALLBACK, aV as IcaoCaptureTuning, b0 as IcaoProfile, b1 as ResolvedIcaoTuning, b2 as resolveIcaoTuning } from '../types-1s8CQrEN.js';
6
+ export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-VwsQo8Bq.js';
7
7
  import '../detect-worker-CHqsPJoM.js';
8
- import '../capture-session-v3-DID39wUZ.js';
8
+ import '../capture-session-v3-TUPtnvmu.js';
9
9
 
10
10
  /** At most this many ranked lenses are tried (each costs a camera reopen). */
11
11
  declare const LENS_TRY_MAX = 3;
@@ -368,10 +368,12 @@ interface ResultOptions {
368
368
  declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
369
369
  /**
370
370
  * Bound on a single execute round-trip (challenge fetch + solve). A healthy
371
- * invisible challenge settles in a few seconds; a stalled one is retried once by
372
- * the liveness submission, so a stall costs about this long, not a full minute.
371
+ * invisible challenge settles in a few seconds, but on slow phones and networks
372
+ * it routinely takes 10 to 20 s: 10 s failed a third of real sessions
373
+ * (incident 2026-11-10), so the bound is 30 s. A failed or timed-out challenge
374
+ * is retried once on a fresh widget.
373
375
  */
374
- declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 10000;
376
+ declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
375
377
  interface TurnstileRenderParams {
376
378
  sitekey: string;
377
379
  callback: (token: string) => void;
@@ -404,9 +406,11 @@ interface ExecuteTurnstileOptions {
404
406
  }
405
407
  /**
406
408
  * Run one invisible execute-mode challenge on the kept widget and resolve its
407
- * token. Rejects on challenge error, on `signal` abort, or after
408
- * {@link TURNSTILE_EXECUTE_TIMEOUT_MS} — the verification maps a failure to
409
- * `result {status:'unavailable', reason:'attestation'}` after one retry.
409
+ * token. A challenge error, a load/render failure or a challenge that does not
410
+ * settle within the timeout removes the widget and runs the challenge ONCE more
411
+ * on a freshly rendered widget; only then does the promise reject. An abort
412
+ * (`signal`) rejects at once, without the second attempt. The verification
413
+ * submits without a token when this rejects, so the server decides.
410
414
  */
411
415
  declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
412
416
 
@@ -1 +1 @@
1
- import{c as me,d as _e,e as Le,h as Te,i as Re,j as Se}from"../chunk-U3NYGTX7.js";import{a as W,b as ve,c as ge,d as be,e as Ge,f as he,g as Ue,h as Ye,i as He,j as k,k as K,l as w,m as X,n as Z,o as J,p as Q,q as j,r as q,s as $,t as ee,u as te,x as re}from"../chunk-YWGW63B3.js";import{a as Bt,b as Vt,c as Xt,d as Zt,e as Jt,f as Qt,g as jt,h as qt,i as $t,j as ne,k as ae,m as se,n as Ee}from"../chunk-VWGKUQ3C.js";import{a as Ft,b as Nt,c as vt,d as gt,e as bt,f as Gt,g as ht,h as Ut,i as Yt,j as Ht,k as Wt,l as kt,m as Kt}from"../chunk-53POX7U4.js";import{a as wt,b as zt}from"../chunk-33KKMPJ5.js";import{b as oe,c as pe,d as ie}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import"../chunk-GI3UFGRQ.js";import{a as D,b as d,c as M,d as F,e as N}from"../chunk-72LG73YL.js";import{A as ut,B as It,C as Ot,D as xt,E as At,F as Ct,G as Pt,H as Dt,I as dt,J as Mt,a as Ke,b as we,c as ze,d as je,e as qe,f as $e,g as et,h as tt,i as rt,j as ot,k as pt,l as it,m as nt,n as at,o as st,p as Et,q as mt,r as _t,s as Lt,t as Tt,u as Rt,v as St,w as ct,x as lt,y as yt,z as ft}from"../chunk-LFMIFR6T.js";import{a as v,b as g,c as b,d as G,e as h,f as U,g as Y,h as H,i as z,j as B,l as V}from"../chunk-G6LKLN4U.js";import{a as We,b as ke}from"../chunk-SMKCBUJL.js";import{a as Be,b as Ve,c as Xe,d as Ze,e as Je,f as Qe}from"../chunk-MXWLCDFX.js";import{a as Pe,b as De,c as de,d as Me,e as Fe,f as Ne}from"../chunk-TDLIXFDT.js";import{b as le,c as ye,d as fe,e as ue,g as Ie,h as er,i as tr,j as rr,k as or,l as pr,m as ir,s as Oe}from"../chunk-RPVI2OGR.js";import{A as C,B as P,i as R,j as S,k as c,l,o as y,u as f,v as u,w as I,x as O,y as x,z as A}from"../chunk-X6UIO5E3.js";import{a as i,b as n,c as a,d as s,i as E,j as m,k as _,l as L,n as T}from"../chunk-5DTWBDCP.js";import"../chunk-7QZWBDI5.js";import"../chunk-PBLZ5W7P.js";import"../chunk-SX7TUC3V.js";import"../chunk-POIQGEZM.js";import{p as xe,q as Ae,r as Ce}from"../chunk-CPUECYAJ.js";import"../chunk-FPXL63KZ.js";import"../chunk-JWEHH2MS.js";import{c as e,d as t,f as r,g as o,h as p}from"../chunk-TSA6GHUG.js";import"../chunk-JYU5YHXN.js";import"../chunk-FSSMUAKC.js";import{a as ce}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ne as ANALYSIS_LONG_EDGE,Pe as ASPECT_BANDS,A as AttestationError,Ue as BLUR_REFUSE_SHARPNESS_MAX,Mt as CAPTURE_CANDIDATE_SPACING_MS,dt as CAPTURE_EXTRA_CANDIDATES,p as CENTERED_FACTOR,r as CIRCLE_RADIUS_FACTOR,Bt as CLIPPED_LUMA,f as CLIP_MIME_ALLOWLIST,Pt as CaptureSessionDoc,tr as DOCUMENT_TYPE_ORDER,je as DOC_ANALYSIS_DEFAULTS,It as DOC_BLACK_FRAME_LUMA,Ot as DOC_BLACK_FRAME_TICKS,xt as DOC_CADENCE_HZ,tt as DOC_CAMERA_TUNING_DEFAULTS,Fe as DOC_CATALOG,Be as DOC_DETECT_WIDTH,Ke as DOC_FEEDBACK_STATES,ut as DOC_FIRST_FRAME_MS,Ve as DOC_GATE_V1_DEFAULTS,At as DOC_SHUTTER_DEFAULTS,V as DocAssist,ze as DocFeedbackAggregator,Qe as DocGateV1,Lt as EMPTY_GUIDE_METRICS,ge as FLIP_FILL_MIN,ve as FLIP_GAP_MS,be as FLIP_TIMEOUT_MS,ct as GUIDE_LOCK_DEFAULTS,yt as GuideLock,gt as ICAO_CANVAS,wt as ICAO_FALLBACK,Ut as ICAO_GATE_CRITERIA,Vt as ICAO_SHARP_REF,O as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,o as IN_CIRCLE_FACTOR,er as ISSUER_CODES,oe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,xe as LENS_TRY_MAX,B as LIVE_MRZ_DEFAULTS,_e as LIVE_PHOTO_IDLE_MS,me as LIVE_PHOTO_MAX_HZ,Ge as MANUAL_SHUTTER_MS,We as MRZ_BAND_DEFAULTS,Me as MR_DOC_CATALOG,he as NO_REPORT_MS,ce as OCR_ASSET_SET,Re as OTP_RESEND_COOLDOWN_MS,ae as PORTRAIT_JPEG_QUALITY,i as PRELOAD_BLAZE_INIT_TIMEOUT_MS,n as PRELOAD_BUDGET_MS,Te as PROCESSING_BACKOFF_MS,ye as PROCESSING_POLL_DELAY_MS,fe as PROCESSING_POLL_MAX,b as REGION_PAD,le as REGISTRY_RETRY_DELAY_MS,te as SAME_FACE_MAX_DROPS,v as SHARPNESS_LONG_EDGE,z as TEXT_LOCK_DEFAULTS,u as TRANSPORT_REPLAY_ATTEMPTS,I as TRANSPORT_REPLAY_DELAY_MS,d as TURNSTILE_EXECUTE_TIMEOUT_MS,D as TURNSTILE_SCRIPT_SRC,J as WEB_OCR_ENGINE,or as acceptedIssuers,rr as acceptedTypesFor,et as analyzeDocFrame,Rt as analyzeGuide,De as aspectBand,de as aspectFits,jt as backgroundStats,q as browserFamily,X as buildDeviceReadHint,K as classifyCardSide,k as classifyCardSideWith,st as coverPointToVideo,re as createDocumentCaptureInternal,ie as createFaceLandmarker,Kt as createIcaoGate,Le as createLivePhotoKit,T as createLivenessCaptureInternal,Ee as createPortraitCaptureInternal,Se as createStepRunner,Ie as createVerificationInternal,h as cropImage,e as detectFormFactor,t as detectIsMobile,ke as detectMrzBand,Et as docZoomFor,W as encodeDocumentImage,N as executeTurnstile,vt as eyeLineRoll,Ht as eyeOpenness,Qt as eyeSpecular,Ft as faceGeometry,Jt as faceLighting,qt as faceSharpness,pe as facesOf,we as feedbackVoteOf,ir as flagOf,mt as focusOk,ee as formatMismatch,c as frontierStep,St as guideQuad,Tt as guideRegionInFrame,$t as icaoPixelStats,bt as icaoWindow,Ye as initialScanState,R as isExecutable,S as isTerminalView,Yt as judgeIcao,Ae as lensKindOf,$ as liveMrzWireReport,F as loadTurnstile,Xt as lumaPlane,_ as mapEngineState,L as mapErrorKind,m as mapGuidanceHint,y as mapSessionResult,H as measureBitmapSharpness,Y as measureRegionSharpness,He as nextScanState,se as observePortraitFrame,_t as openDocCamera,Dt as passportBandOf,Wt as percentile,g as photoSharpness,ht as portraitCropRegion,Oe as portraitMatchStep,Nt as poseFromMatrix,E as preloadedDetectorFactory,Xe as quadAreaFrac,Je as quadBounds,Ze as quadIou,$e as quadTiltRatio,ue as randomUuid,Ce as rankBackCameras,pt as readStoredLens,Zt as regionStats,s as resetLivenessAssetsForTests,M as resetTurnstileForTests,U as resizeLongEdge,pr as resolveAcceptedDocuments,rt as resolveDocCameraTuning,Ct as resolveDocShutterTuning,lt as resolveGuideLockTuning,zt as resolveIcaoTuning,Q as resolveWebOcrPlan,P as runLivenessFlow,C as runSubmission,Ne as scannerFormatFor,kt as scoreFrame,a as setPreloadLoaderForTests,Z as settledHint,at as singleShotFocusAt,qe as specularFraction,j as startWebOcr,l as stepOf,G as stillRegionOf,w as stillToImageData,nt as supportsFocusMode,ft as warmDocDetector,Gt as windowOverflow,it as writeStoredLens};
1
+ import{c as me,d as _e,e as Le,h as Te,i as Re,j as Se}from"../chunk-IC6TI6GV.js";import{a as W,b as ve,c as ge,d as be,e as Ge,f as he,g as Ue,h as Ye,i as He,j as k,k as K,l as w,m as X,n as Z,o as J,p as Q,q as j,r as q,s as $,t as ee,u as te,x as re}from"../chunk-MQBX4DQQ.js";import{a as Bt,b as Vt,c as Xt,d as Zt,e as Jt,f as Qt,g as jt,h as qt,i as $t,j as ne,k as ae,m as se,n as Ee}from"../chunk-VWGKUQ3C.js";import{a as Ft,b as Nt,c as vt,d as gt,e as bt,f as Gt,g as ht,h as Ut,i as Yt,j as Ht,k as Wt,l as kt,m as Kt}from"../chunk-53POX7U4.js";import{a as wt,b as zt}from"../chunk-33KKMPJ5.js";import{b as oe,c as pe,d as ie}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import"../chunk-GI3UFGRQ.js";import{a as D,b as d,c as M,d as F,e as N}from"../chunk-TDCLQRT4.js";import{A as ut,B as It,C as Ot,D as xt,E as At,F as Ct,G as Pt,H as Dt,I as dt,J as Mt,a as Ke,b as we,c as ze,d as je,e as qe,f as $e,g as et,h as tt,i as rt,j as ot,k as pt,l as it,m as nt,n as at,o as st,p as Et,q as mt,r as _t,s as Lt,t as Tt,u as Rt,v as St,w as ct,x as lt,y as yt,z as ft}from"../chunk-FLA42JCK.js";import{a as v,b as g,c as b,d as G,e as h,f as U,g as Y,h as H,i as z,j as B,l as V}from"../chunk-G6LKLN4U.js";import{a as We,b as ke}from"../chunk-SMKCBUJL.js";import{a as Be,b as Ve,c as Xe,d as Ze,e as Je,f as Qe}from"../chunk-MXWLCDFX.js";import{a as Pe,b as De,c as de,d as Me,e as Fe,f as Ne}from"../chunk-TDLIXFDT.js";import{b as le,c as ye,d as fe,e as ue,g as Ie,h as er,i as tr,j as rr,k as or,l as pr,m as ir,s as Oe}from"../chunk-DMOGKGDS.js";import{A as C,B as P,i as R,j as S,k as c,l,o as y,u as f,v as u,w as I,x as O,y as x,z as A}from"../chunk-QY6TJCOJ.js";import{a as i,b as n,c as a,d as s,i as E,j as m,k as _,l as L,n as T}from"../chunk-LBH6KGTV.js";import"../chunk-7QZWBDI5.js";import"../chunk-5YVQIHQA.js";import"../chunk-SX7TUC3V.js";import"../chunk-POIQGEZM.js";import{p as xe,q as Ae,r as Ce}from"../chunk-CPUECYAJ.js";import"../chunk-FPXL63KZ.js";import"../chunk-XI5FXEKC.js";import{c as e,d as t,f as r,g as o,h as p}from"../chunk-TSA6GHUG.js";import"../chunk-IFLOS5OT.js";import"../chunk-FSSMUAKC.js";import{a as ce}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ne as ANALYSIS_LONG_EDGE,Pe as ASPECT_BANDS,A as AttestationError,Ue as BLUR_REFUSE_SHARPNESS_MAX,Mt as CAPTURE_CANDIDATE_SPACING_MS,dt as CAPTURE_EXTRA_CANDIDATES,p as CENTERED_FACTOR,r as CIRCLE_RADIUS_FACTOR,Bt as CLIPPED_LUMA,f as CLIP_MIME_ALLOWLIST,Pt as CaptureSessionDoc,tr as DOCUMENT_TYPE_ORDER,je as DOC_ANALYSIS_DEFAULTS,It as DOC_BLACK_FRAME_LUMA,Ot as DOC_BLACK_FRAME_TICKS,xt as DOC_CADENCE_HZ,tt as DOC_CAMERA_TUNING_DEFAULTS,Fe as DOC_CATALOG,Be as DOC_DETECT_WIDTH,Ke as DOC_FEEDBACK_STATES,ut as DOC_FIRST_FRAME_MS,Ve as DOC_GATE_V1_DEFAULTS,At as DOC_SHUTTER_DEFAULTS,V as DocAssist,ze as DocFeedbackAggregator,Qe as DocGateV1,Lt as EMPTY_GUIDE_METRICS,ge as FLIP_FILL_MIN,ve as FLIP_GAP_MS,be as FLIP_TIMEOUT_MS,ct as GUIDE_LOCK_DEFAULTS,yt as GuideLock,gt as ICAO_CANVAS,wt as ICAO_FALLBACK,Ut as ICAO_GATE_CRITERIA,Vt as ICAO_SHARP_REF,O as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,o as IN_CIRCLE_FACTOR,er as ISSUER_CODES,oe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,xe as LENS_TRY_MAX,B as LIVE_MRZ_DEFAULTS,_e as LIVE_PHOTO_IDLE_MS,me as LIVE_PHOTO_MAX_HZ,Ge as MANUAL_SHUTTER_MS,We as MRZ_BAND_DEFAULTS,Me as MR_DOC_CATALOG,he as NO_REPORT_MS,ce as OCR_ASSET_SET,Re as OTP_RESEND_COOLDOWN_MS,ae as PORTRAIT_JPEG_QUALITY,i as PRELOAD_BLAZE_INIT_TIMEOUT_MS,n as PRELOAD_BUDGET_MS,Te as PROCESSING_BACKOFF_MS,ye as PROCESSING_POLL_DELAY_MS,fe as PROCESSING_POLL_MAX,b as REGION_PAD,le as REGISTRY_RETRY_DELAY_MS,te as SAME_FACE_MAX_DROPS,v as SHARPNESS_LONG_EDGE,z as TEXT_LOCK_DEFAULTS,u as TRANSPORT_REPLAY_ATTEMPTS,I as TRANSPORT_REPLAY_DELAY_MS,d as TURNSTILE_EXECUTE_TIMEOUT_MS,D as TURNSTILE_SCRIPT_SRC,J as WEB_OCR_ENGINE,or as acceptedIssuers,rr as acceptedTypesFor,et as analyzeDocFrame,Rt as analyzeGuide,De as aspectBand,de as aspectFits,jt as backgroundStats,q as browserFamily,X as buildDeviceReadHint,K as classifyCardSide,k as classifyCardSideWith,st as coverPointToVideo,re as createDocumentCaptureInternal,ie as createFaceLandmarker,Kt as createIcaoGate,Le as createLivePhotoKit,T as createLivenessCaptureInternal,Ee as createPortraitCaptureInternal,Se as createStepRunner,Ie as createVerificationInternal,h as cropImage,e as detectFormFactor,t as detectIsMobile,ke as detectMrzBand,Et as docZoomFor,W as encodeDocumentImage,N as executeTurnstile,vt as eyeLineRoll,Ht as eyeOpenness,Qt as eyeSpecular,Ft as faceGeometry,Jt as faceLighting,qt as faceSharpness,pe as facesOf,we as feedbackVoteOf,ir as flagOf,mt as focusOk,ee as formatMismatch,c as frontierStep,St as guideQuad,Tt as guideRegionInFrame,$t as icaoPixelStats,bt as icaoWindow,Ye as initialScanState,R as isExecutable,S as isTerminalView,Yt as judgeIcao,Ae as lensKindOf,$ as liveMrzWireReport,F as loadTurnstile,Xt as lumaPlane,_ as mapEngineState,L as mapErrorKind,m as mapGuidanceHint,y as mapSessionResult,H as measureBitmapSharpness,Y as measureRegionSharpness,He as nextScanState,se as observePortraitFrame,_t as openDocCamera,Dt as passportBandOf,Wt as percentile,g as photoSharpness,ht as portraitCropRegion,Oe as portraitMatchStep,Nt as poseFromMatrix,E as preloadedDetectorFactory,Xe as quadAreaFrac,Je as quadBounds,Ze as quadIou,$e as quadTiltRatio,ue as randomUuid,Ce as rankBackCameras,pt as readStoredLens,Zt as regionStats,s as resetLivenessAssetsForTests,M as resetTurnstileForTests,U as resizeLongEdge,pr as resolveAcceptedDocuments,rt as resolveDocCameraTuning,Ct as resolveDocShutterTuning,lt as resolveGuideLockTuning,zt as resolveIcaoTuning,Q as resolveWebOcrPlan,P as runLivenessFlow,C as runSubmission,Ne as scannerFormatFor,kt as scoreFrame,a as setPreloadLoaderForTests,Z as settledHint,at as singleShotFocusAt,qe as specularFraction,j as startWebOcr,l as stepOf,G as stillRegionOf,w as stillToImageData,nt as supportsFocusMode,ft as warmDocDetector,Gt as windowOverflow,it as writeStoredLens};
@@ -1 +1 @@
1
- import{e as Z}from"./chunk-A3FUGHAH.js";import{a as Q,b as J,e as X,f as E,g as R,j as Y}from"./chunk-U3NYGTX7.js";import{x as $}from"./chunk-YWGW63B3.js";import{n as W}from"./chunk-VWGKUQ3C.js";import"./chunk-53POX7U4.js";import"./chunk-33KKMPJ5.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-GI3UFGRQ.js";import{F as N,i as z,x as K}from"./chunk-LFMIFR6T.js";import"./chunk-G6LKLN4U.js";import"./chunk-SMKCBUJL.js";import"./chunk-MXWLCDFX.js";import"./chunk-TDLIXFDT.js";import{b as O,c as B,q as G,s as j,t as F}from"./chunk-X6UIO5E3.js";import"./chunk-5DTWBDCP.js";import"./chunk-7QZWBDI5.js";import"./chunk-PBLZ5W7P.js";import"./chunk-SX7TUC3V.js";import"./chunk-POIQGEZM.js";import"./chunk-CPUECYAJ.js";import"./chunk-FPXL63KZ.js";import{c as C,i as q}from"./chunk-JWEHH2MS.js";import"./chunk-TSA6GHUG.js";import{a as H}from"./chunk-JYU5YHXN.js";import"./chunk-FSSMUAKC.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";var re=2e4,oe=new Set(["media_type_unsupported","media_type_mismatch"]),ee=new Set(["document_upload_not_allowed","portrait_source_not_allowed","uploaded_media_not_allowed"]);function te(e){let c=null,m=Promise.resolve(),d=!1,w=null,M=null,h=!1,D=null,g=!1,_=!1,k=()=>{c?.controller.handle.destroy(),c=null},v=()=>{let t=e.currentView(),r=t===null?null:R(t,{isMobile:e.isMobile()});return r?.kind==="portrait"?r:null},S=()=>{if(e.destroyed())return"self";let t=e.currentView(),r=t===null?void 0:E(t);return r==="self"||r==="assisted"?r:r==="choice"&&e.captureModeSwitch!==void 0?e.captureModeSwitch.pick()??"self":e.cameraMode?.()??j(r??G(t),null)},I=e.captureModeSwitch,x=I===void 0?void 0:{session:()=>{let t=e.currentView();return t!==null&&E(t)==="choice"?"choice":S()},onModeChange:t=>I.choose(t)},T=async(t,r)=>{if(e.destroyed())return;let u=S();r.setFlowState("uploading"),d=!1;let n=null;try{await e.runner().submit("portrait_icao",async(s,y)=>{if(n===null){let f=await F(s,"image","image/jpeg",t.image.size,{engine:"portrait"});await s.uploadToSpaces(f.uploadUrl,t.image,"image/jpeg"),n=(await s.completeMedia(f.key)).key}r.setFlowState("checking");let b={media:{portrait:n},gate:q(t.gate),...t.tuningVersion!==void 0?{tuningVersion:t.tuningVersion}:{},source:"camera",capture:{mode:u,facingMode:t.facingMode}};return s.submitCheck("portrait_icao",b,{idempotencyKey:y})})}catch(s){d=!0,s instanceof C&&ee.has(s.code)&&await e.refreshView?.().catch(()=>{})}if(r.setFlowState("done"),e.destroyed())return;let o=v();(o===null||o.phase!=="capture")&&c?.controller===r&&k(),e.runner().republish()},L=t=>e.runner().submit("face_match",(r,u)=>r.submitCheck("face_match",e.runner().faceProbeSkipped()?{simulatedCapture:!0}:{},{idempotencyKey:u})).then(()=>{},()=>{d=!0,t()}),P=null,V=async t=>{let r=v();if(r===null||r.phase!=="capture"||!r.photo.uploadOffered)throw new RangeError("upload_not_offered");let{prepareUploadFile:u}=await import("./upload-file-UYXOHCRG.js"),n=await u(t,e.uploadInternals);if(e.destroyed())return;k(),d=!1;let o=null;try{await e.runner().submit("portrait_icao",async(s,y)=>{if(o===null){let f=await s.presign("image",n.contentType,n.blob.size,{source:"upload"});await s.uploadToSpaces(f.uploadUrl,n.blob,n.contentType),o=(await s.completeMedia(f.key)).key}let b={media:{portrait:o},source:"upload"};return s.submitCheck("portrait_icao",b,{idempotencyKey:y})})}catch(s){throw s instanceof C&&oe.has(s.code)?new TypeError("unsupported_file"):(s instanceof C&&ee.has(s.code)&&await e.refreshView?.().catch(()=>{}),s)}},i=null,l=t=>{if(i!==null)return i;let r=v();if(r===null||r.phase!=="review")return Promise.reject(new RangeError("no_pending_fix"));let u={fixReview:{accept:t}},n=e.runner().submit("portrait_icao",(o,s)=>o.submitCheck("portrait_icao",u,{idempotencyKey:s})).catch(async o=>{throw o instanceof C&&o.code==="portrait_no_pending_fix"&&await e.refreshView?.().catch(()=>{}),o}).finally(()=>{i=null});return i=n,n},a=t=>{let r=()=>V(t),u=(P===null?r():P.then(r,r)).finally(()=>{P===u&&(P=null)});return P=u,u};return{bind:(t,r)=>{if(t.phase==="review")return k(),{...t,uploadFailed:d,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("the adjusted photo waits for confirmFix()")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:l};if(t.phase==="match")return k(),w!==t.attemptsRemaining&&!d&&(w=t.attemptsRemaining,L(r)),{...t,uploadFailed:d,resubmit:()=>(d=!1,w=t.attemptsRemaining,r(),L(r)),capture:()=>{throw new Error("the portrait was already accepted")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:l};if(w=null,t.reuse===!0&&t.phase==="capture")return k(),!g&&D!==t.attemptsRemaining&&(D=t.attemptsRemaining,g=!0,e.runner().submit("portrait_icao",(n,o)=>n.submitCheck("portrait_icao",{},{idempotencyKey:o})).then(()=>{_=!1},()=>{_=!0}).finally(()=>{g=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:_&&!g,refresh:()=>(_=!1,D=null,r(),Promise.resolve())};let u=e.keptPortraitInput?.()??null;return u!==null&&(h||u!==M&&t.report===null&&t.reason===void 0&&!t.retakeOnly)?(h||(M=u,h=!0,e.runner().submit("portrait_icao",(n,o)=>n.submitCheck("portrait_icao",u,{idempotencyKey:o})).catch(()=>{}).finally(()=>{h=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:!1,refresh:()=>Promise.resolve()}):{...t,uploadFailed:d,resubmit:()=>Promise.resolve(),capture:n=>{if(c!==null&&c.video===n.video)return c.controller.handle;k(),d=!1;let o=W({video:n.video,tuning:t.tuning,tuningVersion:t.tuningVersion,...t.icao!=null?{policy:t.icao.policy}:{},...n.keepScreenAwake!==void 0?{keepScreenAwake:n.keepScreenAwake}:{},...n.assetBaseUrl!==void 0?{assetBaseUrl:n.assetBaseUrl}:{}},e.internals,S,x);c={video:n.video,controller:o};let s=o.handle.destroy;o.handle.destroy=()=>{c?.controller===o&&(c=null),s()},o.handle.on("error",f=>{e.reportCaptureIssue?.(O("portrait",f,0))});let y=!1,b=(f,U)=>{let A=o.gateScores();A!==null&&e.reportGate?.({kind:"portrait_gate",platform:"web",outcome:f,...U!==null?{failing:U}:{},...A})};return o.handle.on("gate",f=>{!y&&!f.ready&&(o.gateScores()?.elapsedMs??0)>=re&&(y=!0,b("stuck",f.failing))}),o.handle.on("captured",f=>{b("captured",null),y=!1,m=m.then(()=>T(f,o)).catch(()=>{})}),o.handle},uploadPortrait:a,confirmFix:l}},destroy:k}}function ne(e){let c=e;if(typeof c.apiOrigin!="string"||typeof c.sessionToken!="string")return;let m=`${c.apiOrigin}/api/v2/hosted/capture-reports`,d=c.sessionToken;return w=>{try{fetch(m,{method:"POST",headers:{"content-type":"application/json","x-session-token":d,"x-sekyro-sdk":`@sekyro/web/${H}`},body:JSON.stringify({reports:w}),keepalive:!0}).catch(()=>{})}catch{}}}function ie(e){let c=e.apiOrigin;return Z("sdk",typeof c=="string"&&/staging|sandbox|localhost/.test(c)?"sandbox":"live")}function Me(e){let c=null,m=null,d=null,w=B(),M=Promise.resolve(),h=()=>{d?.flow.handle.destroy(),d=null},D=async(i,l)=>{if(e.destroyed())return;l.setFlowState("uploading");let a=null,p,t=!1,r=e.currentView()?.documents!==void 0;try{await c.submit("doc_ocr",async(y,b)=>{if(a===null){let f=await F(y,"image","image/jpeg",i.image.size,{engine:"document"});await y.uploadToSpaces(f.uploadUrl,i.image,"image/jpeg"),a=(await y.completeMedia(f.key)).key}return l.setFlowState("checking"),p===void 0&&(p=l.takeDeviceRead(i)),y.submitCheck("doc_ocr",{imageKey:a,side:i.side,...p!==null?{deviceRead:p}:{},...r?{source:"camera"}:{}},{idempotencyKey:b})})}catch{t=!0}finally{l.setFlowState("done")}if(e.destroyed())return;if(t){l.settle(i.side,{ok:!1,issue:"technical"});return}let u=e.currentView(),n=u===null?null:R(u,{isMobile:e.isMobile()});if(n?.kind!=="document"){l.settle(i.side,{ok:!0}),d?.flow===l?h():l.handle.destroy();return}if(n.reason==="document_type_not_accepted"){m=null,d?.flow===l&&h(),c.republish();return}let o=n.acceptedSides;i.side!=="single"&&(o.includes(i.side)||n.reason==="side_missing")&&!(o.includes("recto")&&o.includes("verso"))?(l.settle(i.side,{ok:!0}),m?.documentType!=="passport"&&l.handle.setSide(n.side)):l.settle(i.side,{ok:!1,issue:"reread"})},g=null,_=async i=>{let l=e.currentView(),a=l===null?null:R(l,{isMobile:e.isMobile()});if(l===null||a?.kind!=="document")throw new RangeError("upload_not_offered");if(!a.photo.uploadOffered)throw new RangeError("upload_not_offered");let p=m?.documentType==="passport"?"single":a.side,{prepareUploadFile:t}=await import("./upload-file-UYXOHCRG.js"),r=await t(i,e.uploadInternals);if(e.destroyed())return;h();let u=null;try{await c.submit("doc_ocr",async(n,o)=>{if(u===null){let s=await n.presign("image",r.contentType,r.blob.size,{source:"upload"});await n.uploadToSpaces(s.uploadUrl,r.blob,r.contentType),u=(await n.completeMedia(s.key)).key}return n.submitCheck("doc_ocr",{imageKey:u,side:p,source:"upload"},{idempotencyKey:o})})}catch(n){throw n instanceof C&&(n.code==="media_type_unsupported"||n.code==="media_type_mismatch")?new TypeError("unsupported_file"):(n instanceof C&&(n.code==="document_upload_not_allowed"||n.code==="uploaded_media_not_allowed")&&await e.refreshView().catch(()=>{}),n)}},k=(i,l)=>({...i,uploadDocument:a=>{let p=()=>_(a),t=(g===null?p():g.then(p,p)).finally(()=>{g===t&&(g=null)});return g=t,t},issuer:m?.issuer??null,documentType:m?.documentType??null,captureSide:m===null?null:m.documentType==="passport"?"single":i.side,selectDocument:(a,p)=>{if(!J(i.documents).includes(a)||!Q(i.documents,a).includes(p))throw new RangeError(`${p} from ${a} is not accepted`);(m?.issuer!==a||m.documentType!==p)&&h(),m={issuer:a,documentType:p},l()},capture:a=>{if(m===null)throw new Error("selectDocument() first");if(d!==null&&d.video===a.video)return d.flow.handle;h();let p=m,t=p.documentType==="passport"?"single":i.acceptedSides.length>0?i.side:void 0,r=$({video:a.video,documentType:p.documentType,issuer:p.issuer,...t!==void 0?{side:t}:{},...a.keepScreenAwake!==void 0?{keepScreenAwake:a.keepScreenAwake}:{},...a.liveMrz!==void 0?{liveMrz:a.liveMrz}:{}},{...e.documentInternals??{},...(()=>{let n=e.currentView()?.capture?.document,o=e.documentInternals?.blurRefuseSharpnessMax??n?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:z(n?.camera),shutter:N(n?.scan),guideLock:K(n?.guide),...e.documentInternals?.engineOptions??{}},...typeof o=="number"&&Number.isFinite(o)&&o>=0&&o<=1?{blurRefuseSharpnessMax:o}:{}}})(),deferRead:!0,...(()=>{let n=e.currentView();if(n===null||e.documentInternals?.webOcr!==void 0)return{};let o=ne(e.runtime.client);return{webOcr:{captureDocument:n.capture?.document,salt:n.sessionId,baseUrl:ie(e.runtime.client),...o!==void 0?{reports:o}:{}}}})()});d={video:a.video,flow:r};let u=r.handle.destroy;return r.handle.destroy=()=>{d?.flow===r&&(d=null),u()},w.newHandle(),r.handle.on("state",n=>w.note(n)),r.handle.on("error",n=>{w.noteError(),e.reportCaptureIssue?.(O("document",n,w.value))}),r.handle.on("captured",n=>{M=M.then(()=>D(n,r)).catch(()=>{})}),r.handle}}),v=null,S=null,I=new Set,x=e.runtime.client;e.runtime.client=new Proxy(x,{get(i,l){if(l==="submitCheck")return(S??i).submitCheck.bind(S??i);let a=Reflect.get(i,l);return typeof a=="function"?a.bind(i):a}});let T=()=>{v?.destroy(),v=null,S=null},L=i=>{let l=e.currentView(),a=l===null?null:R(l,{isMobile:e.isMobile()});if(l===null||a?.kind!=="liveness"||a.livePhoto?.icao!==!0)return;if(v===null){let u=X({tuning:l.capture?.icao??null,tuningVersion:l.capture?.tuningVersion??null,...a.icao!=null?{policy:a.icao.policy}:{},still:a.livePhoto.still,...i.assetBaseUrl!==void 0?{assetBaseUrl:i.assetBaseUrl}:{}},e.livePhotoInternals);v=u,S=u.decorate(x),u.onGate(n=>{for(let o of I)o(n)})}let p=v,t=e.baseCapture??{},r=t.engineOptions?.telemetry;return{...t,engineOptions:{...t.engineOptions??{},measureQuality:p.engineOptions.measureQuality,telemetry:u=>{r?.(u),p.engineOptions.telemetry(u)}}}},P=te({keptPortraitInput:()=>v?.lastPortraitInput()??null,runner:()=>c,currentView:e.currentView,...e.cameraMode!==void 0?{cameraMode:e.cameraMode}:{},...e.captureModeSwitch!==void 0?{captureModeSwitch:e.captureModeSwitch}:{},destroyed:e.destroyed,isMobile:e.isMobile,...e.portraitInternals!==void 0?{internals:e.portraitInternals}:{},...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},refreshView:()=>e.refreshView(),...e.reportCaptureIssue!==void 0?{reportCaptureIssue:e.reportCaptureIssue}:{},reportGate:i=>ne(e.runtime.client)?.([i])}),V=Y({...e,bindDocument:k,bindPortrait:P.bind,stopCameras:()=>{h(),P.destroy(),T(),e.stopLiveness?.()},onLivePhoto:i=>(I.add(i),()=>I.delete(i))});return c=V,{...V,captureInternals:L,destroy:()=>{h(),P.destroy(),T(),I.clear()}}}export{Me as createPlanRunner,ne as reportSink,ie as sdkAssetBase};
1
+ import{e as Z}from"./chunk-A3FUGHAH.js";import{a as Q,b as J,e as X,f as E,g as R,j as Y}from"./chunk-IC6TI6GV.js";import{x as $}from"./chunk-MQBX4DQQ.js";import{n as W}from"./chunk-VWGKUQ3C.js";import"./chunk-53POX7U4.js";import"./chunk-33KKMPJ5.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-GI3UFGRQ.js";import{F as N,i as z,x as K}from"./chunk-FLA42JCK.js";import"./chunk-G6LKLN4U.js";import"./chunk-SMKCBUJL.js";import"./chunk-MXWLCDFX.js";import"./chunk-TDLIXFDT.js";import{b as O,c as B,q as G,s as j,t as F}from"./chunk-QY6TJCOJ.js";import"./chunk-LBH6KGTV.js";import"./chunk-7QZWBDI5.js";import"./chunk-5YVQIHQA.js";import"./chunk-SX7TUC3V.js";import"./chunk-POIQGEZM.js";import"./chunk-CPUECYAJ.js";import"./chunk-FPXL63KZ.js";import{c as C,i as q}from"./chunk-XI5FXEKC.js";import"./chunk-TSA6GHUG.js";import{a as H}from"./chunk-IFLOS5OT.js";import"./chunk-FSSMUAKC.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";var re=2e4,oe=new Set(["media_type_unsupported","media_type_mismatch"]),ee=new Set(["document_upload_not_allowed","portrait_source_not_allowed","uploaded_media_not_allowed"]);function te(e){let c=null,m=Promise.resolve(),d=!1,w=null,M=null,h=!1,D=null,g=!1,_=!1,k=()=>{c?.controller.handle.destroy(),c=null},v=()=>{let t=e.currentView(),r=t===null?null:R(t,{isMobile:e.isMobile()});return r?.kind==="portrait"?r:null},S=()=>{if(e.destroyed())return"self";let t=e.currentView(),r=t===null?void 0:E(t);return r==="self"||r==="assisted"?r:r==="choice"&&e.captureModeSwitch!==void 0?e.captureModeSwitch.pick()??"self":e.cameraMode?.()??j(r??G(t),null)},I=e.captureModeSwitch,x=I===void 0?void 0:{session:()=>{let t=e.currentView();return t!==null&&E(t)==="choice"?"choice":S()},onModeChange:t=>I.choose(t)},T=async(t,r)=>{if(e.destroyed())return;let u=S();r.setFlowState("uploading"),d=!1;let n=null;try{await e.runner().submit("portrait_icao",async(s,y)=>{if(n===null){let f=await F(s,"image","image/jpeg",t.image.size,{engine:"portrait"});await s.uploadToSpaces(f.uploadUrl,t.image,"image/jpeg"),n=(await s.completeMedia(f.key)).key}r.setFlowState("checking");let b={media:{portrait:n},gate:q(t.gate),...t.tuningVersion!==void 0?{tuningVersion:t.tuningVersion}:{},source:"camera",capture:{mode:u,facingMode:t.facingMode}};return s.submitCheck("portrait_icao",b,{idempotencyKey:y})})}catch(s){d=!0,s instanceof C&&ee.has(s.code)&&await e.refreshView?.().catch(()=>{})}if(r.setFlowState("done"),e.destroyed())return;let o=v();(o===null||o.phase!=="capture")&&c?.controller===r&&k(),e.runner().republish()},L=t=>e.runner().submit("face_match",(r,u)=>r.submitCheck("face_match",e.runner().faceProbeSkipped()?{simulatedCapture:!0}:{},{idempotencyKey:u})).then(()=>{},()=>{d=!0,t()}),P=null,V=async t=>{let r=v();if(r===null||r.phase!=="capture"||!r.photo.uploadOffered)throw new RangeError("upload_not_offered");let{prepareUploadFile:u}=await import("./upload-file-UYXOHCRG.js"),n=await u(t,e.uploadInternals);if(e.destroyed())return;k(),d=!1;let o=null;try{await e.runner().submit("portrait_icao",async(s,y)=>{if(o===null){let f=await s.presign("image",n.contentType,n.blob.size,{source:"upload"});await s.uploadToSpaces(f.uploadUrl,n.blob,n.contentType),o=(await s.completeMedia(f.key)).key}let b={media:{portrait:o},source:"upload"};return s.submitCheck("portrait_icao",b,{idempotencyKey:y})})}catch(s){throw s instanceof C&&oe.has(s.code)?new TypeError("unsupported_file"):(s instanceof C&&ee.has(s.code)&&await e.refreshView?.().catch(()=>{}),s)}},i=null,l=t=>{if(i!==null)return i;let r=v();if(r===null||r.phase!=="review")return Promise.reject(new RangeError("no_pending_fix"));let u={fixReview:{accept:t}},n=e.runner().submit("portrait_icao",(o,s)=>o.submitCheck("portrait_icao",u,{idempotencyKey:s})).catch(async o=>{throw o instanceof C&&o.code==="portrait_no_pending_fix"&&await e.refreshView?.().catch(()=>{}),o}).finally(()=>{i=null});return i=n,n},a=t=>{let r=()=>V(t),u=(P===null?r():P.then(r,r)).finally(()=>{P===u&&(P=null)});return P=u,u};return{bind:(t,r)=>{if(t.phase==="review")return k(),{...t,uploadFailed:d,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("the adjusted photo waits for confirmFix()")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:l};if(t.phase==="match")return k(),w!==t.attemptsRemaining&&!d&&(w=t.attemptsRemaining,L(r)),{...t,uploadFailed:d,resubmit:()=>(d=!1,w=t.attemptsRemaining,r(),L(r)),capture:()=>{throw new Error("the portrait was already accepted")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:l};if(w=null,t.reuse===!0&&t.phase==="capture")return k(),!g&&D!==t.attemptsRemaining&&(D=t.attemptsRemaining,g=!0,e.runner().submit("portrait_icao",(n,o)=>n.submitCheck("portrait_icao",{},{idempotencyKey:o})).then(()=>{_=!1},()=>{_=!0}).finally(()=>{g=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:_&&!g,refresh:()=>(_=!1,D=null,r(),Promise.resolve())};let u=e.keptPortraitInput?.()??null;return u!==null&&(h||u!==M&&t.report===null&&t.reason===void 0&&!t.retakeOnly)?(h||(M=u,h=!0,e.runner().submit("portrait_icao",(n,o)=>n.submitCheck("portrait_icao",u,{idempotencyKey:o})).catch(()=>{}).finally(()=>{h=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:!1,refresh:()=>Promise.resolve()}):{...t,uploadFailed:d,resubmit:()=>Promise.resolve(),capture:n=>{if(c!==null&&c.video===n.video)return c.controller.handle;k(),d=!1;let o=W({video:n.video,tuning:t.tuning,tuningVersion:t.tuningVersion,...t.icao!=null?{policy:t.icao.policy}:{},...n.keepScreenAwake!==void 0?{keepScreenAwake:n.keepScreenAwake}:{},...n.assetBaseUrl!==void 0?{assetBaseUrl:n.assetBaseUrl}:{}},e.internals,S,x);c={video:n.video,controller:o};let s=o.handle.destroy;o.handle.destroy=()=>{c?.controller===o&&(c=null),s()},o.handle.on("error",f=>{e.reportCaptureIssue?.(O("portrait",f,0))});let y=!1,b=(f,U)=>{let A=o.gateScores();A!==null&&e.reportGate?.({kind:"portrait_gate",platform:"web",outcome:f,...U!==null?{failing:U}:{},...A})};return o.handle.on("gate",f=>{!y&&!f.ready&&(o.gateScores()?.elapsedMs??0)>=re&&(y=!0,b("stuck",f.failing))}),o.handle.on("captured",f=>{b("captured",null),y=!1,m=m.then(()=>T(f,o)).catch(()=>{})}),o.handle},uploadPortrait:a,confirmFix:l}},destroy:k}}function ne(e){let c=e;if(typeof c.apiOrigin!="string"||typeof c.sessionToken!="string")return;let m=`${c.apiOrigin}/api/v2/hosted/capture-reports`,d=c.sessionToken;return w=>{try{fetch(m,{method:"POST",headers:{"content-type":"application/json","x-session-token":d,"x-sekyro-sdk":`@sekyro/web/${H}`},body:JSON.stringify({reports:w}),keepalive:!0}).catch(()=>{})}catch{}}}function ie(e){let c=e.apiOrigin;return Z("sdk",typeof c=="string"&&/staging|sandbox|localhost/.test(c)?"sandbox":"live")}function Me(e){let c=null,m=null,d=null,w=B(),M=Promise.resolve(),h=()=>{d?.flow.handle.destroy(),d=null},D=async(i,l)=>{if(e.destroyed())return;l.setFlowState("uploading");let a=null,p,t=!1,r=e.currentView()?.documents!==void 0;try{await c.submit("doc_ocr",async(y,b)=>{if(a===null){let f=await F(y,"image","image/jpeg",i.image.size,{engine:"document"});await y.uploadToSpaces(f.uploadUrl,i.image,"image/jpeg"),a=(await y.completeMedia(f.key)).key}return l.setFlowState("checking"),p===void 0&&(p=l.takeDeviceRead(i)),y.submitCheck("doc_ocr",{imageKey:a,side:i.side,...p!==null?{deviceRead:p}:{},...r?{source:"camera"}:{}},{idempotencyKey:b})})}catch{t=!0}finally{l.setFlowState("done")}if(e.destroyed())return;if(t){l.settle(i.side,{ok:!1,issue:"technical"});return}let u=e.currentView(),n=u===null?null:R(u,{isMobile:e.isMobile()});if(n?.kind!=="document"){l.settle(i.side,{ok:!0}),d?.flow===l?h():l.handle.destroy();return}if(n.reason==="document_type_not_accepted"){m=null,d?.flow===l&&h(),c.republish();return}let o=n.acceptedSides;i.side!=="single"&&(o.includes(i.side)||n.reason==="side_missing")&&!(o.includes("recto")&&o.includes("verso"))?(l.settle(i.side,{ok:!0}),m?.documentType!=="passport"&&l.handle.setSide(n.side)):l.settle(i.side,{ok:!1,issue:"reread"})},g=null,_=async i=>{let l=e.currentView(),a=l===null?null:R(l,{isMobile:e.isMobile()});if(l===null||a?.kind!=="document")throw new RangeError("upload_not_offered");if(!a.photo.uploadOffered)throw new RangeError("upload_not_offered");let p=m?.documentType==="passport"?"single":a.side,{prepareUploadFile:t}=await import("./upload-file-UYXOHCRG.js"),r=await t(i,e.uploadInternals);if(e.destroyed())return;h();let u=null;try{await c.submit("doc_ocr",async(n,o)=>{if(u===null){let s=await n.presign("image",r.contentType,r.blob.size,{source:"upload"});await n.uploadToSpaces(s.uploadUrl,r.blob,r.contentType),u=(await n.completeMedia(s.key)).key}return n.submitCheck("doc_ocr",{imageKey:u,side:p,source:"upload"},{idempotencyKey:o})})}catch(n){throw n instanceof C&&(n.code==="media_type_unsupported"||n.code==="media_type_mismatch")?new TypeError("unsupported_file"):(n instanceof C&&(n.code==="document_upload_not_allowed"||n.code==="uploaded_media_not_allowed")&&await e.refreshView().catch(()=>{}),n)}},k=(i,l)=>({...i,uploadDocument:a=>{let p=()=>_(a),t=(g===null?p():g.then(p,p)).finally(()=>{g===t&&(g=null)});return g=t,t},issuer:m?.issuer??null,documentType:m?.documentType??null,captureSide:m===null?null:m.documentType==="passport"?"single":i.side,selectDocument:(a,p)=>{if(!J(i.documents).includes(a)||!Q(i.documents,a).includes(p))throw new RangeError(`${p} from ${a} is not accepted`);(m?.issuer!==a||m.documentType!==p)&&h(),m={issuer:a,documentType:p},l()},capture:a=>{if(m===null)throw new Error("selectDocument() first");if(d!==null&&d.video===a.video)return d.flow.handle;h();let p=m,t=p.documentType==="passport"?"single":i.acceptedSides.length>0?i.side:void 0,r=$({video:a.video,documentType:p.documentType,issuer:p.issuer,...t!==void 0?{side:t}:{},...a.keepScreenAwake!==void 0?{keepScreenAwake:a.keepScreenAwake}:{},...a.liveMrz!==void 0?{liveMrz:a.liveMrz}:{}},{...e.documentInternals??{},...(()=>{let n=e.currentView()?.capture?.document,o=e.documentInternals?.blurRefuseSharpnessMax??n?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:z(n?.camera),shutter:N(n?.scan),guideLock:K(n?.guide),...e.documentInternals?.engineOptions??{}},...typeof o=="number"&&Number.isFinite(o)&&o>=0&&o<=1?{blurRefuseSharpnessMax:o}:{}}})(),deferRead:!0,...(()=>{let n=e.currentView();if(n===null||e.documentInternals?.webOcr!==void 0)return{};let o=ne(e.runtime.client);return{webOcr:{captureDocument:n.capture?.document,salt:n.sessionId,baseUrl:ie(e.runtime.client),...o!==void 0?{reports:o}:{}}}})()});d={video:a.video,flow:r};let u=r.handle.destroy;return r.handle.destroy=()=>{d?.flow===r&&(d=null),u()},w.newHandle(),r.handle.on("state",n=>w.note(n)),r.handle.on("error",n=>{w.noteError(),e.reportCaptureIssue?.(O("document",n,w.value))}),r.handle.on("captured",n=>{M=M.then(()=>D(n,r)).catch(()=>{})}),r.handle}}),v=null,S=null,I=new Set,x=e.runtime.client;e.runtime.client=new Proxy(x,{get(i,l){if(l==="submitCheck")return(S??i).submitCheck.bind(S??i);let a=Reflect.get(i,l);return typeof a=="function"?a.bind(i):a}});let T=()=>{v?.destroy(),v=null,S=null},L=i=>{let l=e.currentView(),a=l===null?null:R(l,{isMobile:e.isMobile()});if(l===null||a?.kind!=="liveness"||a.livePhoto?.icao!==!0)return;if(v===null){let u=X({tuning:l.capture?.icao??null,tuningVersion:l.capture?.tuningVersion??null,...a.icao!=null?{policy:a.icao.policy}:{},still:a.livePhoto.still,...i.assetBaseUrl!==void 0?{assetBaseUrl:i.assetBaseUrl}:{}},e.livePhotoInternals);v=u,S=u.decorate(x),u.onGate(n=>{for(let o of I)o(n)})}let p=v,t=e.baseCapture??{},r=t.engineOptions?.telemetry;return{...t,engineOptions:{...t.engineOptions??{},measureQuality:p.engineOptions.measureQuality,telemetry:u=>{r?.(u),p.engineOptions.telemetry(u)}}}},P=te({keptPortraitInput:()=>v?.lastPortraitInput()??null,runner:()=>c,currentView:e.currentView,...e.cameraMode!==void 0?{cameraMode:e.cameraMode}:{},...e.captureModeSwitch!==void 0?{captureModeSwitch:e.captureModeSwitch}:{},destroyed:e.destroyed,isMobile:e.isMobile,...e.portraitInternals!==void 0?{internals:e.portraitInternals}:{},...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},refreshView:()=>e.refreshView(),...e.reportCaptureIssue!==void 0?{reportCaptureIssue:e.reportCaptureIssue}:{},reportGate:i=>ne(e.runtime.client)?.([i])}),V=Y({...e,bindDocument:k,bindPortrait:P.bind,stopCameras:()=>{h(),P.destroy(),T(),e.stopLiveness?.()},onLivePhoto:i=>(I.add(i),()=>I.delete(i))});return c=V,{...V,captureInternals:L,destroy:()=>{h(),P.destroy(),T(),I.clear()}}}export{Me as createPlanRunner,ne as reportSink,ie as sdkAssetBase};
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"./chunk-72LG73YL.js";export{b as TURNSTILE_EXECUTE_TIMEOUT_MS,a as TURNSTILE_SCRIPT_SRC,e as executeTurnstile,d as loadTurnstile,c as resetTurnstileForTests};
1
+ import{a,b,c,d,e}from"./chunk-TDCLQRT4.js";export{b as TURNSTILE_EXECUTE_TIMEOUT_MS,a as TURNSTILE_SCRIPT_SRC,e as executeTurnstile,d as loadTurnstile,c as resetTurnstileForTests};
@@ -252,10 +252,10 @@ type SessionStatus = "created" | "in_progress" | "review_pending" | "verified" |
252
252
  /**
253
253
  * Why a `not_verified` session was not verified (verification-session.schema.ts
254
254
  * `SESSION_REASONS`): a verdict against the person (`rejected`), no verdict
255
- * (`inconclusive`), the check could not run (`unavailable`), the person left before a
256
- * result (`abandoned`), nobody opened the link (`not_opened`), a flow rule (`policy`),
257
- * the organization cancelled it (`cancelled`), a newer session took its review over
258
- * (`superseded`).
255
+ * (`inconclusive`), the check could not run (`unavailable`), the person started but the
256
+ * session expired before a result (`abandoned`), the link was sent but the session expired
257
+ * before it was opened (`not_opened`), a flow rule (`policy`), the organization cancelled
258
+ * it (`cancelled`), a newer session took its review over (`superseded`).
259
259
  */
260
260
  type SessionReason = "rejected" | "inconclusive" | "unavailable" | "abandoned" | "not_opened" | "policy" | "cancelled" | "superseded";
261
261
  /** Who or what closed a finished session (verification-session.schema.ts `CLOSED_BY`). */
@@ -252,10 +252,10 @@ type SessionStatus = "created" | "in_progress" | "review_pending" | "verified" |
252
252
  /**
253
253
  * Why a `not_verified` session was not verified (verification-session.schema.ts
254
254
  * `SESSION_REASONS`): a verdict against the person (`rejected`), no verdict
255
- * (`inconclusive`), the check could not run (`unavailable`), the person left before a
256
- * result (`abandoned`), nobody opened the link (`not_opened`), a flow rule (`policy`),
257
- * the organization cancelled it (`cancelled`), a newer session took its review over
258
- * (`superseded`).
255
+ * (`inconclusive`), the check could not run (`unavailable`), the person started but the
256
+ * session expired before a result (`abandoned`), the link was sent but the session expired
257
+ * before it was opened (`not_opened`), a flow rule (`policy`), the organization cancelled
258
+ * it (`cancelled`), a newer session took its review over (`superseded`).
259
259
  */
260
260
  type SessionReason = "rejected" | "inconclusive" | "unavailable" | "abandoned" | "not_opened" | "policy" | "cancelled" | "superseded";
261
261
  /** Who or what closed a finished session (verification-session.schema.ts `CLOSED_BY`). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/web",
3
- "version": "0.1.0-rc.23",
3
+ "version": "0.1.0-rc.24",
4
4
  "description": "Sekyro AI web SDK \u2014 browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
package/sbom.cdx.json CHANGED
@@ -97,8 +97,8 @@
97
97
  "type": "application",
98
98
  "name": "web",
99
99
  "group": "@sekyro",
100
- "version": "0.1.0-rc.23",
101
- "bom-ref": "@sekyro/web@0.1.0-rc.23",
100
+ "version": "0.1.0-rc.24",
101
+ "bom-ref": "@sekyro/web@0.1.0-rc.24",
102
102
  "description": "Sekyro AI web SDK — browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
103
103
  "licenses": [
104
104
  {
@@ -108,7 +108,7 @@
108
108
  }
109
109
  }
110
110
  ],
111
- "purl": "pkg:npm/%40sekyro/web@0.1.0-rc.23?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-web",
111
+ "purl": "pkg:npm/%40sekyro/web@0.1.0-rc.24?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-web",
112
112
  "externalReferences": [
113
113
  {
114
114
  "url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
@@ -150,7 +150,7 @@
150
150
  "name": "tasks-vision",
151
151
  "group": "@mediapipe",
152
152
  "version": "0.10.35",
153
- "bom-ref": "@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35",
153
+ "bom-ref": "@sekyro/web@0.1.0-rc.24|@mediapipe/tasks-vision@0.10.35",
154
154
  "licenses": [
155
155
  {
156
156
  "license": {
@@ -185,7 +185,7 @@
185
185
  "name": "thumbmarkjs",
186
186
  "group": "@thumbmarkjs",
187
187
  "version": "1.12.0",
188
- "bom-ref": "@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0",
188
+ "bom-ref": "@sekyro/web@0.1.0-rc.24|@thumbmarkjs/thumbmarkjs@1.12.0",
189
189
  "licenses": [
190
190
  {
191
191
  "license": {
@@ -218,17 +218,17 @@
218
218
  ],
219
219
  "dependencies": [
220
220
  {
221
- "ref": "@sekyro/web@0.1.0-rc.23",
221
+ "ref": "@sekyro/web@0.1.0-rc.24",
222
222
  "dependsOn": [
223
- "@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35",
224
- "@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0"
223
+ "@sekyro/web@0.1.0-rc.24|@mediapipe/tasks-vision@0.10.35",
224
+ "@sekyro/web@0.1.0-rc.24|@thumbmarkjs/thumbmarkjs@1.12.0"
225
225
  ]
226
226
  },
227
227
  {
228
- "ref": "@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35"
228
+ "ref": "@sekyro/web@0.1.0-rc.24|@mediapipe/tasks-vision@0.10.35"
229
229
  },
230
230
  {
231
- "ref": "@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0"
231
+ "ref": "@sekyro/web@0.1.0-rc.24|@thumbmarkjs/thumbmarkjs@1.12.0"
232
232
  }
233
233
  ]
234
234
  }
@@ -1 +0,0 @@
1
- var E="https://challenges.cloudflare.com/turnstile/v0/api.js",x=1e4;function T(){return window.turnstile}var l=null,r=null,p=Promise.resolve();function b(){l=null,r?.container.remove(),r=null,p=Promise.resolve()}function v(){return l??(l=new Promise((i,n)=>{let t=T();if(t){i(t);return}let e=document.createElement("script");e.src=E,e.async=!0,e.onload=()=>{let s=T();s?i(s):(l=null,n(new Error("Turnstile script loaded but exposed no API")))},e.onerror=()=>{l=null,e.remove(),n(new Error("Turnstile script failed to load"))},document.head.appendChild(e)})),l}function c(){return new Error("Turnstile challenge aborted")}function w(i,n){if(r!==null&&r.siteKey===n)return r;if(r!==null){try{i.remove(r.id)}catch{}r.container.remove(),r=null}let t=document.createElement("div");document.body.appendChild(t);let e={siteKey:n,container:t,fresh:!0,pending:null},s=i.render(t,{sitekey:n,execution:"execute",appearance:"execute",callback:o=>e.pending?.resolve(o),"error-callback":o=>e.pending?.reject(new Error(`Turnstile challenge failed${o?` (${o})`:""}`))});if(s===void 0)throw t.remove(),new Error("Turnstile render returned no widget id");return e.id=s,r=e,r}function h(i,n){try{i.reset(n.id),n.fresh=!1}catch{r===n&&(n.container.remove(),r=null)}}function P(i,n={}){let t=p.then(()=>m(i,n),()=>m(i,n));return p=t.catch(()=>{}),t}async function m(i,n){let t=n.timeoutMs??1e4,e=n.signal;if(e?.aborted)throw c();let s=await v();if(e?.aborted)throw c();let o=w(s,i),f,u,g=!1;try{return await new Promise((d,a)=>{o.pending={resolve:d,reject:a},f=setTimeout(()=>a(new Error(`Turnstile challenge timed out (${t} ms)`)),t),e!==void 0&&(u=()=>a(c()),e.addEventListener("abort",u,{once:!0})),o.fresh||s.reset(o.id),o.fresh=!1,s.execute(o.id)}).then(d=>(g=!0,d))}finally{clearTimeout(f),e!==void 0&&u!==void 0&&e.removeEventListener("abort",u),o.pending=null,g||h(s,o)}}export{E as a,x as b,b as c,v as d,P as e};
@@ -1 +0,0 @@
1
- import{A as qe,B as Ye,C as We,a as De,b as Le,c as Ne,d as N,e as W,f as j,g as He,h as T,i as Ue,j as P,k as V,l as A,m as re,n as E,o as H,p as U,q as Z,r as Fe,s as Be,t as Ge,u as Ke}from"./chunk-X6UIO5E3.js";import{n as Ee}from"./chunk-5DTWBDCP.js";import{a as we}from"./chunk-7QZWBDI5.js";import{c as ie,e as Te,g as Ve,h as $}from"./chunk-JWEHH2MS.js";import{c as Me,d as oe}from"./chunk-TSA6GHUG.js";function J(e){return e.idNumberBound??e.nniBound}function F(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function je(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Ct="https://api.sekyro.ai",_t=5e3,kt=24e4,Pt=1500,bt=10;function Rt(e){return new Promise(t=>setTimeout(t,e))}function xt(){let e=globalThis.crypto;if(e!==void 0&&typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(e!==void 0&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<16;r+=1)t[r]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let o=[...t].map(r=>r.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}function gn(e){return Ot(e,{})}function Ot(e,t){let o=e.apiOrigin??Ct,r=e.autoRetry??!0,i=e.rearm??"auto",s=t.client??new Ve({apiOrigin:o,sessionToken:e.clientToken,fetch:e.fetch}),u=t.sleep??Rt,c=t.uuid??xt,p=t.getTurnstileToken??((n,a)=>import("./turnstile-F4DS2L3F.js").then(l=>l.executeTurnstile(n,a))),m=we(),y=null,b=null,d=!1,C=new AbortController,f=null,w=null,B=null,G=()=>B??Fe(f),le=()=>Be(Z(f),G()),R=n=>{f=n,m.emit("view",n),y?.onView(n)},_=()=>f!==null?Promise.resolve(f):(w??(w=s.getSession().then(n=>(R(n),n)).finally(()=>{w=null})),w),x=async()=>{let n=await s.getSession();return R(n),n},Q=async(n,a)=>{n.plan!==void 0?R(n):await x()},X=null,pe=async n=>{let a=await _();if(n||!a.consentRecorded){let l=await s.recordConsent(e.locale);l.plan!==void 0?R(l):f!==null&&R({...f,consentRecorded:!0})}Re(a.turnstileSiteKey)},I=n=>n?.force===!0?pe(!0):(X??(X=pe(!1).finally(()=>{X=null})),X),z={client:s,ensureConsent:n=>I(n),sleep:u,uuid:c,...t.random!==void 0?{random:t.random}:{},onBusy:n=>{d||m.emit("busy",n)}},fe=!1,me=null,ee=n=>{if(n.status==="verified"||n.status==="not_verified"||n.status==="review"){if(fe)return;fe=!0}me=JSON.stringify(n),m.emit("result",n)},st=n=>{me!==JSON.stringify(n)&&ee(n)},he=async n=>{let a=f;n&&(a=await x().catch(()=>f));let l=a===null?null:T(a);return l!==null&&!d&&m.emit("method",l),l!==null},Se=null,ye=!1,ge=!1,Ce=()=>qe(z,(n,a)=>n.submitCheck("population_registry",{},{idempotencyKey:a})),_e=n=>J(n)===!0||F(A(n,"population_registry"))===!0,at=async()=>{try{let n=await _();if(P(n)||T(n)!==null||V(n)?.checkType!=="population_registry")return;if(!_e(n)&&F(A(n,"population_registry"))===void 0&&(n=await x()),!_e(n)){ge=!0;return}await I(),await Q(await Ce(),"population_registry");let a=f===null?void 0:A(f,"population_registry");if(a?.state==="input_required"&&a.reason==="registry_unavailable"&&j(a)>0){if(await u(_t),d)return;await Q(await Ce(),"population_registry")}}catch(n){if(n instanceof ie&&(n.code==="check_not_active"||n.code==="step_not_on_path")){await x().catch(()=>{});return}ye=!0;return}f!==null&&P(f)&&ee(H(f,{autoRetry:r}))},ke=()=>(Se??(Se=at()),Se),Pe=t.now??Date.now,K=null,te=n=>p(n,{signal:C.signal}),be=(n,a)=>n!==null&&n.siteKey===a&&Pe()-n.at<kt,Re=n=>{if(n===null||d||be(K,n))return;let a=te(n);a.catch(()=>{}),K={siteKey:n,at:Pe(),token:a}},ct=n=>{let a=K;return K=null,be(a,n)?a.token.catch(()=>te(n)):te(n)},xe=async()=>{let a=(await _()).turnstileSiteKey;return a===null?{}:{channel:"hosted_web",siteKey:a,turnstileToken:await ct(a)}},q=n=>{if(d)return;let a=s.reportCaptureIssue;if(a===void 0)return;let l=n.formFactor;try{l??(l=Me())}catch{}try{Promise.resolve(a.call(s,{...n,...l!==void 0?{formFactor:l}:{}})).catch(()=>{})}catch{}},k=null,Oe=Promise.resolve(),L=0,ut=async()=>{let n=await _();for(let a=0;a<bt&&!d&&!P(n)&&V(n)===void 0&&W(n).some(l=>l.state==="processing")&&(await u(Pt),!d);a+=1)n=await x();return n},dt=async(n,a,l)=>{let{capture:g}=n,h=()=>d,O=()=>n.alive&&n.attempt===l,Y=S=>{O()&&g.setFlowState(S)},v=S=>{if(!h()&&(S.status==="unavailable"&&S.reasonCode!==void 0&&!De(S.reasonCode)&&q({check:"liveness",kind:"unavailable",phase:"upload",engineKind:S.reasonCode,attempt:Math.max(0,n.issues.value)}),ee(S),!!O())){if(S.status==="retry"&&i==="auto"){g.handle.retry();return}g.setFlowState("done")}};if(a.degraded==="NO_RECORDER"){let S=f?.sessionId??(await _().catch(()=>null))?.sessionId??"";v(E(S,"no_recorder"));return}Y("uploading");try{if(await ke(),h())return;let S=await _(),Ie;if(!P(S)&&T(S)!==null){await he(!1),v(E(S.sessionId,"method_required"));return}if(!P(S)){if(V(S)?.checkType==="population_registry"){v(E(S.sessionId,ge?"nni_unbound":ye?"network":"registry_unavailable"));return}if(await I(),h())return;Ie=f??S;let ne=await Ye({...z,artifacts:a,getAttestation:xe,getView:()=>f??S,refreshView:x,applySubmit:Q,onPhase:Y,isCancelled:h,onKeyframePromoted:gt=>{b=gt}});if(h())return;if(ne.kind==="unavailable"){v(E(S.sessionId,ne.reason));return}if(ne.kind==="resync"&&await x(),f!==null&&T(f)!==null){await he(!1),v(E(S.sessionId,"method_required"));return}S=await ut()}v(H(S,{autoRetry:r,previous:Ie}))}catch{if(h())return;v(E(f?.sessionId??"","network"))}},lt=(n,a)=>{let l=n.attempt;L>0&&n.alive&&n.capture.setFlowState("uploading"),L+=1,Oe=Oe.then(()=>dt(n,a,l)).finally(()=>{L-=1,L===0&&y?.onChainIdle()}).catch(()=>{})},ve=n=>{k?.capture.handle.destroy(),k!==null&&(k.alive=!1);let a=Ee(n,y?.captureInternals?.(n)??t.capture,()=>f?.capture?.liveness?.keyframe?.rank===!0,le,()=>f?.capture?.liveness?.screenRamp,{session:()=>Z(f),onModeChange:h=>{B=h}}),l={capture:a,alive:!0,attempt:0,issues:Ne()};k=l,a.handle.on("error",h=>{q(Le("liveness",h,l.issues.value))}),a.handle.on("state",h=>{if(l.issues.note(h),h==="starting"){l.attempt+=1,Re(f?.turnstileSiteKey??null);let O=f===null?void 0:V(f)?.checkType;(O==="liveness"||O==="face_match")&&I().catch(()=>{})}}),a.handle.on("captured",h=>{Promise.resolve().then(()=>lt(l,h))});let g=a.handle;return{get state(){return g.state},get captureMode(){return g.captureMode},get facingMode(){return g.facingMode},on:(h,O)=>g.on(h,O),start:async h=>{if(f===null&&await _().catch(()=>{}),!!l.alive)return g.start(h)},retry:()=>g.retry(),switchCamera:()=>g.switchCamera(),canSwitchCaptureMode:()=>g.canSwitchCaptureMode(),setCaptureMode:h=>g.setCaptureMode(h),destroy:()=>{l.alive=!1,k===l&&(k=null),g.destroy()}}},pt=async()=>{if(d)return null;try{let n=await _();return d?null:T(n)}catch{return null}},ft=async()=>{if(d)return"self";try{let n=await _();if(d)return"self";let a=Z(n);return a==="choice"?G()??a:a}catch{return"self"}},mt=async()=>{if(d)return!1;try{let n=await _();return d||P(n)||oe()?!1:U(n,V(n))==="phone"||U(n,A(n,"liveness"))==="phone"}catch{return!1}},ht=async()=>{if(d)return!1;try{let n=await _();return!d&&n.returning===!0}catch{return!1}},St=async n=>{let a=(await _()).plan?.choice,l=a?.options.find(h=>N[h.service]===n);if(!l)throw new RangeError(`method ${String(n)} is not offered`);let g=await s.choose(a.nodeId,l.id);d||R(g)},Ae=null,yt=()=>(Ae??(Ae=import("./plan-runner-AD2JTMC7.js").then(n=>{let a=n.createPlanRunner({runtime:z,currentView:()=>f,cameraMode:le,captureModeSwitch:{pick:G,choose:l=>{B=l}},ensureView:_,refreshView:x,ensureConsent:()=>I(),liveness:ve,stopLiveness:()=>{k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null)},chainBusy:()=>L>0,destroyed:()=>d,sleep:u,isMobile:oe,now:t.now??Date.now,keptFaceKey:()=>b,setView:R,baseCapture:t.capture,emitStep:l=>{d||m.emit("step",l)},emitResult:st,reportCaptureIssue:q,documentInternals:t.document,portraitInternals:t.portrait,livePhotoInternals:t.livePhoto,uploadInternals:t.upload});return y=a,a})),Ae);return{consent:()=>I(),startRegistry:ke,methodChoice:pt,selectMethod:St,reportCameraUnavailable:async n=>{await I();let a=s.reportCameraUnavailable;if(a===void 0)throw new TypeError("this client cannot report a missing camera");let l=await a.call(s,n).catch(g=>{if(g instanceof ie&&g.code==="check_out_of_order")return s.getSession();throw g});d||R(l)},reportCaptureIssue:q,testerGate:async n=>{let a=s.testerGate;if(a===void 0)throw new TypeError("this client cannot run the tester gate");let l=n.clip,g=Te(n.clipMime??"");if(l===void 0||!Ke.includes(g))throw new TypeError("the capture has no clip");await I();let h=await Ge(s,"clip",g,l.size,{engine:n.engine,durationMs:n.clipMs});await s.uploadToSpaces(h.uploadUrl,l,g);let{key:O}=await s.completeMedia(h.key),Y=await a.call(s,{clipKey:O,attestation:await xe(),captureChannel:n.captureChannel,capture:We(n)}),{bound:v,...S}=Y;return d||(S.plan!==void 0?R(S):await x()),{bound:v===!0}},mobileRequired:mt,captureMode:ft,chooseCaptureMode:n=>{B=n},get captureChoice(){return G()},returning:ht,liveness:ve,run:async()=>{if(d)throw new Error("verification destroyed");return(await yt()).run()},currentStep:()=>y?.current()??null,voiceClips:async()=>{if(d)return null;try{let n=await _();return d?null:n.voice??null}catch{return null}},on:(n,a)=>m.on(n,a),destroy:()=>{d=!0,C.abort(),y?.destroy(),k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null),m.clear()}}}var Ze=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var vt=["carte_identite","passport","residence_permit"];function At(e,t){let o=e.byIssuer?.[t]??e.default;return vt.filter(r=>o==="*"||o.includes(r))}function Pn(e,t=Ze){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(r=>At(e,r).length>0).sort()}function $e(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function bn(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var Je=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",sandbox_nni_not_seeded:"sandbox_id_number_not_seeded",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),It=new Map(Object.entries(Je)),xn=new Map(Object.entries(Je).map(([e,t])=>[t,e]));function Qe(e){return It.get(e)??e}var Tn=["national_number","document_photo","national_eid"],Mt=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","portrait","face_match","aml_screening","face_dedup","age_estimation"]),wt=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ae=["document","population_registry","national_eid"],ce=["phone_otp","email_otp"],et={identity_method:ae,contact:ce},Et=["population_registry","document"],ue="platform_unsupported",Tt=new Set(["prefilled","user_entered","prefilled_or_entered"]),Vt={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function M(e){return e.section??Vt[e.checkType]??null}function Dt(e,t){let o=e.plan?.choice;if(o===void 0||o.locked)return;let r=o.options.find(i=>i.id!==o.selected&&i.available!==!1&&t.includes(i.service));return r===void 0?void 0:{nodeId:o.nodeId,option:r}}function de(e){let t=e.plan,o=t?.choice;if(t===void 0||o===void 0||o.locked||t.current===null||t.current===o.nodeId||P(e))return null;let r=et[o.kind]??[...ae,...ce],i=o.options.flatMap(c=>c.available===!1||!r.includes(c.service)?[]:[c.nationalEid!=null?{id:c.id,service:c.service,nationalEid:c.nationalEid}:{id:c.id,service:c.service}]),s=t.steps.find(c=>c.id===t.current)?.service,u=o.selected??i.find(c=>c.service===s)?.id??null;return i.some(c=>c.id!==u)?{nodeId:o.nodeId,kind:o.kind,current:u,options:i}:null}function tt(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function Lt(e){let t=e.simulation;if(typeof t!="object"||t===null)return;let{otpCode:o,skipCapture:r}=t;return typeof o=="string"&&o!==""&&typeof r=="boolean"?{otpCode:o,skipCapture:r}:void 0}function Nt(e){let t=(e.plan?.sections??[]).map(u=>({id:u.id,state:u.state})),o={sessionId:re(e.sessionId),orgName:e.orgName,sandbox:e.sandbox===!0,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(u=>u.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(o.branding=e.branding),e.cameraUnavailableHandled===!0&&(o.cameraUnavailableHandled=!0);let r=Lt(e);r!==void 0&&(o.simulation=r);let i=e.testerGate;i?.offered===!0&&typeof i.attemptsLeft=="number"&&i.attemptsLeft>0&&(o.testerGate={attemptsLeft:i.attemptsLeft});let s=de(e);return s!==null&&(o.switchable=s),o}function Ht(e){let t={attemptsRemaining:j(e),attemptsExhausted:e.attempts.used>=e.attempts.max};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var nt={phone_otp:"phone",email_otp:"email"};function Ut(e,t){let o=Dt(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return o===void 0?void 0:nt[o.option.service]}function Ft(e,t,o,r){let i=t.checkType==="email_otp",s=(i?t.emailOtp:t.otp)??{},u=i?t.emailOtp?.emailSource:t.otp?.numberSource,c=u!==void 0&&Tt.has(u)?u:i?"prefilled_or_entered":"user_entered",p=typeof s.sentToMasked=="string"&&s.sentToMasked.length>0,m=s.prefilled===!0,y=Ut(e,i?"email_otp":"phone_otp"),b={key:t.checkType,context:o,section:M(t),phase:p?"verify":"send",canSwitch:y!==void 0,...r},d=i?{kind:"email_otp",...b,emailSource:c,needsEmail:c!=="prefilled"&&!m}:{kind:"phone_otp",...b,numberSource:c,needsPhone:c!=="prefilled"&&!m,channels:(t.otp?.channels??[]).filter(C=>C==="whatsapp"||C==="sms")};if(y!==void 0&&(d.switchChannel=y),m&&(d.prefilled=!0),p&&(d.sentToMasked=s.sentToMasked),!i&&t.otp?.channel!==void 0&&(d.channel=t.otp.channel),!i&&Array.isArray(t.phoneCountries)&&(d.phoneCountries=t.phoneCountries.filter(C=>typeof C=="string"&&/^[A-Z]{2}$/.test(C))),!i&&Array.isArray(t.phoneRules)){let C=d.phoneCountries??[];d.phoneRules=t.phoneRules.flatMap(f=>{let w=Kt(f);return w!==void 0&&C.includes(w.code)?[w]:[]})}return!i&&t.phoneInternational===!0&&(d.phoneInternational=!0),s.expiresAt!==void 0&&(d.codeExpiresAt=s.expiresAt),s.resendAvailableAt!==void 0&&(d.resendAvailableAt=s.resendAvailableAt),d}var Bt=/^[\d[\]\-|()?:^]{1,64}$/;function Gt(e){try{return typeof e=="string"&&Bt.test(e)&&new RegExp(e)!==null}catch{return!1}}var Xe=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function Kt(e){let{code:t,dial:o,trunk:r,lengths:i,formats:s}=e??{};if(typeof t!="string"||typeof o!="string"||!/^\d{1,3}$/.test(o)||r!==void 0&&(typeof r!="string"||!/^\d{1,3}$/.test(r))||!Array.isArray(i)||i.length===0||!i.every(Xe))return;let u={code:t,dial:o,lengths:[...i].sort((c,p)=>c-p)};if(r!==void 0&&(u.trunk=r),s!==void 0){if(!(Array.isArray(s)&&s.length<=8&&s.every(p=>Gt(p?.leading)&&Array.isArray(p.groups)&&p.groups.every(Xe)&&i.includes(p.groups.reduce((m,y)=>m+y,0)))))return;u.formats=s.map(p=>({leading:p.leading,groups:[...p.groups]}))}return u}function qt(e,t,o,r){let i=J(e)===!0?"bound":F(t)===!0?"document":"typed",s=i==="typed"&&t.state==="input_required"&&t.reason!==void 0&&Qe(t.reason)==="id_number_recheck",u=tt(de(e)),c=!r.attemptsExhausted&&u.length===1&&u[0]?.service==="document";return{kind:"registry",key:"registry",context:o,section:M(t),state:t.state==="input_required"?"input_required":"pending",source:i,recheck:s,canUseDocument:c,...r}}function Yt(e,t,o,r,i){let s=[...t.acceptedSides??[]],u={kind:"document",key:"document",context:o,section:M(t),side:s.includes("recto")?"verso":"recto",acceptedSides:s,documents:$e(e),photo:it(ot(e.documents),i),...r};return e.detectedCountry!==void 0&&(u.detectedCountry=e.detectedCountry),Wt(e)&&(u.ageStepUp=!0),u}function ot(e,t=!0){let o=e?.source==="upload"||e?.source==="choice"?e.source:"camera",r=e?.sourcePick==="camera"||e?.sourcePick==="upload"?e.sourcePick:null;return{source:o,pick:r,uploadOffered:t&&e?.uploadOffered===!0}}function it(e,t){return t?{...e,cameraOnPhone:!0}:e}function Wt(e){let t=W(e).find(r=>r.checkType==="age_estimation"),o=t?.reason;return t?.state==="failed"&&(o==="age_uncertain"||o==="age_unavailable")}function jt(e){let t=A(e,"liveness");return t?.state==="passed"||t?.state==="review"}function ze(e,t,o,r,i,s=!1){let u=t.icao?.report,c=e.portrait,p=i==="capture"?c?.pendingFix??null:null;p!==null&&(i="review");let m=rt(e);return{kind:"portrait",key:`portrait:${i}`,context:o,section:M(t),phase:i,report:Array.isArray(u)?u:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:$(e),retakeOnly:i==="capture"&&t.state==="input_required"&&m===void 0&&e.capture?.livePhoto?.oneCapture===!0&&jt(e),photo:it(ot(c,i==="capture"),s&&i==="capture"),pendingFix:p,...m!==void 0?{captureMode:m}:{},...c?.reuse?.pending===!0?{reuse:!0}:{},...r}}function rt(e){let t=e.portrait?.captureMode;return t==="self"||t==="assisted"||t==="choice"?t:void 0}var se={minLongSidePx:1280,jpegQuality:.95};function Zt(e,t){let o=e.capture?.livePhoto;if(o?.oneCapture!==!0)return null;let r=A(e,"portrait_icao"),i=o.still??se;return{icao:t==="liveness"&&$(e)!==null&&rt(e)===void 0&&r!==void 0&&r.state==="pending"&&r.reason===void 0,still:{minLongSidePx:i.minLongSidePx??se.minLongSidePx,jpegQuality:i.jpegQuality??se.jpegQuality}}}function $t(e,t,o,r){let i=t.eid,s=M(t);if(i===void 0||i.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:o,section:s,checkType:"eid_auth",reason:"update_required"};let u=tt(de(e)),c=u.length===1&&Et.includes(u[0]?.service??"")?u[0]:void 0,p=c===void 0?void 0:N[c.service],m=p!==void 0,y={kind:"eid",key:"eid",context:o,section:s,provider:i.provider,providerName:i.providerName,country:i.country,challenge:"app_code",phase:i.awaiting==="code"?"code":"identifier",identifierBound:i.identifierBound===!0,canUseCamera:m,afterPass:i.afterPass==="continue"?"continue":"end",...r};return m&&(y.cameraMethod=p),i.expiresAt!==void 0&&(y.codeExpiresAt=i.expiresAt),i.resendAvailableAt!==void 0&&(y.resendAvailableAt=i.resendAvailableAt),i.resendsRemaining!==void 0&&(y.resendsRemaining=i.resendsRemaining),i.codeAttemptsRemaining!==void 0&&(y.codeAttemptsRemaining=i.codeAttemptsRemaining),y}function Jt(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let o=A(e,"portrait_icao");return o!==void 0&&(o.state==="passed"||o.state==="review")?o:null}var Qt={rejected:"rejected",inconclusive:"inconclusive",unavailable:"unavailable",abandoned:"expired",not_opened:"expired",cancelled:"expired",superseded:"expired",policy:"policy"};function Xt(e){return e.reasonCode===ue?"platform_unsupported":e.status==="review_pending"?"review":e.status==="verified"?"verified":e.reasonCode==="device_cooldown"?"cooldown":e.reasonCode==="starter_credit_claimed"?"policy":(e.status==="not_verified"&&e.reason!==void 0?Qt[e.reason]:void 0)??"rejected"}function zt(e,t){let o=Xt(e),r=o==="platform_unsupported"?{sessionId:re(e.sessionId),status:"unavailable",reasonCode:ue}:H(e,{autoRetry:!1}),i={kind:"result",key:"result",context:t,section:null,display:o,result:r};return e.status==="not_verified"&&e.reason!==void 0&&(i.reason=e.reason),e.reasonCode!==void 0&&(i.reasonCode=e.reasonCode),e.status==="not_verified"&&e.step!==void 0&&(i.step=e.step),e.retryAfter!==void 0&&(i.retryAfter=e.retryAfter),i}function en(e,t,o){let r=e.identitySummary;if(r==null)return null;let i={kind:"identity_summary",key:"identity_summary",context:t,section:o??"identity",summaryKind:r.kind==="partial"?"partial":r.kind??"full",source:r.source,portraitAvailable:r.portrait?.available===!0,retakeAvailable:r.retakeAvailable===!0};for(let u of tn){let c=r[u];typeof c=="string"&&c!==""&&(i[u]=c)}let s=je(r);return s!==void 0&&(i.idNumberMasked=s,i.nniMasked=s),i}var tn=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function D(e,t,o,r){return{kind:"unsupported",key:`unsupported:${o}`,context:e,section:t,checkType:o,reason:r}}function nn(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function on(e,t){let o=et[e.kind]??[...ae,...ce],r=nn(e),i=e.options.flatMap(u=>{if(u.available===!1||!o.includes(u.service))return[];let c={id:u.id,service:u.service};u.nationalEid!=null&&(c.nationalEid=u.nationalEid);let p=(u.channels??[]).filter(m=>m==="whatsapp"||m==="sms");return u.service==="phone_otp"&&p.length>0&&(c.channels=p),[c]});if(i.length===0){let u=e.options.length>0&&e.options.every(c=>c.service==="nfc");return D(t,r,"choice",u?"platform_unsupported":"update_required")}let s={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:i};if(e.kind==="identity_method"){let u={kind:"method",key:"method",context:t,section:r,options:i.map(p=>N[p.service]),choice:s},c=i.find(p=>p.nationalEid!==void 0)?.nationalEid;return c!==void 0&&(u.nationalEid=c),u}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:r,options:i.map(u=>nt[u.service]),selected:null,locked:!1,choice:s}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:r,choice:s}}function Vn(e,t={}){let o=Nt(e);if(P(e)||e.reasonCode===ue)return zt(e,o);let r=e.plan;if(r===void 0||!Array.isArray(r.sections))return D(o,null,"plan","update_required");let i=He(e);if(i!==null)return on(i,o);let s=r.current===null?void 0:r.steps.find(d=>d.id===r.current),u=d=>{let C={kind:"processing",key:"processing",context:o,section:d!==void 0?M(d):r.sections.find(f=>f.state==="current")?.id??null,stalled:!1};return typeof d?.service=="string"&&d.service!==""&&(C.service=d.service),C};if(r.current===null)return u(r.steps.find(d=>d.state==="processing"));if(s===void 0)return D(o,null,"step","update_required");if(!Mt.has(s.service))return s.interaction==="server"?u(s):D(o,M(s),s.service,"update_required");if(wt.has(s.service)||!Ue(s))return u(s);let c=s,p=Ht(c),m=c.checkType,y=M(c),b=t.isMobile===!1?U(e,c):null;if(b==="phone")return{kind:"mobile_required",key:"mobile_required",context:o,section:y,checkType:m};switch(m){case"phone_otp":case"email_otp":return Ft(e,c,o,p);case"population_registry":return qt(e,c,o,p);case"eid_auth":return $t(e,c,o,p);case"doc_ocr":return Yt(e,c,o,p,b==="upload_or_phone");case"identity_confirm":return en(e,o,y)??u(c);case"portrait_icao":return ze(e,c,o,p,"capture",b==="upload_or_phone");case"liveness":case"face_match":{let d=Jt(e,c);if(d!==null)return ze(e,d,o,p,"match");let C=c.requiresMobile===!0,f=$(e);return{kind:"liveness",key:"biometric",context:o,section:y,mode:m==="face_match"?"selfie":"liveness",requiresMobile:C,instructions:f===null?"standard":"icao",icao:f,livePhoto:Zt(e,m),...p}}case"nfc_chip":return D(o,y,m,"platform_unsupported");default:return D(o,y,m,"update_required")}}export{Ct as a,_t as b,Pt as c,bt as d,xt as e,gn as f,Ot as g,Ze as h,vt as i,At as j,Pn as k,$e as l,bn as m,Tn as n,ue as o,M as p,de as q,tt as r,Jt as s,Vn as t};
@@ -1 +0,0 @@
1
- import{A as _e,D as x,E as j,d as K,e as he,f as Se,g as ge,i as ye,j as ee,l as q,m as te,o as be,p as Ce,t as Pe}from"./chunk-X6UIO5E3.js";import{c as pe,d as me,e as fe}from"./chunk-FPXL63KZ.js";import{c as F,h as Q,i as ke}from"./chunk-JWEHH2MS.js";var Re=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var We=["carte_identite","passport","residence_permit"];function qe(e,t){let i=e.byIssuer?.[t]??e.default;return We.filter(a=>i==="*"||i.includes(a))}function Yt(e,t=Re){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(a=>qe(e,a).length>0).sort()}function Me(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}var Qe=640,$e=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),Ee=6,Ae=1500,Ie={sharpness:1,exposure:1,meanLuma:128},ve=null;function Je(e,t){try{ve??(ve=document.createElement("canvas"));let i=ve,a=96/Math.max(1,t.width);i.width=Math.max(1,Math.round(t.width*a)),i.height=Math.max(1,Math.round(t.height*a));let r=i.getContext("2d");if(r===null)return Ie;r.drawImage(e,t.x,t.y,t.width,t.height,0,0,i.width,i.height);let u=r.getImageData(0,0,i.width,i.height);return{sharpness:me(u),exposure:fe(u),meanLuma:pe(u)}}catch{return Ie}}async function ze(e,t){let i=e.source;return"convertToBlob"in i?i.convertToBlob({type:"image/jpeg",quality:t}):new Promise((a,r)=>{i.toBlob(u=>u===null?r(new Error("encode failed")):a(u),"image/jpeg",t)})}function $t(e,t={}){let i=t.now??(()=>performance.now()),a=t.setTimer??((m,C)=>setTimeout(m,C)),r=t.clearTimer??(m=>clearTimeout(m)),u=t.encode??ze,l=t.quality??Je,c=e.tuningVersion??null,p=new Set,S=!1,y=e.video??null,E=null,f=t.grabFrame??null,b=null,v=1e3/Ee,A=null,I=null,T=!1,N=!1,D=Number.NEGATIVE_INFINITY,M=null,G=0,L=null,B=null,J=Promise.all([import("./icao-gate-T3BTOKFJ.js"),import("./icao-tuning-4ETMF53W.js"),import("./create-portrait-capture-5VGYZUOK.js"),import("./landmarker-KB7LVXAU.js"),import("./background-monitor-A7FKJOAG.js")]).then(async([m,C,R,w,O])=>{let k=C.resolveIcaoTuning(e.tuning,e.tuningVersion??void 0);k.background.required&&(I=O.createBackgroundMonitor({tuning:k.backgroundCheck,assetBaseUrl:e.assetBaseUrl??"/models-v3",...t.createSegmenter!==void 0?{createSegmenter:t.createSegmenter}:{},now:i})),E=m.createIcaoGate(k,{policy:e.policy??"reject"}),f??(f=R.defaultGrabber()),b=R.observe,v=1e3/Math.min(Ee,k.cadenceHz);let n=(t.createLandmarker??w.createFaceLandmarker)(e.assetBaseUrl??"/models-v3"),o=await new Promise((s,d)=>{let h=setTimeout(()=>{d(new Error("landmarker init timeout")),n.then(g=>g.close(),()=>{})},w.LANDMARKER_INIT_TIMEOUT_MS);n.then(g=>{clearTimeout(h),s(g)},g=>{clearTimeout(h),d(g)})});S?o.close():A=o}).catch(()=>{T=!0}),H=m=>{for(let C of p)C({holding:N||T,update:m})},Y=()=>{if(M=null,!(S||A===null||E===null||f===null||b===null||y===null)){if(i()-D>Ae){H(null);return}try{let m=f(y,Qe);if(m!==null){let C=Math.max(i(),G+1);G=C;let R=A.detect(m.source,C),w=y.videoWidth||m.width,O=y.videoHeight||m.height,k=b(R,m,w,O);k.geometry!==null&&I!==null&&(k.backgroundCheck=I.measure(m,k.geometry.box,w,O));let n=E.push(k,i());N=n.ready,H(n)}}catch{}M=a(Y,v)}},Z=()=>{let m=i()-D>Ae;D=i(),m&&(E?.reset(),N=!1,L=null,B=null),M===null&&A!==null&&!S&&(M=a(Y,0))},z=()=>{let m=f===null||y===null?null:f(y,null);if(m===null||E===null||Math.max(m.width,m.height)<e.still.minLongSidePx)return Promise.resolve(null);let C=E.summary();return u(m,e.still.jpegQuality).then(R=>({image:R,width:m.width,height:m.height,gate:C}),()=>null)},W=null;return{engineOptions:{measureQuality:(m,C)=>{y=m,Z();let R=l(m,C);return N||T?R:{...R,sharpness:0}},telemetry:m=>{if(m.type!=="fired"||S)return;L=z();let C=W;C!==null&&L.then(R=>R===null?void 0:C(R).catch(()=>{})),N=!1,M!==null&&r(M),M=null,D=Number.NEGATIVE_INFINITY}},decorate:m=>{let C=new WeakMap,R=new Map,w=o=>{let s=C.get(o);return s===void 0&&(s=(async()=>{let d=await Pe(m,"image","image/jpeg",o.image.size,{engine:"portrait"});return await m.uploadToSpaces(d.uploadUrl,o.image,"image/jpeg"),(await m.completeMedia(d.key)).key})(),s.catch(()=>C.delete(o)),C.set(o,s)),s};W=w;let O=async o=>{let s;try{s=await w(o)}catch(d){let h=d?.code;if(typeof h=="string"&&$e.has(h))throw d;return null}return{media:{portrait:s},gate:ke(o.gate),...c!==null?{tuningVersion:c}:{}}},k=m.submitCheck.bind(m),n=(async(o,s,d)=>{if(o!=="liveness")return k(o,s,d);let h=d?.idempotencyKey,g=h===void 0?void 0:R.get(h);if(g===void 0){let de=L;g=de===null?Promise.resolve(null):de.then(le=>le===null?null:O(le)),h!==void 0&&(R.set(h,g),g.catch(()=>R.delete(h)))}let P=await g;if(P===null)return k("liveness",s,d);let _=await k("liveness",{...s,portraitIcao:P},d);return B=P,_});return new Proxy(m,{get(o,s){if(s==="submitCheck")return n;let d=Reflect.get(o,s);return typeof d=="function"?d.bind(o):d}})},onGate:m=>(p.add(m),()=>p.delete(m)),lastPortraitInput:()=>B,destroy:()=>{S=!0,L=null,B=null,M!==null&&r(M),M=null,p.clear(),J.then(()=>{A?.close(),A=null,I?.close(),I=null})}}}function Te(e){return e.idNumberBound??e.nniBound}function Oe(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function we(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var xe=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",sandbox_nni_not_seeded:"sandbox_id_number_not_seeded",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),Xe=new Map(Object.entries(xe)),Xt=new Map(Object.entries(xe).map(([e,t])=>[t,e]));function Ne(e){return Xe.get(e)??e}var et=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","portrait","face_match","aml_screening","face_dedup","age_estimation"]),tt=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ie=["document","population_registry","national_eid"],oe=["phone_otp","email_otp"],De={identity_method:ie,contact:oe},nt=["population_registry","document"],re="platform_unsupported",it=new Set(["prefilled","user_entered","prefilled_or_entered"]),ot={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function V(e){return e.section??ot[e.checkType]??null}function se(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let a=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return a===void 0?void 0:{nodeId:i.nodeId,option:a}}function ae(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||ee(e))return null;let a=De[i.kind]??[...ie,...oe],r=i.options.flatMap(c=>c.available===!1||!a.includes(c.service)?[]:[c.nationalEid!=null?{id:c.id,service:c.service,nationalEid:c.nationalEid}:{id:c.id,service:c.service}]),u=t.steps.find(c=>c.id===t.current)?.service,l=i.selected??r.find(c=>c.service===u)?.id??null;return r.some(c=>c.id!==l)?{nodeId:i.nodeId,kind:i.kind,current:l,options:r}:null}function He(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function rt(e){let t=e.simulation;if(typeof t!="object"||t===null)return;let{otpCode:i,skipCapture:a}=t;return typeof i=="string"&&i!==""&&typeof a=="boolean"?{otpCode:i,skipCapture:a}:void 0}function st(e){let t=(e.plan?.sections??[]).map(l=>({id:l.id,state:l.state})),i={sessionId:te(e.sessionId),orgName:e.orgName,sandbox:e.sandbox===!0,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(l=>l.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(i.branding=e.branding),e.cameraUnavailableHandled===!0&&(i.cameraUnavailableHandled=!0);let a=rt(e);a!==void 0&&(i.simulation=a);let r=e.testerGate;r?.offered===!0&&typeof r.attemptsLeft=="number"&&r.attemptsLeft>0&&(i.testerGate={attemptsLeft:r.attemptsLeft});let u=ae(e);return u!==null&&(i.switchable=u),i}function at(e){let t={attemptsRemaining:Se(e),attemptsExhausted:e.attempts.used>=e.attempts.max};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var Ge={phone_otp:"phone",email_otp:"email"};function ct(e,t){let i=se(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:Ge[i.option.service]}function ut(e,t,i,a){let r=t.checkType==="email_otp",u=(r?t.emailOtp:t.otp)??{},l=r?t.emailOtp?.emailSource:t.otp?.numberSource,c=l!==void 0&&it.has(l)?l:r?"prefilled_or_entered":"user_entered",p=typeof u.sentToMasked=="string"&&u.sentToMasked.length>0,S=u.prefilled===!0,y=ct(e,r?"email_otp":"phone_otp"),E={key:t.checkType,context:i,section:V(t),phase:p?"verify":"send",canSwitch:y!==void 0,...a},f=r?{kind:"email_otp",...E,emailSource:c,needsEmail:c!=="prefilled"&&!S}:{kind:"phone_otp",...E,numberSource:c,needsPhone:c!=="prefilled"&&!S,channels:(t.otp?.channels??[]).filter(b=>b==="whatsapp"||b==="sms")};if(y!==void 0&&(f.switchChannel=y),S&&(f.prefilled=!0),p&&(f.sentToMasked=u.sentToMasked),!r&&t.otp?.channel!==void 0&&(f.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(f.phoneCountries=t.phoneCountries.filter(b=>typeof b=="string"&&/^[A-Z]{2}$/.test(b))),!r&&Array.isArray(t.phoneRules)){let b=f.phoneCountries??[];f.phoneRules=t.phoneRules.flatMap(v=>{let A=pt(v);return A!==void 0&&b.includes(A.code)?[A]:[]})}return!r&&t.phoneInternational===!0&&(f.phoneInternational=!0),u.expiresAt!==void 0&&(f.codeExpiresAt=u.expiresAt),u.resendAvailableAt!==void 0&&(f.resendAvailableAt=u.resendAvailableAt),f}var dt=/^[\d[\]\-|()?:^]{1,64}$/;function lt(e){try{return typeof e=="string"&&dt.test(e)&&new RegExp(e)!==null}catch{return!1}}var Le=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function pt(e){let{code:t,dial:i,trunk:a,lengths:r,formats:u}=e??{};if(typeof t!="string"||typeof i!="string"||!/^\d{1,3}$/.test(i)||a!==void 0&&(typeof a!="string"||!/^\d{1,3}$/.test(a))||!Array.isArray(r)||r.length===0||!r.every(Le))return;let l={code:t,dial:i,lengths:[...r].sort((c,p)=>c-p)};if(a!==void 0&&(l.trunk=a),u!==void 0){if(!(Array.isArray(u)&&u.length<=8&&u.every(p=>lt(p?.leading)&&Array.isArray(p.groups)&&p.groups.every(Le)&&r.includes(p.groups.reduce((S,y)=>S+y,0)))))return;l.formats=u.map(p=>({leading:p.leading,groups:[...p.groups]}))}return l}function mt(e,t,i,a){let r=Te(e)===!0?"bound":Oe(t)===!0?"document":"typed",u=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&Ne(t.reason)==="id_number_recheck",l=He(ae(e)),c=!a.attemptsExhausted&&l.length===1&&l[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:V(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:u,canUseDocument:c,...a}}function ft(e,t,i,a,r){let u=[...t.acceptedSides??[]],l={kind:"document",key:"document",context:i,section:V(t),side:u.includes("recto")?"verso":"recto",acceptedSides:u,documents:Me(e),photo:Ue(Be(e.documents),r),...a};return e.detectedCountry!==void 0&&(l.detectedCountry=e.detectedCountry),ht(e)&&(l.ageStepUp=!0),l}function Be(e,t=!0){let i=e?.source==="upload"||e?.source==="choice"?e.source:"camera",a=e?.sourcePick==="camera"||e?.sourcePick==="upload"?e.sourcePick:null;return{source:i,pick:a,uploadOffered:t&&e?.uploadOffered===!0}}function Ue(e,t){return t?{...e,cameraOnPhone:!0}:e}function ht(e){let t=he(e).find(a=>a.checkType==="age_estimation"),i=t?.reason;return t?.state==="failed"&&(i==="age_uncertain"||i==="age_unavailable")}function St(e){let t=q(e,"liveness");return t?.state==="passed"||t?.state==="review"}function Ve(e,t,i,a,r,u=!1){let l=t.icao?.report,c=e.portrait,p=r==="capture"?c?.pendingFix??null:null;p!==null&&(r="review");let S=Fe(e);return{kind:"portrait",key:`portrait:${r}`,context:i,section:V(t),phase:r,report:Array.isArray(l)?l:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:Q(e),retakeOnly:r==="capture"&&t.state==="input_required"&&S===void 0&&e.capture?.livePhoto?.oneCapture===!0&&St(e),photo:Ue(Be(c,r==="capture"),u&&r==="capture"),pendingFix:p,...S!==void 0?{captureMode:S}:{},...c?.reuse?.pending===!0?{reuse:!0}:{},...a}}function Fe(e){let t=e.portrait?.captureMode;return t==="self"||t==="assisted"||t==="choice"?t:void 0}var ne={minLongSidePx:1280,jpegQuality:.95};function gt(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let a=q(e,"portrait_icao"),r=i.still??ne;return{icao:t==="liveness"&&Q(e)!==null&&Fe(e)===void 0&&a!==void 0&&a.state==="pending"&&a.reason===void 0,still:{minLongSidePx:r.minLongSidePx??ne.minLongSidePx,jpegQuality:r.jpegQuality??ne.jpegQuality}}}function yt(e,t,i,a){let r=t.eid,u=V(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:u,checkType:"eid_auth",reason:"update_required"};let l=He(ae(e)),c=l.length===1&&nt.includes(l[0]?.service??"")?l[0]:void 0,p=c===void 0?void 0:K[c.service],S=p!==void 0,y={kind:"eid",key:"eid",context:i,section:u,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:S,afterPass:r.afterPass==="continue"?"continue":"end",...a};return S&&(y.cameraMethod=p),r.expiresAt!==void 0&&(y.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(y.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(y.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(y.codeAttemptsRemaining=r.codeAttemptsRemaining),y}function bt(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=q(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}var Ct={rejected:"rejected",inconclusive:"inconclusive",unavailable:"unavailable",abandoned:"expired",not_opened:"expired",cancelled:"expired",superseded:"expired",policy:"policy"};function Pt(e){return e.reasonCode===re?"platform_unsupported":e.status==="review_pending"?"review":e.status==="verified"?"verified":e.reasonCode==="device_cooldown"?"cooldown":e.reasonCode==="starter_credit_claimed"?"policy":(e.status==="not_verified"&&e.reason!==void 0?Ct[e.reason]:void 0)??"rejected"}function _t(e,t){let i=Pt(e),a=i==="platform_unsupported"?{sessionId:te(e.sessionId),status:"unavailable",reasonCode:re}:be(e,{autoRetry:!1}),r={kind:"result",key:"result",context:t,section:null,display:i,result:a};return e.status==="not_verified"&&e.reason!==void 0&&(r.reason=e.reason),e.reasonCode!==void 0&&(r.reasonCode=e.reasonCode),e.status==="not_verified"&&e.step!==void 0&&(r.step=e.step),e.retryAfter!==void 0&&(r.retryAfter=e.retryAfter),r}function kt(e,t,i){let a=e.identitySummary;if(a==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:a.kind==="partial"?"partial":a.kind??"full",source:a.source,portraitAvailable:a.portrait?.available===!0,retakeAvailable:a.retakeAvailable===!0};for(let l of Rt){let c=a[l];typeof c=="string"&&c!==""&&(r[l]=c)}let u=we(a);return u!==void 0&&(r.idNumberMasked=u,r.nniMasked=u),r}var Rt=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function U(e,t,i,a){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:a}}function Mt(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function Et(e,t){let i=De[e.kind]??[...ie,...oe],a=Mt(e),r=e.options.flatMap(l=>{if(l.available===!1||!i.includes(l.service))return[];let c={id:l.id,service:l.service};l.nationalEid!=null&&(c.nationalEid=l.nationalEid);let p=(l.channels??[]).filter(S=>S==="whatsapp"||S==="sms");return l.service==="phone_otp"&&p.length>0&&(c.channels=p),[c]});if(r.length===0){let l=e.options.length>0&&e.options.every(c=>c.service==="nfc");return U(t,a,"choice",l?"platform_unsupported":"update_required")}let u={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let l={kind:"method",key:"method",context:t,section:a,options:r.map(p=>K[p.service]),choice:u},c=r.find(p=>p.nationalEid!==void 0)?.nationalEid;return c!==void 0&&(l.nationalEid=c),l}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:a,options:r.map(l=>Ge[l.service]),selected:null,locked:!1,choice:u}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:a,choice:u}}function $(e,t={}){let i=st(e);if(ee(e)||e.reasonCode===re)return _t(e,i);let a=e.plan;if(a===void 0||!Array.isArray(a.sections))return U(i,null,"plan","update_required");let r=ge(e);if(r!==null)return Et(r,i);let u=a.current===null?void 0:a.steps.find(f=>f.id===a.current),l=f=>{let b={kind:"processing",key:"processing",context:i,section:f!==void 0?V(f):a.sections.find(v=>v.state==="current")?.id??null,stalled:!1};return typeof f?.service=="string"&&f.service!==""&&(b.service=f.service),b};if(a.current===null)return l(a.steps.find(f=>f.state==="processing"));if(u===void 0)return U(i,null,"step","update_required");if(!et.has(u.service))return u.interaction==="server"?l(u):U(i,V(u),u.service,"update_required");if(tt.has(u.service)||!ye(u))return l(u);let c=u,p=at(c),S=c.checkType,y=V(c),E=t.isMobile===!1?Ce(e,c):null;if(E==="phone")return{kind:"mobile_required",key:"mobile_required",context:i,section:y,checkType:S};switch(S){case"phone_otp":case"email_otp":return ut(e,c,i,p);case"population_registry":return mt(e,c,i,p);case"eid_auth":return yt(e,c,i,p);case"doc_ocr":return ft(e,c,i,p,E==="upload_or_phone");case"identity_confirm":return kt(e,i,y)??l(c);case"portrait_icao":return Ve(e,c,i,p,"capture",E==="upload_or_phone");case"liveness":case"face_match":{let f=bt(e,c);if(f!==null)return Ve(e,f,i,p,"match");let b=c.requiresMobile===!0,v=Q(e);return{kind:"liveness",key:"biometric",context:i,section:y,mode:S==="face_match"?"selfie":"liveness",requiresMobile:b,instructions:v===null?"standard":"icao",icao:v,livePhoto:gt(e,S),...p}}case"nfc_chip":return U(i,y,S,"platform_unsupported");default:return U(i,y,S,"update_required")}}var At=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,It=Object.freeze({normalize:e=>e.trim().toUpperCase().replace(/\s+/g," "),check:e=>At.test(e),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"});function vt(e){return typeof e=="string"&&/^\d{10}$/.test(e)&&Number(e)%97===1}var Tt=Object.freeze({normalize:e=>e.trim(),check:e=>vt(e),registrySources:Object.freeze(["MR.anrpts"]),describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}),Ot=Object.freeze({"MR:national_id":Tt});function ce(e,t){return Ot[`${e.toUpperCase()}:${t}`]??It}var wt=Object.freeze({MRT:"MR"});function Ke(e,t){let i=e.trim().toUpperCase();return ce(wt[i]??i,t)}function je(e){let t=Ke(e.issuingCountry,e.type);return t.check(t.normalize(e.number))}function Ye(e){return ce("MR","national_id").check(e)}function ue(e){let t="";for(let i of e){let a=i.codePointAt(0)??0;a>=1632&&a<=1641?t+=String(a-1632):a>=1776&&a<=1785?t+=String(a-1776):i!==" "&&i!=="-"&&i!==" "&&(t+=i)}return t}var xt=[1e3,2e3,4e3,8e3,15e3],Nt=3e4,Lt=/^\+[1-9]\d{6,14}$/,Vt=/^\d{6}$/,Dt=/^\d{6}$/,Ht=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ze=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","identity_confirm_locked","choice_locked","choice_option_unavailable","choice_not_found","step_not_on_path","check_not_active"]),Gt={simulatedCapture:!0},Bt=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]);function yn(e){let t=!1,i=null,a="",r=!1,u=!1,l=!1,c={},p={},S=new Set,y=!1,E=!1,f=null,b="idle",v=new Map,A=new Map,I=(n,o,s)=>{let d=`${n}.${o}`,h=v.get(d);if(h!==void 0)return h;let g=A.get(n),P=(g===void 0?s():g.then(s)).finally(()=>{v.delete(d)});v.set(d,P);let _=P.then(()=>{},()=>{});return A.set(n,_),_.then(()=>{A.get(n)===_&&A.delete(n)}),P},T=async(n,o,s)=>{await e.ensureConsent();let d;try{d=await _e(e.runtime,o)}catch(g){if(g instanceof F&&Ze.has(g.code)){await e.refreshView();return}throw g}if(s?.(d),e.destroyed())return;let h=d;h.plan!==void 0&&e.setView!==void 0?e.setView(h):await e.refreshView()},N=async n=>{await e.ensureConsent();let o;try{try{o=await n(e.runtime.client)}catch(s){if(!(s instanceof F)||s.code!=="consent_required")throw s;await e.runtime.ensureConsent({force:!0}),o=await n(e.runtime.client)}}catch(s){if(s instanceof F&&Ze.has(s.code)){await e.refreshView();return}throw s}e.destroyed()||(o!==void 0&&e.setView!==void 0?e.setView(o):await e.refreshView())},D=(n,o)=>I("choice",`${n}:${o}`,()=>N(s=>s.choose(n,o))),M=(n,o)=>n.options.some(s=>s.id===o)?D(n.nodeId,o):Promise.reject(new RangeError(`option ${String(o)} is not offered`)),G=(n,o)=>{let s=e.currentView(),d=s===null?void 0:se(s,n);return d===void 0?Promise.reject(new RangeError(`the ${o} is not offered`)):D(d.nodeId,d.option.id)},L=n=>I("identity",n,()=>N(o=>o.confirmIdentity===void 0?Promise.reject(new Error("identity confirmation is not available in this build")):o.confirmIdentity(n))),B=(n,o)=>{let s=n.kind,d=s==="phone_otp",h=d?"phone":"email",g={action:"send"};if(d?n.needsPhone:n.needsEmail){let P=o[h]??p[s],_=d?P?.replace(/[\s().-]/g,""):P?.trim();if(_!==void 0||n.phase!=="verify"){if(_===void 0||!(d?Lt:Ht).test(_))return Promise.reject(d?new x("phone","format"):new j("email","format"));g[h]=_}}if(d){let P=n.channels,_=o.channel??(P.length===1?P[0]:void 0);if(P.length>0){if(_===void 0)return Promise.reject(new j("channel","required"));if(!P.includes(_))return Promise.reject(new j("channel","unavailable"))}_!==void 0&&(g.channel=_),g.phoneRules=1}return I(s,"send",()=>T(s,(P,_)=>P.submitCheck(s,g,{idempotencyKey:_}),P=>{Ft(P,s)||(c[s]=e.now(),g[h]!==void 0&&(p[s]=g[h]))}))},J=(n,o)=>Vt.test(o)?I(n,"verify",()=>T(n,(s,d)=>s.submitCheck(n,{action:"verify",code:o},{idempotencyKey:d}))):Promise.reject(new x("code","format")),H=(n,o)=>I("eid_auth",n,()=>T("eid_auth",(s,d)=>s.submitCheck("eid_auth",o,{idempotencyKey:d}))),Y=(n,o)=>{if(n.identifierBound)return H("start",{action:"start"});let s=ue(o??"");if(n.country==="MR"){if(!/^\d{10}$/.test(s))return Promise.reject(new x("nni","format"));if(!Ye(s))return Promise.reject(new x("nni","check_digit"))}else if(s==="")return Promise.reject(new x("nni","format"));return H("start",{action:"start",identifier:s})},Z=(n,o,s)=>{if(n.source!=="typed")return Promise.reject(new RangeError("this session already holds the ID number"));let d=ue(o);return/^\d{10}$/.test(d)?je({type:"national_id",issuingCountry:"MR",number:d})?I("population_registry","submitIdNumber",()=>T("population_registry",(h,g)=>h.submitCheck("population_registry",{idNumber:d,nni:d},{idempotencyKey:g}),()=>{f=`\u2022\u2022\u2022\u2022\u2022\u2022${d.slice(-4)}`})):Promise.reject(new x(s,"check_digit")):Promise.reject(new x(s,"format"))},z=n=>(e.stopCameras?.(),I(n,"skipCapture",()=>T(n,(o,s)=>o.submitCheck(n,Gt,{idempotencyKey:s}),()=>{(n==="liveness"||n==="portrait_icao")&&(y=!0)}))),W=n=>{if(n.kind==="result"||n.context.simulation?.skipCapture!==!0)return n;let o=Ut(n);return o===null?n:{...n,skipCapture:()=>z(o)}},X=n=>((n.kind==="document"||n.kind==="portrait")&&n.photo?.cameraOnPhone===!0&&(n.refresh=async()=>{await e.refreshView()}),n),m=n=>{switch(n.kind){case"phone_otp":case"email_otp":{let o={...n,send:(d={})=>B(n,d),verify:d=>J(n.kind,d),switchTo:()=>n.canSwitch&&n.switchChannel!==void 0?G([n.switchChannel==="email"?"email_otp":"phone_otp"],"other contact option"):Promise.reject(new RangeError("this session has no other contact option"))},s=c[n.kind];return o.resendAvailableAt===void 0&&s!==void 0&&(o.resendAvailableAt=new Date(s+Nt).toISOString()),o}case"eid":return{...n,start:o=>Y(n,o),verify:o=>Dt.test(o)?H("verify",{action:"verify",code:o}):Promise.reject(new x("code","format")),resend:()=>n.resendsRemaining===0?Promise.reject(new RangeError("no new code can be sent for this session")):H("resend",{action:"resend"}),useCamera:()=>n.canUseCamera&&n.cameraMethod!==void 0?G(n.cameraMethod==="document_photo"?["document"]:["population_registry"],"camera path"):Promise.reject(new RangeError("the camera path is not offered"))};case"method":return{...n,select:o=>{let s=n.choice.options.find(d=>K[d.service]===o);return s!==void 0?M(n.choice,s.id):Promise.reject(new RangeError(`method ${String(o)} is not offered`))},choose:o=>M(n.choice,o)};case"choice":return{...n,choose:o=>M(n.choice,o)};case"registry":return{...n,submitIdNumber:o=>Z(n,o,"idNumber"),submitNni:o=>Z(n,o,"nni"),confirm:()=>I("population_registry","confirm",()=>T("population_registry",(o,s)=>o.submitCheck("population_registry",{},{idempotencyKey:s}))),useDocument:()=>n.canUseDocument?G(["document"],"document method"):Promise.reject(new RangeError("the document method is not offered"))};case"document":return e.bindDocument!==void 0?X(e.bindDocument(n,k)):{...n,issuer:null,documentType:null,captureSide:null,selectDocument:()=>{throw new Error("document capture is not available in this build")},capture:()=>{throw new Error("document capture is not available in this build")},uploadDocument:()=>Promise.reject(new Error("document upload is not available in this build"))};case"portrait":return e.bindPortrait!==void 0?X(e.bindPortrait(n,k)):{...n,uploadFailed:!1,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("portrait capture is not available in this build")},uploadPortrait:()=>Promise.reject(new Error("portrait upload is not available in this build")),confirmFix:()=>Promise.reject(new Error("portrait review is not available in this build"))};case"contact_choice":return{...n,select:o=>{let s=o==="phone"?"phone_otp":o==="email"?"email_otp":void 0,d=n.choice.options.find(h=>h.service===s);return d!==void 0?M(n.choice,d.id):Promise.reject(new RangeError(`contact ${String(o)} is not offered`))},choose:o=>M(n.choice,o)};case"identity_summary":return{...n,...n.idNumberMasked===void 0&&n.summaryKind==="partial"&&f!==null?{idNumberMasked:f,nniMasked:f}:{},portrait:async()=>{let o=e.runtime.client;if(!n.portraitAvailable||o.identityPortrait===void 0)return null;try{return await o.identityPortrait()}catch{return null}},confirm:()=>L("confirm"),retake:()=>n.retakeAvailable?L("retake"):Promise.reject(new RangeError("no retake is left"))};case"liveness":return{...n,capture:o=>e.liveness(o),onLivePhoto:o=>n.livePhoto?.icao===!0&&e.onLivePhoto!==void 0?e.onLivePhoto(o):()=>{}};case"mobile_required":case"processing":return{...n,refresh:async()=>{r=!1,await e.refreshView()}};case"unsupported":case"result":return{...n};default:{let o=n;throw new Error(`runner: unhandled step ${JSON.stringify(o)}`)}}},C=n=>W(m(n)),R=async()=>{if(!u){u=!0;try{for(let n of xt){if(await e.sleep(n),!t||e.destroyed())return;let o=await e.refreshView().catch(()=>null);if(o!==null&&$(o,{isMobile:e.isMobile()}).kind!=="processing")return}r=!0,k()}finally{u=!1}}},w=n=>{if(n.kind!=="liveness"||n.mode!=="selfie")return null;let o={kind:"processing",key:"processing",context:n.context,section:n.section,stalled:!1};if(b==="inflight")return o;if(!E||b==="done")return null;let s=e.keptFaceKey?.()??null;return s===null?null:(b="inflight",T("face_match",(d,h)=>d.submitCheck("face_match",{imageKey:s},{idempotencyKey:h}),()=>{b="done"}).then(()=>{b==="inflight"&&(b="done",k())},()=>{b="done",k()}),o)},O=(n,o=!1)=>{if(!t||e.destroyed()||e.chainBusy())return;let s=$(n,{isMobile:e.isMobile()});s.kind==="registry"&&s.recheck&&(E=!0,b="idle"),s=w(s)??s,s.kind==="processing"?s.stalled=r:r=!1;let d=C(s),h=s.kind==="result"?void 0:s.context.switchable,g=h===void 0?d:{...d,chooseOption:_=>M({nodeId:h.nodeId,kind:h.kind,selected:h.current,options:h.options},_)},P=JSON.stringify(g);s.kind==="registry"&&s.source==="document"&&s.state==="pending"&&!S.has("registry")&&(S.add("registry"),g.confirm().catch(_=>{(!(_ instanceof F)||Bt.has(_.code))&&S.delete("registry")})),!(!o&&P===a)&&(a=P,i=g,e.emitStep(g),s.kind==="processing"&&!r&&b!=="inflight"&&R(),s.kind==="result"&&!l&&(l=!0,e.emitResult(s.result)))};function k(){let n=e.currentView();n!==null&&O(n,!0)}return{run:async()=>{if(e.destroyed())throw new Error("verification destroyed");t=!0;let n=await e.ensureView();return i===null&&O(n),i??C($(n,{isMobile:e.isMobile()}))},current:()=>i,onView:n=>O(n),onChainIdle:()=>{let n=e.currentView();n!==null&&O(n)},republish:k,submit:T,faceProbeSkipped:()=>y}}function Ut(e){switch(e.kind){case"document":return"doc_ocr";case"liveness":return e.mode==="selfie"?"face_match":"liveness";case"portrait":return e.phase==="capture"?"portrait_icao":null;case"mobile_required":return e.checkType;case"unsupported":return e.checkType==="nfc_chip"?"nfc_chip":null;default:return null}}function Ft(e,t){let i=e,a=i?.plan?.steps??i?.steps;return Array.isArray(a)?a.some(r=>r.checkType===t&&typeof r.reason=="string"):!1}export{qe as a,Yt as b,Ee as c,Ae as d,$t as e,Fe as f,$ as g,xt as h,Nt as i,yn as j};