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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +29 -0
  3. package/README.md +136 -2
  4. package/THIRD-PARTY-NOTICES.txt +154 -0
  5. package/dist/background-monitor-A7FKJOAG.js +1 -0
  6. package/dist/capture-constraints-B5omafmk.d.cts +44 -0
  7. package/dist/capture-constraints-B5omafmk.d.ts +44 -0
  8. package/dist/capture-session-doc-GK6G7JOI.js +1 -0
  9. package/dist/capture-session-v3-CmJw_bK0.d.cts +585 -0
  10. package/dist/capture-session-v3-DGG2stO6.d.ts +585 -0
  11. package/dist/chunk-3MSUJYBO.js +1 -0
  12. package/dist/chunk-7ZCZY3ZP.js +1 -0
  13. package/dist/chunk-A3FUGHAH.js +2 -0
  14. package/dist/chunk-BAGSM67V.js +1 -0
  15. package/dist/chunk-BPE5NSQ2.js +1 -0
  16. package/dist/chunk-CJHMFPL6.js +1 -0
  17. package/dist/chunk-DFTCAWMP.js +1 -0
  18. package/dist/chunk-DK5YPBDQ.js +1 -0
  19. package/dist/chunk-ETY6SAAZ.js +1 -0
  20. package/dist/chunk-FFDB6LQN.js +1 -0
  21. package/dist/chunk-FHJ7HO3M.js +1 -0
  22. package/dist/chunk-FPXL63KZ.js +1 -0
  23. package/dist/chunk-FUHDOEBP.js +1 -0
  24. package/dist/chunk-G6LKLN4U.js +1 -0
  25. package/dist/chunk-GI3UFGRQ.js +1 -0
  26. package/dist/chunk-HAO6EQTH.js +1 -0
  27. package/dist/chunk-HWAXEQD5.js +1 -0
  28. package/dist/chunk-MXWLCDFX.js +1 -0
  29. package/dist/chunk-O5WKNZ2C.js +1 -0
  30. package/dist/chunk-OKWG3PVH.js +1 -0
  31. package/dist/chunk-POIQGEZM.js +1 -0
  32. package/dist/chunk-RI3E7GBN.js +1 -0
  33. package/dist/chunk-SEC64KZ3.js +1 -0
  34. package/dist/chunk-SMKCBUJL.js +1 -0
  35. package/dist/chunk-SXZCL5NO.js +1 -0
  36. package/dist/chunk-SZ7YGNUZ.js +1 -0
  37. package/dist/chunk-TDLIXFDT.js +1 -0
  38. package/dist/chunk-UGMHAFEY.js +1 -0
  39. package/dist/chunk-WKJJEPWA.js +1 -0
  40. package/dist/chunk-XR64UFLK.js +1 -0
  41. package/dist/client/index.cjs +1 -0
  42. package/dist/client/index.d.cts +71 -0
  43. package/dist/client/index.d.ts +71 -0
  44. package/dist/client/index.js +1 -0
  45. package/dist/core/index.cjs +1 -0
  46. package/dist/core/index.d.cts +87 -0
  47. package/dist/core/index.d.ts +87 -0
  48. package/dist/core/index.js +1 -0
  49. package/dist/core/ocr/worker.bundle.js +42 -0
  50. package/dist/core/ocr/worker.cjs +42 -0
  51. package/dist/core/ocr/worker.d.cts +84 -0
  52. package/dist/core/ocr/worker.d.ts +84 -0
  53. package/dist/core/ocr/worker.js +41 -0
  54. package/dist/core/v3/detect-worker.cjs +1 -0
  55. package/dist/core/v3/detect-worker.d.cts +1 -0
  56. package/dist/core/v3/detect-worker.d.ts +1 -0
  57. package/dist/core/v3/detect-worker.js +1 -0
  58. package/dist/create-document-capture-IGUQP2NS.js +1 -0
  59. package/dist/create-portrait-capture-RJSFY37D.js +1 -0
  60. package/dist/create-verification-Bb20j6zk.d.ts +2968 -0
  61. package/dist/create-verification-CtqF4A9W.d.cts +2968 -0
  62. package/dist/detect-worker-DclNxkZT.d.cts +111 -0
  63. package/dist/detect-worker-DclNxkZT.d.ts +111 -0
  64. package/dist/detector-scanic-YCDNLCGV.js +1 -0
  65. package/dist/icao-gate-PWBMKRGC.js +1 -0
  66. package/dist/icao-gate-terzKYD7.d.cts +1770 -0
  67. package/dist/icao-gate-terzKYD7.d.ts +1770 -0
  68. package/dist/icao-tuning-4GGVX6B4.js +1 -0
  69. package/dist/index.cjs +1 -0
  70. package/dist/index.d.cts +74 -0
  71. package/dist/index.d.ts +74 -0
  72. package/dist/index.js +1 -0
  73. package/dist/internal/index.cjs +1 -0
  74. package/dist/internal/index.d.cts +462 -0
  75. package/dist/internal/index.d.ts +462 -0
  76. package/dist/internal/index.js +1 -0
  77. package/dist/keyframe-rank-YAJLYJYF.js +1 -0
  78. package/dist/landmarker-KB7LVXAU.js +1 -0
  79. package/dist/mrz-band-VYHOTDHY.js +1 -0
  80. package/dist/plan-runner-QCK2SOGS.js +1 -0
  81. package/dist/popup/index.cjs +1 -0
  82. package/dist/popup/index.d.cts +66 -0
  83. package/dist/popup/index.d.ts +66 -0
  84. package/dist/popup/index.js +1 -0
  85. package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
  86. package/dist/segmenter-USLNBX65.js +1 -0
  87. package/dist/turnstile-FATNZ4AG.js +1 -0
  88. package/package.json +133 -4
  89. package/sbom.cdx.json +195 -0
