@sekyro/web 0.1.0-rc.24 → 0.1.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +32 -2
- package/dist/{capture-session-doc-RIBBH3M4.js → capture-session-doc-WZMI5XPE.js} +1 -1
- package/dist/{capture-session-v3-CPHzDT7E.d.cts → capture-session-v3-BKSjJ6L0.d.cts} +1 -1
- package/dist/{capture-session-v3-TUPtnvmu.d.ts → capture-session-v3-C1I_GLC9.d.ts} +1 -1
- package/dist/challenge-frame-NUGPTWFP.js +1 -0
- package/dist/{chunk-MXWLCDFX.js → chunk-4DEPREJ3.js} +1 -1
- package/dist/{chunk-LBH6KGTV.js → chunk-65JZHKVG.js} +1 -1
- package/dist/{chunk-FLA42JCK.js → chunk-7MZW3FFH.js} +1 -1
- package/dist/chunk-DVTK2DGX.js +1 -0
- package/dist/chunk-GPFAPAS6.js +3 -0
- package/dist/chunk-HVW2AB35.js +1 -0
- package/dist/{chunk-IFLOS5OT.js → chunk-LLX2CKZ3.js} +1 -1
- package/dist/chunk-LV23FCYP.js +1 -0
- package/dist/{chunk-TDLIXFDT.js → chunk-NFHLJOHW.js} +1 -1
- package/dist/{chunk-5YVQIHQA.js → chunk-OVP7FAMJ.js} +1 -1
- package/dist/{chunk-XI5FXEKC.js → chunk-XOTKATN6.js} +1 -1
- package/dist/chunk-ZCW6PNUX.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +1 -1
- package/dist/create-document-capture-OXPLKHOF.js +1 -0
- package/dist/{create-verification-acQzNRiB.d.ts → create-verification-7wPXJN_P.d.ts} +287 -120
- package/dist/{create-verification-DF60lg8Y.d.cts → create-verification-YeuI7_B0.d.cts} +287 -120
- package/dist/{detector-scanic-YCDNLCGV.js → detector-scanic-23DAYT3H.js} +1 -1
- package/dist/{icao-gate-CX0chQMM.d.cts → icao-gate-BK8TGaCk.d.ts} +1 -1
- package/dist/{icao-gate-VwsQo8Bq.d.ts → icao-gate-pD2dUV3P.d.cts} +1 -1
- package/dist/{icao-policy-WnG2OSyp.d.cts → icao-policy-CdR6PFHS.d.cts} +2 -2
- package/dist/{icao-policy-B02jDiox.d.ts → icao-policy-qJpZOOOu.d.ts} +2 -2
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +3 -1
- package/dist/internal/index.d.cts +69 -114
- package/dist/internal/index.d.ts +69 -114
- package/dist/internal/index.js +1 -1
- package/dist/plan-runner-EP26JU6A.js +1 -0
- package/dist/{types-1s8CQrEN.d.ts → types-DB-cZTSn.d.cts} +156 -29
- package/dist/{types-1s8CQrEN.d.cts → types-DB-cZTSn.d.ts} +156 -29
- package/dist/upload-file-EGXXM6TQ.js +1 -0
- package/package.json +1 -1
- package/sbom.cdx.json +10 -10
- package/dist/chunk-DMOGKGDS.js +0 -1
- package/dist/chunk-IC6TI6GV.js +0 -1
- package/dist/chunk-MQBX4DQQ.js +0 -1
- package/dist/chunk-QY6TJCOJ.js +0 -1
- package/dist/chunk-TDCLQRT4.js +0 -1
- package/dist/create-document-capture-XQURFZZK.js +0 -1
- package/dist/plan-runner-LDV4PYN7.js +0 -1
- package/dist/turnstile-52B3RFXD.js +0 -1
- package/dist/upload-file-UYXOHCRG.js +0 -1
|
@@ -1,11 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { b5 as SubmitRuntime, a4 as LivenessCaptureOptions, a3 as LivenessCaptureHandle, aQ as VerificationStep, aO as VerificationResult, aF as StepSnapshot, $ as LivePhotoGateUpdate, b6 as HostedClientLike, b7 as DocCatalogEntry, b8 as LiveMrzTuning, b9 as TextLockTuning, ba as OcrEngineClient, bb as DocAssistReport, bc as ReadyInfo, bd as LoadFailure, be as OcrEngineOptions } from '../create-verification-YeuI7_B0.cjs';
|
|
2
|
+
export { bf as ANALYSIS_LONG_EDGE, bg as ASPECT_BANDS, bh as AttestationError, bi as BLUR_REFUSE_SHARPNESS_MAX, bj as BlurStatus, bk as CAPTURE_CANDIDATE_SPACING_MS, bl as CAPTURE_EXTRA_CANDIDATES, bm as CHALLENGE_EXECUTE_TIMEOUT_MS, bn as CHALLENGE_READY_TIMEOUT_MS, bo as CLIP_MIME_ALLOWLIST, bp as CaptureEngine, bq as CaptureSessionDoc, br as CaptureSessionDocEvents, bs as CaptureSessionDocOptions, bt as ChallengeAction, bu as ChallengeError, m as ChallengeErrorCode, bv as DOC_ANALYSIS_DEFAULTS, bw as DOC_BLACK_FRAME_LUMA, bx as DOC_BLACK_FRAME_TICKS, by as DOC_CADENCE_HZ, bz as DOC_CAMERA_TUNING_DEFAULTS, bA as DOC_CATALOG, bB as DOC_DETECT_WIDTH, bC as DOC_FEEDBACK_STATES, bD as DOC_FIRST_FRAME_MS, bE as DOC_GATE_V1_DEFAULTS, bF as DOC_SHUTTER_DEFAULTS, bG as DeviceReadHint, bH as DocArtifacts, bI as DocAssist, bJ as DocAssistEngine, bK as DocAssistTick, bL as DocCameraTuning, bM as DocCaptureReport, bN as DocCaptureVia, bO as DocChecksPayload, bP as DocEngineLike, bQ as DocFeedbackAggregator, bR as DocFeedbackKey, bS as DocFeedbackState, bT as DocFormat, bU as DocFrameAnalysis, bV as DocFrameMeasures, bW as DocGateQuality, bX as DocGateThresholds, bY as DocGateTick, bZ as DocGateTickInput, b_ as DocGateV1, b$ as DocQuad, c0 as DocQuadPoint, c1 as DocShutterReason, c2 as DocShutterTuning, c3 as DocSide, c4 as DocumentCaptureController, c5 as DocumentCaptureInternals, c6 as EMPTY_GUIDE_METRICS, c7 as EncodedDocument, c8 as ExecuteChallengeOptions, c9 as FLIP_FILL_MIN, ca as FLIP_GAP_MS, cb as FLIP_TIMEOUT_MS, cc as FocusCaps, cd as FramingStatus, ce as GUIDE_LOCK_DEFAULTS, cf as GlareStatus, cg as GrabbedFrame, ch as GuideBlocker, ci as GuideLock, cj as GuideLockTick, ck as GuideLockTuning, cl as GuideMetrics, cm as GuideRect, cn as INFERENCE_RETRY_ATTEMPTS, co as INFERENCE_RETRY_DEFAULT_S, X as ISSUER_CODES, cp as LANDMARKER_MODEL, cq as LENS_STORAGE_KEY, cr as LIVE_MRZ_DEFAULTS, cs as LIVE_PHOTO_IDLE_MS, ct as LIVE_PHOTO_MAX_HZ, cu as LandmarkedFace, cv as LandmarkerLike, cw as LensSource, cx as LightingStatus, cy as LiveMrzCapture, cz as LiveMrzState, cA as LivePhotoGate, cB as LivePhotoKit, cC as LivePhotoKitInternals, cD as LivePhotoKitOptions, cE as LivePhotoStill, cF as LivenessCaptureInternalHandle, cG as LivenessCaptureInternals, cH as LivenessFlowDeps, cI as LivenessFlowOutcome, cJ as MANUAL_SHUTTER_MS, cK as MR_DOC_CATALOG, cL as NO_REPORT_MS, cM as OpenDocCameraDeps, cN as PORTRAIT_JPEG_QUALITY, cO as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cP as PRELOAD_BUDGET_MS, cQ as PROCESSING_POLL_DELAY_MS, cR as PROCESSING_POLL_MAX, cS as PortraitCaptureController, cT as PortraitCaptureInternals, cU as REGISTRY_RETRY_DELAY_MS, cV as ReticleType, cW as SAME_FACE_MAX_DROPS, cX as ScanEvent, cY as ScanLayout, cZ as ScanNotice, c_ as ScanPhase, c$ as ScanReport, d0 as ScanSide, d1 as ScanState, d2 as SubmitExecutor, d3 as TEXT_LOCK_DEFAULTS, d4 as TRANSPORT_REPLAY_ATTEMPTS, d5 as TRANSPORT_REPLAY_DELAY_MS, d6 as VerificationInternals, d7 as analyzeDocFrame, d8 as analyzeGuide, d9 as aspectBand, da as aspectFits, db as buildDeviceReadHint, dc as coverPointToVideo, dd as createDocumentCaptureInternal, de as createFaceLandmarker, df as createLivePhotoKit, dg as createLivenessCaptureInternal, dh as createPortraitCaptureInternal, di as createVerificationInternal, dj as docZoomFor, dk as encodeDocumentImage, dl as executeChallenge, dm as facesOf, dn as feedbackVoteOf, dp as focusOk, dq as guideQuad, dr as guideRegionInFrame, ds as initialScanState, dt as mapEngineState, du as mapErrorKind, dv as mapGuidanceHint, dw as nextScanState, dx as observePortraitFrame, dy as openDocCamera, dz as passportBandOf, dA as portraitMatchStep, dB as preloadedDetectorFactory, dC as quadAreaFrac, dD as quadBounds, dE as quadIou, dF as quadTiltRatio, dG as randomUuid, dH as readStoredLens, dI as resetChallengeFrameForTests, dJ as resetLivenessAssetsForTests, dK as resolveDocCameraTuning, dL as resolveDocShutterTuning, dM as resolveGuideLockTuning, dN as runLivenessFlow, dO as runSubmission, dP as scannerFormatFor, dQ as setPreloadLoaderForTests, dR as settledHint, dS as singleShotFocusAt, dT as specularFraction, dU as supportsFocusMode, dV as warmDocDetector, dW as writeStoredLens } from '../create-verification-YeuI7_B0.cjs';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-CVqpMNGA.cjs';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-
|
|
4
|
+
import { W as HostedSessionView, h as CheckType, ar as PlanStepView } from '../types-DB-cZTSn.cjs';
|
|
5
|
+
export { bb as ICAO_FALLBACK, b5 as IcaoCaptureTuning, bc as IcaoProfile, bd as ResolvedIcaoTuning, be as resolveIcaoTuning } from '../types-DB-cZTSn.cjs';
|
|
6
|
+
export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-pD2dUV3P.cjs';
|
|
7
7
|
import '../detect-worker-CHqsPJoM.cjs';
|
|
8
|
-
import '../capture-session-v3-
|
|
8
|
+
import '../capture-session-v3-BKSjJ6L0.cjs';
|
|
9
|
+
|
|
10
|
+
/** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
|
|
11
|
+
declare const PROCESSING_BACKOFF_MS: readonly number[];
|
|
12
|
+
/** Hosted parity: a resend is offered 30 s after the last send. */
|
|
13
|
+
declare const OTP_RESEND_COOLDOWN_MS = 30000;
|
|
14
|
+
type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
15
|
+
interface RunnerDeps {
|
|
16
|
+
runtime: SubmitRuntime;
|
|
17
|
+
currentView(): HostedSessionView | null;
|
|
18
|
+
ensureView(): Promise<HostedSessionView>;
|
|
19
|
+
refreshView(): Promise<HostedSessionView>;
|
|
20
|
+
ensureConsent(): Promise<void>;
|
|
21
|
+
liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
22
|
+
/** A liveness submission chain is in flight (do not flip the UI mid-upload). */
|
|
23
|
+
chainBusy(): boolean;
|
|
24
|
+
destroyed(): boolean;
|
|
25
|
+
sleep(ms: number): Promise<void>;
|
|
26
|
+
isMobile(): boolean;
|
|
27
|
+
now(): number;
|
|
28
|
+
emitStep(step: VerificationStep): void;
|
|
29
|
+
emitResult(result: VerificationResult): void;
|
|
30
|
+
/**
|
|
31
|
+
* The promoted face_match probe key of the last liveness submission (profile
|
|
32
|
+
* v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
|
|
33
|
+
* `pending` face_match is resubmitted with it — no new capture. `null` when
|
|
34
|
+
* no liveness was submitted from this page (e.g. after a reload).
|
|
35
|
+
*/
|
|
36
|
+
keptFaceKey?(): string | null;
|
|
37
|
+
/** Task 4: binds the document step (selectDocument + capture). */
|
|
38
|
+
bindDocument?(snapshot: Extract<StepSnapshot, {
|
|
39
|
+
kind: "document";
|
|
40
|
+
}>, republish: () => void): VerificationStep;
|
|
41
|
+
/** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
|
|
42
|
+
bindPortrait?(snapshot: Extract<StepSnapshot, {
|
|
43
|
+
kind: "portrait";
|
|
44
|
+
}>, republish: () => void): VerificationStep;
|
|
45
|
+
/** Spec 2026-11-10 §7.4: binds the proof of address step (uploads, the page camera, `poa` submissions). */
|
|
46
|
+
bindProofOfAddress?(snapshot: Extract<StepSnapshot, {
|
|
47
|
+
kind: "proof_of_address";
|
|
48
|
+
}>, republish: () => void): VerificationStep;
|
|
49
|
+
/** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
|
|
50
|
+
setView?(view: HostedSessionView): void;
|
|
51
|
+
/** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
|
|
52
|
+
onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
|
|
53
|
+
/** Stops every camera of the session (a skipped capture in a simulated session). */
|
|
54
|
+
stopCameras?(): void;
|
|
55
|
+
}
|
|
56
|
+
interface StepRunner {
|
|
57
|
+
run(): Promise<VerificationStep>;
|
|
58
|
+
current(): VerificationStep | null;
|
|
59
|
+
/** Called by the verification on every view update. */
|
|
60
|
+
onView(view: HostedSessionView): void;
|
|
61
|
+
/** Called when the liveness chain becomes idle. */
|
|
62
|
+
onChainIdle(): void;
|
|
63
|
+
/** Re-derive from the current view and publish even if unchanged (local overlay changed). */
|
|
64
|
+
republish(): void;
|
|
65
|
+
/** Submit one step input (exposed for the document binding, Task 4). */
|
|
66
|
+
submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
|
|
67
|
+
/** "Skip with test data" answered the liveness or the portrait on this page: a following match has no probe. */
|
|
68
|
+
faceProbeSkipped(): boolean;
|
|
69
|
+
}
|
|
70
|
+
declare function createStepRunner(deps: RunnerDeps): StepRunner;
|
|
9
71
|
|
|
10
72
|
/** At most this many ranked lenses are tried (each costs a camera reopen). */
|
|
11
73
|
declare const LENS_TRY_MAX = 3;
|
|
@@ -273,64 +335,6 @@ declare const OCR_ASSET_SET: {
|
|
|
273
335
|
};
|
|
274
336
|
};
|
|
275
337
|
|
|
276
|
-
/** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
|
|
277
|
-
declare const PROCESSING_BACKOFF_MS: readonly number[];
|
|
278
|
-
/** Hosted parity: a resend is offered 30 s after the last send. */
|
|
279
|
-
declare const OTP_RESEND_COOLDOWN_MS = 30000;
|
|
280
|
-
type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
281
|
-
interface RunnerDeps {
|
|
282
|
-
runtime: SubmitRuntime;
|
|
283
|
-
currentView(): HostedSessionView | null;
|
|
284
|
-
ensureView(): Promise<HostedSessionView>;
|
|
285
|
-
refreshView(): Promise<HostedSessionView>;
|
|
286
|
-
ensureConsent(): Promise<void>;
|
|
287
|
-
liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
288
|
-
/** A liveness submission chain is in flight (do not flip the UI mid-upload). */
|
|
289
|
-
chainBusy(): boolean;
|
|
290
|
-
destroyed(): boolean;
|
|
291
|
-
sleep(ms: number): Promise<void>;
|
|
292
|
-
isMobile(): boolean;
|
|
293
|
-
now(): number;
|
|
294
|
-
emitStep(step: VerificationStep): void;
|
|
295
|
-
emitResult(result: VerificationResult): void;
|
|
296
|
-
/**
|
|
297
|
-
* The promoted face_match probe key of the last liveness submission (profile
|
|
298
|
-
* v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
|
|
299
|
-
* `pending` face_match is resubmitted with it — no new capture. `null` when
|
|
300
|
-
* no liveness was submitted from this page (e.g. after a reload).
|
|
301
|
-
*/
|
|
302
|
-
keptFaceKey?(): string | null;
|
|
303
|
-
/** Task 4: binds the document step (selectDocument + capture). */
|
|
304
|
-
bindDocument?(snapshot: Extract<StepSnapshot, {
|
|
305
|
-
kind: "document";
|
|
306
|
-
}>, republish: () => void): VerificationStep;
|
|
307
|
-
/** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
|
|
308
|
-
bindPortrait?(snapshot: Extract<StepSnapshot, {
|
|
309
|
-
kind: "portrait";
|
|
310
|
-
}>, republish: () => void): VerificationStep;
|
|
311
|
-
/** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
|
|
312
|
-
setView?(view: HostedSessionView): void;
|
|
313
|
-
/** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
|
|
314
|
-
onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
|
|
315
|
-
/** Stops every camera of the session (a skipped capture in a simulated session). */
|
|
316
|
-
stopCameras?(): void;
|
|
317
|
-
}
|
|
318
|
-
interface StepRunner {
|
|
319
|
-
run(): Promise<VerificationStep>;
|
|
320
|
-
current(): VerificationStep | null;
|
|
321
|
-
/** Called by the verification on every view update. */
|
|
322
|
-
onView(view: HostedSessionView): void;
|
|
323
|
-
/** Called when the liveness chain becomes idle. */
|
|
324
|
-
onChainIdle(): void;
|
|
325
|
-
/** Re-derive from the current view and publish even if unchanged (local overlay changed). */
|
|
326
|
-
republish(): void;
|
|
327
|
-
/** Submit one step input (exposed for the document binding, Task 4). */
|
|
328
|
-
submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
|
|
329
|
-
/** "Skip with test data" answered the liveness or the portrait on this page: a following match has no probe. */
|
|
330
|
-
faceProbeSkipped(): boolean;
|
|
331
|
-
}
|
|
332
|
-
declare function createStepRunner(deps: RunnerDeps): StepRunner;
|
|
333
|
-
|
|
334
338
|
/** A check the browser may still submit. */
|
|
335
339
|
declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
|
|
336
340
|
/** The session accepts no further submissions. */
|
|
@@ -365,55 +369,6 @@ interface ResultOptions {
|
|
|
365
369
|
previous?: HostedSessionView;
|
|
366
370
|
}
|
|
367
371
|
|
|
368
|
-
declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
|
|
369
|
-
/**
|
|
370
|
-
* Bound on a single execute round-trip (challenge fetch + solve). A healthy
|
|
371
|
-
* invisible challenge settles in a few seconds, but on slow phones and networks
|
|
372
|
-
* it routinely takes 10 to 20 s: 10 s failed a third of real sessions
|
|
373
|
-
* (incident 2026-11-10), so the bound is 30 s. A failed or timed-out challenge
|
|
374
|
-
* is retried once on a fresh widget.
|
|
375
|
-
*/
|
|
376
|
-
declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
|
|
377
|
-
interface TurnstileRenderParams {
|
|
378
|
-
sitekey: string;
|
|
379
|
-
callback: (token: string) => void;
|
|
380
|
-
"error-callback"?: (code?: string) => void;
|
|
381
|
-
execution?: "render" | "execute";
|
|
382
|
-
appearance?: "always" | "execute" | "interaction-only";
|
|
383
|
-
}
|
|
384
|
-
/** The subset of the Turnstile JS API this module uses. */
|
|
385
|
-
interface TurnstileApi {
|
|
386
|
-
render(container: HTMLElement, params: TurnstileRenderParams): string | undefined;
|
|
387
|
-
execute(widgetId: string): void;
|
|
388
|
-
reset(widgetId: string): void;
|
|
389
|
-
remove(widgetId: string): void;
|
|
390
|
-
}
|
|
391
|
-
/** Test-only: reset the module singletons between cases. */
|
|
392
|
-
declare function resetTurnstileForTests(): void;
|
|
393
|
-
/** Load the Turnstile script once (singleton; a load failure resets it so a
|
|
394
|
-
* retry can re-attempt). */
|
|
395
|
-
declare function loadTurnstile(): Promise<TurnstileApi>;
|
|
396
|
-
/** Options of {@link executeTurnstile}. */
|
|
397
|
-
interface ExecuteTurnstileOptions {
|
|
398
|
-
/** Bound on the challenge round-trip; default {@link TURNSTILE_EXECUTE_TIMEOUT_MS}. */
|
|
399
|
-
timeoutMs?: number;
|
|
400
|
-
/**
|
|
401
|
-
* Aborts the challenge: the promise rejects and the widget, its container and
|
|
402
|
-
* the timeout are cleaned up at once. `createVerification().destroy()` passes
|
|
403
|
-
* its own signal so a torn-down verification never leaves a widget behind.
|
|
404
|
-
*/
|
|
405
|
-
signal?: AbortSignal;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Run one invisible execute-mode challenge on the kept widget and resolve its
|
|
409
|
-
* token. A challenge error, a load/render failure or a challenge that does not
|
|
410
|
-
* settle within the timeout removes the widget and runs the challenge ONCE more
|
|
411
|
-
* on a freshly rendered widget; only then does the promise reject. An abort
|
|
412
|
-
* (`signal`) rejects at once, without the second attempt. The verification
|
|
413
|
-
* submits without a token when this rejects, so the server decides.
|
|
414
|
-
*/
|
|
415
|
-
declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
|
|
416
|
-
|
|
417
372
|
/**
|
|
418
373
|
* Face of a decoded still: an MRZ band means the verso. With `cardOnly` (the still is the card itself) the band must
|
|
419
374
|
* sit in its lower half, where a card's MRZ is: the line of print across a recto's top (the issuing state) is not one.
|
|
@@ -492,4 +447,4 @@ declare function measureRegionSharpness(image: RawImage, region: StillRegion | n
|
|
|
492
447
|
*/
|
|
493
448
|
declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
|
|
494
449
|
|
|
495
|
-
export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId,
|
|
450
|
+
export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, HostedClientLike, LENS_TRY_MAX, type LensKind, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TextLockTuning, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, lensKindOf, liveMrzWireReport, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, photoSharpness, rankBackCameras, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,11 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { b5 as SubmitRuntime, a4 as LivenessCaptureOptions, a3 as LivenessCaptureHandle, aQ as VerificationStep, aO as VerificationResult, aF as StepSnapshot, $ as LivePhotoGateUpdate, b6 as HostedClientLike, b7 as DocCatalogEntry, b8 as LiveMrzTuning, b9 as TextLockTuning, ba as OcrEngineClient, bb as DocAssistReport, bc as ReadyInfo, bd as LoadFailure, be as OcrEngineOptions } from '../create-verification-7wPXJN_P.js';
|
|
2
|
+
export { bf as ANALYSIS_LONG_EDGE, bg as ASPECT_BANDS, bh as AttestationError, bi as BLUR_REFUSE_SHARPNESS_MAX, bj as BlurStatus, bk as CAPTURE_CANDIDATE_SPACING_MS, bl as CAPTURE_EXTRA_CANDIDATES, bm as CHALLENGE_EXECUTE_TIMEOUT_MS, bn as CHALLENGE_READY_TIMEOUT_MS, bo as CLIP_MIME_ALLOWLIST, bp as CaptureEngine, bq as CaptureSessionDoc, br as CaptureSessionDocEvents, bs as CaptureSessionDocOptions, bt as ChallengeAction, bu as ChallengeError, m as ChallengeErrorCode, bv as DOC_ANALYSIS_DEFAULTS, bw as DOC_BLACK_FRAME_LUMA, bx as DOC_BLACK_FRAME_TICKS, by as DOC_CADENCE_HZ, bz as DOC_CAMERA_TUNING_DEFAULTS, bA as DOC_CATALOG, bB as DOC_DETECT_WIDTH, bC as DOC_FEEDBACK_STATES, bD as DOC_FIRST_FRAME_MS, bE as DOC_GATE_V1_DEFAULTS, bF as DOC_SHUTTER_DEFAULTS, bG as DeviceReadHint, bH as DocArtifacts, bI as DocAssist, bJ as DocAssistEngine, bK as DocAssistTick, bL as DocCameraTuning, bM as DocCaptureReport, bN as DocCaptureVia, bO as DocChecksPayload, bP as DocEngineLike, bQ as DocFeedbackAggregator, bR as DocFeedbackKey, bS as DocFeedbackState, bT as DocFormat, bU as DocFrameAnalysis, bV as DocFrameMeasures, bW as DocGateQuality, bX as DocGateThresholds, bY as DocGateTick, bZ as DocGateTickInput, b_ as DocGateV1, b$ as DocQuad, c0 as DocQuadPoint, c1 as DocShutterReason, c2 as DocShutterTuning, c3 as DocSide, c4 as DocumentCaptureController, c5 as DocumentCaptureInternals, c6 as EMPTY_GUIDE_METRICS, c7 as EncodedDocument, c8 as ExecuteChallengeOptions, c9 as FLIP_FILL_MIN, ca as FLIP_GAP_MS, cb as FLIP_TIMEOUT_MS, cc as FocusCaps, cd as FramingStatus, ce as GUIDE_LOCK_DEFAULTS, cf as GlareStatus, cg as GrabbedFrame, ch as GuideBlocker, ci as GuideLock, cj as GuideLockTick, ck as GuideLockTuning, cl as GuideMetrics, cm as GuideRect, cn as INFERENCE_RETRY_ATTEMPTS, co as INFERENCE_RETRY_DEFAULT_S, X as ISSUER_CODES, cp as LANDMARKER_MODEL, cq as LENS_STORAGE_KEY, cr as LIVE_MRZ_DEFAULTS, cs as LIVE_PHOTO_IDLE_MS, ct as LIVE_PHOTO_MAX_HZ, cu as LandmarkedFace, cv as LandmarkerLike, cw as LensSource, cx as LightingStatus, cy as LiveMrzCapture, cz as LiveMrzState, cA as LivePhotoGate, cB as LivePhotoKit, cC as LivePhotoKitInternals, cD as LivePhotoKitOptions, cE as LivePhotoStill, cF as LivenessCaptureInternalHandle, cG as LivenessCaptureInternals, cH as LivenessFlowDeps, cI as LivenessFlowOutcome, cJ as MANUAL_SHUTTER_MS, cK as MR_DOC_CATALOG, cL as NO_REPORT_MS, cM as OpenDocCameraDeps, cN as PORTRAIT_JPEG_QUALITY, cO as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cP as PRELOAD_BUDGET_MS, cQ as PROCESSING_POLL_DELAY_MS, cR as PROCESSING_POLL_MAX, cS as PortraitCaptureController, cT as PortraitCaptureInternals, cU as REGISTRY_RETRY_DELAY_MS, cV as ReticleType, cW as SAME_FACE_MAX_DROPS, cX as ScanEvent, cY as ScanLayout, cZ as ScanNotice, c_ as ScanPhase, c$ as ScanReport, d0 as ScanSide, d1 as ScanState, d2 as SubmitExecutor, d3 as TEXT_LOCK_DEFAULTS, d4 as TRANSPORT_REPLAY_ATTEMPTS, d5 as TRANSPORT_REPLAY_DELAY_MS, d6 as VerificationInternals, d7 as analyzeDocFrame, d8 as analyzeGuide, d9 as aspectBand, da as aspectFits, db as buildDeviceReadHint, dc as coverPointToVideo, dd as createDocumentCaptureInternal, de as createFaceLandmarker, df as createLivePhotoKit, dg as createLivenessCaptureInternal, dh as createPortraitCaptureInternal, di as createVerificationInternal, dj as docZoomFor, dk as encodeDocumentImage, dl as executeChallenge, dm as facesOf, dn as feedbackVoteOf, dp as focusOk, dq as guideQuad, dr as guideRegionInFrame, ds as initialScanState, dt as mapEngineState, du as mapErrorKind, dv as mapGuidanceHint, dw as nextScanState, dx as observePortraitFrame, dy as openDocCamera, dz as passportBandOf, dA as portraitMatchStep, dB as preloadedDetectorFactory, dC as quadAreaFrac, dD as quadBounds, dE as quadIou, dF as quadTiltRatio, dG as randomUuid, dH as readStoredLens, dI as resetChallengeFrameForTests, dJ as resetLivenessAssetsForTests, dK as resolveDocCameraTuning, dL as resolveDocShutterTuning, dM as resolveGuideLockTuning, dN as runLivenessFlow, dO as runSubmission, dP as scannerFormatFor, dQ as setPreloadLoaderForTests, dR as settledHint, dS as singleShotFocusAt, dT as specularFraction, dU as supportsFocusMode, dV as warmDocDetector, dW as writeStoredLens } from '../create-verification-7wPXJN_P.js';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-CVqpMNGA.js';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-
|
|
4
|
+
import { W as HostedSessionView, h as CheckType, ar as PlanStepView } from '../types-DB-cZTSn.js';
|
|
5
|
+
export { bb as ICAO_FALLBACK, b5 as IcaoCaptureTuning, bc as IcaoProfile, bd as ResolvedIcaoTuning, be as resolveIcaoTuning } from '../types-DB-cZTSn.js';
|
|
6
|
+
export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-BK8TGaCk.js';
|
|
7
7
|
import '../detect-worker-CHqsPJoM.js';
|
|
8
|
-
import '../capture-session-v3-
|
|
8
|
+
import '../capture-session-v3-C1I_GLC9.js';
|
|
9
|
+
|
|
10
|
+
/** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
|
|
11
|
+
declare const PROCESSING_BACKOFF_MS: readonly number[];
|
|
12
|
+
/** Hosted parity: a resend is offered 30 s after the last send. */
|
|
13
|
+
declare const OTP_RESEND_COOLDOWN_MS = 30000;
|
|
14
|
+
type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
15
|
+
interface RunnerDeps {
|
|
16
|
+
runtime: SubmitRuntime;
|
|
17
|
+
currentView(): HostedSessionView | null;
|
|
18
|
+
ensureView(): Promise<HostedSessionView>;
|
|
19
|
+
refreshView(): Promise<HostedSessionView>;
|
|
20
|
+
ensureConsent(): Promise<void>;
|
|
21
|
+
liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
22
|
+
/** A liveness submission chain is in flight (do not flip the UI mid-upload). */
|
|
23
|
+
chainBusy(): boolean;
|
|
24
|
+
destroyed(): boolean;
|
|
25
|
+
sleep(ms: number): Promise<void>;
|
|
26
|
+
isMobile(): boolean;
|
|
27
|
+
now(): number;
|
|
28
|
+
emitStep(step: VerificationStep): void;
|
|
29
|
+
emitResult(result: VerificationResult): void;
|
|
30
|
+
/**
|
|
31
|
+
* The promoted face_match probe key of the last liveness submission (profile
|
|
32
|
+
* v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
|
|
33
|
+
* `pending` face_match is resubmitted with it — no new capture. `null` when
|
|
34
|
+
* no liveness was submitted from this page (e.g. after a reload).
|
|
35
|
+
*/
|
|
36
|
+
keptFaceKey?(): string | null;
|
|
37
|
+
/** Task 4: binds the document step (selectDocument + capture). */
|
|
38
|
+
bindDocument?(snapshot: Extract<StepSnapshot, {
|
|
39
|
+
kind: "document";
|
|
40
|
+
}>, republish: () => void): VerificationStep;
|
|
41
|
+
/** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
|
|
42
|
+
bindPortrait?(snapshot: Extract<StepSnapshot, {
|
|
43
|
+
kind: "portrait";
|
|
44
|
+
}>, republish: () => void): VerificationStep;
|
|
45
|
+
/** Spec 2026-11-10 §7.4: binds the proof of address step (uploads, the page camera, `poa` submissions). */
|
|
46
|
+
bindProofOfAddress?(snapshot: Extract<StepSnapshot, {
|
|
47
|
+
kind: "proof_of_address";
|
|
48
|
+
}>, republish: () => void): VerificationStep;
|
|
49
|
+
/** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
|
|
50
|
+
setView?(view: HostedSessionView): void;
|
|
51
|
+
/** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
|
|
52
|
+
onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
|
|
53
|
+
/** Stops every camera of the session (a skipped capture in a simulated session). */
|
|
54
|
+
stopCameras?(): void;
|
|
55
|
+
}
|
|
56
|
+
interface StepRunner {
|
|
57
|
+
run(): Promise<VerificationStep>;
|
|
58
|
+
current(): VerificationStep | null;
|
|
59
|
+
/** Called by the verification on every view update. */
|
|
60
|
+
onView(view: HostedSessionView): void;
|
|
61
|
+
/** Called when the liveness chain becomes idle. */
|
|
62
|
+
onChainIdle(): void;
|
|
63
|
+
/** Re-derive from the current view and publish even if unchanged (local overlay changed). */
|
|
64
|
+
republish(): void;
|
|
65
|
+
/** Submit one step input (exposed for the document binding, Task 4). */
|
|
66
|
+
submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
|
|
67
|
+
/** "Skip with test data" answered the liveness or the portrait on this page: a following match has no probe. */
|
|
68
|
+
faceProbeSkipped(): boolean;
|
|
69
|
+
}
|
|
70
|
+
declare function createStepRunner(deps: RunnerDeps): StepRunner;
|
|
9
71
|
|
|
10
72
|
/** At most this many ranked lenses are tried (each costs a camera reopen). */
|
|
11
73
|
declare const LENS_TRY_MAX = 3;
|
|
@@ -273,64 +335,6 @@ declare const OCR_ASSET_SET: {
|
|
|
273
335
|
};
|
|
274
336
|
};
|
|
275
337
|
|
|
276
|
-
/** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
|
|
277
|
-
declare const PROCESSING_BACKOFF_MS: readonly number[];
|
|
278
|
-
/** Hosted parity: a resend is offered 30 s after the last send. */
|
|
279
|
-
declare const OTP_RESEND_COOLDOWN_MS = 30000;
|
|
280
|
-
type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
281
|
-
interface RunnerDeps {
|
|
282
|
-
runtime: SubmitRuntime;
|
|
283
|
-
currentView(): HostedSessionView | null;
|
|
284
|
-
ensureView(): Promise<HostedSessionView>;
|
|
285
|
-
refreshView(): Promise<HostedSessionView>;
|
|
286
|
-
ensureConsent(): Promise<void>;
|
|
287
|
-
liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
288
|
-
/** A liveness submission chain is in flight (do not flip the UI mid-upload). */
|
|
289
|
-
chainBusy(): boolean;
|
|
290
|
-
destroyed(): boolean;
|
|
291
|
-
sleep(ms: number): Promise<void>;
|
|
292
|
-
isMobile(): boolean;
|
|
293
|
-
now(): number;
|
|
294
|
-
emitStep(step: VerificationStep): void;
|
|
295
|
-
emitResult(result: VerificationResult): void;
|
|
296
|
-
/**
|
|
297
|
-
* The promoted face_match probe key of the last liveness submission (profile
|
|
298
|
-
* v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
|
|
299
|
-
* `pending` face_match is resubmitted with it — no new capture. `null` when
|
|
300
|
-
* no liveness was submitted from this page (e.g. after a reload).
|
|
301
|
-
*/
|
|
302
|
-
keptFaceKey?(): string | null;
|
|
303
|
-
/** Task 4: binds the document step (selectDocument + capture). */
|
|
304
|
-
bindDocument?(snapshot: Extract<StepSnapshot, {
|
|
305
|
-
kind: "document";
|
|
306
|
-
}>, republish: () => void): VerificationStep;
|
|
307
|
-
/** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
|
|
308
|
-
bindPortrait?(snapshot: Extract<StepSnapshot, {
|
|
309
|
-
kind: "portrait";
|
|
310
|
-
}>, republish: () => void): VerificationStep;
|
|
311
|
-
/** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
|
|
312
|
-
setView?(view: HostedSessionView): void;
|
|
313
|
-
/** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
|
|
314
|
-
onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
|
|
315
|
-
/** Stops every camera of the session (a skipped capture in a simulated session). */
|
|
316
|
-
stopCameras?(): void;
|
|
317
|
-
}
|
|
318
|
-
interface StepRunner {
|
|
319
|
-
run(): Promise<VerificationStep>;
|
|
320
|
-
current(): VerificationStep | null;
|
|
321
|
-
/** Called by the verification on every view update. */
|
|
322
|
-
onView(view: HostedSessionView): void;
|
|
323
|
-
/** Called when the liveness chain becomes idle. */
|
|
324
|
-
onChainIdle(): void;
|
|
325
|
-
/** Re-derive from the current view and publish even if unchanged (local overlay changed). */
|
|
326
|
-
republish(): void;
|
|
327
|
-
/** Submit one step input (exposed for the document binding, Task 4). */
|
|
328
|
-
submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
|
|
329
|
-
/** "Skip with test data" answered the liveness or the portrait on this page: a following match has no probe. */
|
|
330
|
-
faceProbeSkipped(): boolean;
|
|
331
|
-
}
|
|
332
|
-
declare function createStepRunner(deps: RunnerDeps): StepRunner;
|
|
333
|
-
|
|
334
338
|
/** A check the browser may still submit. */
|
|
335
339
|
declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
|
|
336
340
|
/** The session accepts no further submissions. */
|
|
@@ -365,55 +369,6 @@ interface ResultOptions {
|
|
|
365
369
|
previous?: HostedSessionView;
|
|
366
370
|
}
|
|
367
371
|
|
|
368
|
-
declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
|
|
369
|
-
/**
|
|
370
|
-
* Bound on a single execute round-trip (challenge fetch + solve). A healthy
|
|
371
|
-
* invisible challenge settles in a few seconds, but on slow phones and networks
|
|
372
|
-
* it routinely takes 10 to 20 s: 10 s failed a third of real sessions
|
|
373
|
-
* (incident 2026-11-10), so the bound is 30 s. A failed or timed-out challenge
|
|
374
|
-
* is retried once on a fresh widget.
|
|
375
|
-
*/
|
|
376
|
-
declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
|
|
377
|
-
interface TurnstileRenderParams {
|
|
378
|
-
sitekey: string;
|
|
379
|
-
callback: (token: string) => void;
|
|
380
|
-
"error-callback"?: (code?: string) => void;
|
|
381
|
-
execution?: "render" | "execute";
|
|
382
|
-
appearance?: "always" | "execute" | "interaction-only";
|
|
383
|
-
}
|
|
384
|
-
/** The subset of the Turnstile JS API this module uses. */
|
|
385
|
-
interface TurnstileApi {
|
|
386
|
-
render(container: HTMLElement, params: TurnstileRenderParams): string | undefined;
|
|
387
|
-
execute(widgetId: string): void;
|
|
388
|
-
reset(widgetId: string): void;
|
|
389
|
-
remove(widgetId: string): void;
|
|
390
|
-
}
|
|
391
|
-
/** Test-only: reset the module singletons between cases. */
|
|
392
|
-
declare function resetTurnstileForTests(): void;
|
|
393
|
-
/** Load the Turnstile script once (singleton; a load failure resets it so a
|
|
394
|
-
* retry can re-attempt). */
|
|
395
|
-
declare function loadTurnstile(): Promise<TurnstileApi>;
|
|
396
|
-
/** Options of {@link executeTurnstile}. */
|
|
397
|
-
interface ExecuteTurnstileOptions {
|
|
398
|
-
/** Bound on the challenge round-trip; default {@link TURNSTILE_EXECUTE_TIMEOUT_MS}. */
|
|
399
|
-
timeoutMs?: number;
|
|
400
|
-
/**
|
|
401
|
-
* Aborts the challenge: the promise rejects and the widget, its container and
|
|
402
|
-
* the timeout are cleaned up at once. `createVerification().destroy()` passes
|
|
403
|
-
* its own signal so a torn-down verification never leaves a widget behind.
|
|
404
|
-
*/
|
|
405
|
-
signal?: AbortSignal;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Run one invisible execute-mode challenge on the kept widget and resolve its
|
|
409
|
-
* token. A challenge error, a load/render failure or a challenge that does not
|
|
410
|
-
* settle within the timeout removes the widget and runs the challenge ONCE more
|
|
411
|
-
* on a freshly rendered widget; only then does the promise reject. An abort
|
|
412
|
-
* (`signal`) rejects at once, without the second attempt. The verification
|
|
413
|
-
* submits without a token when this rejects, so the server decides.
|
|
414
|
-
*/
|
|
415
|
-
declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
|
|
416
|
-
|
|
417
372
|
/**
|
|
418
373
|
* Face of a decoded still: an MRZ band means the verso. With `cardOnly` (the still is the card itself) the band must
|
|
419
374
|
* sit in its lower half, where a card's MRZ is: the line of print across a recto's top (the issuing state) is not one.
|
|
@@ -492,4 +447,4 @@ declare function measureRegionSharpness(image: RawImage, region: StillRegion | n
|
|
|
492
447
|
*/
|
|
493
448
|
declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
|
|
494
449
|
|
|
495
|
-
export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId,
|
|
450
|
+
export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, HostedClientLike, LENS_TRY_MAX, type LensKind, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OCR_ASSET_SET, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TextLockTuning, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, lensKindOf, liveMrzWireReport, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, photoSharpness, rankBackCameras, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
|
package/dist/internal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as me,d as _e,e as Le,h as
|
|
1
|
+
import{c as me,d as _e,e as Le,h as le,i as ce,j as Se}from"../chunk-DVTK2DGX.js";import{a as W,b as ve,c as ge,d as he,e as Ge,f as be,g as He,h as Ye,i as Ue,j as k,k as K,l as w,m as X,n as Z,o as J,p as Q,q as j,r as q,s as $,t as ee,u as te,x as re}from"../chunk-LV23FCYP.js";import{a as Bt,b as Vt,c as Xt,d as Zt,e as Jt,f as Qt,g as jt,h as qt,i as $t,j as ne,k as ie,m as se,n as Ee}from"../chunk-VWGKUQ3C.js";import{a as Ft,b as Nt,c as vt,d as gt,e as ht,f as Gt,g as bt,h as Ht,i as Yt,j as Ut,k as Wt,l as kt,m as Kt}from"../chunk-53POX7U4.js";import{a as wt,b as zt}from"../chunk-33KKMPJ5.js";import{b as oe,c as pe,d as ae}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import"../chunk-GI3UFGRQ.js";import{a as P,b as d,c as M,d as F,e as N}from"../chunk-HVW2AB35.js";import{A as Ct,B as At,C as Ot,D as xt,E as It,F as ut,G as Dt,H as Pt,I as dt,J as Mt,a as Ke,b as we,c as ze,d as je,e as qe,f as $e,g as et,h as tt,i as rt,j as ot,k as pt,l as at,m as nt,n as it,o as st,p as Et,q as mt,r as _t,s as Lt,t as lt,u as ct,v as St,w as Rt,x as yt,y as Tt,z as ft}from"../chunk-7MZW3FFH.js";import{a as v,b as g,c as h,d as G,e as b,f as H,g as Y,h as U,i as z,j as B,l as V}from"../chunk-G6LKLN4U.js";import{a as We,b as ke}from"../chunk-SMKCBUJL.js";import{a as Be,b as Ve,c as Xe,d as Ze,e as Je,f as Qe}from"../chunk-4DEPREJ3.js";import{a as De,b as Pe,c as de,d as Me,e as Fe,f as Ne}from"../chunk-NFHLJOHW.js";import{b as ye,c as Te,d as fe,e as Ce,g as Ae,h as er,i as tr,j as rr,k as or,l as pr,m as ar,s as Oe}from"../chunk-GPFAPAS6.js";import{A as u,B as D,i as c,j as S,k as R,l as y,o as T,u as f,v as C,w as A,x as O,y as x,z as I}from"../chunk-ZCW6PNUX.js";import{a,b as n,c as i,d as s,i as E,j as m,k as _,l as L,n as l}from"../chunk-65JZHKVG.js";import"../chunk-7QZWBDI5.js";import"../chunk-OVP7FAMJ.js";import"../chunk-SX7TUC3V.js";import"../chunk-POIQGEZM.js";import{p as xe,q as Ie,r as ue}from"../chunk-CPUECYAJ.js";import"../chunk-FPXL63KZ.js";import"../chunk-XOTKATN6.js";import{c as e,d as t,f as r,g as o,h as p}from"../chunk-TSA6GHUG.js";import"../chunk-LLX2CKZ3.js";import"../chunk-FSSMUAKC.js";import{a as Re}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ne as ANALYSIS_LONG_EDGE,De as ASPECT_BANDS,I as AttestationError,He as BLUR_REFUSE_SHARPNESS_MAX,Mt as CAPTURE_CANDIDATE_SPACING_MS,dt as CAPTURE_EXTRA_CANDIDATES,p as CENTERED_FACTOR,M as CHALLENGE_EXECUTE_TIMEOUT_MS,d as CHALLENGE_READY_TIMEOUT_MS,r as CIRCLE_RADIUS_FACTOR,Bt as CLIPPED_LUMA,f as CLIP_MIME_ALLOWLIST,Dt as CaptureSessionDoc,P as ChallengeError,tr as DOCUMENT_TYPE_ORDER,je as DOC_ANALYSIS_DEFAULTS,At as DOC_BLACK_FRAME_LUMA,Ot as DOC_BLACK_FRAME_TICKS,xt as DOC_CADENCE_HZ,tt as DOC_CAMERA_TUNING_DEFAULTS,Fe as DOC_CATALOG,Be as DOC_DETECT_WIDTH,Ke as DOC_FEEDBACK_STATES,Ct as DOC_FIRST_FRAME_MS,Ve as DOC_GATE_V1_DEFAULTS,It as DOC_SHUTTER_DEFAULTS,V as DocAssist,ze as DocFeedbackAggregator,Qe as DocGateV1,Lt as EMPTY_GUIDE_METRICS,ge as FLIP_FILL_MIN,ve as FLIP_GAP_MS,he as FLIP_TIMEOUT_MS,Rt as GUIDE_LOCK_DEFAULTS,Tt as GuideLock,gt as ICAO_CANVAS,wt as ICAO_FALLBACK,Ht as ICAO_GATE_CRITERIA,Vt as ICAO_SHARP_REF,O as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,o as IN_CIRCLE_FACTOR,er as ISSUER_CODES,oe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,xe as LENS_TRY_MAX,B as LIVE_MRZ_DEFAULTS,_e as LIVE_PHOTO_IDLE_MS,me as LIVE_PHOTO_MAX_HZ,Ge as MANUAL_SHUTTER_MS,We as MRZ_BAND_DEFAULTS,Me as MR_DOC_CATALOG,be as NO_REPORT_MS,Re as OCR_ASSET_SET,ce as OTP_RESEND_COOLDOWN_MS,ie as PORTRAIT_JPEG_QUALITY,a as PRELOAD_BLAZE_INIT_TIMEOUT_MS,n as PRELOAD_BUDGET_MS,le as PROCESSING_BACKOFF_MS,Te as PROCESSING_POLL_DELAY_MS,fe as PROCESSING_POLL_MAX,h as REGION_PAD,ye as REGISTRY_RETRY_DELAY_MS,te as SAME_FACE_MAX_DROPS,v as SHARPNESS_LONG_EDGE,z as TEXT_LOCK_DEFAULTS,C as TRANSPORT_REPLAY_ATTEMPTS,A as TRANSPORT_REPLAY_DELAY_MS,J as WEB_OCR_ENGINE,or as acceptedIssuers,rr as acceptedTypesFor,et as analyzeDocFrame,ct as analyzeGuide,Pe as aspectBand,de as aspectFits,jt as backgroundStats,q as browserFamily,X as buildDeviceReadHint,K as classifyCardSide,k as classifyCardSideWith,st as coverPointToVideo,re as createDocumentCaptureInternal,ae as createFaceLandmarker,Kt as createIcaoGate,Le as createLivePhotoKit,l as createLivenessCaptureInternal,Ee as createPortraitCaptureInternal,Se as createStepRunner,Ae as createVerificationInternal,b as cropImage,e as detectFormFactor,t as detectIsMobile,ke as detectMrzBand,Et as docZoomFor,W as encodeDocumentImage,N as executeChallenge,vt as eyeLineRoll,Ut as eyeOpenness,Qt as eyeSpecular,Ft as faceGeometry,Jt as faceLighting,qt as faceSharpness,pe as facesOf,we as feedbackVoteOf,ar as flagOf,mt as focusOk,ee as formatMismatch,R as frontierStep,St as guideQuad,lt as guideRegionInFrame,$t as icaoPixelStats,ht as icaoWindow,Ye as initialScanState,c as isExecutable,S as isTerminalView,Yt as judgeIcao,Ie as lensKindOf,$ as liveMrzWireReport,Xt as lumaPlane,_ as mapEngineState,L as mapErrorKind,m as mapGuidanceHint,T as mapSessionResult,U as measureBitmapSharpness,Y as measureRegionSharpness,Ue as nextScanState,se as observePortraitFrame,_t as openDocCamera,Pt as passportBandOf,Wt as percentile,g as photoSharpness,bt as portraitCropRegion,Oe as portraitMatchStep,Nt as poseFromMatrix,E as preloadedDetectorFactory,Xe as quadAreaFrac,Je as quadBounds,Ze as quadIou,$e as quadTiltRatio,Ce as randomUuid,ue as rankBackCameras,pt as readStoredLens,Zt as regionStats,F as resetChallengeFrameForTests,s as resetLivenessAssetsForTests,H as resizeLongEdge,pr as resolveAcceptedDocuments,rt as resolveDocCameraTuning,ut as resolveDocShutterTuning,yt as resolveGuideLockTuning,zt as resolveIcaoTuning,Q as resolveWebOcrPlan,D as runLivenessFlow,u as runSubmission,Ne as scannerFormatFor,kt as scoreFrame,i as setPreloadLoaderForTests,Z as settledHint,it as singleShotFocusAt,qe as specularFraction,j as startWebOcr,y as stepOf,G as stillRegionOf,w as stillToImageData,nt as supportsFocusMode,ft as warmDocDetector,Gt as windowOverflow,at as writeStoredLens};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as ee}from"./chunk-A3FUGHAH.js";import{a as q,b as J,e as X,f as B,g as x,j as Z}from"./chunk-DVTK2DGX.js";import{x as Q}from"./chunk-LV23FCYP.js";import{n as Y}from"./chunk-VWGKUQ3C.js";import"./chunk-53POX7U4.js";import"./chunk-33KKMPJ5.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-GI3UFGRQ.js";import{F as $,i as K,x as N}from"./chunk-7MZW3FFH.js";import"./chunk-G6LKLN4U.js";import"./chunk-SMKCBUJL.js";import"./chunk-4DEPREJ3.js";import"./chunk-NFHLJOHW.js";import{b as H,c as G,q as j,s as z,t as L}from"./chunk-ZCW6PNUX.js";import"./chunk-65JZHKVG.js";import"./chunk-7QZWBDI5.js";import"./chunk-OVP7FAMJ.js";import{b as U}from"./chunk-SX7TUC3V.js";import"./chunk-POIQGEZM.js";import"./chunk-CPUECYAJ.js";import"./chunk-FPXL63KZ.js";import{c as T,i as W}from"./chunk-XOTKATN6.js";import"./chunk-TSA6GHUG.js";import{a as F}from"./chunk-LLX2CKZ3.js";import"./chunk-FSSMUAKC.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";var ie=2e4,ae=new Set(["media_type_unsupported","media_type_mismatch"]),te=new Set(["document_upload_not_allowed","portrait_source_not_allowed","uploaded_media_not_allowed"]);function ne(e){let o=null,f=Promise.resolve(),c=!1,b=null,I=null,_=!1,E=null,V=!1,C=!1,R=()=>{o?.controller.handle.destroy(),o=null},u=()=>{let t=e.currentView(),r=t===null?null:x(t,{isMobile:e.isMobile()});return r?.kind==="portrait"?r:null},a=()=>{if(e.destroyed())return"self";let t=e.currentView(),r=t===null?void 0:B(t);return r==="self"||r==="assisted"?r:r==="choice"&&e.captureModeSwitch!==void 0?e.captureModeSwitch.pick()??"self":e.cameraMode?.()??z(r??j(t),null)},h=e.captureModeSwitch,p=h===void 0?void 0:{session:()=>{let t=e.currentView();return t!==null&&B(t)==="choice"?"choice":a()},onModeChange:t=>h.choose(t)},g=async(t,r)=>{if(e.destroyed())return;let d=a();r.setFlowState("uploading"),c=!1;let l=null;try{await e.runner().submit("portrait_icao",async(n,w)=>{if(l===null){let k=await L(n,"image","image/jpeg",t.image.size,{engine:"portrait"});await n.uploadToSpaces(k.uploadUrl,t.image,"image/jpeg"),l=(await n.completeMedia(k.key)).key}r.setFlowState("checking");let D={media:{portrait:l},gate:W(t.gate),...t.tuningVersion!==void 0?{tuningVersion:t.tuningVersion}:{},source:"camera",capture:{mode:d,facingMode:t.facingMode}};return n.submitCheck("portrait_icao",D,{idempotencyKey:w})})}catch(n){c=!0,n instanceof T&&te.has(n.code)&&await e.refreshView?.().catch(()=>{})}if(r.setFlowState("done"),e.destroyed())return;let i=u();(i===null||i.phase!=="capture")&&o?.controller===r&&R(),e.runner().republish()},M=t=>e.runner().submit("face_match",(r,d)=>r.submitCheck("face_match",e.runner().faceProbeSkipped()?{simulatedCapture:!0}:{},{idempotencyKey:d})).then(()=>{},()=>{c=!0,t()}),P=null,y=async t=>{let r=u();if(r===null||r.phase!=="capture"||!r.photo.uploadOffered)throw new RangeError("upload_not_offered");let{prepareUploadFile:d}=await import("./upload-file-EGXXM6TQ.js"),l=await d(t,e.uploadInternals);if(e.destroyed())return;R(),c=!1;let i=null;try{await e.runner().submit("portrait_icao",async(n,w)=>{if(i===null){let k=await n.presign("image",l.contentType,l.blob.size,{source:"upload"});await n.uploadToSpaces(k.uploadUrl,l.blob,l.contentType),i=(await n.completeMedia(k.key)).key}let D={media:{portrait:i},source:"upload"};return n.submitCheck("portrait_icao",D,{idempotencyKey:w})})}catch(n){throw n instanceof T&&ae.has(n.code)?new TypeError("unsupported_file"):(n instanceof T&&te.has(n.code)&&await e.refreshView?.().catch(()=>{}),n)}},v=null,S=t=>{if(v!==null)return v;let r=u();if(r===null||r.phase!=="review")return Promise.reject(new RangeError("no_pending_fix"));let d={fixReview:{accept:t}},l=e.runner().submit("portrait_icao",(i,n)=>i.submitCheck("portrait_icao",d,{idempotencyKey:n})).catch(async i=>{throw i instanceof T&&i.code==="portrait_no_pending_fix"&&await e.refreshView?.().catch(()=>{}),i}).finally(()=>{v=null});return v=l,l},s=t=>{let r=()=>y(t),d=(P===null?r():P.then(r,r)).finally(()=>{P===d&&(P=null)});return P=d,d};return{bind:(t,r)=>{if(t.phase==="review")return R(),{...t,uploadFailed:c,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("the adjusted photo waits for confirmFix()")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:S};if(t.phase==="match")return R(),b!==t.attemptsRemaining&&!c&&(b=t.attemptsRemaining,M(r)),{...t,uploadFailed:c,resubmit:()=>(c=!1,b=t.attemptsRemaining,r(),M(r)),capture:()=>{throw new Error("the portrait was already accepted")},uploadPortrait:()=>Promise.reject(new RangeError("upload_not_offered")),confirmFix:S};if(b=null,t.reuse===!0&&t.phase==="capture")return R(),!V&&E!==t.attemptsRemaining&&(E=t.attemptsRemaining,V=!0,e.runner().submit("portrait_icao",(l,i)=>l.submitCheck("portrait_icao",{},{idempotencyKey:i})).then(()=>{C=!1},()=>{C=!0}).finally(()=>{V=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:C&&!V,refresh:()=>(C=!1,E=null,r(),Promise.resolve())};let d=e.keptPortraitInput?.()??null;return d!==null&&(_||d!==I&&t.report===null&&t.reason===void 0&&!t.retakeOnly)?(_||(I=d,_=!0,e.runner().submit("portrait_icao",(l,i)=>l.submitCheck("portrait_icao",d,{idempotencyKey:i})).catch(()=>{}).finally(()=>{_=!1,r()})),{kind:"processing",key:"processing",context:t.context,section:t.section,stalled:!1,refresh:()=>Promise.resolve()}):{...t,uploadFailed:c,resubmit:()=>Promise.resolve(),capture:l=>{if(o!==null&&o.video===l.video)return o.controller.handle;R(),c=!1;let i=Y({video:l.video,tuning:t.tuning,tuningVersion:t.tuningVersion,...t.icao!=null?{policy:t.icao.policy}:{},...l.keepScreenAwake!==void 0?{keepScreenAwake:l.keepScreenAwake}:{},...l.assetBaseUrl!==void 0?{assetBaseUrl:l.assetBaseUrl}:{}},e.internals,a,p);o={video:l.video,controller:i};let n=i.handle.destroy;i.handle.destroy=()=>{o?.controller===i&&(o=null),n()},i.handle.on("error",k=>{e.reportCaptureIssue?.(H("portrait",k,0))});let w=!1,D=(k,O)=>{let A=i.gateScores();A!==null&&e.reportGate?.({kind:"portrait_gate",platform:"web",outcome:k,...O!==null?{failing:O}:{},...A})};return i.handle.on("gate",k=>{!w&&!k.ready&&(i.gateScores()?.elapsedMs??0)>=ie&&(w=!0,D("stuck",k.failing))}),i.handle.on("captured",k=>{D("captured",null),w=!1,f=f.then(()=>g(k,i)).catch(()=>{})}),i.handle},uploadPortrait:s,confirmFix:S}},destroy:R}}var le=.92,se=()=>U("environment",{width:{ideal:1920},height:{ideal:1080}},{getUserMedia:e=>navigator.mediaDevices.getUserMedia(e),enumerateDevices:()=>navigator.mediaDevices.enumerateDevices()}),ue=e=>{let o=document.createElement("canvas");o.width=e.videoWidth,o.height=e.videoHeight;let f=o.getContext("2d");return f===null||o.width===0||o.height===0?Promise.reject(new Error("the camera has no frame yet")):(f.drawImage(e,0,0,o.width,o.height),new Promise((c,b)=>o.toBlob(I=>I===null?b(new Error("the still could not be encoded")):c(I),"image/jpeg",le)))},de=(e,o)=>{try{e.muted=!0,e.playsInline=!0,e.srcObject=o,e.play().catch(()=>{})}catch{}};function re(e){let o=null,f=null,c=u=>{let a=(f===null?u():f.then(u,u)).finally(()=>{f===a&&(f=null)});return f=a,a},b=()=>{o?.handle.destroy(),o=null},I=()=>{let u=e.currentView(),a=u===null?null:x(u,{isMobile:e.isMobile()});return a?.kind==="proof_of_address"?a:null},_=async(u,a)=>{if(a.length===0)throw new RangeError("no_pages");if(a.length>u.maxPages)throw new RangeError("too_many_pages");let{pdfFileKind:h,prepareUploadFile:p}=await import("./upload-file-EGXXM6TQ.js"),g=await Promise.all(a.map(P=>h(P)));if(g.includes("bad"))throw new TypeError("unsupported_file");if(g.includes("pdf")){if(a.length>1)throw new RangeError("too_many_pages");let P=a[0];if(P.size>u.pdf.maxBytes)throw new RangeError("file_too_large");return[{kind:"document_file",blob:P,contentType:"application/pdf"}]}let M=[];for(let P of a){let y=await p(P,e.uploadInternals);M.push({kind:"image",blob:y.blob,contentType:y.contentType})}return M},E=async(u,a,h)=>{let p=null;try{await e.runner().submit("poa",async(g,M)=>{if(p===null){let y=[];for(let v of h){let S=a==="upload"?await g.presign(v.kind,v.contentType,v.blob.size,{source:"upload"}):await L(g,v.kind,v.contentType,v.blob.size,{engine:"poa_page"});await g.uploadToSpaces(S.uploadUrl,v.blob,v.contentType),y.push((await g.completeMedia(S.key)).key)}p=y}let P=h[0]?.kind==="document_file"?{part:u,source:"upload",pdfKey:p[0]}:{part:u,source:a,imageKeys:p};return g.submitCheck("poa",P,{idempotencyKey:M})})}catch(g){throw g instanceof T&&(g.code==="media_type_unsupported"||g.code==="media_type_mismatch")?new TypeError("unsupported_file"):(g instanceof T&&(g.code==="document_upload_not_allowed"||g.code==="uploaded_media_not_allowed")&&await e.refreshView?.().catch(()=>{}),g)}},V=async(u,a)=>{let h=I();if(h===null||!h.photo.uploadOffered)throw new RangeError("upload_not_offered");if(u==="holder_letter"&&h.phase!=="holder_letter")throw new RangeError("holder_letter_not_requested");let p=await _(h,a);e.destroyed()||(b(),await E(u,"upload",p))},C=(u,a)=>{let h=null,p=[],g=!0,M=()=>{for(let y of h?.getTracks()??[])y.stop();h=null},P={get pages(){return p},start:async()=>{if(!g||h!==null)return;let y=await(e.pageCamera?.open??se)();if(!g){for(let v of y.getTracks())v.stop();return}h=y,(e.pageCamera?.attach??de)(u,y)},takePage:async()=>{if(p.length>=a)throw new RangeError("too_many_pages");let y=await(e.pageCamera?.grab??ue)(u);if(p.length>=a)throw new RangeError("too_many_pages");return p=[...p,y],y},removePage:y=>{p=p.filter((v,S)=>S!==y)},submitPages:()=>c(async()=>{if(p.length===0)throw new RangeError("no_pages");let y=I();if(y===null)throw new RangeError("camera_not_offered");let v=y.phase==="holder_letter"?"holder_letter":"document";await E(v,"camera",p.map(S=>({kind:"image",blob:S,contentType:"image/jpeg"}))),o?.handle===P?b():P.destroy()}),destroy:()=>{g=!1,p=[],M(),o?.handle===P&&(o=null)}};return P},R=async()=>{let u=I();if(u===null||!u.licenceAddressAccepted)throw new RangeError("licence_address_not_accepted");if(e.destroyed())return;b();let a={part:"document"};await e.runner().submit("poa",(h,p)=>h.submitCheck("poa",a,{idempotencyKey:p}))};return{bind:u=>({...u,...u.licenceAddressAccepted?{useLicenceAddress:()=>c(R)}:{},uploadPages:a=>c(()=>V("document",a)),uploadHolderLetter:a=>c(()=>V("holder_letter",a)),capturePage:a=>{if(u.photo.source==="upload")throw new RangeError("camera_not_offered");if(o!==null&&o.video===a.video)return o.handle;b();let h=C(a.video,u.maxPages);return o={video:a.video,handle:h},h}}),destroy:b}}function oe(e){let o=e;if(typeof o.apiOrigin!="string"||typeof o.sessionToken!="string")return;let f=`${o.apiOrigin}/api/v2/hosted/capture-reports`,c=o.sessionToken;return b=>{try{fetch(f,{method:"POST",headers:{"content-type":"application/json","x-session-token":c,"x-sekyro-sdk":`@sekyro/web/${F}`},body:JSON.stringify({reports:b}),keepalive:!0}).catch(()=>{})}catch{}}}function ce(e){let o=e.apiOrigin;return ee("sdk",typeof o=="string"&&/staging|sandbox|localhost/.test(o)?"sandbox":"live")}function Ue(e){let o=null,f=null,c=null,b=G(),I=Promise.resolve(),_=()=>{c?.flow.handle.destroy(),c=null},E=()=>f?.documentType==="drivers_license"?{documentType:"drivers_license"}:{},V=async(s,m)=>{if(e.destroyed())return;m.setFlowState("uploading");let t=null,r,d=!1,l=e.currentView()?.documents!==void 0;try{await o.submit("doc_ocr",async(k,O)=>{if(t===null){let A=await L(k,"image","image/jpeg",s.image.size,{engine:"document"});await k.uploadToSpaces(A.uploadUrl,s.image,"image/jpeg"),t=(await k.completeMedia(A.key)).key}return m.setFlowState("checking"),r===void 0&&(r=m.takeDeviceRead(s)),k.submitCheck("doc_ocr",{imageKey:t,side:s.side,...r!==null?{deviceRead:r}:{},...l?{source:"camera"}:{},...E()},{idempotencyKey:O})})}catch{d=!0}finally{m.setFlowState("done")}if(e.destroyed())return;if(d){m.settle(s.side,{ok:!1,issue:"technical"});return}let i=e.currentView(),n=i===null?null:x(i,{isMobile:e.isMobile()});if(n?.kind!=="document"){m.settle(s.side,{ok:!0}),c?.flow===m?_():m.handle.destroy();return}if(n.reason==="document_type_not_accepted"){f=null,c?.flow===m&&_(),o.republish();return}let w=n.acceptedSides;s.side!=="single"&&(w.includes(s.side)||n.reason==="side_missing")&&!(w.includes("recto")&&w.includes("verso"))?(m.settle(s.side,{ok:!0}),f?.documentType!=="passport"&&m.handle.setSide(n.side)):m.settle(s.side,{ok:!1,issue:"reread"})},C=null,R=async s=>{let m=e.currentView(),t=m===null?null:x(m,{isMobile:e.isMobile()});if(m===null||t?.kind!=="document")throw new RangeError("upload_not_offered");if(!t.photo.uploadOffered)throw new RangeError("upload_not_offered");let r=f?.documentType==="passport"?"single":t.side,{prepareUploadFile:d}=await import("./upload-file-EGXXM6TQ.js"),l=await d(s,e.uploadInternals);if(e.destroyed())return;_();let i=null;try{await o.submit("doc_ocr",async(n,w)=>{if(i===null){let D=await n.presign("image",l.contentType,l.blob.size,{source:"upload"});await n.uploadToSpaces(D.uploadUrl,l.blob,l.contentType),i=(await n.completeMedia(D.key)).key}return n.submitCheck("doc_ocr",{imageKey:i,side:r,source:"upload",...E()},{idempotencyKey:w})})}catch(n){throw n instanceof T&&(n.code==="media_type_unsupported"||n.code==="media_type_mismatch")?new TypeError("unsupported_file"):(n instanceof T&&(n.code==="document_upload_not_allowed"||n.code==="uploaded_media_not_allowed")&&await e.refreshView().catch(()=>{}),n)}},u=(s,m)=>({...s,uploadDocument:t=>{let r=()=>R(t),d=(C===null?r():C.then(r,r)).finally(()=>{C===d&&(C=null)});return C=d,d},issuer:f?.issuer??null,documentType:f?.documentType??null,captureSide:f===null?null:f.documentType==="passport"?"single":s.side,selectDocument:(t,r)=>{if(!J(s.documents).includes(t)||!q(s.documents,t).includes(r))throw new RangeError(`${r} from ${t} is not accepted`);(f?.issuer!==t||f.documentType!==r)&&_(),f={issuer:t,documentType:r},m()},capture:t=>{if(f===null)throw new Error("selectDocument() first");if(c!==null&&c.video===t.video)return c.flow.handle;_();let r=f,d=r.documentType==="passport"?"single":s.acceptedSides.length>0?s.side:void 0,l=Q({video:t.video,documentType:r.documentType,issuer:r.issuer,...d!==void 0?{side:d}:{},...t.keepScreenAwake!==void 0?{keepScreenAwake:t.keepScreenAwake}:{},...t.liveMrz!==void 0?{liveMrz:t.liveMrz}:{}},{...e.documentInternals??{},...(()=>{let n=e.currentView()?.capture?.document,w=e.documentInternals?.blurRefuseSharpnessMax??n?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:K(n?.camera),shutter:$(n?.scan),guideLock:N(n?.guide),...e.documentInternals?.engineOptions??{}},...typeof w=="number"&&Number.isFinite(w)&&w>=0&&w<=1?{blurRefuseSharpnessMax:w}:{}}})(),deferRead:!0,...(()=>{let n=e.currentView();if(n===null||e.documentInternals?.webOcr!==void 0)return{};let w=oe(e.runtime.client);return{webOcr:{captureDocument:n.capture?.document,salt:n.sessionId,baseUrl:ce(e.runtime.client),...w!==void 0?{reports:w}:{}}}})()});c={video:t.video,flow:l};let i=l.handle.destroy;return l.handle.destroy=()=>{c?.flow===l&&(c=null),i()},b.newHandle(),l.handle.on("state",n=>b.note(n)),l.handle.on("error",n=>{b.noteError(),e.reportCaptureIssue?.(H("document",n,b.value))}),l.handle.on("captured",n=>{I=I.then(()=>V(n,l)).catch(()=>{})}),l.handle}}),a=null,h=null,p=new Set,g=e.runtime.client;e.runtime.client=new Proxy(g,{get(s,m){if(m==="submitCheck")return(h??s).submitCheck.bind(h??s);let t=Reflect.get(s,m);return typeof t=="function"?t.bind(s):t}});let M=()=>{a?.destroy(),a=null,h=null},P=s=>{let m=e.currentView(),t=m===null?null:x(m,{isMobile:e.isMobile()});if(m===null||t?.kind!=="liveness"||t.livePhoto?.icao!==!0)return;if(a===null){let i=X({tuning:m.capture?.icao??null,tuningVersion:m.capture?.tuningVersion??null,...t.icao!=null?{policy:t.icao.policy}:{},still:t.livePhoto.still,...s.assetBaseUrl!==void 0?{assetBaseUrl:s.assetBaseUrl}:{}},e.livePhotoInternals);a=i,h=i.decorate(g),i.onGate(n=>{for(let w of p)w(n)})}let r=a,d=e.baseCapture??{},l=d.engineOptions?.telemetry;return{...d,engineOptions:{...d.engineOptions??{},measureQuality:r.engineOptions.measureQuality,telemetry:i=>{l?.(i),r.engineOptions.telemetry(i)}}}},y=ne({keptPortraitInput:()=>a?.lastPortraitInput()??null,runner:()=>o,currentView:e.currentView,...e.cameraMode!==void 0?{cameraMode:e.cameraMode}:{},...e.captureModeSwitch!==void 0?{captureModeSwitch:e.captureModeSwitch}:{},destroyed:e.destroyed,isMobile:e.isMobile,...e.portraitInternals!==void 0?{internals:e.portraitInternals}:{},...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},refreshView:()=>e.refreshView(),...e.reportCaptureIssue!==void 0?{reportCaptureIssue:e.reportCaptureIssue}:{},reportGate:s=>oe(e.runtime.client)?.([s])}),v=re({runner:()=>o,currentView:e.currentView,destroyed:e.destroyed,isMobile:e.isMobile,...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},...e.pageCameraInternals!==void 0?{pageCamera:e.pageCameraInternals}:{},refreshView:()=>e.refreshView()}),S=Z({...e,bindDocument:u,bindPortrait:y.bind,bindProofOfAddress:v.bind,stopCameras:()=>{_(),y.destroy(),v.destroy(),M(),e.stopLiveness?.()},onLivePhoto:s=>(p.add(s),()=>p.delete(s))});return o=S,{...S,captureInternals:P,destroy:()=>{_(),y.destroy(),v.destroy(),M(),p.clear()}}}export{Ue as createPlanRunner,oe as reportSink,ce as sdkAssetBase};
|