@sekyro/web 0.1.0-rc.8 → 0.1.0-rc.9

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 (39) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +54 -61
  3. package/dist/{capture-session-doc-YBE3UMJJ.js → capture-session-doc-QQHDBZG4.js} +1 -1
  4. package/dist/{chunk-YPG7CB4O.js → chunk-4Q7EMVP7.js} +1 -1
  5. package/dist/{chunk-RNRFHUJA.js → chunk-56GT33O3.js} +1 -1
  6. package/dist/{chunk-DQWW4OCK.js → chunk-EVVGQSNJ.js} +1 -1
  7. package/dist/chunk-F5ST423J.js +1 -0
  8. package/dist/chunk-GBTZIKGZ.js +1 -0
  9. package/dist/chunk-H6HC7B77.js +1 -0
  10. package/dist/{chunk-LQ7C44JG.js → chunk-LUHNRNTO.js} +1 -1
  11. package/dist/{chunk-RVHAKRAI.js → chunk-WRKUWIJW.js} +1 -1
  12. package/dist/chunk-ZUHTYCY4.js +1 -0
  13. package/dist/client/index.cjs +1 -1
  14. package/dist/client/index.d.cts +26 -4
  15. package/dist/client/index.d.ts +26 -4
  16. package/dist/client/index.js +1 -1
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.js +1 -1
  19. package/dist/create-document-capture-DWRNFXA2.js +1 -0
  20. package/dist/{create-verification-DoFpgzok.d.cts → create-verification-BS2qbe75.d.cts} +101 -16
  21. package/dist/{create-verification-C0AVIcVW.d.ts → create-verification-CCR-CwVQ.d.ts} +101 -16
  22. package/dist/{icao-gate-D8qm1O2t.d.cts → icao-gate-DKbWXP51.d.cts} +104 -39
  23. package/dist/{icao-gate-D8qm1O2t.d.ts → icao-gate-DKbWXP51.d.ts} +104 -39
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.cts +4 -4
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +1 -1
  28. package/dist/internal/index.cjs +1 -1
  29. package/dist/internal/index.d.cts +11 -20
  30. package/dist/internal/index.d.ts +11 -20
  31. package/dist/internal/index.js +1 -1
  32. package/dist/{plan-runner-UBK4B4CG.js → plan-runner-X4YW3INX.js} +1 -1
  33. package/package.json +1 -1
  34. package/sbom.cdx.json +7 -7
  35. package/dist/chunk-4RS2YIL4.js +0 -1
  36. package/dist/chunk-MY6EXEL2.js +0 -1
  37. package/dist/chunk-XLN5OT25.js +0 -1
  38. package/dist/chunk-YDQBVWXG.js +0 -1
  39. package/dist/create-document-capture-T4APHJMY.js +0 -1
@@ -1,8 +1,8 @@
1
- import { aR as DocCatalogEntry, aS as LiveMrzTuning, aT as TextLockTuning, aU as OcrEngineClient, aV as DocAssistReport, aW as ReadyInfo, aX as LoadFailure, aY as OcrEngineOptions, aZ as SubmitRuntime, Z as LivenessCaptureOptions, Y as LivenessCaptureHandle, aD as VerificationStep, aB as VerificationResult, as as StepSnapshot, U as LivePhotoGateUpdate, a_ as HostedClientLike } from '../create-verification-DoFpgzok.cjs';
2
- export { a$ as ANALYSIS_LONG_EDGE, b0 as ASPECT_BANDS, b1 as AttestationError, b2 as BLUR_REFUSE_SHARPNESS_MAX, b3 as BlurStatus, b4 as CAPTURE_CANDIDATE_SPACING_MS, b5 as CAPTURE_EXTRA_CANDIDATES, b6 as CLIP_MIME_ALLOWLIST, b7 as CaptureEngine, b8 as CaptureSessionDoc, b9 as CaptureSessionDocEvents, ba as CaptureSessionDocOptions, bb as DOC_ANALYSIS_DEFAULTS, bc as DOC_CADENCE_HZ, bd as DOC_CAMERA_TUNING_DEFAULTS, be as DOC_CATALOG, bf as DOC_DETECT_WIDTH, bg as DOC_FEEDBACK_STATES, bh as DOC_GATE_V1_DEFAULTS, bi as DOC_SHUTTER_DEFAULTS, bj as DeviceReadHint, bk as DocArtifacts, bl as DocAssist, bm as DocAssistEngine, bn as DocAssistTick, bo as DocCameraTuning, bp as DocCaptureReport, bq as DocCaptureVia, br as DocChecksPayload, bs as DocEngineLike, bt as DocFeedbackAggregator, bu as DocFeedbackKey, bv as DocFeedbackState, bw as DocFormat, bx as DocFrameAnalysis, by as DocFrameMeasures, bz as DocGateQuality, bA as DocGateThresholds, bB as DocGateTick, bC as DocGateTickInput, bD as DocGateV1, bE as DocQuad, bF as DocQuadPoint, bG as DocShutterReason, bH as DocShutterTuning, bI as DocSide, bJ as DocumentCaptureController, bK as DocumentCaptureInternals, bL as EMPTY_GUIDE_METRICS, bM as EncodedDocument, bN as FLIP_FILL_MIN, bO as FLIP_GAP_MS, bP as FLIP_TIMEOUT_MS, bQ as FocusCaps, bR as FramingStatus, bS as GUIDE_LOCK_DEFAULTS, bT as GlareStatus, bU as GrabbedFrame, bV as GuideBlocker, bW as GuideLock, bX as GuideLockTick, bY as GuideLockTuning, bZ as GuideMetrics, b_ as GuideRect, b$ as INFERENCE_RETRY_ATTEMPTS, c0 as INFERENCE_RETRY_DEFAULT_S, R as ISSUER_CODES, c1 as LANDMARKER_MODEL, c2 as LENS_STORAGE_KEY, c3 as LENS_TRY_MAX, c4 as LIVE_MRZ_DEFAULTS, c5 as LIVE_PHOTO_IDLE_MS, c6 as LIVE_PHOTO_MAX_HZ, c7 as LandmarkedFace, c8 as LandmarkerLike, c9 as LensKind, ca as LensSource, cb as LightingStatus, cc as LiveMrzCapture, cd as LiveMrzState, ce as LivePhotoGate, cf as LivePhotoKit, cg as LivePhotoKitInternals, ch as LivePhotoKitOptions, ci as LivePhotoStill, cj as LivenessCaptureInternalHandle, ck as LivenessCaptureInternals, cl as LivenessFlowDeps, cm as LivenessFlowOutcome, cn as MANUAL_SHUTTER_MS, co as MR_DOC_CATALOG, cp as NO_REPORT_MS, cq as OpenDocCameraDeps, cr as PORTRAIT_JPEG_QUALITY, cs as PRELOAD_BLAZE_INIT_TIMEOUT_MS, ct as PRELOAD_BUDGET_MS, cu as PROCESSING_POLL_DELAY_MS, cv as PROCESSING_POLL_MAX, cw as PortraitCaptureController, cx as PortraitCaptureInternals, cy as REGISTRY_RETRY_DELAY_MS, cz as ReticleType, cA as SAME_FACE_MAX_DROPS, cB as ScanEvent, cC as ScanLayout, cD as ScanNotice, cE as ScanPhase, cF as ScanReport, cG as ScanSide, cH as ScanState, cI as SubmitExecutor, cJ as TEXT_LOCK_DEFAULTS, cK as TRANSPORT_REPLAY_ATTEMPTS, cL as TRANSPORT_REPLAY_DELAY_MS, cM as VerificationInternals, cN as analyzeDocFrame, cO as analyzeGuide, cP as aspectBand, cQ as aspectFits, cR as buildDeviceReadHint, cS as coverPointToVideo, cT as createDocumentCaptureInternal, cU as createFaceLandmarker, cV as createLivePhotoKit, cW as createLivenessCaptureInternal, cX as createPortraitCaptureInternal, cY as createVerificationInternal, cZ as docZoomFor, c_ as encodeDocumentImage, c$ as facesOf, d0 as feedbackVoteOf, d1 as focusOk, d2 as guideQuad, d3 as guideRegionInFrame, d4 as initialScanState, d5 as lensKindOf, d6 as mapEngineState, d7 as mapErrorKind, d8 as mapGuidanceHint, d9 as nextScanState, da as observePortraitFrame, db as openDocCamera, dc as passportBandOf, dd as portraitMatchStep, de as preloadedDetectorFactory, df as quadAreaFrac, dg as quadBounds, dh as quadIou, di as quadTiltRatio, dj as randomUuid, dk as rankBackCameras, dl as readStoredLens, dm as resetLivenessAssetsForTests, dn as resolveDocCameraTuning, dp as resolveDocShutterTuning, dq as resolveGuideLockTuning, dr as runLivenessFlow, ds as runSubmission, dt as scannerFormatFor, du as setPreloadLoaderForTests, dv as settledHint, dw as singleShotFocusAt, dx as specularFraction, dy as supportsFocusMode, dz as warmDocDetector, dA as writeStoredLens } from '../create-verification-DoFpgzok.cjs';
1
+ import { aY as DocCatalogEntry, aZ as LiveMrzTuning, a_ as TextLockTuning, a$ as OcrEngineClient, b0 as DocAssistReport, b1 as ReadyInfo, b2 as LoadFailure, b3 as OcrEngineOptions, b4 as SubmitRuntime, a1 as LivenessCaptureOptions, a0 as LivenessCaptureHandle, aI as VerificationStep, aG as VerificationResult, ax as StepSnapshot, Y as LivePhotoGateUpdate, b5 as HostedClientLike } from '../create-verification-BS2qbe75.cjs';
2
+ export { b6 as ANALYSIS_LONG_EDGE, b7 as ASPECT_BANDS, b8 as AttestationError, b9 as BLUR_REFUSE_SHARPNESS_MAX, ba as BlurStatus, bb as CAPTURE_CANDIDATE_SPACING_MS, bc as CAPTURE_EXTRA_CANDIDATES, bd as CLIP_MIME_ALLOWLIST, be as CaptureEngine, bf as CaptureSessionDoc, bg as CaptureSessionDocEvents, bh as CaptureSessionDocOptions, bi as DOC_ANALYSIS_DEFAULTS, bj as DOC_CADENCE_HZ, bk as DOC_CAMERA_TUNING_DEFAULTS, bl as DOC_CATALOG, bm as DOC_DETECT_WIDTH, bn as DOC_FEEDBACK_STATES, bo as DOC_GATE_V1_DEFAULTS, bp as DOC_SHUTTER_DEFAULTS, bq as DeviceReadHint, br as DocArtifacts, bs as DocAssist, bt as DocAssistEngine, bu as DocAssistTick, bv as DocCameraTuning, bw as DocCaptureReport, bx as DocCaptureVia, by as DocChecksPayload, bz as DocEngineLike, bA as DocFeedbackAggregator, bB as DocFeedbackKey, bC as DocFeedbackState, bD as DocFormat, bE as DocFrameAnalysis, bF as DocFrameMeasures, bG as DocGateQuality, bH as DocGateThresholds, bI as DocGateTick, bJ as DocGateTickInput, bK as DocGateV1, bL as DocQuad, bM as DocQuadPoint, bN as DocShutterReason, bO as DocShutterTuning, bP as DocSide, bQ as DocumentCaptureController, bR as DocumentCaptureInternals, bS as EMPTY_GUIDE_METRICS, bT as EncodedDocument, bU as FLIP_FILL_MIN, bV as FLIP_GAP_MS, bW as FLIP_TIMEOUT_MS, bX as FocusCaps, bY as FramingStatus, bZ as GUIDE_LOCK_DEFAULTS, b_ as GlareStatus, b$ as GrabbedFrame, c0 as GuideBlocker, c1 as GuideLock, c2 as GuideLockTick, c3 as GuideLockTuning, c4 as GuideMetrics, c5 as GuideRect, c6 as INFERENCE_RETRY_ATTEMPTS, c7 as INFERENCE_RETRY_DEFAULT_S, U as ISSUER_CODES, c8 as LANDMARKER_MODEL, c9 as LENS_STORAGE_KEY, ca as LENS_TRY_MAX, cb as LIVE_MRZ_DEFAULTS, cc as LIVE_PHOTO_IDLE_MS, cd as LIVE_PHOTO_MAX_HZ, ce as LandmarkedFace, cf as LandmarkerLike, cg as LensKind, ch as LensSource, ci as LightingStatus, cj as LiveMrzCapture, ck as LiveMrzState, cl as LivePhotoGate, cm as LivePhotoKit, cn as LivePhotoKitInternals, co as LivePhotoKitOptions, cp as LivePhotoStill, cq as LivenessCaptureInternalHandle, cr as LivenessCaptureInternals, cs as LivenessFlowDeps, ct as LivenessFlowOutcome, cu as MANUAL_SHUTTER_MS, cv as MR_DOC_CATALOG, cw as NO_REPORT_MS, cx as OpenDocCameraDeps, cy as PORTRAIT_JPEG_QUALITY, cz as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cA as PRELOAD_BUDGET_MS, cB as PROCESSING_POLL_DELAY_MS, cC as PROCESSING_POLL_MAX, cD as PortraitCaptureController, cE as PortraitCaptureInternals, cF as REGISTRY_RETRY_DELAY_MS, cG as ReticleType, cH as SAME_FACE_MAX_DROPS, cI as ScanEvent, cJ as ScanLayout, cK as ScanNotice, cL as ScanPhase, cM as ScanReport, cN as ScanSide, cO as ScanState, cP as SubmitExecutor, cQ as TEXT_LOCK_DEFAULTS, cR as TRANSPORT_REPLAY_ATTEMPTS, cS as TRANSPORT_REPLAY_DELAY_MS, cT as VerificationInternals, cU as analyzeDocFrame, cV as analyzeGuide, cW as aspectBand, cX as aspectFits, cY as buildDeviceReadHint, cZ as coverPointToVideo, c_ as createDocumentCaptureInternal, c$ as createFaceLandmarker, d0 as createLivePhotoKit, d1 as createLivenessCaptureInternal, d2 as createPortraitCaptureInternal, d3 as createVerificationInternal, d4 as docZoomFor, d5 as encodeDocumentImage, d6 as facesOf, d7 as feedbackVoteOf, d8 as focusOk, d9 as guideQuad, da as guideRegionInFrame, db as initialScanState, dc as lensKindOf, dd as mapEngineState, de as mapErrorKind, df as mapGuidanceHint, dg as nextScanState, dh as observePortraitFrame, di as openDocCamera, dj as passportBandOf, dk as portraitMatchStep, dl as preloadedDetectorFactory, dm as quadAreaFrac, dn as quadBounds, dp as quadIou, dq as quadTiltRatio, dr as randomUuid, ds as rankBackCameras, dt as readStoredLens, du as resetLivenessAssetsForTests, dv as resolveDocCameraTuning, dw as resolveDocShutterTuning, dx as resolveGuideLockTuning, dy as runLivenessFlow, dz as runSubmission, dA as scannerFormatFor, dB as setPreloadLoaderForTests, dC as settledHint, dD as singleShotFocusAt, dE as specularFraction, dF as supportsFocusMode, dG as warmDocDetector, dH as writeStoredLens } from '../create-verification-BS2qbe75.cjs';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, I as IN_CIRCLE_FACTOR, d as detectIsMobile } from '../capture-constraints-BujkZcfb.cjs';
4
- import { w as HostedSessionView, P as IdentityMethod, b as CheckType, a6 as SessionView, C as CheckReason, x as HostedStepView } from '../icao-gate-D8qm1O2t.cjs';
5
- export { a7 as BackgroundStats, a8 as Box, a9 as CLIPPED_LUMA, aa as FaceGeometry, ab as FaceLighting, H as HeadPose, ac as ICAO_CANVAS, ad as ICAO_FALLBACK, ae as ICAO_GATE_CRITERIA, af as ICAO_SHARP_REF, I as IcaoCaptureTuning, B as IcaoCoachKey, J as IcaoCriterionState, ag as IcaoFrameObservation, ah as IcaoGate, K as IcaoGateCriterion, ai as IcaoGateOptions, L as IcaoGateSummary, M as IcaoGateUpdate, aj as IcaoJudgedCriterion, ak as IcaoMeasures, al as IcaoPixelStats, am as IcaoProfile, an as LumaPlane, ao as Point, ap as RegionStats, aq as ResolvedIcaoTuning, ar as backgroundStats, as as createIcaoGate, at as eyeLineRoll, au as eyeOpenness, av as eyeSpecular, aw as faceGeometry, ax as faceLighting, ay as faceSharpness, az as icaoPixelStats, aA as icaoWindow, aB as judgeIcao, aC as lumaPlane, aD as percentile, aE as portraitCropRegion, aF as poseFromMatrix, aG as regionStats, aH as resolveIcaoTuning, aI as scoreFrame, aJ as windowOverflow } from '../icao-gate-D8qm1O2t.cjs';
4
+ import { z as HostedSessionView, b as CheckType, C as CheckReason, a6 as PlanStepView } from '../icao-gate-DKbWXP51.cjs';
5
+ export { af as BackgroundStats, ag as Box, ah as CLIPPED_LUMA, ai as FaceGeometry, aj as FaceLighting, H as HeadPose, ak as ICAO_CANVAS, al as ICAO_FALLBACK, am as ICAO_GATE_CRITERIA, an as ICAO_SHARP_REF, J as IcaoCaptureTuning, K as IcaoCoachKey, M as IcaoCriterionState, ao as IcaoFrameObservation, ap as IcaoGate, N as IcaoGateCriterion, aq as IcaoGateOptions, O as IcaoGateSummary, P as IcaoGateUpdate, ar as IcaoJudgedCriterion, as as IcaoMeasures, at as IcaoPixelStats, au as IcaoProfile, av as LumaPlane, aw as Point, ax as RegionStats, ay as ResolvedIcaoTuning, az as backgroundStats, aA as createIcaoGate, aB as eyeLineRoll, aC as eyeOpenness, aD as eyeSpecular, aE as faceGeometry, aF as faceLighting, aG as faceSharpness, aH as icaoPixelStats, aI as icaoWindow, aJ as judgeIcao, aK as lumaPlane, aL as percentile, aM as portraitCropRegion, aN as poseFromMatrix, aO as regionStats, aP as resolveIcaoTuning, aQ as scoreFrame, aR as windowOverflow } from '../icao-gate-DKbWXP51.cjs';
6
6
  import '../detect-worker-DclNxkZT.cjs';