@@ -0,0 +1,462 @@
1
+ import { aZ as DocCatalogEntry, a_ as LiveMrzTuning, a$ as TextLockTuning, b0 as OcrEngineClient, b1 as DocAssistReport, b2 as ReadyInfo, b3 as LoadFailure, b4 as OcrEngineOptions, b5 as SubmitRuntime, a1 as LivenessCaptureOptions, a0 as LivenessCaptureHandle, aJ as VerificationStep, aH as VerificationResult, ay as StepSnapshot, Y as LivePhotoGateUpdate, b6 as HostedClientLike } from '../create-verification-CtqF4A9W.cjs';
2
+ export { b7 as ANALYSIS_LONG_EDGE, b8 as ASPECT_BANDS, b9 as AttestationError, ba as BLUR_REFUSE_SHARPNESS_MAX, bb as BlurStatus, bc as CAPTURE_CANDIDATE_SPACING_MS, bd as CAPTURE_EXTRA_CANDIDATES, be as CLIP_MIME_ALLOWLIST, bf as CaptureEngine, bg as CaptureSessionDoc, bh as CaptureSessionDocEvents, bi as CaptureSessionDocOptions, bj as DOC_ANALYSIS_DEFAULTS, bk as DOC_CADENCE_HZ, bl as DOC_CAMERA_TUNING_DEFAULTS, bm as DOC_CATALOG, bn as DOC_DETECT_WIDTH, bo as DOC_FEEDBACK_STATES, bp as DOC_GATE_V1_DEFAULTS, bq as DOC_SHUTTER_DEFAULTS, br as DeviceReadHint, bs as DocArtifacts, bt as DocAssist, bu as DocAssistEngine, bv as DocAssistTick, bw as DocCameraTuning, bx as DocCaptureReport, by as DocCaptureVia, bz as DocChecksPayload, bA as DocEngineLike, bB as DocFeedbackAggregator, bC as DocFeedbackKey, bD as DocFeedbackState, bE as DocFormat, bF as DocFrameAnalysis, bG as DocFrameMeasures, bH as DocGateQuality, bI as DocGateThresholds, bJ as DocGateTick, bK as DocGateTickInput, bL as DocGateV1, bM as DocQuad, bN as DocQuadPoint, bO as DocShutterReason, bP as DocShutterTuning, bQ as DocSide, bR as DocumentCaptureController, bS as DocumentCaptureInternals, bT as EMPTY_GUIDE_METRICS, bU as EncodedDocument, bV as FLIP_FILL_MIN, bW as FLIP_GAP_MS, bX as FLIP_TIMEOUT_MS, bY as FocusCaps, bZ as FramingStatus, b_ as GUIDE_LOCK_DEFAULTS, b$ as GlareStatus, c0 as GrabbedFrame, c1 as GuideBlocker, c2 as GuideLock, c3 as GuideLockTick, c4 as GuideLockTuning, c5 as GuideMetrics, c6 as GuideRect, c7 as INFERENCE_RETRY_ATTEMPTS, c8 as INFERENCE_RETRY_DEFAULT_S, U as ISSUER_CODES, c9 as LANDMARKER_MODEL, ca as LENS_STORAGE_KEY, cb as LENS_TRY_MAX, cc as LIVE_MRZ_DEFAULTS, cd as LIVE_PHOTO_IDLE_MS, ce as LIVE_PHOTO_MAX_HZ, cf as LandmarkedFace, cg as LandmarkerLike, ch as LensKind, ci as LensSource, cj as LightingStatus, ck as LiveMrzCapture, cl as LiveMrzState, cm as LivePhotoGate, cn as LivePhotoKit, co as LivePhotoKitInternals, cp as LivePhotoKitOptions, cq as LivePhotoStill, cr as LivenessCaptureInternalHandle, cs as LivenessCaptureInternals, ct as LivenessFlowDeps, cu as LivenessFlowOutcome, cv as MANUAL_SHUTTER_MS, cw as MR_DOC_CATALOG, cx as NO_REPORT_MS, cy as OpenDocCameraDeps, cz as PORTRAIT_JPEG_QUALITY, cA as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cB as PRELOAD_BUDGET_MS, cC as PROCESSING_POLL_DELAY_MS, cD as PROCESSING_POLL_MAX, cE as PortraitCaptureController, cF as PortraitCaptureInternals, cG as REGISTRY_RETRY_DELAY_MS, cH as ReticleType, cI as SAME_FACE_MAX_DROPS, cJ as ScanEvent, cK as ScanLayout, cL as ScanNotice, cM as ScanPhase, cN as ScanReport, cO as ScanSide, cP as ScanState, cQ as SubmitExecutor, cR as TEXT_LOCK_DEFAULTS, cS as TRANSPORT_REPLAY_ATTEMPTS, cT as TRANSPORT_REPLAY_DELAY_MS, cU as VerificationInternals, cV as analyzeDocFrame, cW as analyzeGuide, cX as aspectBand, cY as aspectFits, cZ as buildDeviceReadHint, c_ as coverPointToVideo, c$ as createDocumentCaptureInternal, d0 as createFaceLandmarker, d1 as createLivePhotoKit, d2 as createLivenessCaptureInternal, d3 as createPortraitCaptureInternal, d4 as createVerificationInternal, d5 as docZoomFor, d6 as encodeDocumentImage, d7 as facesOf, d8 as feedbackVoteOf, d9 as focusOk, da as guideQuad, db as guideRegionInFrame, dc as initialScanState, dd as lensKindOf, de as mapEngineState, df as mapErrorKind, dg as mapGuidanceHint, dh as nextScanState, di as observePortraitFrame, dj as openDocCamera, dk as passportBandOf, dl as portraitMatchStep, dm as preloadedDetectorFactory, dn as quadAreaFrac, dp as quadBounds, dq as quadIou, dr as quadTiltRatio, ds as randomUuid, dt as rankBackCameras, du as readStoredLens, dv as resetLivenessAssetsForTests, dw as resolveDocCameraTuning, dx as resolveDocShutterTuning, dy as resolveGuideLockTuning, dz as runLivenessFlow, dA as runSubmission, dB as scannerFormatFor, dC as setPreloadLoaderForTests, dD as settledHint, dE as singleShotFocusAt, dF as specularFraction, dG as supportsFocusMode, dH as warmDocDetector, dI as writeStoredLens } from '../create-verification-CtqF4A9W.cjs';
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-B5omafmk.cjs';
4
+ import { B as HostedSessionView, c as CheckType, a as CheckReason, a7 as PlanStepView } from '../icao-gate-terzKYD7.cjs';
5
+ export { ag as BackgroundStats, ah as Box, ai as CLIPPED_LUMA, aj as FaceGeometry, ak as FaceLighting, H as HeadPose, al as ICAO_CANVAS, am as ICAO_FALLBACK, an as ICAO_GATE_CRITERIA, ao as ICAO_SHARP_REF, K as IcaoCaptureTuning, L as IcaoCoachKey, N as IcaoCriterionState, ap as IcaoFrameObservation, aq as IcaoGate, O as IcaoGateCriterion, ar as IcaoGateOptions, P as IcaoGateSummary, Q as IcaoGateUpdate, as as IcaoJudgedCriterion, at as IcaoMeasures, au as IcaoPixelStats, av as IcaoProfile, aw as LumaPlane, ax as Point, ay as RegionStats, az as ResolvedIcaoTuning, aA as backgroundStats, aB as createIcaoGate, aC as eyeLineRoll, aD as eyeOpenness, aE as eyeSpecular, aF as faceGeometry, aG as faceLighting, aH as faceSharpness, aI as icaoPixelStats, aJ as icaoWindow, aK as judgeIcao, aL as lumaPlane, aM as percentile, aN as portraitCropRegion, aO as poseFromMatrix, aP as regionStats, aQ as resolveIcaoTuning, aR as scoreFrame, aS as windowOverflow } from '../icao-gate-terzKYD7.cjs';
6
+ import '../detect-worker-DclNxkZT.cjs';
7
+ import '../capture-session-v3-CmJw_bK0.cjs';
8
+
9
+ type DocumentTypeId = DocCatalogEntry["docType"];
10
+ /** Same shape as the hosted view's `acceptedDocuments`. */
11
+ interface AcceptedDocumentsLike {
12
+ default: "*" | readonly DocumentTypeId[];
13
+ byIssuer?: Readonly<Record<string, readonly DocumentTypeId[]>>;
14
+ }
15
+ /** Picker order. */
16
+ declare const DOCUMENT_TYPE_ORDER: readonly DocumentTypeId[];
17
+ /** Types accepted for documents of `issuer` (ISO alpha-2), in picker order. */
18
+ declare function acceptedTypesFor(accepted: AcceptedDocumentsLike, issuer: string): DocumentTypeId[];
19
+ /** Issuers with at least one accepted type, sorted by code (the UI re-sorts by name). */
20
+ declare function acceptedIssuers(accepted: AcceptedDocumentsLike, codes?: readonly string[]): string[];
21
+ /** `acceptedDocuments`, or — from a server that predates it — MR with the legacy list. */
22
+ declare function resolveAcceptedDocuments(view: {
23
+ acceptedDocuments?: AcceptedDocumentsLike | undefined;
24
+ acceptedDocumentTypes?: readonly DocumentTypeId[] | undefined;
25
+ }): AcceptedDocumentsLike;
26
+ /** 🇲🇷-style flag from an alpha-2 code (regional indicator symbols). */
27
+ declare function flagOf(iso2: string): string;
28
+
29
+ interface MrzBand {
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ /** Mean qualifying-row stroke density (diagnostics/telemetry). */
35
+ density: number;
36
+ }
37
+ interface MrzBandThresholds {
38
+ /** Luma step that counts as a text stroke edge. */
39
+ EDGE_LUMA_DELTA: number;
40
+ /** Min fraction of a row's pixels that are stroke edges to qualify. */
41
+ MIN_ROW_DENSITY: number;
42
+ /** Row must have stroke edges spread across ≥ this fraction of 12 columns. */
43
+ MIN_COLUMN_COVERAGE: number;
44
+ /** Band width (stroke x-extent) as a fraction of frame width. */
45
+ MIN_WIDTH_FRAC: number;
46
+ /** Band height bounds as fractions of frame height (2–3 OCR-B lines). */
47
+ MIN_HEIGHT_FRAC: number;
48
+ MAX_HEIGHT_FRAC: number;
49
+ /** Rows this close together merge into one band (inter-line gap). */
50
+ ROW_MERGE_GAP: number;
51
+ }
52
+ /** Frozen defaults (goldens in test/doc/mrz-band.test.ts — retune together). */
53
+ declare const MRZ_BAND_DEFAULTS: Readonly<MrzBandThresholds>;
54
+ /**
55
+ * Detect the MRZ stroke band on a (≤480px) grayscale-able frame. Returns the
56
+ * tight band rect in frame pixels, or null when no qualifying band exists
57
+ * (no MRZ in view, or only a partial/narrow slice of one).
58
+ */
59
+ declare function detectMrzBand(frame: ImageData, overrides?: Partial<MrzBandThresholds>): MrzBand | null;
60
+
61
+ type CapabilityFailure = "simd" | "worker" | "bitmap" | "memory";
62
+ type Capability = {
63
+ ok: true;
64
+ } | {
65
+ ok: false;
66
+ reason: CapabilityFailure;
67
+ };
68
+ type Probe = {
69
+ WebAssembly?: {
70
+ validate?: (b: BufferSource) => boolean;
71
+ };
72
+ Worker?: unknown;
73
+ createImageBitmap?: unknown;
74
+ navigator?: {
75
+ deviceMemory?: number;
76
+ connection?: {
77
+ saveData?: boolean;
78
+ effectiveType?: string;
79
+ };
80
+ };
81
+ };
82
+ declare function probeCapabilities(t: {
83
+ minDeviceMemoryGb: number;
84
+ }, g?: Probe): Capability;
85
+
86
+ /** This build's engine (packages/sekyro-ocr-wasm wasm-engine.lock.json `engine`). */
87
+ declare const WEB_OCR_ENGINE = "sekyro-ocr-1";
88
+ interface WebOcrPlan {
89
+ /** Create the engine for this session (some OCR path is live). */
90
+ enabled: boolean;
91
+ liveMrz: (LiveMrzTuning & {
92
+ hint: boolean;
93
+ stillConfirm: boolean;
94
+ }) | null;
95
+ textLock: TextLockTuning | null;
96
+ /** The A/B arm per block (`null`: the block is absent or disabled — no report). */
97
+ liveMrzArm: "live" | "control" | null;
98
+ frontLockArm: "live" | "control" | null;
99
+ load: {
100
+ detectorLimit: number;
101
+ loadTimeoutMs: number;
102
+ maxDownloadMs: number;
103
+ minDeviceMemoryGb: number;
104
+ };
105
+ reportSampleRate: number;
106
+ }
107
+ /** `capture.document` → the plan. `mode: "off"` (the embedded option) turns every OCR path off. */
108
+ declare function resolveWebOcrPlan(document: unknown, o?: {
109
+ mode?: "auto" | "off";
110
+ engine?: string;
111
+ }): WebOcrPlan;
112
+ type WebOcrStart = {
113
+ ok: true;
114
+ engine: OcrEngineClient;
115
+ } | {
116
+ ok: false;
117
+ reason: "unsupported" | "off";
118
+ };
119
+ /**
120
+ * Create the engine when the plan, the device (SIMD, workers, bitmaps, memory) and the network allow; else the reason
121
+ * (`off`: nothing enabled for this session; `unsupported`: the device or a slow / Save-Data connection).
122
+ */
123
+ declare function startWebOcr(plan: WebOcrPlan, o: Pick<OcrEngineOptions, "baseUrl" | "salt" | "workerUrl" | "createWorker" | "page"> & {
124
+ probe?: typeof probeCapabilities;
125
+ slow?: () => boolean;
126
+ }): WebOcrStart;
127
+ type BrowserFamily = "chrome" | "safari" | "samsung" | "firefox" | "other";
128
+ /** A fixed browser family (spec §10): from UA brands / tokens, never the UA string itself. */
129
+ declare function browserFamily(ua?: string): BrowserFamily;
130
+ /** The `live_mrz` wire report (identity-backend capture-report.schema.ts LiveMrzReportSchema). Enums and integers only. */
131
+ interface LiveMrzWireReport {
132
+ kind: "live_mrz";
133
+ platform: "web";
134
+ engine: string;
135
+ arm: "live" | "control";
136
+ capture: "recto" | "verso" | "single";
137
+ outcome: "valid" | "locked" | "timeout" | "slow" | "unsupported" | "download" | "integrity" | "error" | "off";
138
+ reads: number;
139
+ format?: "TD1" | "TD2" | "TD3";
140
+ framesToValid?: number;
141
+ msToValid?: number;
142
+ framesToLock?: number;
143
+ msToLock?: number;
144
+ msToCapture?: number;
145
+ warmupMs?: number;
146
+ readP50Ms?: number;
147
+ readP90Ms?: number;
148
+ downloadMs?: number;
149
+ cached?: boolean;
150
+ stillConfirmed?: boolean;
151
+ typeMismatch?: boolean;
152
+ deviceClass?: "fast" | "mid" | "slow";
153
+ browser: BrowserFamily;
154
+ }
155
+ /**
156
+ * One face's report: from the assist's report when it ran, else the engine's load outcome (`unsupported`, `download`,
157
+ * `integrity`, `error`/`timeout` → error) or `off` (the control arm). `arm` = the block's arm for this face.
158
+ */
159
+ declare function liveMrzWireReport(i: {
160
+ arm: "live" | "control";
161
+ capture: "recto" | "verso" | "single";
162
+ assist?: DocAssistReport | null;
163
+ load?: ReadyInfo | LoadFailure | "off" | null;
164
+ msToCapture?: number;
165
+ stillConfirmed?: boolean;
166
+ typeMismatch?: boolean;
167
+ browser?: BrowserFamily;
168
+ engine?: string;
169
+ }): LiveMrzWireReport;
170
+ /** A valid live read whose format contradicts the picked document (spec D5 state 4): TD3 on a card, TD1/TD2 on a passport. */
171
+ declare function formatMismatch(format: "TD1" | "TD2" | "TD3" | undefined, picked: "passport" | "card"): boolean;
172
+
173
+ declare const OCR_ASSET_SET: {
174
+ readonly fp12: "08390000c48a";
175
+ readonly engine: "sekyro-ocr-1";
176
+ readonly precision: "fp32";
177
+ readonly files: {
178
+ readonly "sekyro-ocr.wasm": {
179
+ readonly bytes: 3550608;
180
+ readonly sha256: "c15968a6de3d2225e2fdbf36d71a9214c2910419056c6878444fd2d0567bb748";
181
+ readonly tier: "live";
182
+ readonly contentType: "application/wasm";
183
+ };
184
+ readonly "sekyro-ocr.mjs": {
185
+ readonly bytes: 4270;
186
+ readonly sha256: "209a78d96ca53344996a0c2300aed4ff8a5c69e142713216975a2840eec08cac";
187
+ readonly tier: "bundled";
188
+ readonly contentType: "text/javascript";
189
+ };
190
+ readonly "det.param": {
191
+ readonly bytes: 24252;
192
+ readonly sha256: "c39ba0b1195e8ad37cfc5bdd7acedcfc1d9cb901e7b8eb1c9c4f6e5a66c04eb3";
193
+ readonly tier: "live";
194
+ readonly contentType: "text/plain";
195
+ };
196
+ readonly "det.bin": {
197
+ readonly bytes: 4685856;
198
+ readonly sha256: "652bafe366565109a1a5766caf482bc46f01481f8044d3a785bd9a1be67c63bb";
199
+ readonly tier: "live";
200
+ readonly contentType: "application/octet-stream";
201
+ };
202
+ readonly "mrz-rec.param": {
203
+ readonly bytes: 3510;
204
+ readonly sha256: "bc69b1b9683e35f6605b21001fadeb81468063459c00c0fc83c67c139f23df01";
205
+ readonly tier: "live";
206
+ readonly contentType: "text/plain";
207
+ };
208
+ readonly "mrz-rec.bin": {
209
+ readonly bytes: 494196;
210
+ readonly sha256: "de93a2aa2f08670cc7dedd17ba378d2f5d7cf6ae409054a9eac863a02c2febae";
211
+ readonly tier: "live";
212
+ readonly contentType: "application/octet-stream";
213
+ };
214
+ readonly "mrz_dict.txt": {
215
+ readonly bytes: 73;
216
+ readonly sha256: "b19858a4de2ccbbbdd4b53982188ea2c7664013183bbd1ae9d20ab52c661f97f";
217
+ readonly tier: "live";
218
+ readonly contentType: "text/plain";
219
+ };
220
+ readonly "latin-rec.param": {
221
+ readonly bytes: 19602;
222
+ readonly sha256: "2ae30dfdc7ee482c6cbbc0419c16ee125e880e9eaf69053d61953694bb0fcf4c";
223
+ readonly tier: "lazy";
224
+ readonly contentType: "text/plain";
225
+ };
226
+ readonly "latin-rec.bin": {
227
+ readonly bytes: 10750388;
228
+ readonly sha256: "f91ebdcf4d6b58c58a87704160e59d07ae56bc2d5021eae09d095c5a20bf7525";
229
+ readonly tier: "lazy";
230
+ readonly contentType: "application/octet-stream";
231
+ };
232
+ readonly "ppocr_keys_v1.txt": {
233
+ readonly bytes: 26249;
234
+ readonly sha256: "28b2362ad4ab2dc38769aa72feb535e3a9ddb3fd2a7585a05920e6393b1dc7f7";
235
+ readonly tier: "lazy";
236
+ readonly contentType: "text/plain";
237
+ };
238
+ readonly "arabic-rec.param": {
239
+ readonly bytes: 9858;
240
+ readonly sha256: "4e5cc85667dfaaa0c67d3f308400645a578c08bd43f952cab6c55b7bce143ea9";
241
+ readonly tier: "lazy";
242
+ readonly contentType: "text/plain";
243
+ };
244
+ readonly "arabic-rec.bin": {
245
+ readonly bytes: 8853572;
246
+ readonly sha256: "5acc3265a1738dc31316258383830d5dbdfa5e8ebc2e710f9001f832ecfbffb0";
247
+ readonly tier: "lazy";
248
+ readonly contentType: "application/octet-stream";
249
+ };
250
+ readonly "arabic_dict.txt": {
251
+ readonly bytes: 405;
252
+ readonly sha256: "637c27c88512c22089bef927b34ada08f748dc132ac70facd68d8202384c2726";
253
+ readonly tier: "lazy";
254
+ readonly contentType: "text/plain";
255
+ };
256
+ };
257
+ };
258
+
259
+ /** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
260
+ declare const PROCESSING_BACKOFF_MS: readonly number[];
261
+ /** Hosted parity: a resend is offered 30 s after the last send. */
262
+ declare const OTP_RESEND_COOLDOWN_MS = 30000;
263
+ type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
264
+ interface RunnerDeps {
265
+ runtime: SubmitRuntime;
266
+ currentView(): HostedSessionView | null;
267
+ ensureView(): Promise<HostedSessionView>;
268
+ refreshView(): Promise<HostedSessionView>;
269
+ ensureConsent(): Promise<void>;
270
+ liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
271
+ /** A liveness submission chain is in flight (do not flip the UI mid-upload). */
272
+ chainBusy(): boolean;
273
+ destroyed(): boolean;
274
+ sleep(ms: number): Promise<void>;
275
+ isMobile(): boolean;
276
+ now(): number;
277
+ emitStep(step: VerificationStep): void;
278
+ emitResult(result: VerificationResult): void;
279
+ /**
280
+ * The promoted face_match probe key of the last liveness submission (profile
281
+ * v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
282
+ * `pending` face_match is resubmitted with it — no new capture. `null` when
283
+ * no liveness was submitted from this page (e.g. after a reload).
284
+ */
285
+ keptFaceKey?(): string | null;
286
+ /** Task 4: binds the document step (selectDocument + capture). */
287
+ bindDocument?(snapshot: Extract<StepSnapshot, {
288
+ kind: "document";
289
+ }>, republish: () => void): VerificationStep;
290
+ /** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
291
+ bindPortrait?(snapshot: Extract<StepSnapshot, {
292
+ kind: "portrait";
293
+ }>, republish: () => void): VerificationStep;
294
+ /** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
295
+ setView?(view: HostedSessionView): void;
296
+ /** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
297
+ onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
298
+ }
299
+ interface StepRunner {
300
+ run(): Promise<VerificationStep>;
301
+ current(): VerificationStep | null;
302
+ /** Called by the verification on every view update. */
303
+ onView(view: HostedSessionView): void;
304
+ /** Called when the liveness chain becomes idle. */
305
+ onChainIdle(): void;
306
+ /** Re-derive from the current view and publish even if unchanged (local overlay changed). */
307
+ republish(): void;
308
+ /** Submit one step input (exposed for the document binding, Task 4). */
309
+ submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
310
+ }
311
+ declare function createStepRunner(deps: RunnerDeps): StepRunner;
312
+
313
+ /**
314
+ * Reasons the backend parks at `input_required` while attempts remain
315
+ * (identity-backend/src/checks/check-reasons.ts isRetryable tables — the single
316
+ * source of truth; identity-hosted/lib/reason-copy.ts mirrors the same rows).
317
+ */
318
+ declare const RETRYABLE_REASONS: ReadonlySet<CheckReason>;
319
+ /** A check the browser may still submit. */
320
+ declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
321
+ /** The session accepts no further submissions. */
322
+ declare function isTerminalView(view: Pick<HostedSessionView, "status">): boolean;
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;
327
+ /**
328
+ * Map the session view to the public result:
329
+ * - `completed/approved → approved`, `completed/review` or `review_pending → review`,
330
+ * `failed` or `completed/rejected → rejected` (session-policy reason takes
331
+ * precedence on a failed session; otherwise use the deciding step's reason);
332
+ * - `expired → unavailable` (no reason);
333
+ * - in flight: a biometric step parked at `input_required` with a retryable
334
+ * reason → `retry` when `autoRetry` and attempts remain, else `rejected`
335
+ * (`mobile_required` → `unavailable`: only a phone can capture it)
336
+ * (the partner opted out of retries — this capture was refused); a step in
337
+ * `review` with nothing executable left → `review`; otherwise `unavailable`
338
+ * (a non-biometric frontier the SDK cannot drive, or still processing).
339
+ */
340
+ declare function mapSessionResult(view: HostedSessionView, opts: {
341
+ autoRetry: boolean;
342
+ }): VerificationResult;
343
+
344
+ declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
345
+ /** Bound on a single execute round-trip (challenge fetch + solve). */
346
+ declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
347
+ interface TurnstileRenderParams {
348
+ sitekey: string;
349
+ callback: (token: string) => void;
350
+ "error-callback"?: (code?: string) => void;
351
+ execution?: "render" | "execute";
352
+ appearance?: "always" | "execute" | "interaction-only";
353
+ }
354
+ /** The subset of the Turnstile JS API this module uses. */
355
+ interface TurnstileApi {
356
+ render(container: HTMLElement, params: TurnstileRenderParams): string | undefined;
357
+ execute(widgetId: string): void;
358
+ remove(widgetId: string): void;
359
+ }
360
+ /** Test-only: reset the module singleton between cases. */
361
+ declare function resetTurnstileForTests(): void;
362
+ /** Load the Turnstile script once (singleton; a load failure resets it so a
363
+ * retry can re-attempt). */
364
+ declare function loadTurnstile(): Promise<TurnstileApi>;
365
+ /** Options of {@link executeTurnstile}. */
366
+ interface ExecuteTurnstileOptions {
367
+ /** Bound on the challenge round-trip; default {@link TURNSTILE_EXECUTE_TIMEOUT_MS}. */
368
+ timeoutMs?: number;
369
+ /**
370
+ * Aborts the challenge: the promise rejects and the widget, its container and
371
+ * the timeout are cleaned up at once. `createVerification().destroy()` passes
372
+ * its own signal so a torn-down verification never leaves a widget behind.
373
+ */
374
+ signal?: AbortSignal;
375
+ }
376
+ /**
377
+ * Run one invisible execute-mode challenge and resolve its token. Rejects on
378
+ * challenge error, on `signal` abort, or after {@link TURNSTILE_EXECUTE_TIMEOUT_MS}
379
+ * — the verification maps a failure to `result {status:'unavailable',
380
+ * reason:'attestation'}` after one retry.
381
+ */
382
+ declare function executeTurnstile(siteKey: string, opts?: ExecuteTurnstileOptions): Promise<string>;
383
+
384
+ /**
385
+ * Face of a decoded still: an MRZ band means the verso. With `cardOnly` (the still is the card itself) the band must
386
+ * 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.
387
+ */
388
+ declare function classifyCardSideWith(detect: typeof detectMrzBand, still: ImageData, cardOnly?: boolean): "recto" | "verso";
389
+ /** {@link classifyCardSideWith} with the MRZ-band detector loaded on demand. */
390
+ declare function classifyCardSide(still: ImageData, cardOnly?: boolean): Promise<"recto" | "verso">;
391
+ /** Downscale a captured JPEG to a 480 px-wide ImageData for the classifier. */
392
+ declare function stillToImageData(blob: Blob, width?: number): Promise<ImageData | null>;
393
+
394
+ /** Long side the measure runs at (Mattel: about what the recognizer sees of a card). */
395
+ declare const SHARPNESS_LONG_EDGE = 1000;
396
+ /** Inverse-edge-width sharpness of an RGBA image; `-1` for an unusable one (< 16 px). */
397
+ declare function photoSharpness(image: {
398
+ data: ArrayLike<number>;
399
+ width: number;
400
+ height: number;
401
+ }): number;
402
+ /** A rectangle of the full-resolution still, in its pixels. */
403
+ interface StillRegion {
404
+ x: number;
405
+ y: number;
406
+ width: number;
407
+ height: number;
408
+ }
409
+ /** Padding around the card's bounding box, as a fraction of its size per side. */
410
+ declare const REGION_PAD = 0.06;
411
+ /**
412
+ * The card region of the still (Mattel measures the guide region, not the
413
+ * whole photo): the bounding box of the last gate quad — in detect-frame
414
+ * coordinates — scaled to the still, padded by {@link REGION_PAD} and clamped.
415
+ * `null` when there is no usable quad (then the whole still is measured).
416
+ */
417
+ declare function stillRegionOf(quad: {
418
+ topLeft: {
419
+ x: number;
420
+ y: number;
421
+ };
422
+ topRight: {
423
+ x: number;
424
+ y: number;
425
+ };
426
+ bottomRight: {
427
+ x: number;
428
+ y: number;
429
+ };
430
+ bottomLeft: {
431
+ x: number;
432
+ y: number;
433
+ };
434
+ } | null, frame: {
435
+ width: number;
436
+ height: number;
437
+ }, still: {
438
+ width: number;
439
+ height: number;
440
+ }, pad?: number): StillRegion | null;
441
+ type RawImage = {
442
+ data: ArrayLike<number>;
443
+ width: number;
444
+ height: number;
445
+ };
446
+ /** Crop `region` out of an RGBA image (pure; the canvas path does the same with drawImage). */
447
+ declare function cropImage(image: RawImage, region: StillRegion): {
448
+ data: Uint8ClampedArray;
449
+ width: number;
450
+ height: number;
451
+ };
452
+ /** Area-average downscale so the long side is at most `longEdge` (pure; mirrors cv INTER_AREA). */
453
+ declare function resizeLongEdge(image: RawImage, longEdge?: number): RawImage;
454
+ /** The blur-gate measure of a still: its card region (or the whole still), scaled to ≤ 1000 px. */
455
+ declare function measureRegionSharpness(image: RawImage, region: StillRegion | null): number;
456
+ /**
457
+ * Browser path of {@link measureRegionSharpness} on an already decoded still:
458
+ * one drawImage crops and scales the region; the canvas is released after.
459
+ */
460
+ declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
461
+
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 };