@succinctlabs/react-native-zcam1 0.2.5
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 +61 -0
- package/Zcam1Sdk.podspec +157 -0
- package/app.plugin.js +11 -0
- package/cpp/generated/zcam1_c2pa_utils.cpp +4091 -0
- package/cpp/generated/zcam1_c2pa_utils.hpp +367 -0
- package/cpp/generated/zcam1_certs_utils.cpp +1799 -0
- package/cpp/generated/zcam1_certs_utils.hpp +72 -0
- package/cpp/generated/zcam1_verify_utils.cpp +1857 -0
- package/cpp/generated/zcam1_verify_utils.hpp +79 -0
- package/cpp/proving/generated/zcam1_proving_utils.cpp +3661 -0
- package/cpp/proving/generated/zcam1_proving_utils.hpp +275 -0
- package/cpp/proving/zcam1-proving.cpp +16 -0
- package/cpp/proving/zcam1-proving.h +15 -0
- package/cpp/zcam1-sdk.cpp +20 -0
- package/cpp/zcam1-sdk.h +15 -0
- package/ios/Zcam1Camera.swift +2945 -0
- package/ios/Zcam1CameraFilmStyle.swift +191 -0
- package/ios/Zcam1CameraViewManager.m +86 -0
- package/ios/Zcam1Capture.h +13 -0
- package/ios/Zcam1Capture.mm +500 -0
- package/ios/Zcam1DepthData.swift +417 -0
- package/ios/Zcam1Sdk.h +16 -0
- package/ios/Zcam1Sdk.mm +66 -0
- package/ios/proving/Zcam1Proving.h +16 -0
- package/ios/proving/Zcam1Proving.mm +66 -0
- package/lib/module/NativeZcam1Capture.js +12 -0
- package/lib/module/NativeZcam1Capture.js.map +1 -0
- package/lib/module/NativeZcam1Sdk.js +7 -0
- package/lib/module/NativeZcam1Sdk.js.map +1 -0
- package/lib/module/bindings.js +51 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/camera.js +522 -0
- package/lib/module/camera.js.map +1 -0
- package/lib/module/capture.js +120 -0
- package/lib/module/capture.js.map +1 -0
- package/lib/module/common.js +35 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils.js +1202 -0
- package/lib/module/generated/zcam1_c2pa_utils.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils.js +399 -0
- package/lib/module/generated/zcam1_certs_utils.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils.js +515 -0
- package/lib/module/generated/zcam1_proving_utils.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils.js +252 -0
- package/lib/module/generated/zcam1_verify_utils.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/picker.js +222 -0
- package/lib/module/picker.js.map +1 -0
- package/lib/module/proving/NativeZcam1Proving.js +7 -0
- package/lib/module/proving/NativeZcam1Proving.js.map +1 -0
- package/lib/module/proving/bindings.js +46 -0
- package/lib/module/proving/bindings.js.map +1 -0
- package/lib/module/proving/index.js +5 -0
- package/lib/module/proving/index.js.map +1 -0
- package/lib/module/proving/prove.js +346 -0
- package/lib/module/proving/prove.js.map +1 -0
- package/lib/module/utils.js +27 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/verify.js +82 -0
- package/lib/module/verify.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts +280 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts.map +1 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts +8 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts.map +1 -0
- package/lib/typescript/src/bindings.d.ts +14 -0
- package/lib/typescript/src/bindings.d.ts.map +1 -0
- package/lib/typescript/src/camera.d.ts +300 -0
- package/lib/typescript/src/camera.d.ts.map +1 -0
- package/lib/typescript/src/capture.d.ts +59 -0
- package/lib/typescript/src/capture.d.ts.map +1 -0
- package/lib/typescript/src/common.d.ts +10 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts +175 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts +811 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts +82 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts +413 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts +153 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts +321 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts +84 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts +286 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +29 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/picker.d.ts +103 -0
- package/lib/typescript/src/picker.d.ts.map +1 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts +8 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts.map +1 -0
- package/lib/typescript/src/proving/bindings.d.ts +8 -0
- package/lib/typescript/src/proving/bindings.d.ts.map +1 -0
- package/lib/typescript/src/proving/index.d.ts +3 -0
- package/lib/typescript/src/proving/index.d.ts.map +1 -0
- package/lib/typescript/src/proving/prove.d.ts +74 -0
- package/lib/typescript/src/proving/prove.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/verify.d.ts +45 -0
- package/lib/typescript/src/verify.d.ts.map +1 -0
- package/package.json +118 -0
- package/src/NativeZcam1Capture.ts +335 -0
- package/src/NativeZcam1Sdk.ts +10 -0
- package/src/bindings.tsx +49 -0
- package/src/camera.tsx +705 -0
- package/src/capture.tsx +165 -0
- package/src/common.tsx +46 -0
- package/src/generated/zcam1_c2pa_utils-ffi.ts +456 -0
- package/src/generated/zcam1_c2pa_utils.ts +1866 -0
- package/src/generated/zcam1_certs_utils-ffi.ts +187 -0
- package/src/generated/zcam1_certs_utils.ts +549 -0
- package/src/generated/zcam1_proving_utils-ffi.ts +374 -0
- package/src/generated/zcam1_proving_utils.ts +804 -0
- package/src/generated/zcam1_verify_utils-ffi.ts +196 -0
- package/src/generated/zcam1_verify_utils.ts +372 -0
- package/src/index.ts +73 -0
- package/src/picker.tsx +342 -0
- package/src/proving/NativeZcam1Proving.ts +10 -0
- package/src/proving/bindings.tsx +50 -0
- package/src/proving/index.ts +8 -0
- package/src/proving/prove.tsx +492 -0
- package/src/utils.ts +38 -0
- package/src/verify.tsx +119 -0
- package/turbo.json +27 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import JailMonkey from "jail-monkey";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { requireNativeComponent } from "react-native";
|
|
6
|
+
import { Dirs, Util } from "react-native-file-access";
|
|
7
|
+
import { buildSelfSignedCertificate, computeHash, formatFromPath, ManifestEditor } from "./bindings.js";
|
|
8
|
+
import { ZPhoto } from "./capture.js";
|
|
9
|
+
import NativeZcam1Sdk from "./NativeZcam1Capture.js";
|
|
10
|
+
import { generateAppAttestAssertion } from "./utils.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export const CERT_KEY_TAG = "CERT_KEY_TAG";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Capture format produced by the native Swift camera.
|
|
16
|
+
* - "jpeg": standard compressed JPEG file
|
|
17
|
+
* - "dng": RAW DNG file (original), C2PA-signed JPEG copy is still produced
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Camera film style presets.
|
|
22
|
+
* - "normal": No film style (default)
|
|
23
|
+
* - "mellow": Negative Film Gold style - warm, saturated, lifted shadows
|
|
24
|
+
* - "nostalgic": Kodak Portra 400 style - warm amber, faded, bright
|
|
25
|
+
* - "bw": Contrasty B&W with warm tint
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
// Custom Film Style Recipe Types
|
|
30
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
/** White balance adjustment configuration. */
|
|
33
|
+
|
|
34
|
+
/** Highlight and shadow adjustment configuration. */
|
|
35
|
+
|
|
36
|
+
/** Monochrome (black & white) film style configuration. */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Individual film style effect that can be combined into a recipe.
|
|
40
|
+
* Effects are applied in the order they appear in the recipe array.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A film style recipe is an ordered array of film style effects.
|
|
45
|
+
* Effects are applied sequentially to produce the final look.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Default film style recipes for built-in presets.
|
|
50
|
+
*/
|
|
51
|
+
const DEFAULT_FILM_STYLE_RECIPES = {
|
|
52
|
+
normal: [],
|
|
53
|
+
// Mellow: Negative Film Gold - warm amber/magenta, saturated, lifted shadows.
|
|
54
|
+
mellow: [{
|
|
55
|
+
type: "whiteBalance",
|
|
56
|
+
config: {
|
|
57
|
+
temperature: 6900,
|
|
58
|
+
tint: 40
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
type: "saturation",
|
|
62
|
+
value: 1.4
|
|
63
|
+
}, {
|
|
64
|
+
type: "contrast",
|
|
65
|
+
value: 0.8
|
|
66
|
+
}, {
|
|
67
|
+
type: "brightness",
|
|
68
|
+
value: -0.1
|
|
69
|
+
}, {
|
|
70
|
+
type: "highlightShadow",
|
|
71
|
+
config: {
|
|
72
|
+
highlights: 0,
|
|
73
|
+
shadows: 0.4
|
|
74
|
+
}
|
|
75
|
+
}],
|
|
76
|
+
// Nostalgic: Kodak Portra 400 - warm amber, faded, lifted shadows, bright.
|
|
77
|
+
nostalgic: [{
|
|
78
|
+
type: "whiteBalance",
|
|
79
|
+
config: {
|
|
80
|
+
temperature: 7000,
|
|
81
|
+
tint: 0
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
type: "saturation",
|
|
85
|
+
value: 1.1
|
|
86
|
+
}, {
|
|
87
|
+
type: "contrast",
|
|
88
|
+
value: 0.7
|
|
89
|
+
}, {
|
|
90
|
+
type: "brightness",
|
|
91
|
+
value: 0.15
|
|
92
|
+
}, {
|
|
93
|
+
type: "highlightShadow",
|
|
94
|
+
config: {
|
|
95
|
+
highlights: -0.4,
|
|
96
|
+
shadows: 0.5
|
|
97
|
+
}
|
|
98
|
+
}],
|
|
99
|
+
// B&W: Contrasty black and white with subtle warm tint.
|
|
100
|
+
bw: [{
|
|
101
|
+
type: "monochrome",
|
|
102
|
+
config: {
|
|
103
|
+
intensity: 1.0,
|
|
104
|
+
color: {
|
|
105
|
+
r: 0.6,
|
|
106
|
+
g: 0.55,
|
|
107
|
+
b: 0.5
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
type: "contrast",
|
|
112
|
+
value: 1.2
|
|
113
|
+
}, {
|
|
114
|
+
type: "brightness",
|
|
115
|
+
value: -0.1
|
|
116
|
+
}]
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Options for a single capture call. */
|
|
120
|
+
|
|
121
|
+
/** Props passed to the native Swift camera view. */
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Native Swift-backed camera preview view.
|
|
125
|
+
* You must implement a matching iOS view manager named "Zcam1CameraView".
|
|
126
|
+
*/
|
|
127
|
+
const Zcam1CameraView = requireNativeComponent("Zcam1CameraView");
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* React wrapper around the native Swift camera.
|
|
131
|
+
*
|
|
132
|
+
* Responsibilities:
|
|
133
|
+
* - Render native camera preview (AVFoundation in Swift).
|
|
134
|
+
* - Trigger native capture (JPEG / DNG) via the TurboModule `Zcam1Sdk`.
|
|
135
|
+
* - Run C2PA signing on the captured image and return a `ZPhoto`.
|
|
136
|
+
*
|
|
137
|
+
* Exposed API remains compatible with the previous VisionCamera-based
|
|
138
|
+
* implementation: `cameraRef.current?.takePhoto()`.
|
|
139
|
+
*/
|
|
140
|
+
export class ZCamera extends React.PureComponent {
|
|
141
|
+
/** Reference to the underlying native view (if needed later). */
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
nativeRef = /*#__PURE__*/React.createRef();
|
|
144
|
+
|
|
145
|
+
/** Best-effort JS-side guard; native is the source of truth. */
|
|
146
|
+
recordingInProgress = false;
|
|
147
|
+
|
|
148
|
+
/** Captured for convenience/debugging; cleared after stop. */
|
|
149
|
+
lastVideoStartResult = null;
|
|
150
|
+
constructor(props) {
|
|
151
|
+
super(props);
|
|
152
|
+
let certChainPem;
|
|
153
|
+
if (props.certChain && "pem" in props.certChain) {
|
|
154
|
+
certChainPem = props.certChain.pem;
|
|
155
|
+
} else {
|
|
156
|
+
console.warn("[ZCAM1] Using a self signed certificate");
|
|
157
|
+
certChainPem = buildSelfSignedCertificate(props.captureInfo.contentPublicKey, props.certChain);
|
|
158
|
+
}
|
|
159
|
+
this.certChainPem = certChainPem;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Resolve the current film style info for embedding in capture metadata.
|
|
164
|
+
* Returns null for "normal" with no overrides (no filter applied).
|
|
165
|
+
*/
|
|
166
|
+
resolveFilmStyleInfo() {
|
|
167
|
+
const {
|
|
168
|
+
filmStyle = "normal",
|
|
169
|
+
filmStyleOverrides,
|
|
170
|
+
customFilmStyles
|
|
171
|
+
} = this.props;
|
|
172
|
+
|
|
173
|
+
// Determine the source of the active film style.
|
|
174
|
+
const isOverride = filmStyleOverrides?.[filmStyle] !== undefined;
|
|
175
|
+
const isCustom = customFilmStyles?.[filmStyle] !== undefined;
|
|
176
|
+
const source = isOverride ? "override" : isCustom ? "custom" : "builtin";
|
|
177
|
+
|
|
178
|
+
// Resolve the actual recipe that was applied.
|
|
179
|
+
const recipe = filmStyleOverrides?.[filmStyle] ?? customFilmStyles?.[filmStyle] ?? DEFAULT_FILM_STYLE_RECIPES[filmStyle] ?? [];
|
|
180
|
+
|
|
181
|
+
// Skip embedding for unmodified "normal" (no effects applied).
|
|
182
|
+
if (filmStyle === "normal" && source === "builtin") {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
name: filmStyle,
|
|
187
|
+
source,
|
|
188
|
+
recipe: JSON.stringify(recipe)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get the minimum supported zoom factor.
|
|
194
|
+
* For virtual devices with ultra-wide, this is 1.0 (corresponds to 0.5x user-facing).
|
|
195
|
+
*/
|
|
196
|
+
async getMinZoom() {
|
|
197
|
+
return NativeZcam1Sdk.getMinZoom();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Get the maximum supported zoom factor (capped at 15x for UX).
|
|
202
|
+
*/
|
|
203
|
+
async getMaxZoom() {
|
|
204
|
+
return NativeZcam1Sdk.getMaxZoom();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get the zoom factors where the device switches between physical lenses.
|
|
209
|
+
* Returns empty array for single-camera devices.
|
|
210
|
+
* For triple camera: typically [2.0, 6.0] meaning:
|
|
211
|
+
* - Below 2.0: ultra-wide lens (0.5x-1x user-facing)
|
|
212
|
+
* - At 2.0: switches FROM ultra-wide TO wide lens (1x user-facing)
|
|
213
|
+
* - At 6.0: switches FROM wide TO telephoto lens (3x user-facing)
|
|
214
|
+
*/
|
|
215
|
+
async getSwitchOverZoomFactors() {
|
|
216
|
+
return NativeZcam1Sdk.getSwitchOverZoomFactors();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Check if the current device has an ultra-wide camera.
|
|
221
|
+
* This is true for builtInTripleCamera and builtInDualWideCamera (iPhone 11+, Pro models).
|
|
222
|
+
* This is false for builtInDualCamera (Wide + Telephoto, e.g., iPhone X/XS) and single-lens devices.
|
|
223
|
+
*
|
|
224
|
+
* Use this to correctly interpret zoom factors:
|
|
225
|
+
* - If hasUltraWide: minZoom (1.0) = 0.5x user-facing, switchOverFactors[0] (2.0) = 1x user-facing
|
|
226
|
+
* - If !hasUltraWide: minZoom (1.0) = 1x user-facing, switchOverFactors[0] (2.0) = 2x user-facing (telephoto)
|
|
227
|
+
*/
|
|
228
|
+
async hasUltraWideCamera() {
|
|
229
|
+
return NativeZcam1Sdk.hasUltraWideCamera();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Get the supported exposure compensation range in EV units.
|
|
234
|
+
* Returns the device's min and max exposure target bias values.
|
|
235
|
+
* Use this to configure slider bounds for exposure UI controls.
|
|
236
|
+
*/
|
|
237
|
+
async getExposureRange() {
|
|
238
|
+
return NativeZcam1Sdk.getExposureRange();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Reset exposure compensation to neutral (0 EV).
|
|
243
|
+
* Convenience method equivalent to setting the exposure prop to 0.
|
|
244
|
+
*/
|
|
245
|
+
resetExposure() {
|
|
246
|
+
NativeZcam1Sdk.resetExposure();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Focus at a point in the preview. Also adjusts exposure point if supported.
|
|
251
|
+
* @param x Normalized x coordinate (0-1, left to right)
|
|
252
|
+
* @param y Normalized y coordinate (0-1, top to bottom)
|
|
253
|
+
*/
|
|
254
|
+
focusAtPoint(x, y) {
|
|
255
|
+
NativeZcam1Sdk.focusAtPoint(x, y);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Set zoom with smooth animation. Recommended for pinch-to-zoom gestures.
|
|
260
|
+
* Uses native AVFoundation ramp for smooth transitions across lens switchover boundaries.
|
|
261
|
+
* This method bypasses React re-renders for lowest latency during continuous gestures.
|
|
262
|
+
* @param factor Device zoom factor (use getMinZoom/getMaxZoom for valid range)
|
|
263
|
+
*/
|
|
264
|
+
setZoomAnimated(factor) {
|
|
265
|
+
NativeZcam1Sdk.setZoomAnimated(factor);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get diagnostic info about the current camera device for debugging.
|
|
270
|
+
* Returns device type, supported zoom range, switching behavior, and more.
|
|
271
|
+
* Useful for debugging zoom issues on different device configurations.
|
|
272
|
+
*/
|
|
273
|
+
async getDeviceDiagnostics() {
|
|
274
|
+
return NativeZcam1Sdk.getDeviceDiagnostics();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Check if the current camera device supports depth data capture.
|
|
279
|
+
* Returns true for dual/triple rear cameras and TrueDepth front camera.
|
|
280
|
+
* Returns false for single rear cameras (iPhone SE, 16e, Air).
|
|
281
|
+
*/
|
|
282
|
+
async isDepthSupported() {
|
|
283
|
+
return NativeZcam1Sdk.isDepthSupported();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Check if enabling depth would restrict zoom on this device.
|
|
288
|
+
* Returns true if zoom is limited to discrete levels (min == max in all ranges).
|
|
289
|
+
* This typically happens on dual-camera devices (iPhone 12-16 base).
|
|
290
|
+
* Returns false for triple-camera devices (Pro) and TrueDepth front cameras.
|
|
291
|
+
*/
|
|
292
|
+
async hasDepthZoomLimitations() {
|
|
293
|
+
return NativeZcam1Sdk.hasDepthZoomLimitations();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Get zoom ranges supported when depth data delivery is enabled.
|
|
298
|
+
* Returns array of [min, max] pairs. If min == max, it's a discrete level.
|
|
299
|
+
* Empty array means no depth support or no zoom restrictions.
|
|
300
|
+
*
|
|
301
|
+
* Example for dual-camera iPhone: [[2.0, 2.0], [4.0, 4.0]] (discrete 1x and 2x only)
|
|
302
|
+
* Example for triple-camera iPhone: [[1.0, 6.0]] (continuous zoom supported)
|
|
303
|
+
*/
|
|
304
|
+
async getDepthSupportedZoomRanges() {
|
|
305
|
+
return NativeZcam1Sdk.getDepthSupportedZoomRanges();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Start recording a native video to a temporary `.mov` file.
|
|
310
|
+
*
|
|
311
|
+
* Promise resolves once the native recorder reports it has started.
|
|
312
|
+
*
|
|
313
|
+
* @param position Which camera to record from.
|
|
314
|
+
* @param options Optional recording configuration.
|
|
315
|
+
* @param options.maxDurationSeconds Maximum recording duration in seconds.
|
|
316
|
+
* The native layer will automatically stop the recording when this limit is
|
|
317
|
+
* reached. Pass 0 or omit for unlimited recording.
|
|
318
|
+
*/
|
|
319
|
+
async startVideoRecording(position = this.props.position || "back", options) {
|
|
320
|
+
if (this.recordingInProgress) {
|
|
321
|
+
throw new Error("Video recording is already in progress. Call stopVideoRecording() first.");
|
|
322
|
+
}
|
|
323
|
+
this.recordingInProgress = true;
|
|
324
|
+
this.lastVideoStartResult = null;
|
|
325
|
+
try {
|
|
326
|
+
const result = await NativeZcam1Sdk.startNativeVideoRecording(position, options?.maxDurationSeconds ?? 0);
|
|
327
|
+
this.lastVideoStartResult = result;
|
|
328
|
+
return result;
|
|
329
|
+
} catch (e) {
|
|
330
|
+
// Roll back local state if native failed to start.
|
|
331
|
+
this.recordingInProgress = false;
|
|
332
|
+
this.lastVideoStartResult = null;
|
|
333
|
+
throw e;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Stop the current native video recording and return the finalized file path + metadata.
|
|
339
|
+
*/
|
|
340
|
+
async stopVideoRecording() {
|
|
341
|
+
if (!this.recordingInProgress) {
|
|
342
|
+
throw new Error("No video recording is in progress. Call startVideoRecording() first.");
|
|
343
|
+
}
|
|
344
|
+
try {
|
|
345
|
+
const result = await NativeZcam1Sdk.stopNativeVideoRecording();
|
|
346
|
+
const when = new Date().toISOString().replace("T", " ").split(".")[0];
|
|
347
|
+
const isJailBroken = JailMonkey.isJailBroken();
|
|
348
|
+
const isLocationSpoofingAvailable = JailMonkey.canMockLocation();
|
|
349
|
+
result.filePath = await embedBindings(result.filePath, when, {
|
|
350
|
+
deviceMake: result.deviceMake,
|
|
351
|
+
deviceModel: result.deviceModel,
|
|
352
|
+
softwareVersion: result.softwareVersion,
|
|
353
|
+
format: result.format,
|
|
354
|
+
hasAudio: result.hasAudio,
|
|
355
|
+
durationSeconds: result.durationSeconds,
|
|
356
|
+
fileSizeBytes: result.fileSizeBytes,
|
|
357
|
+
width: result.width,
|
|
358
|
+
height: result.height,
|
|
359
|
+
rotationDegrees: result.rotationDegrees,
|
|
360
|
+
frameRate: result.frameRate,
|
|
361
|
+
videoCodec: result.videoCodec,
|
|
362
|
+
audioCodec: result.audioCodec,
|
|
363
|
+
audioSampleRate: result.audioSampleRate,
|
|
364
|
+
audioChannels: result.audioChannels,
|
|
365
|
+
authenticityData: {
|
|
366
|
+
isJailBroken,
|
|
367
|
+
isLocationSpoofingAvailable
|
|
368
|
+
},
|
|
369
|
+
filmStyle: this.resolveFilmStyleInfo()
|
|
370
|
+
}, this.props.captureInfo, this.certChainPem);
|
|
371
|
+
return result;
|
|
372
|
+
} finally {
|
|
373
|
+
// Always clear local state regardless of native outcome.
|
|
374
|
+
this.recordingInProgress = false;
|
|
375
|
+
this.lastVideoStartResult = null;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Capture a photo using the native Swift camera and return a signed `ZPhoto`.
|
|
381
|
+
*
|
|
382
|
+
* The native side is expected to expose a `capturePhoto` method on the
|
|
383
|
+
* `Zcam1Sdk` TurboModule with signature:
|
|
384
|
+
*
|
|
385
|
+
* capturePhoto(options: {
|
|
386
|
+
* position?: "front" | "back";
|
|
387
|
+
* format?: "jpeg" | "dng";
|
|
388
|
+
* }): Promise<{ path: string; metadata?: any }>
|
|
389
|
+
*/
|
|
390
|
+
async takePhoto(options = {}) {
|
|
391
|
+
const format = options.format ?? this.props.captureFormat ?? "jpeg";
|
|
392
|
+
const flash = options.flash ?? "off";
|
|
393
|
+
const includeDepthData = options.includeDepthData ?? false;
|
|
394
|
+
const aspectRatio = options.aspectRatio ?? "4:3";
|
|
395
|
+
const orientation = options.orientation ?? "auto";
|
|
396
|
+
console.log("[ZCamera] takePhoto: calling native with includeDepthData =", includeDepthData);
|
|
397
|
+
const result = await NativeZcam1Sdk.takeNativePhoto(format, this.props.position || "back", flash, includeDepthData, aspectRatio, orientation, false // skipPostProcessing - default to false for normal operation
|
|
398
|
+
);
|
|
399
|
+
console.log("[ZCamera] takePhoto: native result:", {
|
|
400
|
+
filePath: result?.filePath ? "present" : "missing",
|
|
401
|
+
format: result?.format,
|
|
402
|
+
hasMetadata: !!result?.metadata,
|
|
403
|
+
hasDepthData: !!result?.depthData,
|
|
404
|
+
depthDataKeys: result?.depthData ? Object.keys(result.depthData) : null
|
|
405
|
+
});
|
|
406
|
+
if (!result || !result.filePath) {
|
|
407
|
+
throw new Error("Native camera capture did not return a valid file path.");
|
|
408
|
+
}
|
|
409
|
+
const originalPath = result.filePath;
|
|
410
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
411
|
+
const metadata = result.metadata ?? {};
|
|
412
|
+
const exif = metadata["{Exif}"] ?? {};
|
|
413
|
+
const tiff = metadata["{TIFF}"] ?? {};
|
|
414
|
+
const when = tiff.DateTime || new Date().toISOString().replace("T", " ").split(".")[0];
|
|
415
|
+
const deviceMake = tiff.Make || "Apple";
|
|
416
|
+
const deviceModel = tiff.Model || "Unknown";
|
|
417
|
+
const softwareVersion = tiff.Software || "Unknown";
|
|
418
|
+
const isJailBroken = JailMonkey.isJailBroken();
|
|
419
|
+
const isLocationSpoofingAvailable = JailMonkey.canMockLocation();
|
|
420
|
+
const destinationPath = await embedBindings(originalPath, when, {
|
|
421
|
+
deviceMake: deviceMake,
|
|
422
|
+
deviceModel: deviceModel,
|
|
423
|
+
softwareVersion: softwareVersion,
|
|
424
|
+
xResolution: exif.PixelXDimension,
|
|
425
|
+
yResolution: exif.PixelYDimension,
|
|
426
|
+
orientation: metadata.Orientation,
|
|
427
|
+
iso: exif.ISOSpeedRatings?.toString(),
|
|
428
|
+
exposureTime: exif.ExposureTime,
|
|
429
|
+
depthOfField: exif.FNumber,
|
|
430
|
+
focalLength: exif.FocalLength,
|
|
431
|
+
authenticityData: {
|
|
432
|
+
isJailBroken,
|
|
433
|
+
isLocationSpoofingAvailable
|
|
434
|
+
},
|
|
435
|
+
depthData: result.depthData,
|
|
436
|
+
filmStyle: this.resolveFilmStyleInfo()
|
|
437
|
+
}, this.props.captureInfo, this.certChainPem);
|
|
438
|
+
return new ZPhoto(originalPath, destinationPath);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* Render the native Swift camera preview view. */
|
|
442
|
+
render() {
|
|
443
|
+
const {
|
|
444
|
+
isActive = true,
|
|
445
|
+
position = "back",
|
|
446
|
+
captureFormat,
|
|
447
|
+
// Default to 2.0 (1x user-facing) for back camera on devices with ultra-wide.
|
|
448
|
+
// On single-camera devices, 2.0 will be clamped to device's max (usually 1.0).
|
|
449
|
+
// For front camera, default to 1.0 to avoid digital zoom (front cameras are single-lens).
|
|
450
|
+
zoom = position === "front" ? 1.0 : 2.0,
|
|
451
|
+
torch = false,
|
|
452
|
+
exposure = 0,
|
|
453
|
+
filmStyle = "normal",
|
|
454
|
+
filmStyleOverrides,
|
|
455
|
+
customFilmStyles,
|
|
456
|
+
depthEnabled = false,
|
|
457
|
+
onOrientationChange,
|
|
458
|
+
style
|
|
459
|
+
} = this.props;
|
|
460
|
+
|
|
461
|
+
// Merge default recipes with user overrides (user overrides take precedence).
|
|
462
|
+
const mergedFilmStyleOverrides = {
|
|
463
|
+
...DEFAULT_FILM_STYLE_RECIPES,
|
|
464
|
+
...filmStyleOverrides
|
|
465
|
+
};
|
|
466
|
+
return /*#__PURE__*/_jsx(Zcam1CameraView, {
|
|
467
|
+
ref: this.nativeRef,
|
|
468
|
+
style: [{
|
|
469
|
+
flex: 1
|
|
470
|
+
}, style],
|
|
471
|
+
isActive: isActive,
|
|
472
|
+
position: position,
|
|
473
|
+
captureFormat: captureFormat,
|
|
474
|
+
zoom: zoom,
|
|
475
|
+
torch: torch,
|
|
476
|
+
exposure: exposure,
|
|
477
|
+
filmStyle: filmStyle,
|
|
478
|
+
filmStyleOverrides: mergedFilmStyleOverrides,
|
|
479
|
+
customFilmStyles: customFilmStyles,
|
|
480
|
+
depthEnabled: depthEnabled,
|
|
481
|
+
onOrientationChange: onOrientationChange ? event => onOrientationChange(event.nativeEvent.orientation) : undefined
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Embeds C2PA bindings and capture metadata into a photo, producing a new signed file.
|
|
488
|
+
*/
|
|
489
|
+
async function embedBindings(originalPath, when, metadata, captureInfo, certChainPem) {
|
|
490
|
+
originalPath = originalPath.replace("file://", "");
|
|
491
|
+
const dataHash = computeHash(originalPath);
|
|
492
|
+
const format = formatFromPath(originalPath);
|
|
493
|
+
const ext = Util.extname(originalPath);
|
|
494
|
+
if (format === undefined) {
|
|
495
|
+
throw new Error(`Unsupported file format: ${originalPath}`);
|
|
496
|
+
}
|
|
497
|
+
const destinationPath = Dirs.CacheDir + `/zcam-${Date.now()}-${Math.random().toString(36).slice(2, 10)}.${ext}`;
|
|
498
|
+
const manifestEditor = new ManifestEditor(originalPath, captureInfo.contentKeyId.buffer, certChainPem);
|
|
499
|
+
|
|
500
|
+
// Add the "capture" action to the manifest.
|
|
501
|
+
let normalizedMetadata = undefined;
|
|
502
|
+
if (format.indexOf("video") < 0) {
|
|
503
|
+
normalizedMetadata = manifestEditor.addPhotoMetadataAction(metadata, when);
|
|
504
|
+
} else {
|
|
505
|
+
console.log("Metadata", metadata);
|
|
506
|
+
normalizedMetadata = manifestEditor.addVideoMetadataAction(metadata, when);
|
|
507
|
+
}
|
|
508
|
+
const assertion = await generateAppAttestAssertion(dataHash, normalizedMetadata, captureInfo.deviceKeyId);
|
|
509
|
+
|
|
510
|
+
// Add an assertion containing all data needed to later generate a proof
|
|
511
|
+
manifestEditor.addAssertion("succinct.bindings", JSON.stringify({
|
|
512
|
+
app_id: captureInfo.appId,
|
|
513
|
+
device_key_id: captureInfo.deviceKeyId,
|
|
514
|
+
attestation: captureInfo.attestation,
|
|
515
|
+
assertion
|
|
516
|
+
}));
|
|
517
|
+
|
|
518
|
+
// Sign the captured image with C2PA, producing a new signed file.
|
|
519
|
+
await manifestEditor.embedManifestToFile(destinationPath, format);
|
|
520
|
+
return destinationPath;
|
|
521
|
+
}
|
|
522
|
+
//# sourceMappingURL=camera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["JailMonkey","React","requireNativeComponent","Dirs","Util","buildSelfSignedCertificate","computeHash","formatFromPath","ManifestEditor","ZPhoto","NativeZcam1Sdk","generateAppAttestAssertion","jsx","_jsx","CERT_KEY_TAG","DEFAULT_FILM_STYLE_RECIPES","normal","mellow","type","config","temperature","tint","value","highlights","shadows","nostalgic","bw","intensity","color","r","g","b","Zcam1CameraView","ZCamera","PureComponent","nativeRef","createRef","recordingInProgress","lastVideoStartResult","constructor","props","certChainPem","certChain","pem","console","warn","captureInfo","contentPublicKey","resolveFilmStyleInfo","filmStyle","filmStyleOverrides","customFilmStyles","isOverride","undefined","isCustom","source","recipe","name","JSON","stringify","getMinZoom","getMaxZoom","getSwitchOverZoomFactors","hasUltraWideCamera","getExposureRange","resetExposure","focusAtPoint","x","y","setZoomAnimated","factor","getDeviceDiagnostics","isDepthSupported","hasDepthZoomLimitations","getDepthSupportedZoomRanges","startVideoRecording","position","options","Error","result","startNativeVideoRecording","maxDurationSeconds","e","stopVideoRecording","stopNativeVideoRecording","when","Date","toISOString","replace","split","isJailBroken","isLocationSpoofingAvailable","canMockLocation","filePath","embedBindings","deviceMake","deviceModel","softwareVersion","format","hasAudio","durationSeconds","fileSizeBytes","width","height","rotationDegrees","frameRate","videoCodec","audioCodec","audioSampleRate","audioChannels","authenticityData","takePhoto","captureFormat","flash","includeDepthData","aspectRatio","orientation","log","takeNativePhoto","hasMetadata","metadata","hasDepthData","depthData","depthDataKeys","Object","keys","originalPath","exif","tiff","DateTime","Make","Model","Software","destinationPath","xResolution","PixelXDimension","yResolution","PixelYDimension","Orientation","iso","ISOSpeedRatings","toString","exposureTime","ExposureTime","depthOfField","FNumber","focalLength","FocalLength","render","isActive","zoom","torch","exposure","depthEnabled","onOrientationChange","style","mergedFilmStyleOverrides","ref","flex","event","nativeEvent","dataHash","ext","extname","CacheDir","now","Math","random","slice","manifestEditor","contentKeyId","buffer","normalizedMetadata","indexOf","addPhotoMetadataAction","addVideoMetadataAction","assertion","deviceKeyId","addAssertion","app_id","appId","device_key_id","attestation","embedManifestToFile"],"sourceRoot":"../../src","sources":["camera.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,aAAa;AACpC,OAAOC,KAAK,MAAM,OAAO;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eAAe,EAAEnC,MAAM,CAAC;EAEjE,OAAOmC,eAAe;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { generateHardwareKey, getAttestation } from "@pagopa/io-react-native-integrity";
|
|
4
|
+
import EncryptedStorage from "react-native-encrypted-storage";
|
|
5
|
+
import { getContentPublicKey, getSecureEnclaveKeyId } from "./common.js";
|
|
6
|
+
export { buildSelfSignedCertificate, SelfSignedCertChain } from "./bindings.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Camera component for capturing photos with secure enclave integration.
|
|
10
|
+
*/
|
|
11
|
+
export { ZCamera } from "./camera.js";
|
|
12
|
+
import NativeZcam1Capture from "./NativeZcam1Capture.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Present a native full-screen preview for any file using iOS QLPreviewController.
|
|
16
|
+
* Supports images, videos, PDFs, and other common file types with native playback controls.
|
|
17
|
+
* @param filePath Absolute filesystem path to the file.
|
|
18
|
+
*/
|
|
19
|
+
export async function previewFile(filePath) {
|
|
20
|
+
return NativeZcam1Capture.previewFile(filePath);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Flash mode for photo capture.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Native video recording results.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Device registration information including keys, certificate chain, and attestation.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Configuration settings for device initialization and backend communication.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents a captured photo with its original and processed file paths.
|
|
41
|
+
*/
|
|
42
|
+
export class ZPhoto {
|
|
43
|
+
constructor(originalPath, path) {
|
|
44
|
+
this.originalPath = originalPath;
|
|
45
|
+
this.path = path;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initializes the device by generating keys, obtaining certificate chain, and registering with the backend.
|
|
51
|
+
* @param settings - Configuration settings for initialization
|
|
52
|
+
* @returns Device information including keys, certificate chain, and attestation
|
|
53
|
+
*/
|
|
54
|
+
export async function initCapture(settings) {
|
|
55
|
+
let deviceKeyId = await EncryptedStorage.getItem(`deviceKeyId-${settings.appId}`);
|
|
56
|
+
const contentPublicKey = await getContentPublicKey();
|
|
57
|
+
if (contentPublicKey.kty !== "EC") {
|
|
58
|
+
throw "Only EC public keys are supported";
|
|
59
|
+
}
|
|
60
|
+
const contentKeyId = getSecureEnclaveKeyId(contentPublicKey);
|
|
61
|
+
if (deviceKeyId == null) {
|
|
62
|
+
// Try to generate hardware key, but fall back to mock for simulator
|
|
63
|
+
try {
|
|
64
|
+
deviceKeyId = await generateHardwareKey();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
// If running in simulator, hardware key generation is not supported
|
|
67
|
+
const err = error;
|
|
68
|
+
if (err?.code === "-1" || err?.message?.includes("UNSUPPORTED_SERVICE")) {
|
|
69
|
+
console.warn("[ZCAM] Running in simulator - using mock device key. This is for development only.");
|
|
70
|
+
// Generate a mock device key for simulator testing
|
|
71
|
+
deviceKeyId = `SIMULATOR_DEVICE_KEY_${Date.now()}`;
|
|
72
|
+
} else {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
await EncryptedStorage.setItem(`deviceKeyId-${settings.appId}`, deviceKeyId);
|
|
77
|
+
}
|
|
78
|
+
if (deviceKeyId == null) {
|
|
79
|
+
throw "failed to generate a device key";
|
|
80
|
+
}
|
|
81
|
+
let attestation = await EncryptedStorage.getItem(`attestation-${deviceKeyId}`);
|
|
82
|
+
if (attestation == null) {
|
|
83
|
+
attestation = await updateRegistration(deviceKeyId, settings);
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
appId: settings.appId,
|
|
87
|
+
deviceKeyId,
|
|
88
|
+
contentPublicKey,
|
|
89
|
+
contentKeyId,
|
|
90
|
+
attestation
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Updates device registration by performing attestation with the backend.
|
|
96
|
+
* @param keyId - The hardware key identifier
|
|
97
|
+
* @param settings - Configuration settings for registration
|
|
98
|
+
* @returns Attestation data and challenge
|
|
99
|
+
*/
|
|
100
|
+
export async function updateRegistration(keyId, _settings) {
|
|
101
|
+
// Try to get real attestation, but fall back to mock for simulator
|
|
102
|
+
let attestation;
|
|
103
|
+
try {
|
|
104
|
+
attestation = await getAttestation(keyId, keyId);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
// If running in simulator, App Attest is not supported
|
|
107
|
+
const err = error;
|
|
108
|
+
if (err?.code === "-1" || err?.message?.includes("UNSUPPORTED_SERVICE")) {
|
|
109
|
+
console.warn("[ZCAM] Running in simulator - using mock attestation. This is for development only.");
|
|
110
|
+
// Use a mock attestation for simulator testing
|
|
111
|
+
// In production, this would need to be rejected by the backend
|
|
112
|
+
return `SIMULATOR_MOCK_${keyId}_${Date.now()}`;
|
|
113
|
+
} else {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
await EncryptedStorage.setItem(`attestation-${keyId}`, attestation);
|
|
118
|
+
return attestation;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateHardwareKey","getAttestation","EncryptedStorage","getContentPublicKey","getSecureEnclaveKeyId","buildSelfSignedCertificate","SelfSignedCertChain","ZCamera","NativeZcam1Capture","previewFile","filePath","ZPhoto","constructor","originalPath","path","initCapture","settings","deviceKeyId","getItem","appId","contentPublicKey","kty","contentKeyId","error","err","code","message","includes","console","warn","Date","now","setItem","attestation","updateRegistration","keyId","_settings"],"sourceRoot":"../../src","sources":["capture.tsx"],"mappings":";;AAAA,SAASA,mBAA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