7
7
  import '../capture-session-v3-Dvob-uH2.cjs';
8
8
 
@@ -260,14 +260,13 @@ declare const OCR_ASSET_SET: {
260
260
  declare const PROCESSING_BACKOFF_MS: readonly number[];
261
261
  /** Hosted parity: a resend is offered 30 s after the last send. */
262
262
  declare const OTP_RESEND_COOLDOWN_MS = 30000;
263
- type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<SessionView>;
263
+ type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
264
264
  interface RunnerDeps {
265
265
  runtime: SubmitRuntime;
266
266
  currentView(): HostedSessionView | null;
267
267
  ensureView(): Promise<HostedSessionView>;
268
268
  refreshView(): Promise<HostedSessionView>;
269
269
  ensureConsent(): Promise<void>;
270
- selectMethod(method: IdentityMethod): Promise<void>;
271
270
  liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
272
271
  /** A liveness submission chain is in flight (do not flip the UI mid-upload). */
273
272
  chainBusy(): boolean;
@@ -318,21 +317,13 @@ declare function createStepRunner(deps: RunnerDeps): StepRunner;
318
317
  */
319
318
  declare const RETRYABLE_REASONS: ReadonlySet<CheckReason>;
320
319
  /** A check the browser may still submit. */
321
- declare function isExecutable(step: HostedStepView | undefined): boolean;
320
+ declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
322
321
  /** The session accepts no further submissions. */
323
322
  declare function isTerminalView(view: Pick<HostedSessionView, "status">): boolean;
324
- /** First step in `steps[]` order with state `pending | input_required` (the backend's frontier). */
325
- declare function frontierStep(view: HostedSessionView): HostedStepView | undefined;
326
- declare function stepOf(view: HostedSessionView, checkType: CheckType): HostedStepView | undefined;
327
- /**
328
- * Fold a submit response (partner `SessionView`: no attemptsRemaining) into the
329
- * hosted view: status/outcome/step states+reasons come from the response; the
330
- * submitted check's `attemptsRemaining` is decremented locally, as is a match
331
- * executed decisively by a liveness bundle (one attempt per executed check).
332
- * Same-key transport replays are resolved before this merge is called.
333
- * This keeps the happy path free of extra `GET /hosted/session` round-trips.
334
- */
335
- declare function mergeSessionView(prev: HostedSessionView, next: SessionView, submitted: CheckType): HostedSessionView;
323
+ /** The step `plan.current` names while it can still be submitted (the backend's frontier). */
324
+ declare function frontierStep(view: HostedSessionView): PlanStepView | undefined;
325
+ /** The plan step of a check type (check types are unique on a session's path). */
326
+ declare function stepOf(view: HostedSessionView, checkType: CheckType): PlanStepView | undefined;
336
327
  /**
337
328
  * Map the session view to the public result:
338
329
  * - `completed/approved → approved`, `completed/review` or `review_pending → review`,
@@ -468,4 +459,4 @@ declare function measureRegionSharpness(image: RawImage, region: StillRegion | n
468
459
  */
469
460
  declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
470
461
 
471
- export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, type ExecuteTurnstileOptions, HostedClientLike, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, RETRYABLE_REASONS, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TURNSTILE_EXECUTE_TIMEOUT_MS, TURNSTILE_SCRIPT_SRC, TextLockTuning, type TurnstileApi, type TurnstileRenderParams, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, executeTurnstile, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, liveMrzWireReport, loadTurnstile, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, mergeSessionView, photoSharpness, resetTurnstileForTests, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
462
+ export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, type ExecuteTurnstileOptions, HostedClientLike, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, RETRYABLE_REASONS, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TURNSTILE_EXECUTE_TIMEOUT_MS, TURNSTILE_SCRIPT_SRC, TextLockTuning, type TurnstileApi, type TurnstileRenderParams, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, executeTurnstile, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, liveMrzWireReport, loadTurnstile, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, photoSharpness, resetTurnstileForTests, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
@@ -1,8 +1,8 @@
1
- import { aR as DocCatalogEntry, aS as LiveMrzTuning, aT as TextLockTuning, aU as OcrEngineClient, aV as DocAssistReport, aW as ReadyInfo, aX as LoadFailure, aY as OcrEngineOptions, aZ as SubmitRuntime, Z as LivenessCaptureOptions, Y as LivenessCaptureHandle, aD as VerificationStep, aB as VerificationResult, as as StepSnapshot, U as LivePhotoGateUpdate, a_ as HostedClientLike } from '../create-verification-C0AVIcVW.js';
2
- export { a$ as ANALYSIS_LONG_EDGE, b0 as ASPECT_BANDS, b1 as AttestationError, b2 as BLUR_REFUSE_SHARPNESS_MAX, b3 as BlurStatus, b4 as CAPTURE_CANDIDATE_SPACING_MS, b5 as CAPTURE_EXTRA_CANDIDATES, b6 as CLIP_MIME_ALLOWLIST, b7 as CaptureEngine, b8 as CaptureSessionDoc, b9 as CaptureSessionDocEvents, ba as CaptureSessionDocOptions, bb as DOC_ANALYSIS_DEFAULTS, bc as DOC_CADENCE_HZ, bd as DOC_CAMERA_TUNING_DEFAULTS, be as DOC_CATALOG, bf as DOC_DETECT_WIDTH, bg as DOC_FEEDBACK_STATES, bh as DOC_GATE_V1_DEFAULTS, bi as DOC_SHUTTER_DEFAULTS, bj as DeviceReadHint, bk as DocArtifacts, bl as DocAssist, bm as DocAssistEngine, bn as DocAssistTick, bo as DocCameraTuning, bp as DocCaptureReport, bq as DocCaptureVia, br as DocChecksPayload, bs as DocEngineLike, bt as DocFeedbackAggregator, bu as DocFeedbackKey, bv as DocFeedbackState, bw as DocFormat, bx as DocFrameAnalysis, by as DocFrameMeasures, bz as DocGateQuality, bA as DocGateThresholds, bB as DocGateTick, bC as DocGateTickInput, bD as DocGateV1, bE as DocQuad, bF as DocQuadPoint, bG as DocShutterReason, bH as DocShutterTuning, bI as DocSide, bJ as DocumentCaptureController, bK as DocumentCaptureInternals, bL as EMPTY_GUIDE_METRICS, bM as EncodedDocument, bN as FLIP_FILL_MIN, bO as FLIP_GAP_MS, bP as FLIP_TIMEOUT_MS, bQ as FocusCaps, bR as FramingStatus, bS as GUIDE_LOCK_DEFAULTS, bT as GlareStatus, bU as GrabbedFrame, bV as GuideBlocker, bW as GuideLock, bX as GuideLockTick, bY as GuideLockTuning, bZ as GuideMetrics, b_ as GuideRect, b$ as INFERENCE_RETRY_ATTEMPTS, c0 as INFERENCE_RETRY_DEFAULT_S, R as ISSUER_CODES, c1 as LANDMARKER_MODEL, c2 as LENS_STORAGE_KEY, c3 as LENS_TRY_MAX, c4 as LIVE_MRZ_DEFAULTS, c5 as LIVE_PHOTO_IDLE_MS, c6 as LIVE_PHOTO_MAX_HZ, c7 as LandmarkedFace, c8 as LandmarkerLike, c9 as LensKind, ca as LensSource, cb as LightingStatus, cc as LiveMrzCapture, cd as LiveMrzState, ce as LivePhotoGate, cf as LivePhotoKit, cg as LivePhotoKitInternals, ch as LivePhotoKitOptions, ci as LivePhotoStill, cj as LivenessCaptureInternalHandle, ck as LivenessCaptureInternals, cl as LivenessFlowDeps, cm as LivenessFlowOutcome, cn as MANUAL_SHUTTER_MS, co as MR_DOC_CATALOG, cp as NO_REPORT_MS, cq as OpenDocCameraDeps, cr as PORTRAIT_JPEG_QUALITY, cs as PRELOAD_BLAZE_INIT_TIMEOUT_MS, ct as PRELOAD_BUDGET_MS, cu as PROCESSING_POLL_DELAY_MS, cv as PROCESSING_POLL_MAX, cw as PortraitCaptureController, cx as PortraitCaptureInternals, cy as REGISTRY_RETRY_DELAY_MS, cz as ReticleType, cA as SAME_FACE_MAX_DROPS, cB as ScanEvent, cC as ScanLayout, cD as ScanNotice, cE as ScanPhase, cF as ScanReport, cG as ScanSide, cH as ScanState, cI as SubmitExecutor, cJ as TEXT_LOCK_DEFAULTS, cK as TRANSPORT_REPLAY_ATTEMPTS, cL as TRANSPORT_REPLAY_DELAY_MS, cM as VerificationInternals, cN as analyzeDocFrame, cO as analyzeGuide, cP as aspectBand, cQ as aspectFits, cR as buildDeviceReadHint, cS as coverPointToVideo, cT as createDocumentCaptureInternal, cU as createFaceLandmarker, cV as createLivePhotoKit, cW as createLivenessCaptureInternal, cX as createPortraitCaptureInternal, cY as createVerificationInternal, cZ as docZoomFor, c_ as encodeDocumentImage, c$ as facesOf, d0 as feedbackVoteOf, d1 as focusOk, d2 as guideQuad, d3 as guideRegionInFrame, d4 as initialScanState, d5 as lensKindOf, d6 as mapEngineState, d7 as mapErrorKind, d8 as mapGuidanceHint, d9 as nextScanState, da as observePortraitFrame, db as openDocCamera, dc as passportBandOf, dd as portraitMatchStep, de as preloadedDetectorFactory, df as quadAreaFrac, dg as quadBounds, dh as quadIou, di as quadTiltRatio, dj as randomUuid, dk as rankBackCameras, dl as readStoredLens, dm as resetLivenessAssetsForTests, dn as resolveDocCameraTuning, dp as resolveDocShutterTuning, dq as resolveGuideLockTuning, dr as runLivenessFlow, ds as runSubmission, dt as scannerFormatFor, du as setPreloadLoaderForTests, dv as settledHint, dw as singleShotFocusAt, dx as specularFraction, dy as supportsFocusMode, dz as warmDocDetector, dA as writeStoredLens } from '../create-verification-C0AVIcVW.js';
1
+ import { aY as DocCatalogEntry, aZ as LiveMrzTuning, a_ as TextLockTuning, a$ as OcrEngineClient, b0 as DocAssistReport, b1 as ReadyInfo, b2 as LoadFailure, b3 as OcrEngineOptions, b4 as SubmitRuntime, a1 as LivenessCaptureOptions, a0 as LivenessCaptureHandle, aI as VerificationStep, aG as VerificationResult, ax as StepSnapshot, Y as LivePhotoGateUpdate, b5 as HostedClientLike } from '../create-verification-CCR-CwVQ.js';
2
+ export { b6 as ANALYSIS_LONG_EDGE, b7 as ASPECT_BANDS, b8 as AttestationError, b9 as BLUR_REFUSE_SHARPNESS_MAX, ba as BlurStatus, bb as CAPTURE_CANDIDATE_SPACING_MS, bc as CAPTURE_EXTRA_CANDIDATES, bd as CLIP_MIME_ALLOWLIST, be as CaptureEngine, bf as CaptureSessionDoc, bg as CaptureSessionDocEvents, bh as CaptureSessionDocOptions, bi as DOC_ANALYSIS_DEFAULTS, bj as DOC_CADENCE_HZ, bk as DOC_CAMERA_TUNING_DEFAULTS, bl as DOC_CATALOG, bm as DOC_DETECT_WIDTH, bn as DOC_FEEDBACK_STATES, bo as DOC_GATE_V1_DEFAULTS, bp as DOC_SHUTTER_DEFAULTS, bq as DeviceReadHint, br as DocArtifacts, bs as DocAssist, bt as DocAssistEngine, bu as DocAssistTick, bv as DocCameraTuning, bw as DocCaptureReport, bx as DocCaptureVia, by as DocChecksPayload, bz as DocEngineLike, bA as DocFeedbackAggregator, bB as DocFeedbackKey, bC as DocFeedbackState, bD as DocFormat, bE as DocFrameAnalysis, bF as DocFrameMeasures, bG as DocGateQuality, bH as DocGateThresholds, bI as DocGateTick, bJ as DocGateTickInput, bK as DocGateV1, bL as DocQuad, bM as DocQuadPoint, bN as DocShutterReason, bO as DocShutterTuning, bP as DocSide, bQ as DocumentCaptureController, bR as DocumentCaptureInternals, bS as EMPTY_GUIDE_METRICS, bT as EncodedDocument, bU as FLIP_FILL_MIN, bV as FLIP_GAP_MS, bW as FLIP_TIMEOUT_MS, bX as FocusCaps, bY as FramingStatus, bZ as GUIDE_LOCK_DEFAULTS, b_ as GlareStatus, b$ as GrabbedFrame, c0 as GuideBlocker, c1 as GuideLock, c2 as GuideLockTick, c3 as GuideLockTuning, c4 as GuideMetrics, c5 as GuideRect, c6 as INFERENCE_RETRY_ATTEMPTS, c7 as INFERENCE_RETRY_DEFAULT_S, U as ISSUER_CODES, c8 as LANDMARKER_MODEL, c9 as LENS_STORAGE_KEY, ca as LENS_TRY_MAX, cb as LIVE_MRZ_DEFAULTS, cc as LIVE_PHOTO_IDLE_MS, cd as LIVE_PHOTO_MAX_HZ, ce as LandmarkedFace, cf as LandmarkerLike, cg as LensKind, ch as LensSource, ci as LightingStatus, cj as LiveMrzCapture, ck as LiveMrzState, cl as LivePhotoGate, cm as LivePhotoKit, cn as LivePhotoKitInternals, co as LivePhotoKitOptions, cp as LivePhotoStill, cq as LivenessCaptureInternalHandle, cr as LivenessCaptureInternals, cs as LivenessFlowDeps, ct as LivenessFlowOutcome, cu as MANUAL_SHUTTER_MS, cv as MR_DOC_CATALOG, cw as NO_REPORT_MS, cx as OpenDocCameraDeps, cy as PORTRAIT_JPEG_QUALITY, cz as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cA as PRELOAD_BUDGET_MS, cB as PROCESSING_POLL_DELAY_MS, cC as PROCESSING_POLL_MAX, cD as PortraitCaptureController, cE as PortraitCaptureInternals, cF as REGISTRY_RETRY_DELAY_MS, cG as ReticleType, cH as SAME_FACE_MAX_DROPS, cI as ScanEvent, cJ as ScanLayout, cK as ScanNotice, cL as ScanPhase, cM as ScanReport, cN as ScanSide, cO as ScanState, cP as SubmitExecutor, cQ as TEXT_LOCK_DEFAULTS, cR as TRANSPORT_REPLAY_ATTEMPTS, cS as TRANSPORT_REPLAY_DELAY_MS, cT as VerificationInternals, cU as analyzeDocFrame, cV as analyzeGuide, cW as aspectBand, cX as aspectFits, cY as buildDeviceReadHint, cZ as coverPointToVideo, c_ as createDocumentCaptureInternal, c$ as createFaceLandmarker, d0 as createLivePhotoKit, d1 as createLivenessCaptureInternal, d2 as createPortraitCaptureInternal, d3 as createVerificationInternal, d4 as docZoomFor, d5 as encodeDocumentImage, d6 as facesOf, d7 as feedbackVoteOf, d8 as focusOk, d9 as guideQuad, da as guideRegionInFrame, db as initialScanState, dc as lensKindOf, dd as mapEngineState, de as mapErrorKind, df as mapGuidanceHint, dg as nextScanState, dh as observePortraitFrame, di as openDocCamera, dj as passportBandOf, dk as portraitMatchStep, dl as preloadedDetectorFactory, dm as quadAreaFrac, dn as quadBounds, dp as quadIou, dq as quadTiltRatio, dr as randomUuid, ds as rankBackCameras, dt as readStoredLens, du as resetLivenessAssetsForTests, dv as resolveDocCameraTuning, dw as resolveDocShutterTuning, dx as resolveGuideLockTuning, dy as runLivenessFlow, dz as runSubmission, dA as scannerFormatFor, dB as setPreloadLoaderForTests, dC as settledHint, dD as singleShotFocusAt, dE as specularFraction, dF as supportsFocusMode, dG as warmDocDetector, dH as writeStoredLens } from '../create-verification-CCR-CwVQ.js';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, I as IN_CIRCLE_FACTOR, d as detectIsMobile } from '../capture-constraints-BujkZcfb.js';
4
- import { w as HostedSessionView, P as IdentityMethod, b as CheckType, a6 as SessionView, C as CheckReason, x as HostedStepView } from '../icao-gate-D8qm1O2t.js';
5
- export { a7 as BackgroundStats, a8 as Box, a9 as CLIPPED_LUMA, aa as FaceGeometry, ab as FaceLighting, H as HeadPose, ac as ICAO_CANVAS, ad as ICAO_FALLBACK, ae as ICAO_GATE_CRITERIA, af as ICAO_SHARP_REF, I as IcaoCaptureTuning, B as IcaoCoachKey, J as IcaoCriterionState, ag as IcaoFrameObservation, ah as IcaoGate, K as IcaoGateCriterion, ai as IcaoGateOptions, L as IcaoGateSummary, M as IcaoGateUpdate, aj as IcaoJudgedCriterion, ak as IcaoMeasures, al as IcaoPixelStats, am as IcaoProfile, an as LumaPlane, ao as Point, ap as RegionStats, aq as ResolvedIcaoTuning, ar as backgroundStats, as as createIcaoGate, at as eyeLineRoll, au as eyeOpenness, av as eyeSpecular, aw as faceGeometry, ax as faceLighting, ay as faceSharpness, az as icaoPixelStats, aA as icaoWindow, aB as judgeIcao, aC as lumaPlane, aD as percentile, aE as portraitCropRegion, aF as poseFromMatrix, aG as regionStats, aH as resolveIcaoTuning, aI as scoreFrame, aJ as windowOverflow } from '../icao-gate-D8qm1O2t.js';
4
+ import { z as HostedSessionView, b as CheckType, C as CheckReason, a6 as PlanStepView } from '../icao-gate-DKbWXP51.js';
5
+ export { af as BackgroundStats, ag as Box, ah as CLIPPED_LUMA, ai as FaceGeometry, aj as FaceLighting, H as HeadPose, ak as ICAO_CANVAS, al as ICAO_FALLBACK, am as ICAO_GATE_CRITERIA, an as ICAO_SHARP_REF, J as IcaoCaptureTuning, K as IcaoCoachKey, M as IcaoCriterionState, ao as IcaoFrameObservation, ap as IcaoGate, N as IcaoGateCriterion, aq as IcaoGateOptions, O as IcaoGateSummary, P as IcaoGateUpdate, ar as IcaoJudgedCriterion, as as IcaoMeasures, at as IcaoPixelStats, au as IcaoProfile, av as LumaPlane, aw as Point, ax as RegionStats, ay as ResolvedIcaoTuning, az as backgroundStats, aA as createIcaoGate, aB as eyeLineRoll, aC as eyeOpenness, aD as eyeSpecular, aE as faceGeometry, aF as faceLighting, aG as faceSharpness, aH as icaoPixelStats, aI as icaoWindow, aJ as judgeIcao, aK as lumaPlane, aL as percentile, aM as portraitCropRegion, aN as poseFromMatrix, aO as regionStats, aP as resolveIcaoTuning, aQ as scoreFrame, aR as windowOverflow } from '../icao-gate-DKbWXP51.js';
6
6
  import '../detect-worker-DclNxkZT.js';
7
7
  import '../capture-session-v3-CQK-G-qX.js';
8
8
 
@@ -260,14 +260,13 @@ declare const OCR_ASSET_SET: {
260
260
  declare const PROCESSING_BACKOFF_MS: readonly number[];
261
261
  /** Hosted parity: a resend is offered 30 s after the last send. */
262
262
  declare const OTP_RESEND_COOLDOWN_MS = 30000;
263
- type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<SessionView>;
263
+ type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
264
264
  interface RunnerDeps {
265
265
  runtime: SubmitRuntime;
266
266
  currentView(): HostedSessionView | null;
267
267
  ensureView(): Promise<HostedSessionView>;
268
268
  refreshView(): Promise<HostedSessionView>;
269
269
  ensureConsent(): Promise<void>;
270
- selectMethod(method: IdentityMethod): Promise<void>;
271
270
  liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
272
271
  /** A liveness submission chain is in flight (do not flip the UI mid-upload). */
273
272
  chainBusy(): boolean;
@@ -318,21 +317,13 @@ declare function createStepRunner(deps: RunnerDeps): StepRunner;
318
317
  */
319
318
  declare const RETRYABLE_REASONS: ReadonlySet<CheckReason>;
320
319
  /** A check the browser may still submit. */
321
- declare function isExecutable(step: HostedStepView | undefined): boolean;
320
+ declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
322
321
  /** The session accepts no further submissions. */
323
322
  declare function isTerminalView(view: Pick<HostedSessionView, "status">): boolean;
324
- /** First step in `steps[]` order with state `pending | input_required` (the backend's frontier). */
325
- declare function frontierStep(view: HostedSessionView): HostedStepView | undefined;
326
- declare function stepOf(view: HostedSessionView, checkType: CheckType): HostedStepView | undefined;
327
- /**
328
- * Fold a submit response (partner `SessionView`: no attemptsRemaining) into the
329
- * hosted view: status/outcome/step states+reasons come from the response; the
330
- * submitted check's `attemptsRemaining` is decremented locally, as is a match
331
- * executed decisively by a liveness bundle (one attempt per executed check).
332
- * Same-key transport replays are resolved before this merge is called.
333
- * This keeps the happy path free of extra `GET /hosted/session` round-trips.
334
- */
335
- declare function mergeSessionView(prev: HostedSessionView, next: SessionView, submitted: CheckType): HostedSessionView;
323
+ /** The step `plan.current` names while it can still be submitted (the backend's frontier). */
324
+ declare function frontierStep(view: HostedSessionView): PlanStepView | undefined;
325
+ /** The plan step of a check type (check types are unique on a session's path). */
326
+ declare function stepOf(view: HostedSessionView, checkType: CheckType): PlanStepView | undefined;
336
327
  /**
337
328
  * Map the session view to the public result:
338
329
  * - `completed/approved → approved`, `completed/review` or `review_pending → review`,
@@ -468,4 +459,4 @@ declare function measureRegionSharpness(image: RawImage, region: StillRegion | n
468
459
  */
469
460
  declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
470
461
 
471
- export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, type ExecuteTurnstileOptions, HostedClientLike, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, RETRYABLE_REASONS, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TURNSTILE_EXECUTE_TIMEOUT_MS, TURNSTILE_SCRIPT_SRC, TextLockTuning, type TurnstileApi, type TurnstileRenderParams, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, executeTurnstile, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, liveMrzWireReport, loadTurnstile, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, mergeSessionView, photoSharpness, resetTurnstileForTests, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
462
+ export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, type ExecuteTurnstileOptions, HostedClientLike, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, RETRYABLE_REASONS, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TURNSTILE_EXECUTE_TIMEOUT_MS, TURNSTILE_SCRIPT_SRC, TextLockTuning, type TurnstileApi, type TurnstileRenderParams, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, executeTurnstile, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, liveMrzWireReport, loadTurnstile, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, photoSharpness, resetTurnstileForTests, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
@@ -1 +1 @@
1
- import{c as _e,d as Le,e as Re,g as Se,h as Te,i as le}from"../chunk-MY6EXEL2.js";import{a as wt,b as Bt,c as Vt,d as zt,e as Xt,f as Zt,g as Jt,h as Qt,i as jt,j as ae,l as se,n as Ee,o as me}from"../chunk-M43ET4NJ.js";import{b as pe,c as ie,d as ne}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import{a as d,b as M,c as F,d as N,e as v}from"../chunk-O5WKNZ2C.js";import{A as yt,B as ft,C as ut,D as Ot,E as At,F as It,G as xt,H as Ct,I as Pt,J as Dt,a as We,b as ke,c as Ke,d as Je,e as Qe,f as je,g as qe,h as $e,i as et,j as tt,k as rt,l as ot,m as pt,n as it,o as nt,p as at,q as st,r as Et,s as mt,t as _t,u as Lt,v as Rt,w as St,x as Tt,y as lt,z as ct}from"../chunk-YPG7CB4O.js";import{a as Ye,b as He}from"../chunk-SMKCBUJL.js";import{a as we,b as Be,c as Ve,d as ze,e as Xe,f as Ze}from"../chunk-MXWLCDFX.js";import{a as k,b as Fe,c as Ne,d as ve,e as ge,f as be,g as Ge,h as he,i as Ue,j as K,k as w,l as B,m as Z,n as J,o as Q,p as j,q,r as $,s as ee,t as te,u as re,x as oe}from"../chunk-RNRFHUJA.js";import{a as g,b,c as G,d as h,e as U,f as Y,g as H,h as W,i as V,j as z,l as X}from"../chunk-G6LKLN4U.js";import{a as xe,b as Ce,c as Pe,d as De,e as de,f as Me}from"../chunk-TDLIXFDT.js";import{a as dt,b as Mt,c as Ft,d as Nt,e as vt,f as gt,g as bt,h as Gt,i as ht,j as Ut,k as Yt,l as Ht,m as Wt}from"../chunk-7ZCZY3ZP.js";import{a as kt,b as Kt}from"../chunk-BPE5NSQ2.js";import"../chunk-GI3UFGRQ.js";import{b as ye,c as fe,d as ue,e as Oe,g as Ae,h as qt,i as $t,j as er,k as tr,l as rr,m as or,q as Ie}from"../chunk-XLN5OT25.js";import{a as R,c as S,d as T,e as l,f as c,g as y,i as f,k as u,l as O,m as A,n as I,o as x,p as C,q as P,r as D}from"../chunk-YDQBVWXG.js";import{a as p,b as i,c as n,d as a,i as s,j as E,k as m,l as _,m as L}from"../chunk-RVHAKRAI.js";import"../chunk-7V2M6Y2W.js";import{b as e,c as t,d as r,e as o}from"../chunk-DQWW4OCK.js";import"../chunk-POIQGEZM.js";import"../chunk-FHJ7HO3M.js";import"../chunk-FPXL63KZ.js";import"../chunk-4RS2YIL4.js";import"../chunk-LQ7C44JG.js";import"../chunk-OKWG3PVH.js";import{a as ce}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ae as ANALYSIS_LONG_EDGE,xe as ASPECT_BANDS,C as AttestationError,Ge as BLUR_REFUSE_SHARPNESS_MAX,Dt as CAPTURE_CANDIDATE_SPACING_MS,Pt as CAPTURE_EXTRA_CANDIDATES,o as CENTERED_FACTOR,t as CIRCLE_RADIUS_FACTOR,wt as CLIPPED_LUMA,u as CLIP_MIME_ALLOWLIST,xt as CaptureSessionDoc,$t as DOCUMENT_TYPE_ORDER,Je as DOC_ANALYSIS_DEFAULTS,Ot as DOC_CADENCE_HZ,$e as DOC_CAMERA_TUNING_DEFAULTS,de as DOC_CATALOG,we as DOC_DETECT_WIDTH,We as DOC_FEEDBACK_STATES,Be as DOC_GATE_V1_DEFAULTS,At as DOC_SHUTTER_DEFAULTS,X as DocAssist,Ke as DocFeedbackAggregator,Ze as DocGateV1,Rt as EMPTY_GUIDE_METRICS,Ne as FLIP_FILL_MIN,Fe as FLIP_GAP_MS,ve as FLIP_TIMEOUT_MS,ct as GUIDE_LOCK_DEFAULTS,ft as GuideLock,Nt as ICAO_CANVAS,kt as ICAO_FALLBACK,Gt as ICAO_GATE_CRITERIA,Bt as ICAO_SHARP_REF,I as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,r as IN_CIRCLE_FACTOR,qt as ISSUER_CODES,pe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,_t as LENS_TRY_MAX,z as LIVE_MRZ_DEFAULTS,Le as LIVE_PHOTO_IDLE_MS,_e as LIVE_PHOTO_MAX_HZ,ge as MANUAL_SHUTTER_MS,Ye as MRZ_BAND_DEFAULTS,De as MR_DOC_CATALOG,be as NO_REPORT_MS,ce as OCR_ASSET_SET,Te as OTP_RESEND_COOLDOWN_MS,se as PORTRAIT_JPEG_QUALITY,p as PRELOAD_BLAZE_INIT_TIMEOUT_MS,i as PRELOAD_BUDGET_MS,Se as PROCESSING_BACKOFF_MS,fe as PROCESSING_POLL_DELAY_MS,ue as PROCESSING_POLL_MAX,G as REGION_PAD,ye as REGISTRY_RETRY_DELAY_MS,R as RETRYABLE_REASONS,re as SAME_FACE_MAX_DROPS,g as SHARPNESS_LONG_EDGE,V as TEXT_LOCK_DEFAULTS,O as TRANSPORT_REPLAY_ATTEMPTS,A as TRANSPORT_REPLAY_DELAY_MS,M as TURNSTILE_EXECUTE_TIMEOUT_MS,d as TURNSTILE_SCRIPT_SRC,Q as WEB_OCR_ENGINE,tr as acceptedIssuers,er as acceptedTypesFor,qe as analyzeDocFrame,Tt as analyzeGuide,Ce as aspectBand,Pe as aspectFits,Jt as backgroundStats,$ as browserFamily,Z as buildDeviceReadHint,w as classifyCardSide,K as classifyCardSideWith,st as coverPointToVideo,oe as createDocumentCaptureInternal,ne as createFaceLandmarker,Wt as createIcaoGate,Re as createLivePhotoKit,L as createLivenessCaptureInternal,me as createPortraitCaptureInternal,le as createStepRunner,Ae as createVerificationInternal,U as cropImage,e as detectIsMobile,He as detectMrzBand,Et as docZoomFor,k as encodeDocumentImage,v as executeTurnstile,Ft as eyeLineRoll,Ut as eyeOpenness,Zt as eyeSpecular,dt as faceGeometry,Xt as faceLighting,Qt as faceSharpness,ie as facesOf,ke as feedbackVoteOf,or as flagOf,mt as focusOk,te as formatMismatch,l as frontierStep,lt as guideQuad,St as guideRegionInFrame,jt as icaoPixelStats,vt as icaoWindow,he as initialScanState,S as isExecutable,T as isTerminalView,ht as judgeIcao,tt as lensKindOf,ee as liveMrzWireReport,N as loadTurnstile,Vt as lumaPlane,m as mapEngineState,_ as mapErrorKind,E as mapGuidanceHint,f as mapSessionResult,W as measureBitmapSharpness,H as measureRegionSharpness,y as mergeSessionView,Ue as nextScanState,Ee as observePortraitFrame,Lt as openDocCamera,Ct as passportBandOf,Yt as percentile,b as photoSharpness,bt as portraitCropRegion,Ie as portraitMatchStep,Mt as poseFromMatrix,s as preloadedDetectorFactory,Ve as quadAreaFrac,Xe as quadBounds,ze as quadIou,je as quadTiltRatio,Oe as randomUuid,rt as rankBackCameras,pt as readStoredLens,zt as regionStats,a as resetLivenessAssetsForTests,F as resetTurnstileForTests,Y as resizeLongEdge,rr as resolveAcceptedDocuments,et as resolveDocCameraTuning,It as resolveDocShutterTuning,yt as resolveGuideLockTuning,Kt as resolveIcaoTuning,j as resolveWebOcrPlan,D as runLivenessFlow,P as runSubmission,Me as scannerFormatFor,Ht as scoreFrame,n as setPreloadLoaderForTests,J as settledHint,at as singleShotFocusAt,Qe as specularFraction,q as startWebOcr,c as stepOf,h as stillRegionOf,B as stillToImageData,nt as supportsFocusMode,ut as warmDocDetector,gt as windowOverflow,it as writeStoredLens};
1
+ import{c as me,d as _e,e as Le,g as Re,h as Se,i as Te}from"../chunk-H6HC7B77.js";import{a as Kt,b as Bt,c as wt,d as zt,e as Vt,f as Xt,g as Zt,h as Jt,i as Qt,j as ne,l as ae,n as se,o as Ee}from"../chunk-M43ET4NJ.js";import{b as oe,c as pe,d as ie}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import{a as D,b as d,c as M,d as F,e as N}from"../chunk-O5WKNZ2C.js";import{A as ct,B as yt,C as ft,D as ut,E as Ot,F as At,G as It,H as xt,I as Ct,J as Pt,a as He,b as We,c as ke,d as Ze,e as Je,f as Qe,g as je,h as qe,i as $e,j as et,k as tt,l as rt,m as ot,n as pt,o as it,p as nt,q as at,r as st,s as Et,t as mt,u as _t,v as Lt,w as Rt,x as St,y as Tt,z as lt}from"../chunk-4Q7EMVP7.js";import{a as Ue,b as Ye}from"../chunk-SMKCBUJL.js";import{a as Ke,b as Be,c as we,d as ze,e as Ve,f as Xe}from"../chunk-MXWLCDFX.js";import{a as W,b as Me,c as Fe,d as Ne,e as ve,f as ge,g as be,h as Ge,i as he,j as k,k as K,l as B,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-56GT33O3.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 w,j as z,l as V}from"../chunk-G6LKLN4U.js";import{a as Ie,b as xe,c as Ce,d as Pe,e as De,f as de}from"../chunk-TDLIXFDT.js";import{a as Dt,b as dt,c as Mt,d as Ft,e as Nt,f as vt,g as gt,h as bt,i as Gt,j as ht,k as Ut,l as Yt,m as Ht}from"../chunk-7ZCZY3ZP.js";import{a as Wt,b as kt}from"../chunk-BPE5NSQ2.js";import"../chunk-GI3UFGRQ.js";import{b as ce,c as ye,d as fe,e as ue,g as Oe,h as jt,i as qt,j as $t,k as er,l as tr,m as rr,s as Ae}from"../chunk-GBTZIKGZ.js";import{a as R,g as S,h as T,i as l,j as c,l as y,n as f,o as u,p as O,q as A,r as I,s as x,t as C,u as P}from"../chunk-ZUHTYCY4.js";import{a as p,b as i,c as n,d as a,i as s,j as E,k as m,l as _,m as L}from"../chunk-WRKUWIJW.js";import"../chunk-7V2M6Y2W.js";import{b as e,c as t,d as r,e as o}from"../chunk-EVVGQSNJ.js";import"../chunk-POIQGEZM.js";import"../chunk-FHJ7HO3M.js";import"../chunk-FPXL63KZ.js";import"../chunk-F5ST423J.js";import"../chunk-LUHNRNTO.js";import"../chunk-OKWG3PVH.js";import{a as le}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ne as ANALYSIS_LONG_EDGE,Ie as ASPECT_BANDS,x as AttestationError,be as BLUR_REFUSE_SHARPNESS_MAX,Pt as CAPTURE_CANDIDATE_SPACING_MS,Ct as CAPTURE_EXTRA_CANDIDATES,o as CENTERED_FACTOR,t as CIRCLE_RADIUS_FACTOR,Kt as CLIPPED_LUMA,f as CLIP_MIME_ALLOWLIST,It as CaptureSessionDoc,qt as DOCUMENT_TYPE_ORDER,Ze as DOC_ANALYSIS_DEFAULTS,ut as DOC_CADENCE_HZ,qe as DOC_CAMERA_TUNING_DEFAULTS,De as DOC_CATALOG,Ke as DOC_DETECT_WIDTH,He as DOC_FEEDBACK_STATES,Be as DOC_GATE_V1_DEFAULTS,Ot as DOC_SHUTTER_DEFAULTS,V as DocAssist,ke as DocFeedbackAggregator,Xe as DocGateV1,Lt as EMPTY_GUIDE_METRICS,Fe as FLIP_FILL_MIN,Me as FLIP_GAP_MS,Ne as FLIP_TIMEOUT_MS,lt as GUIDE_LOCK_DEFAULTS,yt as GuideLock,Ft as ICAO_CANVAS,Wt as ICAO_FALLBACK,bt as ICAO_GATE_CRITERIA,Bt as ICAO_SHARP_REF,A as INFERENCE_RETRY_ATTEMPTS,I as INFERENCE_RETRY_DEFAULT_S,r as IN_CIRCLE_FACTOR,jt as ISSUER_CODES,oe as LANDMARKER_MODEL,rt as LENS_STORAGE_KEY,mt as LENS_TRY_MAX,z as LIVE_MRZ_DEFAULTS,_e as LIVE_PHOTO_IDLE_MS,me as LIVE_PHOTO_MAX_HZ,ve as MANUAL_SHUTTER_MS,Ue as MRZ_BAND_DEFAULTS,Pe as MR_DOC_CATALOG,ge as NO_REPORT_MS,le as OCR_ASSET_SET,Se as OTP_RESEND_COOLDOWN_MS,ae as PORTRAIT_JPEG_QUALITY,p as PRELOAD_BLAZE_INIT_TIMEOUT_MS,i as PRELOAD_BUDGET_MS,Re as PROCESSING_BACKOFF_MS,ye as PROCESSING_POLL_DELAY_MS,fe as PROCESSING_POLL_MAX,b as REGION_PAD,ce as REGISTRY_RETRY_DELAY_MS,R as RETRYABLE_REASONS,te as SAME_FACE_MAX_DROPS,v as SHARPNESS_LONG_EDGE,w as TEXT_LOCK_DEFAULTS,u as TRANSPORT_REPLAY_ATTEMPTS,O as TRANSPORT_REPLAY_DELAY_MS,d as TURNSTILE_EXECUTE_TIMEOUT_MS,D as TURNSTILE_SCRIPT_SRC,J as WEB_OCR_ENGINE,er as acceptedIssuers,$t as acceptedTypesFor,je as analyzeDocFrame,St as analyzeGuide,xe as aspectBand,Ce as aspectFits,Zt as backgroundStats,q as browserFamily,X as buildDeviceReadHint,K as classifyCardSide,k as classifyCardSideWith,at as coverPointToVideo,re as createDocumentCaptureInternal,ie as createFaceLandmarker,Ht as createIcaoGate,Le as createLivePhotoKit,L as createLivenessCaptureInternal,Ee as createPortraitCaptureInternal,Te as createStepRunner,Oe as createVerificationInternal,h as cropImage,e as detectIsMobile,Ye as detectMrzBand,st as docZoomFor,W as encodeDocumentImage,N as executeTurnstile,Mt as eyeLineRoll,ht as eyeOpenness,Xt as eyeSpecular,Dt as faceGeometry,Vt as faceLighting,Jt as faceSharpness,pe as facesOf,We as feedbackVoteOf,rr as flagOf,Et as focusOk,ee as formatMismatch,l as frontierStep,Tt as guideQuad,Rt as guideRegionInFrame,Qt as icaoPixelStats,Nt as icaoWindow,Ge as initialScanState,S as isExecutable,T as isTerminalView,Gt as judgeIcao,et as lensKindOf,$ as liveMrzWireReport,F as loadTurnstile,wt as lumaPlane,m as mapEngineState,_ as mapErrorKind,E as mapGuidanceHint,y as mapSessionResult,H as measureBitmapSharpness,Y as measureRegionSharpness,he as nextScanState,se as observePortraitFrame,_t as openDocCamera,xt as passportBandOf,Ut as percentile,g as photoSharpness,gt as portraitCropRegion,Ae as portraitMatchStep,dt as poseFromMatrix,s as preloadedDetectorFactory,we as quadAreaFrac,Ve as quadBounds,ze as quadIou,Qe as quadTiltRatio,ue as randomUuid,tt as rankBackCameras,ot as readStoredLens,zt as regionStats,a as resetLivenessAssetsForTests,M as resetTurnstileForTests,U as resizeLongEdge,tr as resolveAcceptedDocuments,$e as resolveDocCameraTuning,At as resolveDocShutterTuning,ct as resolveGuideLockTuning,kt as resolveIcaoTuning,Q as resolveWebOcrPlan,P as runLivenessFlow,C as runSubmission,de as scannerFormatFor,Yt as scoreFrame,n as setPreloadLoaderForTests,Z as settledHint,nt as singleShotFocusAt,Je as specularFraction,j as startWebOcr,c as stepOf,G as stillRegionOf,B as stillToImageData,it as supportsFocusMode,ft as warmDocDetector,vt as windowOverflow,pt as writeStoredLens};
@@ -1 +1 @@
1
- import{e as U}from"./chunk-A3FUGHAH.js";import{a as V,b as O,e as A,f as w,i as F}from"./chunk-MY6EXEL2.js";import{o as H}from"./chunk-M43ET4NJ.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import{A as L,F as T,i as M}from"./chunk-YPG7CB4O.js";import"./chunk-SMKCBUJL.js";import"./chunk-MXWLCDFX.js";import{x}from"./chunk-RNRFHUJA.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-GI3UFGRQ.js";import{j as I}from"./chunk-YDQBVWXG.js";import"./chunk-RVHAKRAI.js";import"./chunk-7V2M6Y2W.js";import"./chunk-DQWW4OCK.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import{g as B}from"./chunk-4RS2YIL4.js";import"./chunk-LQ7C44JG.js";import"./chunk-OKWG3PVH.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";function _(t){let a=null,c=Promise.resolve(),u=!1,g=null,y=null,C=null,h=!1,m=()=>{a?.controller.handle.destroy(),a=null},k=()=>{let i=t.currentView(),s=i===null?null:w(i,{isMobile:t.isMobile()});return s?.kind==="portrait"?s:null},P=async(i,s)=>{if(t.destroyed())return;s.setFlowState("uploading"),u=!1;let d=null;try{await t.runner().submit("portrait_icao",async(n,r)=>{if(d===null){let p=await I(n,"image","image/jpeg",i.image.size,{engine:"portrait"});await n.uploadToSpaces(p.uploadUrl,i.image,"image/jpeg"),d=(await n.completeMedia(p.key)).key}s.setFlowState("checking");let l={media:{portrait:d},gate:B(i.gate),...i.tuningVersion!==void 0?{tuningVersion:i.tuningVersion}:{}};return n.submitCheck("portrait_icao",l,{idempotencyKey:r})},()=>{g=d})}catch{u=!0}if(s.setFlowState("done"),t.destroyed())return;let e=k();(e===null||e.phase!=="capture")&&a?.controller===s&&m(),t.runner().republish()},b=i=>t.runner().submit("face_match",(s,d)=>s.submitCheck("face_match",g!==null?{imageKey:g}:{},{idempotencyKey:d})).then(()=>{},()=>{u=!0,i()});return{bind:(i,s)=>{if(i.phase==="match")return m(),y!==i.attemptsRemaining&&!u&&(y=i.attemptsRemaining,b(s)),{...i,uploadFailed:u,resubmit:()=>(u=!1,y=i.attemptsRemaining,s(),b(s)),capture:()=>{throw new Error("the portrait was already accepted")}};y=null;let d=t.keptPortraitInput?.()??null;return d!==null&&(h||d!==C&&i.report===null&&i.reason===void 0&&!i.retakeOnly)?(h||(C=d,h=!0,t.runner().submit("portrait_icao",(e,n)=>e.submitCheck("portrait_icao",d,{idempotencyKey:n}),()=>{g=d.media.portrait}).catch(()=>{}).finally(()=>{h=!1,s()})),{kind:"processing",key:"processing",context:i.context,section:i.section,stalled:!1,refresh:()=>Promise.resolve()}):{...i,uploadFailed:u,resubmit:()=>Promise.resolve(),capture:e=>{if(a!==null&&a.video===e.video)return a.controller.handle;m(),u=!1;let n=H({video:e.video,tuning:i.tuning,tuningVersion:i.tuningVersion,...i.icao!=null?{policy:i.icao.policy}:{},...e.keepScreenAwake!==void 0?{keepScreenAwake:e.keepScreenAwake}:{},...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}},t.internals);return a={video:e.video,controller:n},n.handle.on("captured",r=>{c=c.then(()=>P(r,n)).catch(()=>{})}),n.handle}}},destroy:m}}function z(t){let a=t;if(typeof a.apiOrigin!="string"||typeof a.sessionToken!="string")return;let c=`${a.apiOrigin}/api/v2/hosted/capture-reports`,u=a.sessionToken;return g=>{try{fetch(c,{method:"POST",headers:{"content-type":"application/json","x-session-token":u},body:JSON.stringify({reports:g}),keepalive:!0}).catch(()=>{})}catch{}}}function j(t){let a=t.apiOrigin;return U("sdk",typeof a=="string"&&/staging|sandbox|localhost/.test(a)?"sandbox":"live")}function oe(t){let a=null,c=null,u=null,g=Promise.resolve(),y=()=>{u?.flow.handle.destroy(),u=null},C=async(e,n)=>{if(t.destroyed())return;n.setFlowState("uploading");let r=null,l,p=!1;try{await a.submit("doc_ocr",async(S,K)=>{if(r===null){let R=await I(S,"image","image/jpeg",e.image.size,{engine:"document"});await S.uploadToSpaces(R.uploadUrl,e.image,"image/jpeg"),r=(await S.completeMedia(R.key)).key}return n.setFlowState("checking"),l===void 0&&(l=n.takeDeviceRead(e)),S.submitCheck("doc_ocr",{imageKey:r,side:e.side,...l!==null?{deviceRead:l}:{}},{idempotencyKey:K})})}catch{p=!0}finally{n.setFlowState("done")}if(t.destroyed())return;if(p){n.settle(e.side,{ok:!1,issue:"technical"});return}let v=t.currentView(),o=v===null?null:w(v,{isMobile:t.isMobile()});if(o?.kind!=="document"){n.settle(e.side,{ok:!0}),u?.flow===n?y():n.handle.destroy();return}if(o.reason==="document_type_not_accepted"){c=null,u?.flow===n&&y(),a.republish();return}e.side==="single"||o.acceptedSides.includes(e.side)||o.reason==="side_missing"?(n.settle(e.side,{ok:!0}),c?.documentType!=="passport"&&n.handle.setSide(o.side)):n.settle(e.side,{ok:!1,issue:"reread"})},h=(e,n)=>({...e,issuer:c?.issuer??null,documentType:c?.documentType??null,captureSide:c===null?null:c.documentType==="passport"?"single":e.side,selectDocument:(r,l)=>{if(!O(e.documents).includes(r)||!V(e.documents,r).includes(l))throw new RangeError(`${l} from ${r} is not accepted`);(c?.issuer!==r||c.documentType!==l)&&y(),c={issuer:r,documentType:l},n()},capture:r=>{if(c===null)throw new Error("selectDocument() first");if(u!==null&&u.video===r.video)return u.flow.handle;y();let l=c,p=l.documentType==="passport"?"single":e.acceptedSides.length>0?e.side:void 0,v=x({video:r.video,documentType:l.documentType,issuer:l.issuer,...p!==void 0?{side:p}:{},...r.keepScreenAwake!==void 0?{keepScreenAwake:r.keepScreenAwake}:{},...r.liveMrz!==void 0?{liveMrz:r.liveMrz}:{}},{...t.documentInternals??{},...(()=>{let o=t.currentView()?.capture?.document,f=t.documentInternals?.blurRefuseSharpnessMax??o?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:M(o?.camera),shutter:T(o?.scan),guideLock:L(o?.guide),...t.documentInternals?.engineOptions??{}},...typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1?{blurRefuseSharpnessMax:f}:{}}})(),deferRead:!0,...(()=>{let o=t.currentView();if(o===null||t.documentInternals?.webOcr!==void 0)return{};let f=z(t.runtime.client);return{webOcr:{captureDocument:o.capture?.document,salt:o.sessionId,baseUrl:j(t.runtime.client),...f!==void 0?{reports:f}:{}}}})()});return u={video:r.video,flow:v},v.handle.on("captured",o=>{g=g.then(()=>C(o,v)).catch(()=>{})}),v.handle}}),m=null,k=null,P=new Set,b=t.runtime.client;t.runtime.client=new Proxy(b,{get(e,n){if(n==="submitCheck")return(k??e).submitCheck.bind(k??e);let r=Reflect.get(e,n);return typeof r=="function"?r.bind(e):r}});let D=()=>{m?.destroy(),m=null,k=null},i=e=>{let n=t.currentView(),r=n===null?null:w(n,{isMobile:t.isMobile()});if(n===null||r?.kind!=="liveness"||r.livePhoto?.icao!==!0)return;if(m===null){let o=A({tuning:n.capture?.icao??null,tuningVersion:n.capture?.tuningVersion??null,...r.icao!=null?{policy:r.icao.policy}:{},still:r.livePhoto.still,...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}},t.livePhotoInternals);m=o,k=o.decorate(b),o.onGate(f=>{for(let S of P)S(f)})}let l=m,p=t.baseCapture??{},v=p.engineOptions?.telemetry;return{...p,engineOptions:{...p.engineOptions??{},measureQuality:l.engineOptions.measureQuality,telemetry:o=>{v?.(o),l.engineOptions.telemetry(o)}}}},s=_({keptPortraitInput:()=>m?.lastPortraitInput()??null,runner:()=>a,currentView:t.currentView,destroyed:t.destroyed,isMobile:t.isMobile,...t.portraitInternals!==void 0?{internals:t.portraitInternals}:{}}),d=F({...t,bindDocument:h,bindPortrait:s.bind,onLivePhoto:e=>(P.add(e),()=>P.delete(e))});return a=d,{...d,captureInternals:i,destroy:()=>{y(),s.destroy(),D(),P.clear()}}}export{oe as createPlanRunner,j as sdkAssetBase};
1
+ import{e as U}from"./chunk-A3FUGHAH.js";import{a as V,b as O,e as A,f as w,i as F}from"./chunk-H6HC7B77.js";import{o as H}from"./chunk-M43ET4NJ.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import{A as L,F as T,i as M}from"./chunk-4Q7EMVP7.js";import"./chunk-SMKCBUJL.js";import"./chunk-MXWLCDFX.js";import{x}from"./chunk-56GT33O3.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-GI3UFGRQ.js";import{m as I}from"./chunk-ZUHTYCY4.js";import"./chunk-WRKUWIJW.js";import"./chunk-7V2M6Y2W.js";import"./chunk-EVVGQSNJ.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import{g as B}from"./chunk-F5ST423J.js";import"./chunk-LUHNRNTO.js";import"./chunk-OKWG3PVH.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";function _(t){let a=null,c=Promise.resolve(),u=!1,g=null,y=null,C=null,h=!1,m=()=>{a?.controller.handle.destroy(),a=null},k=()=>{let i=t.currentView(),s=i===null?null:w(i,{isMobile:t.isMobile()});return s?.kind==="portrait"?s:null},P=async(i,s)=>{if(t.destroyed())return;s.setFlowState("uploading"),u=!1;let d=null;try{await t.runner().submit("portrait_icao",async(n,r)=>{if(d===null){let p=await I(n,"image","image/jpeg",i.image.size,{engine:"portrait"});await n.uploadToSpaces(p.uploadUrl,i.image,"image/jpeg"),d=(await n.completeMedia(p.key)).key}s.setFlowState("checking");let l={media:{portrait:d},gate:B(i.gate),...i.tuningVersion!==void 0?{tuningVersion:i.tuningVersion}:{}};return n.submitCheck("portrait_icao",l,{idempotencyKey:r})},()=>{g=d})}catch{u=!0}if(s.setFlowState("done"),t.destroyed())return;let e=k();(e===null||e.phase!=="capture")&&a?.controller===s&&m(),t.runner().republish()},b=i=>t.runner().submit("face_match",(s,d)=>s.submitCheck("face_match",g!==null?{imageKey:g}:{},{idempotencyKey:d})).then(()=>{},()=>{u=!0,i()});return{bind:(i,s)=>{if(i.phase==="match")return m(),y!==i.attemptsRemaining&&!u&&(y=i.attemptsRemaining,b(s)),{...i,uploadFailed:u,resubmit:()=>(u=!1,y=i.attemptsRemaining,s(),b(s)),capture:()=>{throw new Error("the portrait was already accepted")}};y=null;let d=t.keptPortraitInput?.()??null;return d!==null&&(h||d!==C&&i.report===null&&i.reason===void 0&&!i.retakeOnly)?(h||(C=d,h=!0,t.runner().submit("portrait_icao",(e,n)=>e.submitCheck("portrait_icao",d,{idempotencyKey:n}),()=>{g=d.media.portrait}).catch(()=>{}).finally(()=>{h=!1,s()})),{kind:"processing",key:"processing",context:i.context,section:i.section,stalled:!1,refresh:()=>Promise.resolve()}):{...i,uploadFailed:u,resubmit:()=>Promise.resolve(),capture:e=>{if(a!==null&&a.video===e.video)return a.controller.handle;m(),u=!1;let n=H({video:e.video,tuning:i.tuning,tuningVersion:i.tuningVersion,...i.icao!=null?{policy:i.icao.policy}:{},...e.keepScreenAwake!==void 0?{keepScreenAwake:e.keepScreenAwake}:{},...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}},t.internals);return a={video:e.video,controller:n},n.handle.on("captured",r=>{c=c.then(()=>P(r,n)).catch(()=>{})}),n.handle}}},destroy:m}}function z(t){let a=t;if(typeof a.apiOrigin!="string"||typeof a.sessionToken!="string")return;let c=`${a.apiOrigin}/api/v2/hosted/capture-reports`,u=a.sessionToken;return g=>{try{fetch(c,{method:"POST",headers:{"content-type":"application/json","x-session-token":u},body:JSON.stringify({reports:g}),keepalive:!0}).catch(()=>{})}catch{}}}function j(t){let a=t.apiOrigin;return U("sdk",typeof a=="string"&&/staging|sandbox|localhost/.test(a)?"sandbox":"live")}function oe(t){let a=null,c=null,u=null,g=Promise.resolve(),y=()=>{u?.flow.handle.destroy(),u=null},C=async(e,n)=>{if(t.destroyed())return;n.setFlowState("uploading");let r=null,l,p=!1;try{await a.submit("doc_ocr",async(S,K)=>{if(r===null){let R=await I(S,"image","image/jpeg",e.image.size,{engine:"document"});await S.uploadToSpaces(R.uploadUrl,e.image,"image/jpeg"),r=(await S.completeMedia(R.key)).key}return n.setFlowState("checking"),l===void 0&&(l=n.takeDeviceRead(e)),S.submitCheck("doc_ocr",{imageKey:r,side:e.side,...l!==null?{deviceRead:l}:{}},{idempotencyKey:K})})}catch{p=!0}finally{n.setFlowState("done")}if(t.destroyed())return;if(p){n.settle(e.side,{ok:!1,issue:"technical"});return}let v=t.currentView(),o=v===null?null:w(v,{isMobile:t.isMobile()});if(o?.kind!=="document"){n.settle(e.side,{ok:!0}),u?.flow===n?y():n.handle.destroy();return}if(o.reason==="document_type_not_accepted"){c=null,u?.flow===n&&y(),a.republish();return}e.side==="single"||o.acceptedSides.includes(e.side)||o.reason==="side_missing"?(n.settle(e.side,{ok:!0}),c?.documentType!=="passport"&&n.handle.setSide(o.side)):n.settle(e.side,{ok:!1,issue:"reread"})},h=(e,n)=>({...e,issuer:c?.issuer??null,documentType:c?.documentType??null,captureSide:c===null?null:c.documentType==="passport"?"single":e.side,selectDocument:(r,l)=>{if(!O(e.documents).includes(r)||!V(e.documents,r).includes(l))throw new RangeError(`${l} from ${r} is not accepted`);(c?.issuer!==r||c.documentType!==l)&&y(),c={issuer:r,documentType:l},n()},capture:r=>{if(c===null)throw new Error("selectDocument() first");if(u!==null&&u.video===r.video)return u.flow.handle;y();let l=c,p=l.documentType==="passport"?"single":e.acceptedSides.length>0?e.side:void 0,v=x({video:r.video,documentType:l.documentType,issuer:l.issuer,...p!==void 0?{side:p}:{},...r.keepScreenAwake!==void 0?{keepScreenAwake:r.keepScreenAwake}:{},...r.liveMrz!==void 0?{liveMrz:r.liveMrz}:{}},{...t.documentInternals??{},...(()=>{let o=t.currentView()?.capture?.document,f=t.documentInternals?.blurRefuseSharpnessMax??o?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:M(o?.camera),shutter:T(o?.scan),guideLock:L(o?.guide),...t.documentInternals?.engineOptions??{}},...typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1?{blurRefuseSharpnessMax:f}:{}}})(),deferRead:!0,...(()=>{let o=t.currentView();if(o===null||t.documentInternals?.webOcr!==void 0)return{};let f=z(t.runtime.client);return{webOcr:{captureDocument:o.capture?.document,salt:o.sessionId,baseUrl:j(t.runtime.client),...f!==void 0?{reports:f}:{}}}})()});return u={video:r.video,flow:v},v.handle.on("captured",o=>{g=g.then(()=>C(o,v)).catch(()=>{})}),v.handle}}),m=null,k=null,P=new Set,b=t.runtime.client;t.runtime.client=new Proxy(b,{get(e,n){if(n==="submitCheck")return(k??e).submitCheck.bind(k??e);let r=Reflect.get(e,n);return typeof r=="function"?r.bind(e):r}});let D=()=>{m?.destroy(),m=null,k=null},i=e=>{let n=t.currentView(),r=n===null?null:w(n,{isMobile:t.isMobile()});if(n===null||r?.kind!=="liveness"||r.livePhoto?.icao!==!0)return;if(m===null){let o=A({tuning:n.capture?.icao??null,tuningVersion:n.capture?.tuningVersion??null,...r.icao!=null?{policy:r.icao.policy}:{},still:r.livePhoto.still,...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}},t.livePhotoInternals);m=o,k=o.decorate(b),o.onGate(f=>{for(let S of P)S(f)})}let l=m,p=t.baseCapture??{},v=p.engineOptions?.telemetry;return{...p,engineOptions:{...p.engineOptions??{},measureQuality:l.engineOptions.measureQuality,telemetry:o=>{v?.(o),l.engineOptions.telemetry(o)}}}},s=_({keptPortraitInput:()=>m?.lastPortraitInput()??null,runner:()=>a,currentView:t.currentView,destroyed:t.destroyed,isMobile:t.isMobile,...t.portraitInternals!==void 0?{internals:t.portraitInternals}:{}}),d=F({...t,bindDocument:h,bindPortrait:s.bind,onLivePhoto:e=>(P.add(e),()=>P.delete(e))});return a=d,{...d,captureInternals:i,destroy:()=>{y(),s.destroy(),D(),P.clear()}}}export{oe as createPlanRunner,j as sdkAssetBase};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/web",
3
- "version": "0.1.0-rc.8",
3
+ "version": "0.1.0-rc.9",
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.8",
101
- "bom-ref": "@sekyro/web@0.1.0-rc.8",
100
+ "version": "0.1.0-rc.9",
101
+ "bom-ref": "@sekyro/web@0.1.0-rc.9",
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.8?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.9?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.8|@mediapipe/tasks-vision@0.10.35",
153
+ "bom-ref": "@sekyro/web@0.1.0-rc.9|@mediapipe/tasks-vision@0.10.35",
154
154
  "licenses": [
155
155
  {
156
156
  "license": {
@@ -183,13 +183,13 @@
183
183
  ],
184
184
  "dependencies": [
185
185
  {
186
- "ref": "@sekyro/web@0.1.0-rc.8",
186
+ "ref": "@sekyro/web@0.1.0-rc.9",
187
187
  "dependsOn": [
188
- "@sekyro/web@0.1.0-rc.8|@mediapipe/tasks-vision@0.10.35"
188
+ "@sekyro/web@0.1.0-rc.9|@mediapipe/tasks-vision@0.10.35"
189
189
  ]
190
190
  },
191
191
  {
192
- "ref": "@sekyro/web@0.1.0-rc.8|@mediapipe/tasks-vision@0.10.35"
192
+ "ref": "@sekyro/web@0.1.0-rc.9|@mediapipe/tasks-vision@0.10.35"
193
193
  }
194
194
  ]
195
195
  }
@@ -1 +0,0 @@
1
- import{a as l}from"./chunk-LQ7C44JG.js";var _=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","method_required","method_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","method_not_offered","nfc_outcome_not_accepted","contact_locked","identity_confirm_required","identity_confirm_locked"];function R(s){return _.includes(s)}var c=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds)}};var b=6e4,m=4,g=3e4,T=9e5,w=200,S=5,k=400;function p(s){return(s.split(";")[0]??"").trim()}var P={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},h=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let t=e.fetch;this.fetchImpl=(n,o)=>(t??globalThis.fetch).call(globalThis,n,o),this.requestTimeoutMs=e.requestTimeoutMs??g,this.retryAttempts=e.inProgressRetry?.attempts??S,this.retryDelayMs=e.inProgressRetry?.delayMs??k}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e}})}async selectMethod(e){let t=await this.api("POST","/hosted/method",{body:{method:e}});return this.sessionId=t.sessionId,t}async selectContact(e){return this.api("POST","/hosted/contact",{body:{channel:e}})}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,t,n){let o=await this.ensureSessionId(),i={kind:e,contentType:p(t),contentLength:n};return this.api("POST",`/sessions/${o}/media`,{body:i})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,t,n,o={}){let i=await this.ensureSessionId(),a=await this.takeCaptureNonce(),r=a===void 0?void 0:{nonce:a,...o.engine!==void 0?{engine:o.engine.slice(0,32)}:{},...o.durationMs!==void 0&&Number.isFinite(o.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(o.durationMs)))}:{}},d={kind:e,contentType:p(t),contentLength:n,...r!==void 0?{capture:r}:{}};return this.api("POST",`/sessions/${i}/media`,{body:d})}async takeCaptureNonce(){let e=()=>{let t=Date.now();return this.captureNonces=this.captureNonces.filter(n=>n.expiresAt-b>t),this.captureNonces.shift()?.nonce};for(let t=0;t<2;t++){let n=e();if(n!==void 0)return n;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:Math.min(m,Math.max(1,e))}}),o=Date.now()+Math.max(0,n.expiresIn)*1e3;for(let i of Array.isArray(n.nonces)?n.nonces:[])typeof i=="string"&&i.length>0&&this.captureNonces.push({nonce:i,expiresAt:o});this.captureNonces=this.captureNonces.slice(-m)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,t,n){let o;try{o=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":p(n)},body:t,signal:AbortSignal.timeout(T)})}catch(i){throw y(i)}if(!o.ok){let i=(await o.text().catch(()=>"")).slice(0,w);throw new c({status:o.status,code:"upload_failed",message:`media upload failed (HTTP ${o.status})${i?`: ${i}`:""}`})}}async completeMedia(e){let t=await this.ensureSessionId();return this.api("POST",`/sessions/${t}/media/complete`,{body:{key:e}})}async submitCheck(e,t,n={}){let o=await this.ensureSessionId(),i={input:t,...n.forceOutcome!==void 0?{forceOutcome:n.forceOutcome}:{}};return this.api("POST",`/sessions/${o}/checks/${e}`,{body:i,...n.idempotencyKey!==void 0?{idempotencyKey:n.idempotencyKey}:{}})}async uploadAndSubmit(e,t,n,o={}){let i=p(t.contentType),a=await this.presign(t.kind,i,t.blob.size);await this.uploadToSpaces(a.uploadUrl,t.blob,i);let r=await this.completeMedia(a.key),d={...n,[P[e]]:r.key};return this.submitCheck(e,d,o)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,t,n={}){let o=`${this.apiOrigin}/api/v2${t}`,i={"x-session-token":this.sessionToken};n.body!==void 0&&(i["content-type"]="application/json"),n.idempotencyKey!==void 0&&(i["x-idempotency-key"]=n.idempotencyKey);try{let a=l.timezone();a!==void 0&&(i["sekyro-client-timezone"]=a)}catch{}try{let a=await l.deviceHeader();a!==void 0&&(i["sekyro-client-device"]=a)}catch{}for(let a=0;;a++){let r;try{r=await this.fetchImpl(o,{method:e,headers:i,...n.body!==void 0?{body:JSON.stringify(n.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(u){throw y(u)}if(r.ok){if(n.blob===!0)try{return await r.blob()}catch(f){throw y(f)}let u;try{u=await r.json()}catch{throw new c({status:r.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${r.status})`})}return C(u)}let d=await I(r);if(d.code==="idempotency_in_progress"&&a<this.retryAttempts){this.retryDelayMs>0&&await M(this.retryDelayMs);continue}throw d}}};function y(s){if((typeof s=="object"&&s!==null?s.name:void 0)==="TimeoutError")return new c({status:0,code:"timeout",message:"request timed out"});let t=s instanceof Error?s.message:String(s);return new c({status:0,code:"network_error",message:`network request failed: ${t}`})}function C(s){return s!==null&&typeof s=="object"&&"success"in s&&"data"in s?s.data:s}async function I(s){let e="unknown_error",t=`request failed (HTTP ${s.status})`,n=Number.NaN;try{let a=await s.json();if(a!==null&&typeof a=="object"){let r=a;typeof r.code=="string"&&r.code.length>0&&(e=r.code),typeof r.message=="string"&&r.message.length>0&&(t=r.message),typeof r.retryAfterSeconds=="number"&&(n=r.retryAfterSeconds)}}catch{}let o=s.headers.get("retry-after"),i=o===null?Math.floor(n):Number.parseInt(o,10);return new c({status:s.status,code:e,message:t,...Number.isFinite(i)&&i>=0?{retryAfterSeconds:i}:{}})}function M(s){return new Promise(e=>setTimeout(e,s))}function v(s){let e=s?.portrait,t=e?.icao,n=e?.purpose==="id_document";return t==null?n?{policy:"reject",profile:"id_document"}:null:{policy:t.policy==="alert"&&!n?"alert":"reject",profile:n||t.profile==="id_document"?"id_document":"selfie"}}function x(s){return{...s.baselineEyeOpenness!==void 0?{baselineEyeOpenness:s.baselineEyeOpenness}:{},criteria:s.verdict??{},...s.backgroundCheck!==void 0?{backgroundCheck:s.backgroundCheck}:{}}}export{_ as a,R as b,c,p as d,h as e,v as f,x as g};
@@ -1 +0,0 @@
1
- import{b as oe,d as re,e as se,i as ae,j as ce,q as le,s as I,t as F}from"./chunk-YDQBVWXG.js";import{c as te,d as ne,e as ie}from"./chunk-FPXL63KZ.js";import{c as B,f as q,g as ue}from"./chunk-4RS2YIL4.js";var de=["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 ve=["carte_identite","passport","residence_permit"];function _e(e,n){let i=e.byIssuer?.[n]??e.default;return ve.filter(s=>i==="*"||i.includes(s))}function tt(e,n=de){return[...new Set([...n,...Object.keys(e.byIssuer??{})])].filter(s=>_e(e,s).length>0).sort()}function pe(e){if(e.acceptedDocuments)return e.acceptedDocuments;let n=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:n}}}var Ce=640,Pe=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),me=6,fe=1500,he={sharpness:1,exposure:1,meanLuma:128},ye=null;function we(e,n){try{ye??(ye=document.createElement("canvas"));let i=ye,s=96/Math.max(1,n.width);i.width=Math.max(1,Math.round(n.width*s)),i.height=Math.max(1,Math.round(n.height*s));let a=i.getContext("2d");if(a===null)return he;a.drawImage(e,n.x,n.y,n.width,n.height,0,0,i.width,i.height);let c=a.getImageData(0,0,i.width,i.height);return{sharpness:ne(c),exposure:ie(c),meanLuma:te(c)}}catch{return he}}async function xe(e,n){let i=e.source;return"convertToBlob"in i?i.convertToBlob({type:"image/jpeg",quality:n}):new Promise((s,a)=>{i.toBlob(c=>c===null?a(new Error("encode failed")):s(c),"image/jpeg",n)})}function st(e,n={}){let i=n.now??(()=>performance.now()),s=n.setTimer??((t,r)=>setTimeout(t,r)),a=n.clearTimer??(t=>clearTimeout(t)),c=n.encode??xe,y=n.quality??we,S=e.tuningVersion??null,g=new Set,u=!1,p=e.video??null,f=null,b=n.grabFrame??null,O=null,V=1e3/me,v=null,x=null,N=!1,R=!1,D=Number.NEGATIVE_INFINITY,w=null,K=0,H=null,A=null,Y=Promise.all([import("./icao-gate-PWBMKRGC.js"),import("./icao-tuning-4GGVX6B4.js"),import("./create-portrait-capture-B57GE5FU.js"),import("./landmarker-KB7LVXAU.js"),import("./background-monitor-A7FKJOAG.js")]).then(async([t,r,l,m,k])=>{let d=r.resolveIcaoTuning(e.tuning,e.tuningVersion??void 0);d.background.required&&(x=k.createBackgroundMonitor({tuning:d.backgroundCheck,assetBaseUrl:e.assetBaseUrl??"/models-v3",...n.createSegmenter!==void 0?{createSegmenter:n.createSegmenter}:{},now:i})),f=t.createIcaoGate(d,{policy:e.policy??"reject"}),b??(b=l.defaultGrabber()),O=l.observe,V=1e3/Math.min(me,d.cadenceHz);let h=(n.createLandmarker??m.createFaceLandmarker)(e.assetBaseUrl??"/models-v3"),_=await new Promise((C,P)=>{let E=setTimeout(()=>{P(new Error("landmarker init timeout")),h.then(T=>T.close(),()=>{})},m.LANDMARKER_INIT_TIMEOUT_MS);h.then(T=>{clearTimeout(E),C(T)},T=>{clearTimeout(E),P(T)})});u?_.close():v=_}).catch(()=>{N=!0}),U=t=>{for(let r of g)r({holding:R||N,update:t})},j=()=>{if(w=null,!(u||v===null||f===null||b===null||O===null||p===null)){if(i()-D>fe){U(null);return}try{let t=b(p,Ce);if(t!==null){let r=Math.max(i(),K+1);K=r;let l=v.detect(t.source,r),m=p.videoWidth||t.width,k=p.videoHeight||t.height,d=O(l,t,m,k);d.geometry!==null&&x!==null&&(d.backgroundCheck=x.measure(t,d.geometry.box,m,k));let h=f.push(d,i());R=h.ready,U(h)}}catch{}w=s(j,V)}},W=()=>{let t=i()-D>fe;D=i(),t&&(f?.reset(),R=!1,H=null,A=null),w===null&&v!==null&&!u&&(w=s(j,0))},G=()=>{let t=b===null||p===null?null:b(p,null);if(t===null||f===null||Math.max(t.width,t.height)<e.still.minLongSidePx)return Promise.resolve(null);let r=f.summary();return c(t,e.still.jpegQuality).then(l=>({image:l,width:t.width,height:t.height,gate:r}),()=>null)},M=null;return{engineOptions:{measureQuality:(t,r)=>{p=t,W();let l=y(t,r);return R||N?l:{...l,sharpness:0}},telemetry:t=>{if(t.type!=="fired"||u)return;H=G();let r=M;r!==null&&H.then(l=>l===null?void 0:r(l).catch(()=>{})),R=!1,w!==null&&a(w),w=null,D=Number.NEGATIVE_INFINITY}},decorate:t=>{let r=new WeakMap,l=new Map,m=_=>{let C=r.get(_);return C===void 0&&(C=(async()=>{let P=await ce(t,"image","image/jpeg",_.image.size,{engine:"portrait"});return await t.uploadToSpaces(P.uploadUrl,_.image,"image/jpeg"),(await t.completeMedia(P.key)).key})(),C.catch(()=>r.delete(_)),r.set(_,C)),C};M=m;let k=async _=>{let C;try{C=await m(_)}catch(P){let E=P?.code;if(typeof E=="string"&&Pe.has(E))throw P;return null}return{media:{portrait:C},gate:ue(_.gate),...S!==null?{tuningVersion:S}:{}}},d=t.submitCheck.bind(t),h=(async(_,C,P)=>{if(_!=="liveness")return d(_,C,P);let E=P?.idempotencyKey,T=E===void 0?void 0:l.get(E);if(T===void 0){let z=H;T=z===null?Promise.resolve(null):z.then(ee=>ee===null?null:k(ee)),E!==void 0&&(l.set(E,T),T.catch(()=>l.delete(E)))}let $=await T;if($===null)return d("liveness",C,P);let ke=await d("liveness",{...C,portraitIcao:$},P);return A=$,ke});return new Proxy(t,{get(_,C){if(C==="submitCheck")return h;let P=Reflect.get(_,C);return typeof P=="function"?P.bind(_):P}})},onGate:t=>(g.add(t),()=>g.delete(t)),lastPortraitInput:()=>A,destroy:()=>{u=!0,H=null,A=null,w!==null&&a(w),w=null,g.clear(),Y.then(()=>{v?.close(),v=null,x?.close(),x=null})}}}var Ee=["national_number","document_photo","national_eid"],Te=["national_number","document_photo"],Ie=new Set(["eid_not_enrolled","eid_unavailable","eid_locked"]),ge="platform_unsupported",Ae=new Set(["prefilled","user_entered","prefilled_or_entered"]),Me={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 L(e){return e.section??Me[e.checkType]??null}function Re(e){let n={sessionId:e.sessionId,orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:[]};for(let i of e.steps){let s=L(i);s!==null&&!n.sections.includes(s)&&n.sections.push(s)}return e.branding!==void 0&&(n.branding=e.branding),n}function Le(e){let n={attemptsRemaining:e.attemptsRemaining,attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(n.reason=e.reason),n}function Oe(e,n){let i=e.otpChoice;if(i===void 0||i.locked||i.selected===null)return;let s=n==="phone_otp"?"email":"phone";return i.options.includes(s)?s:void 0}function Ve(e,n,i,s){let a=n.checkType==="email_otp",c=(a?n.emailOtp:n.otp)??{},y=a?n.emailOtp?.emailSource:n.otp?.numberSource,S=y!==void 0&&Ae.has(y)?y:a?"prefilled_or_entered":"user_entered",g=typeof c.sentToMasked=="string"&&c.sentToMasked.length>0,u=Oe(e,a?"email_otp":"phone_otp"),p={key:n.checkType,context:i,section:L(n),phase:g?"verify":"send",canSwitch:u!==void 0,...s},f=a?{kind:"email_otp",...p,emailSource:S,needsEmail:S!=="prefilled"}:{kind:"phone_otp",...p,numberSource:S,needsPhone:S!=="prefilled",channels:(n.otp?.channels??[]).filter(b=>b==="whatsapp"||b==="sms")};return u!==void 0&&(f.switchChannel=u),g&&(f.sentToMasked=c.sentToMasked),!a&&n.otp?.channel!==void 0&&(f.channel=n.otp.channel),c.expiresAt!==void 0&&(f.codeExpiresAt=c.expiresAt),c.resendAvailableAt!==void 0&&(f.resendAvailableAt=c.resendAvailableAt),f}function De(e,n,i,s){let a=e.nniBound===!0?"bound":n.nniFromDocument===!0?"document":"typed",c=a==="typed"&&n.state==="input_required"&&n.reason==="nni_recheck",y=n.reason==="nni_not_found"&&n.state==="input_required"&&!s.attemptsExhausted&&e.methodChoice?.available===!0&&e.methodChoice.options.includes("document_photo");return{kind:"registry",key:"registry",context:i,section:L(n),state:n.state==="input_required"?"input_required":"pending",source:a,recheck:c,canUseDocument:y,...s}}function He(e,n,i,s){let a=[...n.acceptedSides??[]];return{kind:"document",key:"document",context:i,section:L(n),side:a.includes("recto")?"verso":"recto",acceptedSides:a,documents:pe(e),...s}}function Ne(e){let n=e.steps.find(i=>i.checkType==="liveness");return n?.state==="passed"||n?.state==="review"}function Se(e,n,i,s,a){let c=n.icao?.report;return{kind:"portrait",key:`portrait:${a}`,context:i,section:L(n),phase:a,report:Array.isArray(c)?c:null,review:n.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:q(e),retakeOnly:a==="capture"&&n.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&Ne(e),...s}}var Z={minLongSidePx:1280,jpegQuality:.95};function Ge(e,n){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let s=e.steps.find(c=>c.checkType==="portrait_icao"),a=i.still??Z;return{icao:n==="liveness"&&q(e)!==null&&s!==void 0&&s.state==="pending"&&s.reason===void 0,still:{minLongSidePx:a.minLongSidePx??Z.minLongSidePx,jpegQuality:a.jpegQuality??Z.jpegQuality}}}function Be(e,n,i,s){let a=n.eid,c=L(n);if(a===void 0||a.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:c,checkType:"eid_auth",reason:"update_required"};let y=e.methodChoice,S=y?.available===!0?y.options.find(p=>Te.includes(p)):void 0,g=S!==void 0&&n.state==="input_required"&&(n.reason!==void 0&&Ie.has(n.reason)||n.attemptsExhausted===!0||n.attemptsRemaining===0||n.reason==="eid_resend_limit"&&a.awaiting!=="code"),u={kind:"eid",key:"eid",context:i,section:c,provider:a.provider,providerName:a.providerName,country:a.country,challenge:"app_code",phase:a.awaiting==="code"?"code":"identifier",identifierBound:a.identifierBound===!0,canUseCamera:g,afterPass:a.afterPass==="continue"?"continue":"end",...s};return g&&(u.cameraMethod=S),a.expiresAt!==void 0&&(u.codeExpiresAt=a.expiresAt),a.resendAvailableAt!==void 0&&(u.resendAvailableAt=a.resendAvailableAt),a.resendsRemaining!==void 0&&(u.resendsRemaining=a.resendsRemaining),a.codeAttemptsRemaining!==void 0&&(u.codeAttemptsRemaining=a.codeAttemptsRemaining),u}function Ue(e,n){if(n.checkType!=="face_match"||n.reason!==void 0)return null;let i=e.steps.find(s=>s.checkType==="portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function Fe(e){return e.steps.some(n=>n.attemptsExhausted===!0)}function Ke(e,n){let i=e.failureReason,s;i===ge?s="platform_unsupported":e.status==="expired"?s="expired":e.status==="review_pending"?s="review":e.status==="completed"&&e.outcome==="approved"?s="approved":e.status==="completed"&&e.outcome==="review"?s="review":i==="device_cooldown"?s="cooldown":i!==void 0?s="policy_stop":Fe(e)?s="attempts_exhausted":s="rejected";let a=s==="platform_unsupported"?{sessionId:e.sessionId,status:"unavailable"}:ae(e,{autoRetry:!1}),c={kind:"result",key:"result",context:n,section:null,display:s,result:a};return i!==void 0&&(c.failureReason=i),e.retryAfter!==void 0&&(c.retryAfter=e.retryAfter),c}function je(e,n){let i=e.identitySummary;if(i==null)return null;let s={kind:"identity_summary",key:"identity_summary",context:n,section:"identity",summaryKind:i.kind==="partial"?"partial":i.kind??"full",source:i.source,portraitAvailable:i.portrait?.available===!0,retakeAvailable:i.retakeAvailable===!0};for(let a of qe){let c=i[a];typeof c=="string"&&c!==""&&(s[a]=c)}return s}var qe=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","nniMasked","expiryDate","retakeTarget"];function Q(e,n={}){let i=Re(e);if(re(e)||e.failureReason===ge)return Ke(e,i);let s=je(e,i);if(s!==null)return s;let a=oe(e);if(a!==null){let u=a.options.filter(f=>Ee.includes(f));if(u.length===0)return{kind:"unsupported",key:"unsupported:method",context:i,section:"identity",checkType:"method",reason:"platform_unsupported"};let p={kind:"method",key:"method",context:i,section:"identity",options:u};return u.includes("national_eid")&&a.nationalEid!==void 0&&(p.nationalEid=a.nationalEid),p}let c=se(e);if(c===void 0){let u=e.steps.find(p=>p.state==="processing");return{kind:"processing",key:"processing",context:i,section:u===void 0?null:L(u),stalled:!1}}let y=Le(c),S=c.checkType,g=L(c);switch(S){case"phone_otp":case"email_otp":{let u=e.otpChoice;return u!==void 0&&u.selected===null&&!u.locked?{kind:"contact_choice",key:"contact_choice",context:i,section:g,options:u.options.filter(p=>p==="phone"||p==="email"),selected:null,locked:!1}:Ve(e,c,i,y)}case"population_registry":return De(e,c,i,y);case"eid_auth":return Be(e,c,i,y);case"doc_ocr":return He(e,c,i,y);case"portrait_icao":return Se(e,c,i,y,"capture");case"liveness":case"face_match":{let u=Ue(e,c);if(u!==null)return Se(e,u,i,y,"match");let p=c.requiresMobile===!0,f=q(e);return p&&n.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:g,checkType:S}:{kind:"liveness",key:"biometric",context:i,section:g,mode:S==="face_match"?"selfie":"liveness",requiresMobile:p,instructions:f===null?"standard":"icao",icao:f,livePhoto:Ge(e,S),...y}}default:return{kind:"unsupported",key:`unsupported:${S}`,context:i,section:g,checkType:S,reason:S==="nfc_chip"?"platform_unsupported":"update_required"}}}function J(e){return/^\d{10}$/.test(e)&&Number(e)%97===1}function X(e){let n="";for(let i of e){let s=i.codePointAt(0)??0;s>=1632&&s<=1641?n+=String(s-1632):s>=1776&&s<=1785?n+=String(s-1776):i!==" "&&i!=="-"&&i!=="\xA0"&&(n+=i)}return n}var Qe=[1e3,2e3,4e3,8e3,15e3],Ye=3e4,We=/^\+[1-9]\d{7,14}$/,$e=/^\d{6}$/,Ze=/^\d{6}$/,Je=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,be=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","method_required","contact_locked","identity_confirm_required","identity_confirm_locked"]),Xe=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]);function gt(e){let n=!1,i=null,s="",a=!1,c=!1,y=!1,S={},g={},u=new Set,p=!1,f=null,b="idle",O=new Map,V=new Map,v=(o,t,r)=>{let l=`${o}.${t}`,m=O.get(l);if(m!==void 0)return m;let k=V.get(o),d=(k===void 0?r():k.then(r)).finally(()=>{O.delete(l)});O.set(l,d);let h=d.then(()=>{},()=>{});return V.set(o,h),h.then(()=>{V.get(o)===h&&V.delete(o)}),d},x=async(o,t,r)=>{await e.ensureConsent();try{await le(e.runtime,t)}catch(l){if(l instanceof B&&be.has(l.code)){await e.refreshView();return}throw l}r?.(),e.destroyed()||await e.refreshView()},N=async o=>{await e.ensureConsent();let t;try{try{t=await o(e.runtime.client)}catch(r){if(!(r instanceof B)||r.code!=="consent_required")throw r;await e.runtime.ensureConsent({force:!0}),t=await o(e.runtime.client)}}catch(r){if(r instanceof B&&be.has(r.code)){await e.refreshView();return}throw r}e.destroyed()||(t!==void 0&&e.setView!==void 0?e.setView(t):await e.refreshView())},R=o=>v("contact",`select:${o}`,()=>N(t=>t.selectContact===void 0?Promise.reject(new Error("contact choice is not available in this build")):t.selectContact(o))),D=o=>v("identity",o,()=>N(t=>t.confirmIdentity===void 0?Promise.reject(new Error("identity confirmation is not available in this build")):t.confirmIdentity(o))),w=async o=>{await e.ensureConsent();try{await e.selectMethod(o)}catch(t){if(!(t instanceof B)||t.code!=="consent_required")throw t;await e.runtime.ensureConsent({force:!0}),await e.selectMethod(o)}},K=(o,t)=>{let r=o.kind,l=r==="phone_otp",m=l?"phone":"email",k={action:"send"};if(l?o.needsPhone:o.needsEmail){let d=t[m]??g[r],h=l?d?.replace(/[\s().-]/g,""):d?.trim();if(h===void 0||!(l?We:Je).test(h))return Promise.reject(l?new I("phone","format"):new F("email","format"));k[m]=h}if(l){let d=o.channels,h=t.channel??(d.length===1?d[0]:void 0);if(d.length>0){if(h===void 0)return Promise.reject(new F("channel","required"));if(!d.includes(h))return Promise.reject(new F("channel","unavailable"))}h!==void 0&&(k.channel=h)}return v(r,"send",()=>x(r,(d,h)=>d.submitCheck(r,k,{idempotencyKey:h}),()=>{S[r]=e.now(),k[m]!==void 0&&(g[r]=k[m])}))},H=(o,t)=>$e.test(t)?v(o,"verify",()=>x(o,(r,l)=>r.submitCheck(o,{action:"verify",code:t},{idempotencyKey:l}))):Promise.reject(new I("code","format")),A=(o,t)=>v("eid_auth",o,()=>x("eid_auth",(r,l)=>r.submitCheck("eid_auth",t,{idempotencyKey:l}))),Y=(o,t)=>{if(o.identifierBound)return A("start",{action:"start"});let r=X(t??"");if(o.country==="MR"){if(!/^\d{10}$/.test(r))return Promise.reject(new I("nni","format"));if(!J(r))return Promise.reject(new I("nni","check_digit"))}else if(r==="")return Promise.reject(new I("nni","format"));return A("start",{action:"start",identifier:r})},U=o=>{switch(o.kind){case"phone_otp":case"email_otp":{let t={...o,send:(l={})=>K(o,l),verify:l=>H(o.kind,l),switchTo:()=>o.canSwitch&&o.switchChannel!==void 0?R(o.switchChannel):Promise.reject(new RangeError("this session has no other contact option"))},r=S[o.kind];return t.resendAvailableAt===void 0&&r!==void 0&&(t.resendAvailableAt=new Date(r+Ye).toISOString()),t}case"eid":return{...o,start:t=>Y(o,t),verify:t=>Ze.test(t)?A("verify",{action:"verify",code:t}):Promise.reject(new I("code","format")),resend:()=>o.resendsRemaining===0?Promise.reject(new RangeError("no new code can be sent for this session")):A("resend",{action:"resend"}),useCamera:()=>o.canUseCamera&&o.cameraMethod!==void 0?v("method","useCamera",()=>w(o.cameraMethod)):Promise.reject(new RangeError("the camera path is not offered"))};case"method":return{...o,select:t=>o.options.includes(t)?v("method","select",()=>w(t)):Promise.reject(new RangeError(`method ${String(t)} is not offered`))};case"registry":return{...o,submitNni:t=>{if(o.source!=="typed")return Promise.reject(new RangeError("this session already holds the NNI"));let r=X(t);return/^\d{10}$/.test(r)?J(r)?v("population_registry","submitNni",()=>x("population_registry",(l,m)=>l.submitCheck("population_registry",{nni:r},{idempotencyKey:m}),()=>{f=`\u2022\u2022\u2022\u2022\u2022\u2022${r.slice(-4)}`})):Promise.reject(new I("nni","check_digit")):Promise.reject(new I("nni","format"))},confirm:()=>v("population_registry","confirm",()=>x("population_registry",(t,r)=>t.submitCheck("population_registry",{},{idempotencyKey:r}))),useDocument:()=>o.canUseDocument?v("method","useDocument",()=>w("document_photo")):Promise.reject(new RangeError("the document method is not offered"))};case"document":return e.bindDocument!==void 0?e.bindDocument(o,M):{...o,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")}};case"portrait":return e.bindPortrait!==void 0?e.bindPortrait(o,M):{...o,uploadFailed:!1,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("portrait capture is not available in this build")}};case"contact_choice":return{...o,select:t=>o.options.includes(t)?R(t):Promise.reject(new RangeError(`contact ${String(t)} is not offered`))};case"identity_summary":return{...o,...o.nniMasked===void 0&&o.summaryKind==="partial"&&f!==null?{nniMasked:f}:{},portrait:async()=>{let t=e.runtime.client;if(!o.portraitAvailable||t.identityPortrait===void 0)return null;try{return await t.identityPortrait()}catch{return null}},confirm:()=>D("confirm"),retake:()=>o.retakeAvailable?D("retake"):Promise.reject(new RangeError("no retake is left"))};case"liveness":return{...o,capture:t=>e.liveness(t),onLivePhoto:t=>o.livePhoto?.icao===!0&&e.onLivePhoto!==void 0?e.onLivePhoto(t):()=>{}};case"mobile_required":case"processing":return{...o,refresh:async()=>{a=!1,await e.refreshView()}};case"unsupported":case"result":return{...o};default:{let t=o;throw new Error(`runner: unhandled step ${JSON.stringify(t)}`)}}},j=async()=>{if(!c){c=!0;try{for(let o of Qe){if(await e.sleep(o),!n||e.destroyed())return;let t=await e.refreshView().catch(()=>null);if(t!==null&&Q(t,{isMobile:e.isMobile()}).kind!=="processing")return}a=!0,M()}finally{c=!1}}},W=o=>{if(o.kind!=="liveness"||o.mode!=="selfie")return null;let t={kind:"processing",key:"processing",context:o.context,section:o.section,stalled:!1};if(b==="inflight")return t;if(!p||b==="done")return null;let r=e.keptFaceKey?.()??null;return r===null?null:(b="inflight",x("face_match",(l,m)=>l.submitCheck("face_match",{imageKey:r},{idempotencyKey:m}),()=>{b="done"}).then(()=>{b==="inflight"&&(b="done",M())},()=>{b="done",M()}),t)},G=(o,t=!1)=>{if(!n||e.destroyed()||e.chainBusy())return;let r=Q(o,{isMobile:e.isMobile()});r.kind==="registry"&&r.recheck&&(p=!0,b="idle"),r=W(r)??r,r.kind==="processing"?r.stalled=a:a=!1;let l=U(r),m=JSON.stringify(l);r.kind==="registry"&&r.source==="document"&&r.state==="pending"&&!u.has("registry")&&(u.add("registry"),l.confirm().catch(k=>{(!(k instanceof B)||Xe.has(k.code))&&u.delete("registry")})),!(!t&&m===s)&&(s=m,i=l,e.emitStep(l),r.kind==="processing"&&!a&&b!=="inflight"&&j(),r.kind==="result"&&!y&&(y=!0,e.emitResult(r.result)))};function M(){let o=e.currentView();o!==null&&G(o,!0)}return{run:async()=>{if(e.destroyed())throw new Error("verification destroyed");n=!0;let o=await e.ensureView();return i===null&&G(o),i??U(Q(o,{isMobile:e.isMobile()}))},current:()=>i,onView:o=>G(o),onChainIdle:()=>{let o=e.currentView();o!==null&&G(o)},republish:M,submit:x}}export{_e as a,tt as b,me as c,fe as d,st as e,Q as f,Qe as g,Ye as h,gt as i};
@@ -1 +0,0 @@
1
- import{b as R,c as le,d as x,e as T,f as w,g as de,h as E,i as V,q as pe,r as me}from"./chunk-YDQBVWXG.js";import{m as ae}from"./chunk-RVHAKRAI.js";import{a as se}from"./chunk-7V2M6Y2W.js";import{b as F}from"./chunk-DQWW4OCK.js";import{c as ce,e as ue,f as L}from"./chunk-4RS2YIL4.js";var Ee="https://api.sekyro.ai",ve=5e3,Me=1500,we=10;function Ve(e){return new Promise(t=>setTimeout(t,e))}function Oe(){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 i=0;i<16;i+=1)t[i]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let o=[...t].map(i=>i.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 lt(e){return De(e,{})}function De(e,t){let o=e.apiOrigin??Ee,i=e.autoRetry??!0,r=e.rearm??"auto",s=t.client??new ue({apiOrigin:o,sessionToken:e.clientToken,...e.fetch!==void 0?{fetch:e.fetch}:{}}),d=t.sleep??Ve,f=t.uuid??Oe,g=t.getTurnstileToken??((n,a)=>import("./turnstile-FATNZ4AG.js").then(m=>m.executeTurnstile(n,a))),c=se(),u=null,y=null,l=!1,q=new AbortController,p=null,H=null,P=n=>{p=n,c.emit("view",n),u?.onView(n)},C=()=>p!==null?Promise.resolve(p):(H??(H=s.getSession().then(n=>(P(n),n)).finally(()=>{H=null})),H),b=async()=>{let n=await s.getSession();return P(n),n},N=(n,a)=>{p!==null&&P(de(p,n,a))},B=null,Y=async n=>{let a=await C();!n&&a.consentRecorded||(await s.recordConsent(e.locale),p!==null&&P({...p,consentRecorded:!0}))},v=n=>n?.force===!0?Y(!0):(B??(B=Y(!1).finally(()=>{B=null})),B),U={client:s,ensureConsent:n=>v(n),sleep:d,uuid:f,onBusy:n=>{l||c.emit("busy",n)}},W=!1,Z=null,G=n=>{if(n.status==="approved"||n.status==="rejected"||n.status==="review"){if(W)return;W=!0}Z=JSON.stringify(n),c.emit("result",n)},ge=n=>{Z!==JSON.stringify(n)&&G(n)},J=async n=>{let a=p;n&&(a=await b().catch(()=>p));let m=a===null?null:R(a);return m!==null&&!l&&c.emit("method",m),m!==null},Q=null,j=!1,$=!1,X=()=>pe(U,(n,a)=>n.submitCheck("population_registry",{},{idempotencyKey:a})),z=n=>n.nniBound===!0||w(n,"population_registry")?.nniFromDocument===!0,Ce=async()=>{try{let n=await C();if(x(n)||R(n)!==null||T(n)?.checkType!=="population_registry")return;if(!z(n)&&w(n,"population_registry")?.nniFromDocument===void 0&&(n=await b()),!z(n)){$=!0;return}await v(),N(await X(),"population_registry");let a=p===null?void 0:w(p,"population_registry");if(a?.state==="input_required"&&a.reason==="registry_unavailable"&&a.attemptsRemaining>0){if(await d(ve),l)return;N(await X(),"population_registry")}}catch(n){if(n instanceof ce&&n.code==="method_required"){await b().catch(()=>{});return}j=!0;return}p!==null&&x(p)&&G(V(p,{autoRetry:i}))},ee=()=>(Q??(Q=Ce()),Q),_e=async()=>{let a=(await C()).turnstileSiteKey;return a===null?{sandbox:!0}:{channel:"hosted_web",siteKey:a,turnstileToken:await g(a,{signal:q.signal})}},_=null,te=Promise.resolve(),M=0,ke=async()=>{let n=await C();for(let a=0;a<we&&!l&&!x(n)&&T(n)===void 0&&n.steps.some(m=>m.state==="processing")&&(await d(Me),!l);a+=1)n=await b();return n},xe=async(n,a,m)=>{let{capture:k}=n,h=()=>l,O=()=>n.alive&&n.attempt===m,re=S=>{O()&&k.setFlowState(S)},I=S=>{if(!h()&&(G(S),!!O())){if(S.status==="retry"&&r==="auto"){k.handle.retry();return}k.setFlowState("done")}};if(a.degraded==="NO_RECORDER"){let S=p?.sessionId??(await C().catch(()=>null))?.sessionId??"";I(E(S,"no_recorder"));return}re("uploading");try{if(await ee(),h())return;let S=await C();if(!x(S)&&R(S)!==null){await J(!1),I(E(S.sessionId,"method_required"));return}if(!x(S)){if(T(S)?.checkType==="population_registry"){I(E(S.sessionId,$?"nni_unbound":j?"network":"registry_unavailable"));return}if(await v(),h())return;let D=await me({...U,artifacts:a,getAttestation:_e,getView:()=>p??S,refreshView:b,applySubmit:N,onPhase:re,isCancelled:h,onKeyframePromoted:Te=>{y=Te}});if(h())return;if(D.kind==="unavailable"){if(D.reason==="method_required"&&await J(!0),h())return;I(E(S.sessionId,D.reason));return}D.kind==="resync"&&await b(),S=await ke()}I(V(S,{autoRetry:i}))}catch{if(h())return;I(E(p?.sessionId??"","network"))}},Ae=(n,a)=>{let m=n.attempt;M>0&&n.alive&&n.capture.setFlowState("uploading"),M+=1,te=te.then(()=>xe(n,a,m)).finally(()=>{M-=1,M===0&&u?.onChainIdle()}).catch(()=>{})},ne=n=>{_?.capture.handle.destroy(),_!==null&&(_.alive=!1);let a=ae(n,u?.captureInternals?.(n)??t.capture,()=>p?.capture?.liveness?.keyframe?.rank===!0),m={capture:a,alive:!0,attempt:0};_=m,a.handle.on("state",h=>{h==="starting"&&(m.attempt+=1)}),a.handle.on("captured",h=>{Promise.resolve().then(()=>Ae(m,h))});let k=a.handle;return{get state(){return k.state},on:(h,O)=>k.on(h,O),start:h=>k.start(h),retry:()=>k.retry(),switchCamera:()=>k.switchCamera(),destroy:()=>{m.alive=!1,_===m&&(_=null),k.destroy()}}},be=async()=>{if(l)return null;try{let n=await C();return l?null:R(n)}catch{return null}},Re=async()=>{if(l)return!1;try{let n=await C();if(l||x(n))return!1;let a=w(n,"liveness");return le(a)&&a?.requiresMobile===!0&&!F()}catch{return!1}},Pe=async()=>{if(l)return!1;try{let n=await C();return!l&&n.returning===!0}catch{return!1}},oe=async n=>{let a=await s.selectMethod(n);l||P(a)},ie=null,Ie=()=>(ie??(ie=import("./plan-runner-UBK4B4CG.js").then(n=>{let a=n.createPlanRunner({runtime:U,currentView:()=>p,ensureView:C,refreshView:b,ensureConsent:()=>v(),selectMethod:oe,liveness:ne,chainBusy:()=>M>0,destroyed:()=>l,sleep:d,isMobile:F,now:t.now??Date.now,keptFaceKey:()=>y,setView:P,baseCapture:t.capture,emitStep:m=>{l||c.emit("step",m)},emitResult:ge,...t.document!==void 0?{documentInternals:t.document}:{},...t.portrait!==void 0?{portraitInternals:t.portrait}:{},livePhotoInternals:t.livePhoto});return u=a,a})),ie);return{consent:()=>v(),startRegistry:ee,methodChoice:be,selectMethod:oe,mobileRequired:Re,returning:Pe,liveness:ne,run:async()=>{if(l)throw new Error("verification destroyed");return(await Ie()).run()},currentStep:()=>u?.current()??null,voiceClips:async()=>{if(l)return null;try{let n=await C();return l?null:n.voice??null}catch{return null}},on:(n,a)=>c.on(n,a),destroy:()=>{l=!0,q.abort(),u?.destroy(),_!==null&&(_.alive=!1,_.capture.handle.destroy(),_=null),c.clear()}}}var fe=["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 Le=["carte_identite","passport","residence_permit"];function He(e,t){let o=e.byIssuer?.[t]??e.default;return Le.filter(i=>o==="*"||o.includes(i))}function ft(e,t=fe){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(i=>He(e,i).length>0).sort()}function Se(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function St(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var Ne=["national_number","document_photo","national_eid"],Be=["national_number","document_photo"],Ue=new Set(["eid_not_enrolled","eid_unavailable","eid_locked"]),ye="platform_unsupported",Ge=new Set(["prefilled","user_entered","prefilled_or_entered"]),Fe={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 A(e){return e.section??Fe[e.checkType]??null}function Ke(e){let t={sessionId:e.sessionId,orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:[]};for(let o of e.steps){let i=A(o);i!==null&&!t.sections.includes(i)&&t.sections.push(i)}return e.branding!==void 0&&(t.branding=e.branding),t}function qe(e){let t={attemptsRemaining:e.attemptsRemaining,attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),t}function Ye(e,t){let o=e.otpChoice;if(o===void 0||o.locked||o.selected===null)return;let i=t==="phone_otp"?"email":"phone";return o.options.includes(i)?i:void 0}function We(e,t,o,i){let r=t.checkType==="email_otp",s=(r?t.emailOtp:t.otp)??{},d=r?t.emailOtp?.emailSource:t.otp?.numberSource,f=d!==void 0&&Ge.has(d)?d:r?"prefilled_or_entered":"user_entered",g=typeof s.sentToMasked=="string"&&s.sentToMasked.length>0,c=Ye(e,r?"email_otp":"phone_otp"),u={key:t.checkType,context:o,section:A(t),phase:g?"verify":"send",canSwitch:c!==void 0,...i},y=r?{kind:"email_otp",...u,emailSource:f,needsEmail:f!=="prefilled"}:{kind:"phone_otp",...u,numberSource:f,needsPhone:f!=="prefilled",channels:(t.otp?.channels??[]).filter(l=>l==="whatsapp"||l==="sms")};return c!==void 0&&(y.switchChannel=c),g&&(y.sentToMasked=s.sentToMasked),!r&&t.otp?.channel!==void 0&&(y.channel=t.otp.channel),s.expiresAt!==void 0&&(y.codeExpiresAt=s.expiresAt),s.resendAvailableAt!==void 0&&(y.resendAvailableAt=s.resendAvailableAt),y}function Ze(e,t,o,i){let r=e.nniBound===!0?"bound":t.nniFromDocument===!0?"document":"typed",s=r==="typed"&&t.state==="input_required"&&t.reason==="nni_recheck",d=t.reason==="nni_not_found"&&t.state==="input_required"&&!i.attemptsExhausted&&e.methodChoice?.available===!0&&e.methodChoice.options.includes("document_photo");return{kind:"registry",key:"registry",context:o,section:A(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:s,canUseDocument:d,...i}}function Je(e,t,o,i){let r=[...t.acceptedSides??[]];return{kind:"document",key:"document",context:o,section:A(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:Se(e),...i}}function Qe(e){let t=e.steps.find(o=>o.checkType==="liveness");return t?.state==="passed"||t?.state==="review"}function he(e,t,o,i,r){let s=t.icao?.report;return{kind:"portrait",key:`portrait:${r}`,context:o,section:A(t),phase:r,report:Array.isArray(s)?s:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:L(e),retakeOnly:r==="capture"&&t.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&Qe(e),...i}}var K={minLongSidePx:1280,jpegQuality:.95};function je(e,t){let o=e.capture?.livePhoto;if(o?.oneCapture!==!0)return null;let i=e.steps.find(s=>s.checkType==="portrait_icao"),r=o.still??K;return{icao:t==="liveness"&&L(e)!==null&&i!==void 0&&i.state==="pending"&&i.reason===void 0,still:{minLongSidePx:r.minLongSidePx??K.minLongSidePx,jpegQuality:r.jpegQuality??K.jpegQuality}}}function $e(e,t,o,i){let r=t.eid,s=A(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:o,section:s,checkType:"eid_auth",reason:"update_required"};let d=e.methodChoice,f=d?.available===!0?d.options.find(u=>Be.includes(u)):void 0,g=f!==void 0&&t.state==="input_required"&&(t.reason!==void 0&&Ue.has(t.reason)||t.attemptsExhausted===!0||t.attemptsRemaining===0||t.reason==="eid_resend_limit"&&r.awaiting!=="code"),c={kind:"eid",key:"eid",context:o,section:s,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:g,afterPass:r.afterPass==="continue"?"continue":"end",...i};return g&&(c.cameraMethod=f),r.expiresAt!==void 0&&(c.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(c.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(c.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(c.codeAttemptsRemaining=r.codeAttemptsRemaining),c}function Xe(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let o=e.steps.find(i=>i.checkType==="portrait_icao");return o!==void 0&&(o.state==="passed"||o.state==="review")?o:null}function ze(e){return e.steps.some(t=>t.attemptsExhausted===!0)}function et(e,t){let o=e.failureReason,i;o===ye?i="platform_unsupported":e.status==="expired"?i="expired":e.status==="review_pending"?i="review":e.status==="completed"&&e.outcome==="approved"?i="approved":e.status==="completed"&&e.outcome==="review"?i="review":o==="device_cooldown"?i="cooldown":o!==void 0?i="policy_stop":ze(e)?i="attempts_exhausted":i="rejected";let r=i==="platform_unsupported"?{sessionId:e.sessionId,status:"unavailable"}:V(e,{autoRetry:!1}),s={kind:"result",key:"result",context:t,section:null,display:i,result:r};return o!==void 0&&(s.failureReason=o),e.retryAfter!==void 0&&(s.retryAfter=e.retryAfter),s}function tt(e,t){let o=e.identitySummary;if(o==null)return null;let i={kind:"identity_summary",key:"identity_summary",context:t,section:"identity",summaryKind:o.kind==="partial"?"partial":o.kind??"full",source:o.source,portraitAvailable:o.portrait?.available===!0,retakeAvailable:o.retakeAvailable===!0};for(let r of nt){let s=o[r];typeof s=="string"&&s!==""&&(i[r]=s)}return i}var nt=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","nniMasked","expiryDate","retakeTarget"];function _t(e,t={}){let o=Ke(e);if(x(e)||e.failureReason===ye)return et(e,o);let i=tt(e,o);if(i!==null)return i;let r=R(e);if(r!==null){let c=r.options.filter(y=>Ne.includes(y));if(c.length===0)return{kind:"unsupported",key:"unsupported:method",context:o,section:"identity",checkType:"method",reason:"platform_unsupported"};let u={kind:"method",key:"method",context:o,section:"identity",options:c};return c.includes("national_eid")&&r.nationalEid!==void 0&&(u.nationalEid=r.nationalEid),u}let s=T(e);if(s===void 0){let c=e.steps.find(u=>u.state==="processing");return{kind:"processing",key:"processing",context:o,section:c===void 0?null:A(c),stalled:!1}}let d=qe(s),f=s.checkType,g=A(s);switch(f){case"phone_otp":case"email_otp":{let c=e.otpChoice;return c!==void 0&&c.selected===null&&!c.locked?{kind:"contact_choice",key:"contact_choice",context:o,section:g,options:c.options.filter(u=>u==="phone"||u==="email"),selected:null,locked:!1}:We(e,s,o,d)}case"population_registry":return Ze(e,s,o,d);case"eid_auth":return $e(e,s,o,d);case"doc_ocr":return Je(e,s,o,d);case"portrait_icao":return he(e,s,o,d,"capture");case"liveness":case"face_match":{let c=Xe(e,s);if(c!==null)return he(e,c,o,d,"match");let u=s.requiresMobile===!0,y=L(e);return u&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:o,section:g,checkType:f}:{kind:"liveness",key:"biometric",context:o,section:g,mode:f==="face_match"?"selfie":"liveness",requiresMobile:u,instructions:y===null?"standard":"icao",icao:y,livePhoto:je(e,f),...d}}default:return{kind:"unsupported",key:`unsupported:${f}`,context:o,section:g,checkType:f,reason:f==="nfc_chip"?"platform_unsupported":"update_required"}}}export{Ee as a,ve as b,Me as c,we as d,Oe as e,lt as f,De as g,fe as h,Le as i,He as j,ft as k,Se as l,St as m,Ne as n,ye as o,A as p,Xe as q,_t as r};
@@ -1 +0,0 @@
1
- import{c as v,d as E}from"./chunk-4RS2YIL4.js";var L=new Set(["no_face","media_unreadable","clip_too_short","no_face_source","side_missing","unreadable","registry_unavailable","otp_mismatch","otp_expired","otp_send_failed","document_type_not_accepted","age_unverifiable","nationality_unreadable","liveness_inconclusive","match_inconclusive","document_authenticity","probe_not_from_liveness","chip_read_failed","chip_access_denied","chip_parse_failed","icao_pose","icao_eyes","icao_mouth","icao_occlusion","icao_lighting","icao_background","icao_resolution","portrait_not_from_liveness","nni_recheck","device_integrity_failed","eid_identifier_invalid","eid_code_invalid","eid_code_expired","eid_unavailable","eid_resend_too_soon"]);function Z(e){let t=e.methodChoice;if(t===void 0||!t.available||t.selected!==null)return null;let n=w(e)?.checkType;return n==="phone_otp"||n==="email_otp"?null:t}var F=new Set(["liveness","face_match"]);function C(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}function M(e){return e.status!=="created"&&e.status!=="in_progress"}function w(e){return e.steps.find(t=>C(t))}function S(e,t){return e.steps.find(n=>n.checkType===t)}function R(e,t){let n=t.steps.find(o=>o.checkType==="liveness"),i=t.steps.find(o=>o.checkType==="face_match");return S(e,"face_match")?.state==="pending"&&(n?.state==="passed"||n?.state==="review")&&i!==void 0&&i.state!=="pending"&&i.state!=="skipped"}function ee(e,t,n){let i=new Map(e.steps.map(r=>[r.checkType,r])),o=n==="liveness"&&R(e,t),s=t.steps.map(r=>{let u=i.get(r.checkType),a=u?.attemptsRemaining??0,c={...u??{},checkType:r.checkType,state:r.state,attemptsRemaining:r.checkType===n||r.checkType==="face_match"&&o?Math.max(0,a-1):a};return r.reason!==void 0?c.reason=r.reason:delete c.reason,r.attemptsExhausted!==void 0?c.attemptsExhausted=r.attemptsExhausted:delete c.attemptsExhausted,c});return{...e,status:t.status,outcome:t.outcome,failureReason:t.failureReason,steps:s,expiresAt:t.expiresAt}}function g(e,t){return t===void 0?{sessionId:e,status:"unavailable"}:{sessionId:e,status:"unavailable",reason:t}}function m(e,t,n){return n===void 0?{sessionId:e,status:t}:{sessionId:e,status:t,reason:n}}function te(e,t){let{sessionId:n}=e;switch(e.status){case"completed":return e.outcome==="approved"?{sessionId:n,status:"approved"}:e.outcome==="review"?m(n,"review",h(e,"review")):m(n,"rejected",h(e,"failed"));case"failed":{let s=m(n,"rejected",e.failureReason??h(e,"failed"));return e.failureReason==="device_cooldown"&&e.retryAfter!==void 0&&(s.retryAfter=e.retryAfter),s}case"review_pending":return m(n,"review",h(e,"review"));case"expired":return g(n);case"created":case"in_progress":break;default:{let s=e.status;throw new Error(`mapSessionResult: unhandled status ${s}`)}}let i=e.steps.find(s=>F.has(s.checkType)&&s.state==="input_required"&&s.reason!==void 0);if(i?.reason==="mobile_required")return g(n,"mobile_required");if(i?.reason!==void 0){let s=t.autoRetry&&L.has(i.reason)&&i.attemptsRemaining>0;return{sessionId:n,status:s?"retry":"rejected",reason:i.reason,attemptsRemaining:i.attemptsRemaining}}let o=w(e);return o===void 0&&e.steps.some(s=>s.state==="review")?m(n,"review",h(e,"review")):o?.checkType==="portrait_icao"?g(n,"portrait_required"):g(n)}function h(e,t){return e.steps.find(n=>n.state===t&&n.reason!==void 0)?.reason}function T(e,t,n,i,o){return e.presignCapture!==void 0?e.presignCapture(t,n,i,o):e.presign(t,n,i)}function V(e){return{...e?.engine!==void 0?{engine:e.engine}:{},...e?.clipMs!==void 0?{durationMs:e.clipMs}:{}}}var I=["video/webm","video/mp4"],x="image/jpeg",q=2,K=1e3,O=1e4,N=3,Y=10,B=30,D=3,U=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),$=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required"]),_=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}};function j(e){let t=e.steps.findIndex(i=>i.checkType==="liveness");return t<0?!1:e.steps.slice(t+1).find(i=>C(i))?.checkType==="face_match"}var y=class extends Error{constructor(t){super(t),this.name="AttestationError"}};async function A(e,t,n={}){let i=e.uuid(),o=!1,s=!1,r=0,u=0;for(;;)try{return await t(e.client,i)}catch(a){if(a instanceof y){if(s)throw a;s=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(a instanceof v))throw a;if(a.code==="consent_required"&&!o){o=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(a.code==="attestation_invalid"&&!s){s=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(a.code==="inference_unavailable"&&u<N){u+=1;let c=Math.min(a.retryAfterSeconds??Y,B);e.onBusy?.({attempt:u,retryAfterSeconds:c}),await e.sleep(c*1e3),n.onAttestationInvalid?.(),i=e.uuid();continue}if(U.has(a.code)&&r<q){r+=1;let c=a.retryAfterSeconds!==void 0?a.retryAfterSeconds*1e3:void 0;await e.sleep(c!==void 0?Math.min(c,O):K);continue}throw a}}var z=new Set(["passed","review","processing","skipped"]);async function re(e){let{artifacts:t}=e,n=t.clip,i=E(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!I.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let o=X(e,t.keyframe),s=W(e,n,i,o),r=G(e,o),u=!1,a=!1,c=!0,f=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let l=e.getView();if(M(l))return{kind:"settled"};let b=w(l)?.checkType,k=b==="liveness"&&!u?"liveness":b==="face_match"&&!a&&c?"face_match":null;if(k===null)return{kind:"settled"};if(k==="liveness"&&t.captureChannel==="desktop"&&S(l,"liveness")?.requiresMobile===!0)return{kind:"unavailable",reason:"mobile_required"};try{if(k==="liveness"){u=!0;let d=await s();if(e.isCancelled())return{kind:"cancelled"};a=R(l,d),e.applySubmit(d,"liveness");let p=S(e.getView(),"liveness")?.state;c=p===void 0||z.has(p)}else{a=!0;let d=await r();if(e.isCancelled())return{kind:"cancelled"};e.applySubmit(d,"face_match")}}catch(d){if(e.isCancelled()||d instanceof _)return{kind:"cancelled"};let p=Q(d);if(p.kind!=="resync"||f>=D)return p;f+=1,await e.refreshView()}}}function X(e,t){let n=null,i=null,o=()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let s=await T(e.client,"image",x,t.size,V(e.artifacts));return await e.client.uploadToSpaces(s.uploadUrl,t,x),n=(await e.client.completeMedia(s.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i);return{ensure:o,attempt:()=>o().catch(()=>null),current:()=>n}}function W(e,t,n,i){let o=null,s,r=null;return()=>A(e,async(u,a)=>{if(o===null||s===void 0){if(e.isCancelled())throw new _;s===void 0&&!j(e.getView())&&(s=null),e.onPhase("uploading");let[c,f]=await Promise.all([o!==null?Promise.resolve(o):(async()=>{let l=await T(u,"clip",n,t.size,V(e.artifacts));return await u.uploadToSpaces(l.uploadUrl,t,n),(await u.completeMedia(l.key)).key})(),s!==void 0?Promise.resolve(s===null?null:s.imageKey):i.attempt()]);o=c,s===void 0&&(s=f===null?null:{imageKey:f})}if(r===null)try{r=await e.getAttestation()}catch(c){throw new y(c instanceof Error?c.message:String(c))}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:o,attestation:r,captureChannel:e.artifacts.captureChannel,capture:J(e.artifacts),...s!==null?{faceMatch:s}:{}},{idempotencyKey:a})},{onAttestationInvalid:()=>{r=null}})}function G(e,t){return()=>A(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new _;e.onPhase("uploading")}let o=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:o},{idempotencyKey:i})})}function J(e){return{...e.engine!==void 0?{engine:e.engine}:{},width:e.width,height:e.height,...e.clipMs!==void 0?{clipMs:e.clipMs}:{},...e.cameraReadyMs!==void 0?{cameraReadyMs:e.cameraReadyMs}:{},...e.faceAcquireMs!==void 0?{faceAcquireMs:e.faceAcquireMs}:{},...e.captureMs!==void 0?{captureMs:e.captureMs}:{}}}function Q(e){if(e instanceof y)return{kind:"unavailable",reason:"attestation"};if(e instanceof v){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="method_required")return{kind:"unavailable",reason:"method_required"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if($.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}var P=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},H=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}};export{L as a,Z as b,C as c,M as d,w as e,S as f,ee as g,g as h,te as i,T as j,I as k,q as l,K as m,N as n,Y as o,y as p,A as q,re as r,P as s,H as t};
@@ -1 +0,0 @@
1
- import{u as a,v as b,w as c,x as d}from"./chunk-RNRFHUJA.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-RVHAKRAI.js";import"./chunk-7V2M6Y2W.js";import"./chunk-DQWW4OCK.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import"./chunk-LQ7C44JG.js";import"./chunk-OKWG3PVH.js";import"./chunk-DK5YPBDQ.js";export{a as SAME_FACE_MAX_DROPS,c as createDocumentCapture,d as createDocumentCaptureInternal,b as warmDocumentCapture};