@sekyro/web 0.0.0-stage → 0.1.0-rc.2

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 (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +20 -0
  3. package/README.md +92 -2
  4. package/dist/capture-constraints-BujkZcfb.d.cts +21 -0
  5. package/dist/capture-constraints-BujkZcfb.d.ts +21 -0
  6. package/dist/capture-session-v3-BJ8ciaWl.d.ts +457 -0
  7. package/dist/capture-session-v3-CAoWM8iT.d.cts +457 -0
  8. package/dist/chunk-BPYVZUJA.js +852 -0
  9. package/dist/chunk-BPYVZUJA.js.map +1 -0
  10. package/dist/chunk-LOTAJDRE.js +1094 -0
  11. package/dist/chunk-LOTAJDRE.js.map +1 -0
  12. package/dist/chunk-MWNFSNMP.js +52 -0
  13. package/dist/chunk-MWNFSNMP.js.map +1 -0
  14. package/dist/chunk-NILNKLK6.js +50 -0
  15. package/dist/chunk-NILNKLK6.js.map +1 -0
  16. package/dist/chunk-NWF46H7K.js +359 -0
  17. package/dist/chunk-NWF46H7K.js.map +1 -0
  18. package/dist/chunk-WY6U7AIK.js +193 -0
  19. package/dist/chunk-WY6U7AIK.js.map +1 -0
  20. package/dist/chunk-YVFF4Q4G.js +327 -0
  21. package/dist/chunk-YVFF4Q4G.js.map +1 -0
  22. package/dist/client/index.cjs +357 -0
  23. package/dist/client/index.cjs.map +1 -0
  24. package/dist/client/index.d.cts +39 -0
  25. package/dist/client/index.d.ts +39 -0
  26. package/dist/client/index.js +15 -0
  27. package/dist/client/index.js.map +1 -0
  28. package/dist/core/index.cjs +1605 -0
  29. package/dist/core/index.cjs.map +1 -0
  30. package/dist/core/index.d.cts +87 -0
  31. package/dist/core/index.d.ts +87 -0
  32. package/dist/core/index.js +139 -0
  33. package/dist/core/index.js.map +1 -0
  34. package/dist/core/v3/detect-worker.cjs +392 -0
  35. package/dist/core/v3/detect-worker.cjs.map +1 -0
  36. package/dist/core/v3/detect-worker.d.cts +1 -0
  37. package/dist/core/v3/detect-worker.d.ts +1 -0
  38. package/dist/core/v3/detect-worker.js +13 -0
  39. package/dist/core/v3/detect-worker.js.map +1 -0
  40. package/dist/create-verification-CjLnJ0w6.d.ts +348 -0
  41. package/dist/create-verification-EnZ13uY4.d.cts +348 -0
  42. package/dist/detect-worker-CKXHlXx9.d.cts +105 -0
  43. package/dist/detect-worker-CKXHlXx9.d.ts +105 -0
  44. package/dist/detector-scanic-4C6IEW2K.js +787 -0
  45. package/dist/detector-scanic-4C6IEW2K.js.map +1 -0
  46. package/dist/hosted-client-BpvBqu9f.d.cts +408 -0
  47. package/dist/hosted-client-BpvBqu9f.d.ts +408 -0
  48. package/dist/index.cjs +2636 -0
  49. package/dist/index.cjs.map +1 -0
  50. package/dist/index.d.cts +6 -0
  51. package/dist/index.d.ts +6 -0
  52. package/dist/index.js +28 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/internal/index.cjs +4166 -0
  55. package/dist/internal/index.cjs.map +1 -0
  56. package/dist/internal/index.d.cts +431 -0
  57. package/dist/internal/index.d.ts +431 -0
  58. package/dist/internal/index.js +647 -0
  59. package/dist/internal/index.js.map +1 -0
  60. package/dist/popup/index.cjs +76 -0
  61. package/dist/popup/index.cjs.map +1 -0
  62. package/dist/popup/index.d.cts +66 -0
  63. package/dist/popup/index.d.ts +66 -0
  64. package/dist/popup/index.js +11 -0
  65. package/dist/popup/index.js.map +1 -0
  66. package/dist/scanic-ml-stub-S2OZ6HEF.js +10 -0
  67. package/dist/scanic-ml-stub-S2OZ6HEF.js.map +1 -0
  68. package/package.json +118 -4
@@ -0,0 +1,431 @@
1
+ import { n as DeviceClass, h as CaptureState, b as CaptureArtifacts, c as CaptureErrorKind } from '../capture-session-v3-BJ8ciaWl.js';
2
+ export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, I as IN_CIRCLE_FACTOR } from '../capture-constraints-BujkZcfb.js';
3
+ import { k as VerificationResult } from '../create-verification-CjLnJ0w6.js';
4
+ export { A as AttestationError, o as CLIP_MIME_ALLOWLIST, p as CaptureEngine, H as HostedClientLike, q as LivenessCaptureInternalHandle, r as LivenessCaptureInternals, s as LivenessFlowDeps, t as LivenessFlowOutcome, P as PROCESSING_POLL_DELAY_MS, u as PROCESSING_POLL_MAX, v as REGISTRY_RETRY_DELAY_MS, w as SubmitExecutor, x as SubmitRuntime, T as TRANSPORT_REPLAY_ATTEMPTS, y as TRANSPORT_REPLAY_DELAY_MS, z as VerificationInternals, B as createLivenessCaptureInternal, E as createVerificationInternal, F as mapEngineState, I as mapErrorKind, J as mapGuidanceHint, K as randomUuid, M as runLivenessFlow, N as runSubmission } from '../create-verification-CjLnJ0w6.js';
5
+ import { C as CheckReason, c as HostedSessionView, d as HostedStepView, h as SessionView, b as CheckType } from '../hosted-client-BpvBqu9f.js';
6
+ import '../detect-worker-CKXHlXx9.js';
7
+
8
+ /** Physical geometry the scanner frames (ISO/IEC 7810 / ICAO 9303). */
9
+ type DocFormat = "ID-1" | "ID-3";
10
+ type DocSide = "recto" | "verso" | "single";
11
+ interface DocCatalogEntry {
12
+ /** kyc-docs-v2 `document_type`, verbatim. */
13
+ docType: "carte_identite" | "passport";
14
+ format: DocFormat;
15
+ /** Capture sequence the hosted doc step walks, in order. */
16
+ sides: readonly DocSide[];
17
+ /** MRZ geometry: td1 = 3×30 (ID-1 verso), td3 = 2×44 (passport data page). */
18
+ mrz: "none" | "td1" | "td3";
19
+ /** Which side carries the holder photo (drives portrait expectations). */
20
+ portraitSide: DocSide;
21
+ /** Physical width/height ratio of the framed page. */
22
+ aspectRatio: number;
23
+ /** Where the subject identifier (NNI) is parsed from, when the doc carries one. */
24
+ identifierSource?: "mrz";
25
+ }
26
+ /**
27
+ * Plausibility aspect bands per format (Task 34 gate input): ID-1 cards are
28
+ * 85.6×53.98mm → 1.586; an ID-3 passport DATA PAGE frames at ≈125×88mm → 1.42
29
+ * (wider tolerance — page curl and hinge shadow skew the detected quad).
30
+ */
31
+ declare const ASPECT_BANDS: Record<DocFormat, {
32
+ center: number;
33
+ tolerance: number;
34
+ }>;
35
+ /** Aspect band for a format — helper the DocGateV1 plausibility check calls. */
36
+ declare function aspectBand(format: DocFormat): {
37
+ center: number;
38
+ tolerance: number;
39
+ };
40
+ /** The MR docTypes facet (findings §4). Order = the hosted picker's display order. */
41
+ declare const MR_DOC_CATALOG: readonly DocCatalogEntry[];
42
+
43
+ /** Detect-frame width the session downscales to (findings §1: 25ms median).
44
+ * Lives HERE (not detector-scanic.ts) so the session can import it without
45
+ * statically pulling the scanic chunk into host bundles. */
46
+ declare const DOC_DETECT_WIDTH = 480;
47
+ interface DocQuadPoint {
48
+ x: number;
49
+ y: number;
50
+ }
51
+ /** Detected document quad, image-space pixels (scanic CornerPoints shape). */
52
+ interface DocQuad {
53
+ topLeft: DocQuadPoint;
54
+ topRight: DocQuadPoint;
55
+ bottomRight: DocQuadPoint;
56
+ bottomLeft: DocQuadPoint;
57
+ }
58
+ interface DocGateThresholds {
59
+ /** Quad area / frame area below which the doc is too far. */
60
+ MIN_AREA_FRAC: number;
61
+ /** A corner this close to (or past) a frame edge counts as clipped. */
62
+ EDGE_CLIP_MARGIN_PX: number;
63
+ /** Consecutive stable plausible+quality ticks required to fire. */
64
+ STABLE_TICKS: number;
65
+ /** Quad-bbox IoU with the previous tick at/above which the streak holds. */
66
+ IOU_STABLE_MIN: number;
67
+ /** Integrator slopes, per second — mirrors FaceGateV3's gentle drain. */
68
+ RISE_PER_S: number;
69
+ FALL_PER_S: number;
70
+ /** Quality guidance trigger levels (same semantics as the face gate). */
71
+ GUIDE_EXPOSURE: number;
72
+ GUIDE_SHARPNESS: number;
73
+ /** ID-3 (MRZ-band mode): band width / frame width floor. */
74
+ ID3_BAND_MIN_WIDTH_FRAC: number;
75
+ /** ID-3 (MRZ-band mode): band aspect (w/h) sanity bounds. */
76
+ ID3_BAND_ASPECT_MIN: number;
77
+ ID3_BAND_ASPECT_MAX: number;
78
+ }
79
+ /** Frozen defaults (plan Task 34 — do not retune without a golden update). */
80
+ declare const DOC_GATE_V1_DEFAULTS: Readonly<DocGateThresholds>;
81
+ interface DocGateQuality {
82
+ /** frame-quality.sharpness on the quad crop. */
83
+ sharpness: number;
84
+ /** frame-quality.exposure on the quad crop. */
85
+ exposure: number;
86
+ /** Mean crop luma — picks more_light vs too_bright. */
87
+ meanLuma: number;
88
+ }
89
+ interface DocGateTickInput {
90
+ timestampMs: number;
91
+ quad: DocQuad | null;
92
+ quality: DocGateQuality;
93
+ frameWidth: number;
94
+ frameHeight: number;
95
+ }
96
+ /** Per-tick output — the scanner chrome contract. */
97
+ interface DocGateTick {
98
+ at: number;
99
+ quad: DocQuad | null;
100
+ /** Geometry passed: present × big enough × in frame × right shape. */
101
+ plausible: boolean;
102
+ /** Integrated progress 0..1 (the overlay ring). */
103
+ p: number;
104
+ /** dcv1.* message key (host translates; never prose). */
105
+ guidanceKey: string;
106
+ /** Fire signal: plausible × quality × STABLE_TICKS consecutive high-IoU ticks. */
107
+ ready: boolean;
108
+ /** Current stability streak length (diagnostics/telemetry). */
109
+ stableTicks: number;
110
+ }
111
+ /** Shoelace area of the quad as a fraction of the frame area. */
112
+ declare function quadAreaFrac(quad: DocQuad, frameWidth: number, frameHeight: number): number;
113
+ /** IoU of the two quads' axis-aligned bounding boxes (stability metric). */
114
+ declare function quadIou(a: DocQuad, b: DocQuad): number;
115
+ /** Axis-aligned bounds (width/height) of a quad — the ID-3 band-mode geometry. */
116
+ declare function quadBounds(quad: DocQuad): {
117
+ width: number;
118
+ height: number;
119
+ };
120
+ declare class DocGateV1 {
121
+ private readonly t;
122
+ private readonly format;
123
+ private p;
124
+ private lastTickAt;
125
+ private lastQuad;
126
+ private streak;
127
+ constructor(format: DocFormat, overrides?: Partial<DocGateThresholds>);
128
+ reset(): void;
129
+ tick(input: DocGateTickInput): DocGateTick;
130
+ private edgeClipped;
131
+ }
132
+
133
+ interface MrzBand {
134
+ x: number;
135
+ y: number;
136
+ width: number;
137
+ height: number;
138
+ /** Mean qualifying-row stroke density (diagnostics/telemetry). */
139
+ density: number;
140
+ }
141
+ interface MrzBandThresholds {
142
+ /** Luma step that counts as a text stroke edge. */
143
+ EDGE_LUMA_DELTA: number;
144
+ /** Min fraction of a row's pixels that are stroke edges to qualify. */
145
+ MIN_ROW_DENSITY: number;
146
+ /** Row must have stroke edges spread across ≥ this fraction of 12 columns. */
147
+ MIN_COLUMN_COVERAGE: number;
148
+ /** Band width (stroke x-extent) as a fraction of frame width. */
149
+ MIN_WIDTH_FRAC: number;
150
+ /** Band height bounds as fractions of frame height (2–3 OCR-B lines). */
151
+ MIN_HEIGHT_FRAC: number;
152
+ MAX_HEIGHT_FRAC: number;
153
+ /** Rows this close together merge into one band (inter-line gap). */
154
+ ROW_MERGE_GAP: number;
155
+ }
156
+ /** Frozen defaults (goldens in test/doc/mrz-band.test.ts — retune together). */
157
+ declare const MRZ_BAND_DEFAULTS: Readonly<MrzBandThresholds>;
158
+ /**
159
+ * Detect the MRZ stroke band on a (≤480px) grayscale-able frame. Returns the
160
+ * tight band rect in frame pixels, or null when no qualifying band exists
161
+ * (no MRZ in view, or only a partial/narrow slice of one).
162
+ */
163
+ declare function detectMrzBand(frame: ImageData, overrides?: Partial<MrzBandThresholds>): MrzBand | null;
164
+
165
+ type FramingStatus = "no_document" | "too_far" | "too_close" | "edge_clipped" | "wrong_shape" | "tilted" | "ok";
166
+ type LightingStatus = "too_dark" | "too_bright" | "ok";
167
+ type BlurStatus = "blurry" | "ok";
168
+ type GlareStatus = "glare" | "ok";
169
+ /** The per-frame analysis vector (every axis judged independently). */
170
+ interface DocFrameAnalysis {
171
+ framing: FramingStatus;
172
+ lighting: LightingStatus;
173
+ blur: BlurStatus;
174
+ glare: GlareStatus;
175
+ /** All-clear: every axis ok — the gate's integrator/stability input. */
176
+ acceptable: boolean;
177
+ }
178
+ interface DocFrameMeasures {
179
+ /** frame-quality sharpness on the doc-region crop (0..1). */
180
+ sharpness: number;
181
+ /** frame-quality exposure on the doc-region crop (0..1). */
182
+ exposure: number;
183
+ /** Mean crop luma (0..255) — picks too_dark vs too_bright. */
184
+ meanLuma: number;
185
+ /** Fraction of crop pixels at/above the specular ceiling (0..1). */
186
+ specularFraction: number;
187
+ }
188
+ /** Analysis thresholds beyond the gate's — frozen defaults (round 4). */
189
+ declare const DOC_ANALYSIS_DEFAULTS: Readonly<{
190
+ /** Doc area fraction above which the camera is too close (capture would crop). */
191
+ MAX_AREA_FRAC: 0.92;
192
+ /** Opposite-side length ratio beyond which the view is too oblique. */
193
+ TILT_MAX_SIDE_RATIO: 1.3;
194
+ /** Specular-pixel fraction at/above which the frame reads as glare. */
195
+ GLARE_MAX_SPECULAR_FRAC: 0.025;
196
+ }>;
197
+ /** Fraction of crop pixels with luma ≥ 252 — cheap specular-highlight measure. */
198
+ declare function specularFraction(crop: ImageData): number;
199
+ /** Opposite-side length ratio of the quad (1 = fronto-parallel). */
200
+ declare function quadTiltRatio(quad: DocQuad): number;
201
+ /**
202
+ * Judge one frame. `detectionMode` mirrors the gate: ID-1 quads carry
203
+ * area/aspect/tilt semantics; ID-3 MRZ bands carry width-fraction semantics
204
+ * (band rects are axis-aligned, so tilt/aspect checks are band-specific).
205
+ */
206
+ declare function analyzeDocFrame(input: {
207
+ format: DocFormat;
208
+ quad: DocQuad | null;
209
+ frameWidth: number;
210
+ frameHeight: number;
211
+ measures: DocFrameMeasures;
212
+ thresholds?: Partial<DocGateThresholds>;
213
+ }): DocFrameAnalysis;
214
+
215
+ /** Feedback vocabulary (dcv2.* message keys on the hosted side). */
216
+ type DocFeedbackKey = "sensing" | "too_far" | "too_close" | "edge_clipped" | "wrong_shape" | "tilted" | "too_dark" | "too_bright" | "blurry" | "glare" | "hold_still" | "processing" | "side_captured" | "captured";
217
+ /** Reticle rendering mode per feedback state (the stage maps to visuals). */
218
+ type ReticleType = "searching" | "coaching" | "locking" | "processing" | "flip" | "done";
219
+ interface DocFeedbackState {
220
+ key: DocFeedbackKey;
221
+ reticle: ReticleType;
222
+ /** The state holds the UI at least this long (ms) before a switch. */
223
+ minDurationMs: number;
224
+ }
225
+ declare const DOC_FEEDBACK_STATES: Readonly<Record<DocFeedbackKey, DocFeedbackState>>;
226
+ /** Frame analysis → the feedback vote it casts (worst axis speaks). */
227
+ declare function feedbackVoteOf(analysis: DocFrameAnalysis): DocFeedbackKey;
228
+ /** Sliding vote window + exponential decay + per-state minimum hold. */
229
+ declare class DocFeedbackAggregator {
230
+ private readonly windowMs;
231
+ /** Per-second decay factor — recent frames outvote stale ones. */
232
+ private readonly decayPerSecond;
233
+ private votes;
234
+ private current;
235
+ private currentSinceMs;
236
+ constructor(windowMs?: number,
237
+ /** Per-second decay factor — recent frames outvote stale ones. */
238
+ decayPerSecond?: number);
239
+ reset(): void;
240
+ /** Force a terminal/choreography state (capture fired, side flip, upload). */
241
+ force(key: Extract<DocFeedbackKey, "processing" | "side_captured" | "captured">, nowMs: number): DocFeedbackState;
242
+ /** Cast this frame's vote and return the (possibly held) winning state. */
243
+ tick(vote: DocFeedbackKey, nowMs: number): DocFeedbackState;
244
+ }
245
+
246
+ /**
247
+ * Pre-fetch + cache the scanic chunk (call when the scan surface MOUNTS, before
248
+ * the camera is even granted) so the first detect tick pays no chunk-fetch
249
+ * latency. Fire-and-forget; failures fall back to the lazy path.
250
+ */
251
+ declare function warmDocDetector(): void;
252
+ /** Doc detect cadence per device class — scanic @480px is ~3–8× a face tick,
253
+ * so the doc loop paces slower than the face profiles (findings §1: 2–5 Hz). */
254
+ declare const DOC_CADENCE_HZ: Readonly<Record<DeviceClass, number>>;
255
+ interface DocChecksPayload {
256
+ engine: "docv1";
257
+ /** Gate integrator 0..1 — the overlay ring. */
258
+ p: number;
259
+ plausible: boolean;
260
+ stableTicks: number;
261
+ quad: DocQuad | null;
262
+ /** Detect-frame size the quad coordinates live in (overlay scaling). */
263
+ frameWidth: number;
264
+ frameHeight: number;
265
+ /** Capture-v2 per-frame status vector (framing/lighting/blur/glare). */
266
+ analysis: DocFrameAnalysis;
267
+ }
268
+ /** Artifacts: `keyframe` = the full-res still of the framed side (JPEG). */
269
+ type DocArtifacts = CaptureArtifacts & {
270
+ side?: DocSide;
271
+ };
272
+ interface CaptureSessionDocEvents {
273
+ statechange: {
274
+ state: CaptureState;
275
+ };
276
+ checks: DocChecksPayload;
277
+ /** dcv1.* message KEY — hosts translate; never prose. Deduped. */
278
+ guidance: {
279
+ key: string;
280
+ };
281
+ /** Capture-v2 AGGREGATED feedback (time-decay voted, min-duration held) —
282
+ * the stage's message + reticle channel. Deduped on state key. */
283
+ feedback: DocFeedbackState;
284
+ artifacts: DocArtifacts;
285
+ error: {
286
+ kind: CaptureErrorKind;
287
+ retryable: boolean;
288
+ };
289
+ }
290
+ interface CaptureSessionDocOptions {
291
+ /** Host-owned <video playsInline muted>. */
292
+ video: HTMLVideoElement;
293
+ format?: DocFormat;
294
+ /** Side label stamped on the artifacts event (recto→verso sequencing). */
295
+ side?: DocSide;
296
+ thresholds?: Partial<DocGateThresholds>;
297
+ deviceClass?: DeviceClass;
298
+ /** (navigator.mediaDevices.getUserMedia — environment camera) */
299
+ getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
300
+ /** (vendored scanic detectQuad) */
301
+ detect?: (image: ImageData) => Promise<DocQuad | null>;
302
+ /** (canvas downscale of the live video to the 480px detect frame) */
303
+ grabDetectFrame?: (video: HTMLVideoElement, targetWidth: number) => ImageData | null;
304
+ /** (full-res canvas still → JPEG blob + preview; quad passed for telemetry) */
305
+ captureStill?: (video: HTMLVideoElement, quad: DocQuad, detectSize: {
306
+ width: number;
307
+ height: number;
308
+ }) => Promise<{
309
+ blob: Blob;
310
+ previewDataUrl: string;
311
+ }>;
312
+ /** (performance.now) */
313
+ now?: () => number;
314
+ /** (setTimeout/clearTimeout) — the cadence pacer. */
315
+ setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
316
+ clearTimer?: (id: ReturnType<typeof setTimeout>) => void;
317
+ }
318
+ type Handler<K extends keyof CaptureSessionDocEvents> = (payload: CaptureSessionDocEvents[K]) => void;
319
+ declare class CaptureSessionDoc {
320
+ private readonly opts;
321
+ private readonly gate;
322
+ private readonly cadenceMs;
323
+ private readonly handlers;
324
+ private stream;
325
+ private timer;
326
+ private state;
327
+ private lastGuidance;
328
+ private attempt;
329
+ private capturing;
330
+ private readonly feedback;
331
+ private lastFeedbackKey;
332
+ constructor(opts: CaptureSessionDocOptions);
333
+ on<K extends keyof CaptureSessionDocEvents>(event: K, handler: Handler<K>): () => void;
334
+ private emit;
335
+ start(): Promise<void>;
336
+ /** Restart the gate for another side / a retake (same stream). */
337
+ rearm(side?: DocSide): void;
338
+ destroy(): void;
339
+ private setState;
340
+ private scheduleTick;
341
+ private tick;
342
+ /**
343
+ * BEST-FRAME capture window (capture-v2): the first ready tick captures a
344
+ * candidate immediately, then up to CAPTURE_EXTRA_CANDIDATES more stills are
345
+ * taken at CAPTURE_CANDIDATE_SPACING_MS while the user holds — each scored
346
+ * by the live detect-tick sharpness at its capture moment — and the SHARPEST
347
+ * wins. Beats first-acceptable-frame capture without decoding stills.
348
+ */
349
+ private fire;
350
+ }
351
+ /** Best-frame window: 2 extra candidates, 260ms apart, ≥8% sharper to replace. */
352
+ declare const CAPTURE_EXTRA_CANDIDATES = 2;
353
+ declare const CAPTURE_CANDIDATE_SPACING_MS = 260;
354
+
355
+ /**
356
+ * Reasons the backend parks at `input_required` while attempts remain
357
+ * (identity-backend/src/checks/check-reasons.ts isRetryable tables — the single
358
+ * source of truth; identity-hosted/lib/reason-copy.ts mirrors the same rows).
359
+ */
360
+ declare const RETRYABLE_REASONS: ReadonlySet<CheckReason>;
361
+ /** A check the browser may still submit. */
362
+ declare function isExecutable(step: HostedStepView | undefined): boolean;
363
+ /** The session accepts no further submissions. */
364
+ declare function isTerminalView(view: Pick<HostedSessionView, "status">): boolean;
365
+ /** First step in `steps[]` order with state `pending | input_required` (the backend's frontier). */
366
+ declare function frontierStep(view: HostedSessionView): HostedStepView | undefined;
367
+ declare function stepOf(view: HostedSessionView, checkType: CheckType): HostedStepView | undefined;
368
+ /**
369
+ * Fold a submit response (partner `SessionView`: no attemptsRemaining) into the
370
+ * hosted view: status/outcome/step states+reasons come from the response; the
371
+ * submitted check's `attemptsRemaining` is decremented locally (every accepted
372
+ * submit consumes exactly one attempt server-side — `max(0, cap - attempts)`).
373
+ * This keeps the happy path free of extra `GET /hosted/session` round-trips.
374
+ */
375
+ declare function mergeSessionView(prev: HostedSessionView, next: SessionView, submitted: CheckType): HostedSessionView;
376
+ /**
377
+ * Map the session view to the public result:
378
+ * - `completed/approved → approved`, `completed/review` or `review_pending → review`,
379
+ * `failed` or `completed/rejected → rejected` (reason = the deciding step's);
380
+ * - `expired → unavailable` (no reason);
381
+ * - in flight: a biometric step parked at `input_required` with a retryable
382
+ * reason → `retry` when `autoRetry` and attempts remain, else `rejected`
383
+ * (the partner opted out of retries — this capture was refused); a step in
384
+ * `review` with nothing executable left → `review`; otherwise `unavailable`
385
+ * (a non-biometric frontier the SDK cannot drive, or still processing).
386
+ */
387
+ declare function mapSessionResult(view: HostedSessionView, opts: {
388
+ autoRetry: boolean;
389
+ }): VerificationResult;
390
+
391
+ declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
392
+ /** Bound on a single execute round-trip (challenge fetch + solve). */
393
+ declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
394
+ interface TurnstileRenderParams {
395
+ sitekey: string;
396
+ callback: (token: string) => void;
397
+ "error-callback"?: (code?: string) => void;
398
+ execution?: "render" | "execute";
399
+ appearance?: "always" | "execute" | "interaction-only";
400
+ }
401
+ /** The subset of the Turnstile JS API this module uses. */
402
+ interface TurnstileApi {
403
+ render(container: HTMLElement, params: TurnstileRenderParams): string | undefined;
404
+ execute(widgetId: string): void;
405
+ remove(widgetId: string): void;
406
+ }
407
+ /** Test-only: reset the module singleton between cases. */
408
+ declare function resetTurnstileForTests(): void;
409
+ /** Load the Turnstile script once (singleton; a load failure resets it so a
410
+ * retry can re-attempt). */
411
+ declare function loadTurnstile(): Promise<TurnstileApi>;
412
+ /** Options of {@link executeTurnstile}. */
413
+ interface ExecuteTurnstileOptions {
414
+ /** Bound on the challenge round-trip; default {@link TURNSTILE_EXECUTE_TIMEOUT_MS}. */
415
+ timeoutMs?: number;
416
+ /**
417
+ * Aborts the challenge: the promise rejects and the widget, its container and
418
+ * the timeout are cleaned up at once. `createVerification().destroy()` passes
419
+ * its own signal so a torn-down verification never leaves a widget behind.
420
+ */
421
+ signal?: AbortSignal;
422
+ }
423
+ /**
424
+ * Run one invisible execute-mode challenge and resolve its token. Rejects on
425
+ * challenge error, on `signal` abort, or after {@link TURNSTILE_EXECUTE_TIMEOUT_MS}
426
+ * — the verification maps a failure to `result {status:'unavailable',
427
+ * reason:'attestation'}` after one retry.
428
+ */
429
+ declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
430
+
431
+ export { ASPECT_BANDS, type BlurStatus, CAPTURE_CANDIDATE_SPACING_MS, CAPTURE_EXTRA_CANDIDATES, CaptureSessionDoc, type CaptureSessionDocEvents, type CaptureSessionDocOptions, DOC_ANALYSIS_DEFAULTS, DOC_CADENCE_HZ, DOC_DETECT_WIDTH, DOC_FEEDBACK_STATES, DOC_GATE_V1_DEFAULTS, type DocArtifacts, type DocCatalogEntry, type DocChecksPayload, DocFeedbackAggregator, type DocFeedbackKey, type DocFeedbackState, type DocFormat, type DocFrameAnalysis, type DocFrameMeasures, type DocGateQuality, type DocGateThresholds, type DocGateTick, type DocGateTickInput, DocGateV1, type DocQuad, type DocQuadPoint, type DocSide, type ExecuteTurnstileOptions, type FramingStatus, type GlareStatus, type LightingStatus, MRZ_BAND_DEFAULTS, MR_DOC_CATALOG, type MrzBand, type MrzBandThresholds, RETRYABLE_REASONS, type ReticleType, TURNSTILE_EXECUTE_TIMEOUT_MS, TURNSTILE_SCRIPT_SRC, type TurnstileApi, type TurnstileRenderParams, analyzeDocFrame, aspectBand, detectMrzBand, executeTurnstile, feedbackVoteOf, frontierStep, isExecutable, isTerminalView, loadTurnstile, mapSessionResult, mergeSessionView, quadAreaFrac, quadBounds, quadIou, quadTiltRatio, resetTurnstileForTests, specularFraction, stepOf, warmDocDetector };