@idmission/websdk-core 0.2.0-rc.2 → 0.2.0
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/README.md +8 -1
- package/dist/client/IdmissionClient.d.ts +2 -0
- package/dist/client/IdmissionClient.d.ts.map +1 -1
- package/dist/client/IdmissionClient.js +3 -0
- package/dist/client/artifacts.d.ts +2 -0
- package/dist/client/artifacts.d.ts.map +1 -1
- package/dist/client/payload.d.ts.map +1 -1
- package/dist/client/payload.js +2 -1
- package/dist/client/types.d.ts +2 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/documentCapture/autoCaptureEngine.d.ts +106 -0
- package/dist/documentCapture/autoCaptureEngine.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureEngine.js +456 -0
- package/dist/documentCapture/autoCaptureGeometry.d.ts +424 -0
- package/dist/documentCapture/autoCaptureGeometry.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureGeometry.js +394 -0
- package/dist/documentCapture/autoCaptureGuidance.d.ts +61 -0
- package/dist/documentCapture/autoCaptureGuidance.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureGuidance.js +73 -0
- package/dist/documentCapture/autoCaptureMetadata.d.ts +185 -0
- package/dist/documentCapture/autoCaptureMetadata.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureMetadata.js +197 -0
- package/dist/documentCapture/autoCaptureOptions.d.ts +212 -0
- package/dist/documentCapture/autoCaptureOptions.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureOptions.js +178 -0
- package/dist/documentCapture/autoCaptureShutter.d.ts +162 -0
- package/dist/documentCapture/autoCaptureShutter.d.ts.map +1 -0
- package/dist/documentCapture/autoCaptureShutter.js +183 -0
- package/dist/documentCapture/controller.d.ts +33 -1
- package/dist/documentCapture/controller.d.ts.map +1 -1
- package/dist/documentCapture/controller.js +604 -40
- package/dist/documentCapture/index.d.ts +8 -2
- package/dist/documentCapture/index.d.ts.map +1 -1
- package/dist/documentCapture/index.js +6 -0
- package/dist/documentCapture/reducer.d.ts +26 -1
- package/dist/documentCapture/reducer.d.ts.map +1 -1
- package/dist/documentCapture/reducer.js +43 -0
- package/dist/documentCapture/state.d.ts +118 -0
- package/dist/documentCapture/state.d.ts.map +1 -1
- package/dist/documentCapture/state.js +24 -0
- package/dist/idCapture/controller.d.ts +20 -0
- package/dist/idCapture/controller.d.ts.map +1 -1
- package/dist/idCapture/controller.js +42 -3
- package/dist/idCapture/index.d.ts +1 -1
- package/dist/idCapture/index.d.ts.map +1 -1
- package/dist/idCapture/index.js +12 -1
- package/dist/idCapture/pipeline.d.ts +30 -0
- package/dist/idCapture/pipeline.d.ts.map +1 -1
- package/dist/idCapture/pipeline.js +33 -10
- package/dist/models/DocumentDetection.d.ts +29 -1
- package/dist/models/DocumentDetection.d.ts.map +1 -1
- package/dist/models/DocumentDetection.js +37 -5
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts +3 -0
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.js +15 -0
- package/dist/models/defaults/index.d.ts +4 -1
- package/dist/models/defaults/index.d.ts.map +1 -1
- package/dist/models/defaults/index.js +4 -0
- package/dist/models/preloadModels.d.ts +21 -14
- package/dist/models/preloadModels.d.ts.map +1 -1
- package/dist/models/preloadModels.js +10 -0
- package/dist/models/providers/litert/docDetectPrePost.d.ts.map +1 -1
- package/dist/models/providers/litert/docDetectPrePost.js +5 -0
- package/dist/selfieCapture/guidance.d.ts +49 -0
- package/dist/selfieCapture/guidance.d.ts.map +1 -1
- package/dist/selfieCapture/guidance.js +51 -0
- package/dist/selfieCapture/index.d.ts +1 -1
- package/dist/selfieCapture/index.d.ts.map +1 -1
- package/dist/selfieCapture/index.js +1 -1
- package/dist/signatureCapture/controller.d.ts.map +1 -1
- package/dist/signatureCapture/controller.js +71 -21
- package/dist/signatureCapture/pipeline.d.ts +14 -2
- package/dist/signatureCapture/pipeline.d.ts.map +1 -1
- package/dist/signatureCapture/pipeline.js +30 -7
- package/dist/signatureCapture/state.d.ts +15 -0
- package/dist/signatureCapture/state.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/videoIdCapture/controller.d.ts.map +1 -1
- package/dist/videoIdCapture/controller.js +64 -3
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { AutoCaptureDiagnostics } from './autoCaptureGeometry';
|
|
2
|
+
import type { DocumentCaptureMode } from './state';
|
|
3
|
+
/**
|
|
4
|
+
* Why auto-capture was or was not the thing that fired.
|
|
5
|
+
*
|
|
6
|
+
* A separate field rather than more `captureMode` members: `captureMode` is an
|
|
7
|
+
* existing wire enum the ID side shares, and widening it changes meaning for a
|
|
8
|
+
* flow that is not moving. These are the situations that would all otherwise
|
|
9
|
+
* collapse into `'Manual'`.
|
|
10
|
+
*
|
|
11
|
+
* `disabled:lateFlag` is the one worth insisting on. `autoCapture` is
|
|
12
|
+
* mount-time-only, so a capture screen that mounts before the host's flags land
|
|
13
|
+
* has auto-capture off for that applicant's entire session — and if that race
|
|
14
|
+
* cannot be SEEN IN THE FIELD, a misconfigured flags gate reads as "the flag is
|
|
15
|
+
* off and the ramp is fine."
|
|
16
|
+
*/
|
|
17
|
+
export type AutoCaptureStatus =
|
|
18
|
+
/** The loop ran and was allowed to fire. */
|
|
19
|
+
'engaged'
|
|
20
|
+
/** No `autoCapture` bag on this document. */
|
|
21
|
+
| 'disabled:unconfigured'
|
|
22
|
+
/** The host's feature flag was off. */
|
|
23
|
+
| 'disabled:flag'
|
|
24
|
+
/** A per-session escape (e.g. `?autoCapture=0`) turned it off. */
|
|
25
|
+
| 'disabled:param'
|
|
26
|
+
/** The bag arrived AFTER mount and was therefore ignored. */
|
|
27
|
+
| 'disabled:lateFlag'
|
|
28
|
+
/** The detector failed to load, so the screen fell back to a manual shutter. */
|
|
29
|
+
| 'disabled:modelLoadFailed'
|
|
30
|
+
/** The escape budget ran out and the applicant took the shutter. */
|
|
31
|
+
| 'timedOutToManual';
|
|
32
|
+
/**
|
|
33
|
+
* The accumulated reading for one capture attempt.
|
|
34
|
+
*
|
|
35
|
+
* A SIBLING of `AutoCaptureDiagnostics`, not the same type, because they differ
|
|
36
|
+
* on a real axis: the diagnostics bag is INSTANTANEOUS — what the engine
|
|
37
|
+
* believes on this frame, for someone watching glass — and this is ACCUMULATED,
|
|
38
|
+
* `best*` being maxima across the attempt, which is what a soak median is
|
|
39
|
+
* computed over. One source, two projections. Sharing one type would force
|
|
40
|
+
* either the live bag to carry running maxima it has no use for, or this to
|
|
41
|
+
* report whatever the last frame happened to say.
|
|
42
|
+
*
|
|
43
|
+
* It also deliberately DROPS `CaptureAttemptMetadata`'s `bestMaxGlareScore`,
|
|
44
|
+
* `bestMaxHologramScore`, `bestBarcodeScore`, `barcodeBoundingBox` and
|
|
45
|
+
* `livenessScore`. Reusing that type verbatim would put five permanently-
|
|
46
|
+
* undefined fields on every POA record and invite a reader to conclude that an
|
|
47
|
+
* absent `bestMaxGlareScore` means "no glare".
|
|
48
|
+
*/
|
|
49
|
+
export type DocumentCaptureAttemptMetadata = {
|
|
50
|
+
/** Schema marker: a live backend reader already exists for `filemetadata`. */
|
|
51
|
+
v: 1;
|
|
52
|
+
captureMode: DocumentCaptureMode;
|
|
53
|
+
autoCaptureStatus: AutoCaptureStatus;
|
|
54
|
+
/**
|
|
55
|
+
* Attempts made for this document, including the discarded ones.
|
|
56
|
+
*
|
|
57
|
+
* Carried EXPLICITLY because `upload()` only ever runs on the accepted frame,
|
|
58
|
+
* so channel A sees exactly one attempt where channel B sees every one. Mean
|
|
59
|
+
* attempts-per-capture comes free on the ID side from its array-per-capture
|
|
60
|
+
* shape and here does not exist. Without this, the upload channel silently
|
|
61
|
+
* reports every capture as first-try — worse than reporting nothing, because
|
|
62
|
+
* it looks like a valid measurement.
|
|
63
|
+
*/
|
|
64
|
+
attemptCount: number;
|
|
65
|
+
/** ms from the loop starting to the shutter firing. */
|
|
66
|
+
captureTime: number | null;
|
|
67
|
+
/** ms the whole document took, including retries. */
|
|
68
|
+
operationTime: number | null;
|
|
69
|
+
/** Frames the engine actually ran. 0 on a manual or upload record. */
|
|
70
|
+
framesObserved: number;
|
|
71
|
+
/** Maxima across the attempt. Null when the engine never ran. */
|
|
72
|
+
bestDetectionScore: number | null;
|
|
73
|
+
bestFocusScore: number | null;
|
|
74
|
+
/** Detection scores of the discarded attempts, oldest first. */
|
|
75
|
+
discardedDetectionScores: number[];
|
|
76
|
+
/** The accepted frame's box, in frame fractions. */
|
|
77
|
+
boundingBox: {
|
|
78
|
+
xMin: number;
|
|
79
|
+
yMin: number;
|
|
80
|
+
xMax: number;
|
|
81
|
+
yMax: number;
|
|
82
|
+
} | null;
|
|
83
|
+
/**
|
|
84
|
+
* Framing at the accepted frame. Margins are READINGS, not verdicts — #343
|
|
85
|
+
* deleted the margin gate — and are carried so a later question about which
|
|
86
|
+
* axis bound is answerable without a new SDK release.
|
|
87
|
+
*/
|
|
88
|
+
framing: {
|
|
89
|
+
fill: number;
|
|
90
|
+
fillWidth: number;
|
|
91
|
+
fillHeight: number;
|
|
92
|
+
leftMargin: number;
|
|
93
|
+
rightMargin: number;
|
|
94
|
+
topMargin: number;
|
|
95
|
+
bottomMargin: number;
|
|
96
|
+
} | null;
|
|
97
|
+
/** The window in force when the shutter fired. */
|
|
98
|
+
fillWindow: {
|
|
99
|
+
fillMin: number;
|
|
100
|
+
fillMax: number;
|
|
101
|
+
} | null;
|
|
102
|
+
};
|
|
103
|
+
/** Running totals, folded one frame at a time. */
|
|
104
|
+
export type AttemptAccumulator = {
|
|
105
|
+
framesObserved: number;
|
|
106
|
+
bestDetectionScore: number | null;
|
|
107
|
+
bestFocusScore: number | null;
|
|
108
|
+
lastFrame: AutoCaptureDiagnostics | null;
|
|
109
|
+
startedAt: number | null;
|
|
110
|
+
attemptCount: number;
|
|
111
|
+
discardedDetectionScores: number[];
|
|
112
|
+
};
|
|
113
|
+
export declare function createAttemptAccumulator(): AttemptAccumulator;
|
|
114
|
+
/**
|
|
115
|
+
* Fold one frame in.
|
|
116
|
+
*
|
|
117
|
+
* `bestFocusScore` is SCOPED TO FRAMES THAT PASSED THE FILL WINDOW rather than
|
|
118
|
+
* being a session-wide running max, and that divergence from `idCapture` is
|
|
119
|
+
* required: focus and fill are orthogonal, so being the sharpest frame is no
|
|
120
|
+
* evidence of being a framed one, and a session-wide max would report a sharp
|
|
121
|
+
* reading taken from a framing the gate rejected.
|
|
122
|
+
*/
|
|
123
|
+
export declare function accumulateFrame(accumulator: AttemptAccumulator, frame: AutoCaptureDiagnostics): AttemptAccumulator;
|
|
124
|
+
/**
|
|
125
|
+
* A retry starts a new attempt against the same document.
|
|
126
|
+
*
|
|
127
|
+
* The discarded attempt's detection score is kept — it is the cheapest possible
|
|
128
|
+
* answer to "was the loop struggling, or was the applicant?" — while the frame
|
|
129
|
+
* maxima reset, because they describe the attempt that produced the artifact.
|
|
130
|
+
*/
|
|
131
|
+
export declare function retryAttempt(accumulator: AttemptAccumulator): AttemptAccumulator;
|
|
132
|
+
export type BuildAttemptMetadataOptions = {
|
|
133
|
+
captureMode: DocumentCaptureMode;
|
|
134
|
+
autoCaptureStatus: AutoCaptureStatus;
|
|
135
|
+
/** ms the document has been open, including retries. */
|
|
136
|
+
operationTime?: number | null;
|
|
137
|
+
/**
|
|
138
|
+
* The frame the submitted artifact was actually taken from.
|
|
139
|
+
*
|
|
140
|
+
* REQUIRED for an auto-capture, and the reason is a contract: `boundingBox`
|
|
141
|
+
* and `framing` claim to describe the accepted artifact. Falling back to the
|
|
142
|
+
* accumulator's last frame only holds while the shutter fires ON the frame
|
|
143
|
+
* it captures, which stopped being true when the burst window landed — the
|
|
144
|
+
* window deliberately runs through unsatisfied frames, so the last frame
|
|
145
|
+
* seen can be a blurred, cropped or empty one that the applicant never
|
|
146
|
+
* submitted. Filing that box against a sharp banked image is a measurement
|
|
147
|
+
* that looks valid and is not.
|
|
148
|
+
*/
|
|
149
|
+
acceptedFrame?: AutoCaptureDiagnostics | null;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Project the accumulator into the wire record.
|
|
153
|
+
*
|
|
154
|
+
* ALWAYS EMITTED, including for the control arm and for gallery uploads — see
|
|
155
|
+
* `emitsForEveryCapture` below. The auto-capture-specific fields go ABSENT
|
|
156
|
+
* (null), never zeroed: a zeroed `bestDetectionScore` reads as "the detector
|
|
157
|
+
* saw nothing", which is a different and false claim from "no detector ran".
|
|
158
|
+
*/
|
|
159
|
+
export declare function buildAttemptMetadata(accumulator: AttemptAccumulator | null, options: BuildAttemptMetadataOptions): DocumentCaptureAttemptMetadata;
|
|
160
|
+
/**
|
|
161
|
+
* The budget rule, enforced rather than documented.
|
|
162
|
+
*
|
|
163
|
+
* Uploads go to tusd, whose S3 store copies the ENTIRE tus metadata map into
|
|
164
|
+
* the object's user-defined metadata, which S3 caps at 2 KB total — and tus
|
|
165
|
+
* base64-encodes each value first (~1.33x), against a budget shared with
|
|
166
|
+
* `filetype`, `contentType`, `fingerprint`, `capturedAt`, `jobid` and `taskid`.
|
|
167
|
+
*
|
|
168
|
+
* Two constraints follow, both binding:
|
|
169
|
+
*
|
|
170
|
+
* - tusd REPLACES EVERY NON-ASCII CHARACTER WITH `?` in that copy. JSON of
|
|
171
|
+
* numbers and enums is pure ASCII, so a scalar spine is safe — but no
|
|
172
|
+
* human-readable string may ever ride here, which matters given the
|
|
173
|
+
* guidance strings ship in Spanish and `es` is what AMEX renders.
|
|
174
|
+
* - There is a second, UNCAPPED `.info` copy. The cap and the mangling apply
|
|
175
|
+
* to the convenient copy, not the only copy.
|
|
176
|
+
*
|
|
177
|
+
* `payload.ts`'s escape hatch — "the full analysis still reaches the submission
|
|
178
|
+
* body untouched" — DOES NOT EXIST HERE. With no submission body, the trimmed
|
|
179
|
+
* upload copy is the only wire copy, which is why channel B is not optional.
|
|
180
|
+
*
|
|
181
|
+
* This exists to stop exactly one thing: the ~300-frame diagnostics ring buffer.
|
|
182
|
+
*/
|
|
183
|
+
export declare const FILE_METADATA_BUDGET_BYTES = 600;
|
|
184
|
+
export declare function toFileMetadata(metadata: DocumentCaptureAttemptMetadata): string;
|
|
185
|
+
//# sourceMappingURL=autoCaptureMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoCaptureMetadata.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureMetadata.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// What a POA capture attempt reports about itself (#377).
|
|
2
|
+
//
|
|
3
|
+
// `documentCapture` has NO SUBMISSION — `collectArtifacts` returns `{}` because
|
|
4
|
+
// sdk2 runs this flow at `SubmissionAction.NONE` and the uploaded ids reach the
|
|
5
|
+
// integrator through `onComplete`, never `/submit`. So nothing here requires a
|
|
6
|
+
// backend contract change, and there is no `captureAttempts.documents` key to
|
|
7
|
+
// design. Two channels exist instead, and both are already load-bearing
|
|
8
|
+
// elsewhere:
|
|
9
|
+
//
|
|
10
|
+
// A. `DocumentMetadata.filemetadata` on the existing tus upload. A PROVEN
|
|
11
|
+
// channel: the backend signature-video trimmer already derives its clip
|
|
12
|
+
// window from this field on another document type, and dropping one entry
|
|
13
|
+
// from it once silently disabled trimming.
|
|
14
|
+
// B. A field on core's `CapturedDocument` result, which rides the façade's
|
|
15
|
+
// `toLegacyCapturedDocument` spread through to the 2.x `onCaptured` for
|
|
16
|
+
// free — where a third callback argument would be dropped on the floor by
|
|
17
|
+
// compat's wrapper.
|
|
18
|
+
//
|
|
19
|
+
// Channel B closes the ramp gate (host-side aggregation, `distinctId = jobId`
|
|
20
|
+
// already wired). Channel A is the durable per-artifact record that makes a
|
|
21
|
+
// backend ground-truth join POSSIBLE LATER without a second SDK release.
|
|
22
|
+
export function createAttemptAccumulator() {
|
|
23
|
+
return {
|
|
24
|
+
framesObserved: 0,
|
|
25
|
+
bestDetectionScore: null,
|
|
26
|
+
bestFocusScore: null,
|
|
27
|
+
lastFrame: null,
|
|
28
|
+
startedAt: null,
|
|
29
|
+
attemptCount: 1,
|
|
30
|
+
discardedDetectionScores: [],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Fold one frame in.
|
|
35
|
+
*
|
|
36
|
+
* `bestFocusScore` is SCOPED TO FRAMES THAT PASSED THE FILL WINDOW rather than
|
|
37
|
+
* being a session-wide running max, and that divergence from `idCapture` is
|
|
38
|
+
* required: focus and fill are orthogonal, so being the sharpest frame is no
|
|
39
|
+
* evidence of being a framed one, and a session-wide max would report a sharp
|
|
40
|
+
* reading taken from a framing the gate rejected.
|
|
41
|
+
*/
|
|
42
|
+
export function accumulateFrame(accumulator, frame) {
|
|
43
|
+
const inBand = !frame.fillWindow.tooClose && !frame.fillWindow.tooFar;
|
|
44
|
+
const focus = inBand && frame.focus ? frame.focus.score : null;
|
|
45
|
+
return {
|
|
46
|
+
...accumulator,
|
|
47
|
+
framesObserved: accumulator.framesObserved + 1,
|
|
48
|
+
startedAt: accumulator.startedAt ?? frame.timeRunning,
|
|
49
|
+
bestDetectionScore: maxOrNull(accumulator.bestDetectionScore, frame.target?.score ?? null),
|
|
50
|
+
bestFocusScore: maxOrNull(accumulator.bestFocusScore, focus),
|
|
51
|
+
lastFrame: frame,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A retry starts a new attempt against the same document.
|
|
56
|
+
*
|
|
57
|
+
* The discarded attempt's detection score is kept — it is the cheapest possible
|
|
58
|
+
* answer to "was the loop struggling, or was the applicant?" — while the frame
|
|
59
|
+
* maxima reset, because they describe the attempt that produced the artifact.
|
|
60
|
+
*/
|
|
61
|
+
export function retryAttempt(accumulator) {
|
|
62
|
+
const discarded = accumulator.bestDetectionScore;
|
|
63
|
+
return {
|
|
64
|
+
...createAttemptAccumulator(),
|
|
65
|
+
attemptCount: accumulator.attemptCount + 1,
|
|
66
|
+
discardedDetectionScores: discarded === null
|
|
67
|
+
? accumulator.discardedDetectionScores
|
|
68
|
+
: [...accumulator.discardedDetectionScores, round3(discarded)],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function maxOrNull(a, b) {
|
|
72
|
+
if (a === null)
|
|
73
|
+
return b;
|
|
74
|
+
if (b === null)
|
|
75
|
+
return a;
|
|
76
|
+
return Math.max(a, b);
|
|
77
|
+
}
|
|
78
|
+
/** Four decimals: two would round the whole framing decision away. */
|
|
79
|
+
function round4(value) {
|
|
80
|
+
return Math.round(value * 10000) / 10000;
|
|
81
|
+
}
|
|
82
|
+
function round3(value) {
|
|
83
|
+
return Math.round(value * 1000) / 1000;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Project the accumulator into the wire record.
|
|
87
|
+
*
|
|
88
|
+
* ALWAYS EMITTED, including for the control arm and for gallery uploads — see
|
|
89
|
+
* `emitsForEveryCapture` below. The auto-capture-specific fields go ABSENT
|
|
90
|
+
* (null), never zeroed: a zeroed `bestDetectionScore` reads as "the detector
|
|
91
|
+
* saw nothing", which is a different and false claim from "no detector ran".
|
|
92
|
+
*/
|
|
93
|
+
export function buildAttemptMetadata(accumulator, options) {
|
|
94
|
+
// The banked frame when there is one; the last frame seen otherwise, which
|
|
95
|
+
// is right for a manual capture (there is no banked pair) and for the
|
|
96
|
+
// control arm (there are no frames at all).
|
|
97
|
+
const frame = options.acceptedFrame ?? accumulator?.lastFrame ?? null;
|
|
98
|
+
const framing = frame?.framing ?? null;
|
|
99
|
+
const box = frame?.target?.box ?? null;
|
|
100
|
+
return {
|
|
101
|
+
v: 1,
|
|
102
|
+
captureMode: options.captureMode,
|
|
103
|
+
autoCaptureStatus: options.autoCaptureStatus,
|
|
104
|
+
attemptCount: accumulator?.attemptCount ?? 1,
|
|
105
|
+
captureTime: accumulator && frame && accumulator.startedAt !== null
|
|
106
|
+
? Math.round(frame.timeRunning - accumulator.startedAt)
|
|
107
|
+
: null,
|
|
108
|
+
operationTime: options.operationTime ?? null,
|
|
109
|
+
framesObserved: accumulator?.framesObserved ?? 0,
|
|
110
|
+
bestDetectionScore: accumulator?.bestDetectionScore === null ||
|
|
111
|
+
accumulator?.bestDetectionScore === undefined
|
|
112
|
+
? null
|
|
113
|
+
: round3(accumulator.bestDetectionScore),
|
|
114
|
+
bestFocusScore: accumulator?.bestFocusScore === null ||
|
|
115
|
+
accumulator?.bestFocusScore === undefined
|
|
116
|
+
? null
|
|
117
|
+
: round3(accumulator.bestFocusScore),
|
|
118
|
+
discardedDetectionScores: accumulator?.discardedDetectionScores ?? [],
|
|
119
|
+
boundingBox: box ? normalizeBox(box, frame) : null,
|
|
120
|
+
framing: framing
|
|
121
|
+
? {
|
|
122
|
+
fill: round4(framing.fill),
|
|
123
|
+
fillWidth: round4(framing.fillWidth),
|
|
124
|
+
fillHeight: round4(framing.fillHeight),
|
|
125
|
+
leftMargin: round4(framing.leftMargin),
|
|
126
|
+
rightMargin: round4(framing.rightMargin),
|
|
127
|
+
topMargin: round4(framing.topMargin),
|
|
128
|
+
bottomMargin: round4(framing.bottomMargin),
|
|
129
|
+
}
|
|
130
|
+
: null,
|
|
131
|
+
fillWindow: frame
|
|
132
|
+
? {
|
|
133
|
+
fillMin: frame.fillWindow.fillMin,
|
|
134
|
+
fillMax: frame.fillWindow.fillMax,
|
|
135
|
+
}
|
|
136
|
+
: null,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Fractions of the GUIDE RECT, because that is what the capture crops to — so
|
|
141
|
+
* the box describes the image the backend actually receives.
|
|
142
|
+
*
|
|
143
|
+
* Normalising against the raw frame would report coordinates into a picture
|
|
144
|
+
* nobody was sent: on a 16:9 camera the guide rect is ~40% of frame width, so
|
|
145
|
+
* a box hugging the crop's left edge would be filed at x ≈ 0.30.
|
|
146
|
+
*/
|
|
147
|
+
function normalizeBox(box, frame) {
|
|
148
|
+
const rect = frame?.guideRect;
|
|
149
|
+
const width = rect?.width || frame?.frameWidth || 1;
|
|
150
|
+
const height = rect?.height || frame?.frameHeight || 1;
|
|
151
|
+
const originX = rect?.x ?? 0;
|
|
152
|
+
const originY = rect?.y ?? 0;
|
|
153
|
+
return {
|
|
154
|
+
xMin: round4((box.xMin - originX) / width),
|
|
155
|
+
yMin: round4((box.yMin - originY) / height),
|
|
156
|
+
xMax: round4((box.xMax - originX) / width),
|
|
157
|
+
yMax: round4((box.yMax - originY) / height),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The budget rule, enforced rather than documented.
|
|
162
|
+
*
|
|
163
|
+
* Uploads go to tusd, whose S3 store copies the ENTIRE tus metadata map into
|
|
164
|
+
* the object's user-defined metadata, which S3 caps at 2 KB total — and tus
|
|
165
|
+
* base64-encodes each value first (~1.33x), against a budget shared with
|
|
166
|
+
* `filetype`, `contentType`, `fingerprint`, `capturedAt`, `jobid` and `taskid`.
|
|
167
|
+
*
|
|
168
|
+
* Two constraints follow, both binding:
|
|
169
|
+
*
|
|
170
|
+
* - tusd REPLACES EVERY NON-ASCII CHARACTER WITH `?` in that copy. JSON of
|
|
171
|
+
* numbers and enums is pure ASCII, so a scalar spine is safe — but no
|
|
172
|
+
* human-readable string may ever ride here, which matters given the
|
|
173
|
+
* guidance strings ship in Spanish and `es` is what AMEX renders.
|
|
174
|
+
* - There is a second, UNCAPPED `.info` copy. The cap and the mangling apply
|
|
175
|
+
* to the convenient copy, not the only copy.
|
|
176
|
+
*
|
|
177
|
+
* `payload.ts`'s escape hatch — "the full analysis still reaches the submission
|
|
178
|
+
* body untouched" — DOES NOT EXIST HERE. With no submission body, the trimmed
|
|
179
|
+
* upload copy is the only wire copy, which is why channel B is not optional.
|
|
180
|
+
*
|
|
181
|
+
* This exists to stop exactly one thing: the ~300-frame diagnostics ring buffer.
|
|
182
|
+
*/
|
|
183
|
+
export const FILE_METADATA_BUDGET_BYTES = 600;
|
|
184
|
+
/** How many discarded scores fit before the spine risks the budget. */
|
|
185
|
+
const MAX_DISCARDED_SCORES = 8;
|
|
186
|
+
export function toFileMetadata(metadata) {
|
|
187
|
+
const trimmed = {
|
|
188
|
+
...metadata,
|
|
189
|
+
discardedDetectionScores: metadata.discardedDetectionScores.slice(0, MAX_DISCARDED_SCORES),
|
|
190
|
+
};
|
|
191
|
+
const json = JSON.stringify(trimmed);
|
|
192
|
+
if (json.length <= FILE_METADATA_BUDGET_BYTES)
|
|
193
|
+
return json;
|
|
194
|
+
// Drop the optional collection before the scalar spine. Nothing below this
|
|
195
|
+
// point is unbounded, so one fallback is enough.
|
|
196
|
+
return JSON.stringify({ ...trimmed, discardedDetectionScores: [] });
|
|
197
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { DocumentDetectorRuntime } from '../models/DocumentDetection';
|
|
2
|
+
/**
|
|
3
|
+
* The four numeric gates, all required.
|
|
4
|
+
*
|
|
5
|
+
* Callers override a subset through `DocumentAutoCaptureOptions['thresholds']`,
|
|
6
|
+
* which is a `Partial` of this — so the resolved form and the override form are
|
|
7
|
+
* the same shape and cannot drift apart.
|
|
8
|
+
*
|
|
9
|
+
* Every value here is an OPERATING POINT, not a separator. The distributions
|
|
10
|
+
* they sit between touch: complete sheets max 0.996 against a held crop's min
|
|
11
|
+
* 0.994; readable framings min 0.710 against too-far max 0.721. What makes them
|
|
12
|
+
* defensible is the replay simulation over four real recordings, not any
|
|
13
|
+
* separation in the data (#380).
|
|
14
|
+
*/
|
|
15
|
+
export type DocumentAutoCaptureThresholds = {
|
|
16
|
+
/** Lower edge of #343's two-sided `fill` window — below it, "move closer". */
|
|
17
|
+
fillMin: number;
|
|
18
|
+
/** Upper edge — the anti-crop gate that IS the AMEX failure. "Move back." */
|
|
19
|
+
fillMax: number;
|
|
20
|
+
/** Minimum pairwise IoU across the stability window. NOT a score gate. */
|
|
21
|
+
stability: number;
|
|
22
|
+
/** Focus floor, already resolved for the platform branch in force. */
|
|
23
|
+
focus: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Per-document auto-capture options.
|
|
27
|
+
*
|
|
28
|
+
* PRESENCE is the opt-in: `autoCapture: {}` runs the loop with every default in
|
|
29
|
+
* force, and omitting it leaves today's manual shutter untouched. There is
|
|
30
|
+
* deliberately no `enabled?: boolean` member — that member is the cascade trap
|
|
31
|
+
* in its purest form (`item.autoCapture?.enabled ?? config.autoCapture?.enabled
|
|
32
|
+
* ?? true`) and would have been this repo's fifth incident.
|
|
33
|
+
*
|
|
34
|
+
* Adding members later is additive and non-breaking, so nothing is reserved
|
|
35
|
+
* here against future use.
|
|
36
|
+
*/
|
|
37
|
+
export type DocumentAutoCaptureOptions = {
|
|
38
|
+
/** Labels framing may be measured on, in priority order. */
|
|
39
|
+
targetLabels?: readonly string[];
|
|
40
|
+
/** Confidence floor a box must clear before geometry is taken from it. */
|
|
41
|
+
minScore?: number;
|
|
42
|
+
/** Length of both the IoU window and the `fill` window, in frames. */
|
|
43
|
+
stabilityFrames?: number;
|
|
44
|
+
/** ms of sustained gate failure before the manual shutter is offered. 0 disables. */
|
|
45
|
+
manualFallbackAfterMs?: number;
|
|
46
|
+
/**
|
|
47
|
+
* ms to keep looking for a sharper frame once the gates are satisfied.
|
|
48
|
+
* 0 fires on the first satisfied frame, which is the pre-burst behaviour.
|
|
49
|
+
*/
|
|
50
|
+
burstWindowMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* ms to keep looking for a sharper frame after the applicant TAPS. 0 saves
|
|
53
|
+
* the frame the tap landed on, which is the pre-burst behaviour.
|
|
54
|
+
*/
|
|
55
|
+
manualBurstWindowMs?: number;
|
|
56
|
+
thresholds?: Partial<DocumentAutoCaptureThresholds>;
|
|
57
|
+
};
|
|
58
|
+
/** Environment the resolver cannot read for itself. */
|
|
59
|
+
export type AutoCaptureEnvironment = {
|
|
60
|
+
/** Which branch of `POA_FOCUS_THRESHOLDS` applies. */
|
|
61
|
+
onMobile?: boolean;
|
|
62
|
+
/** What the integrator asked for on `DocumentCaptureControllerConfig`. */
|
|
63
|
+
documentDetectorRuntime?: DocumentDetectorRuntime;
|
|
64
|
+
};
|
|
65
|
+
/** `DocumentAutoCaptureOptions` with every value decided. */
|
|
66
|
+
export type ResolvedAutoCapture = {
|
|
67
|
+
targetLabels: readonly string[];
|
|
68
|
+
minScore: number;
|
|
69
|
+
stabilityFrames: number;
|
|
70
|
+
manualFallbackAfterMs: number;
|
|
71
|
+
burstWindowMs: number;
|
|
72
|
+
manualBurstWindowMs: number;
|
|
73
|
+
thresholds: DocumentAutoCaptureThresholds;
|
|
74
|
+
/** Which focus branch produced `thresholds.focus`. Reported, not inferred. */
|
|
75
|
+
focusBranch: 'desktop' | 'mobile';
|
|
76
|
+
/** Pinned; see `resolveDocumentDetectorRuntime`. */
|
|
77
|
+
documentDetectorRuntime: DocumentDetectorRuntime;
|
|
78
|
+
};
|
|
79
|
+
/** Frames the IoU window holds before a stability verdict is possible. */
|
|
80
|
+
export declare const DEFAULT_STABILITY_FRAMES = 12;
|
|
81
|
+
/**
|
|
82
|
+
* Minimum pairwise IoU across the stability window.
|
|
83
|
+
*
|
|
84
|
+
* Seeded from `defaultDocumentDetectionThresholds.stability.singlePage` and
|
|
85
|
+
* left there by #380: stability resolves in ~690 ms of not moving, so it is
|
|
86
|
+
* rarely the binding gate.
|
|
87
|
+
*/
|
|
88
|
+
export declare const DEFAULT_STABILITY_IOU = 0.5;
|
|
89
|
+
/**
|
|
90
|
+
* ms of sustained gate failure before the manual shutter is offered (#345).
|
|
91
|
+
*
|
|
92
|
+
* RAISED FROM 8000 ON FIELD EVIDENCE. The 8 s value was inherited from
|
|
93
|
+
* `idCapture`'s `allowOverrideWrongDocumentTypeAfterMs`, tuned for the
|
|
94
|
+
* wrong-document-type case, with no POA number behind it — and its own note
|
|
95
|
+
* predicted this outcome:
|
|
96
|
+
*
|
|
97
|
+
* > The hard recording first-captures at 11.5 s, so on hard-but-recoverable
|
|
98
|
+
* > framings the dialog will be offered BEFORE the loop succeeds. That is
|
|
99
|
+
* > harmless by construction — the loop stays armed until the applicant
|
|
100
|
+
* > accepts — but the dialog will be common, and nobody has watched a real
|
|
101
|
+
* > applicant react to it.
|
|
102
|
+
*
|
|
103
|
+
* Someone has now watched, and it pops while the loop is still converging.
|
|
104
|
+
* "Harmless by construction" was true of the CAPTURE and false of the
|
|
105
|
+
* experience: being offered a way out mid-attempt reads as the SDK giving up.
|
|
106
|
+
*
|
|
107
|
+
* 30 s clears the 11.5 s hard-recording first-capture with room, so the offer
|
|
108
|
+
* arrives after the loop has plainly failed rather than during its slowest
|
|
109
|
+
* success. Still an operating point rather than a measurement — what would
|
|
110
|
+
* move it is a distribution of real time-to-capture, not another guess.
|
|
111
|
+
*/
|
|
112
|
+
export declare const DEFAULT_MANUAL_FALLBACK_AFTER_MS = 30000;
|
|
113
|
+
/**
|
|
114
|
+
* Camera width worth requesting for auto-capture, as a RECOMMENDATION.
|
|
115
|
+
*
|
|
116
|
+
* The submitted image is the guide rect cropped out of the camera frame, so an
|
|
117
|
+
* A4 portrait guide on the default 1920-wide 16:9 stream is 764x1080 and the
|
|
118
|
+
* sheet inside it lands near 90 DPI — 6pt print about two pixels tall. That is
|
|
119
|
+
* a sampling limit, not blur, and no focus threshold recovers it. The same
|
|
120
|
+
* guide on 2560 is 1018x1440.
|
|
121
|
+
*
|
|
122
|
+
* NOT APPLIED AUTOMATICALLY, and that is the finding rather than an oversight.
|
|
123
|
+
* It was, briefly, and it made captures materially harder to land: the loop
|
|
124
|
+
* draws every frame at the stream's size, so a bigger frame costs more per
|
|
125
|
+
* frame, and both the stability and fill windows are twelve FRAMES — a slower
|
|
126
|
+
* loop stretches the hold-still the applicant has to sustain. Some devices
|
|
127
|
+
* also answer a larger width with a lower-frame-rate capture mode, which
|
|
128
|
+
* compounds it.
|
|
129
|
+
*
|
|
130
|
+
* So this is a number to pass deliberately, per integration, after watching
|
|
131
|
+
* `frameRate` on the tuning overlay:
|
|
132
|
+
*
|
|
133
|
+
* <DocumentCapture camera={{ maxVideoWidth: AUTO_CAPTURE_VIDEO_WIDTH }} … />
|
|
134
|
+
*
|
|
135
|
+
* Re-landing it as a default needs a frame-rate measurement across the target
|
|
136
|
+
* device range, not another guess.
|
|
137
|
+
*/
|
|
138
|
+
export declare const AUTO_CAPTURE_VIDEO_WIDTH = 2560;
|
|
139
|
+
/**
|
|
140
|
+
* ms to keep looking for a sharper frame after the gates first go green.
|
|
141
|
+
*
|
|
142
|
+
* WHY THIS EXISTS. Two of the three gates are windowed and slow-moving — fill
|
|
143
|
+
* is a 12-frame mean and stability is a 12-frame IoU — so they ratchet into
|
|
144
|
+
* satisfaction and stay there. Focus is the only single-frame gate. Firing on
|
|
145
|
+
* the first satisfied frame therefore fires the instant FOCUS first crosses
|
|
146
|
+
* its threshold, and that threshold is deliberately permissive: #380 lowered
|
|
147
|
+
* it to 0.5 because 0.6 was rejecting 4.8% of live frames.
|
|
148
|
+
*
|
|
149
|
+
* A first-crossing rule on a noisy signal is biased toward the threshold by
|
|
150
|
+
* construction — it catches marginal upward excursions. So the shutter was
|
|
151
|
+
* systematically capturing near the floor on exactly the holds where focus was
|
|
152
|
+
* the binding gate, which is the motion blur this addresses.
|
|
153
|
+
*
|
|
154
|
+
* Expressed in MILLISECONDS and converted through the measured frame rate,
|
|
155
|
+
* like `manualFallbackAfterMs`, so the pause is the same length of time on a
|
|
156
|
+
* fast phone and a slow one. A fixed frame count would be 200 ms at 30 fps and
|
|
157
|
+
* 750 ms at 8 fps — the device that can least afford the wait would wait
|
|
158
|
+
* longest.
|
|
159
|
+
*
|
|
160
|
+
* 300 ms is #383's `mean of 6` translated into time: six frames at the ~20 fps
|
|
161
|
+
* this loop runs at. It is an operating point, not a measurement.
|
|
162
|
+
*/
|
|
163
|
+
export declare const DEFAULT_BURST_WINDOW_MS = 300;
|
|
164
|
+
/**
|
|
165
|
+
* The same idea pointed at the applicant's tap, and longer on purpose.
|
|
166
|
+
*
|
|
167
|
+
* Pressing a phone's screen moves the phone. The frame the tap lands on is
|
|
168
|
+
* therefore among the WORST frames available — the finger has already made
|
|
169
|
+
* contact and the transient has not damped — so saving it is sampling the
|
|
170
|
+
* blur rather than avoiding it. This is the one complaint about hand-held
|
|
171
|
+
* manual capture that no amount of guidance can fix, because the guidance is
|
|
172
|
+
* correct right up until the moment the applicant acts on it.
|
|
173
|
+
*
|
|
174
|
+
* The window opens AT the tap and never reaches backwards. Frames from before
|
|
175
|
+
* it are sharper still, and deliberately out of scope: the tap is the
|
|
176
|
+
* applicant's intent expressed at a moment of their choosing, and submitting
|
|
177
|
+
* pixels from before it would be a different photo than the one they took.
|
|
178
|
+
* What the window buys is the settle on the far side.
|
|
179
|
+
*
|
|
180
|
+
* Longer than `burstWindowMs` because it has different work to do. That one
|
|
181
|
+
* picks the best of frames the gates have already certified; this one has to
|
|
182
|
+
* OUTLIVE a physical transient, and a window that ends inside the jostle has
|
|
183
|
+
* only jostled frames to choose between. 400 ms covers the damping on a
|
|
184
|
+
* hand-held phone with room on either side. It is an operating point, not a
|
|
185
|
+
* measurement — if it reads as lag, this is the number to turn down.
|
|
186
|
+
*/
|
|
187
|
+
export declare const DEFAULT_MANUAL_BURST_WINDOW_MS = 400;
|
|
188
|
+
/**
|
|
189
|
+
* Pin the document detector to the runtime that can actually run the POA
|
|
190
|
+
* artifact.
|
|
191
|
+
*
|
|
192
|
+
* The artifact's input tensor is uint8, and the mediapipe provider cannot load
|
|
193
|
+
* a raw `.tflite` at all — so `'mediapipe'` is downgraded with a warning rather
|
|
194
|
+
* than left to fail at the first frame, where it reads as a broken camera.
|
|
195
|
+
*
|
|
196
|
+
* The WebGPU half of this hazard is already closed one layer down:
|
|
197
|
+
* `providers/litert/DocumentDetection.ts` forces the `'wasm'` accelerator
|
|
198
|
+
* unconditionally, because LiteRT.js's WebGPU backend cannot allocate uint8
|
|
199
|
+
* tensor buffers and throws at the first `model.run()`. No knob on this surface
|
|
200
|
+
* can reach WebGPU, which is also why the Adreno/Snapdragon WebGPU hazard is
|
|
201
|
+
* moot here — it returns only if a future export drops uint8.
|
|
202
|
+
*/
|
|
203
|
+
export declare function resolveDocumentDetectorRuntime(requested: DocumentDetectorRuntime | undefined): DocumentDetectorRuntime;
|
|
204
|
+
/**
|
|
205
|
+
* Turn an all-optional `autoCapture` bag into a total one.
|
|
206
|
+
*
|
|
207
|
+
* Both parameters are `| undefined` and the return type has no optional
|
|
208
|
+
* members, which is the whole point: there is exactly one `??` per value, in
|
|
209
|
+
* one file, against one constant.
|
|
210
|
+
*/
|
|
211
|
+
export declare function resolveAutoCapture(options: DocumentAutoCaptureOptions | undefined, environment: AutoCaptureEnvironment | undefined): ResolvedAutoCapture;
|
|
212
|
+
//# sourceMappingURL=autoCaptureOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoCaptureOptions.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureOptions.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAS1E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAA;IACf,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,0BAA0B,GAAG;IAIvC,4DAA4D;IAC5D,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAG5B,UAAU,CAAC,EAAE,OAAO,CAAC,6BAA6B,CAAC,CAAA;CACpD,CAAA;AAED,uDAAuD;AACvD,MAAM,MAAM,sBAAsB,GAAG;IACnC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD,CAAA;AAED,6DAA6D;AAC7D,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,6BAA6B,CAAA;IACzC,8EAA8E;IAC9E,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAA;IACjC,oDAAoD;IACpD,uBAAuB,EAAE,uBAAuB,CAAA;CACjD,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAA;AAEjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,uBAAuB,GAAG,SAAS,GAC7C,uBAAuB,CASzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,0BAA0B,GAAG,SAAS,EAC/C,WAAW,EAAE,sBAAsB,GAAG,SAAS,GAC9C,mBAAmB,CAwBrB"}
|