@contentauth/c2pa-web 0.5.6 → 0.6.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 CHANGED
@@ -10,15 +10,16 @@ As a guiding philosophy, `c2pa-web` attempts to adhere closely to the API paradi
10
10
  npm install @contentauth/c2pa-web
11
11
  ```
12
12
 
13
- ## Quickstart
13
+ ## Importing the library
14
14
 
15
- ### Importing
15
+ There are two ways to import the library, due to [specific requirements](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running) for handling Wasm modules:
16
+ - Using a separate Wasm binary, which provides better performance.
17
+ - Using an inline Wasm binary, which is more convenient.
16
18
 
17
- Due to [specific requirements](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running) around handling WASM modules, there are two methods of importing the library. One optimizes for performance, the other for convenience.
19
+ ### Using a separate Wasm binary
18
20
 
19
- #### With a separate WASM binary (performance)
20
-
21
- The recommended method of using the library requires that the WASM binary be hosted separately, to be fetched over the network at runtime.
21
+ The recommended way to import the library is to fetch the Wasm binary over the network at runtime.
22
+ This requires that the Wasm binary be hosted separately.
22
23
 
23
24
  With Vite:
24
25
 
@@ -30,7 +31,7 @@ import wasmSrc from '@contentauth/c2pa-web/resources/c2pa.wasm?url';
30
31
  const c2pa = createC2pa({ wasmSrc });
31
32
  ```
32
33
 
33
- Use a solution appropriate to your tooling. Alternatively, the binary can be requested from a CDN:
34
+ Use a solution appropriate to your tooling. Alternatively, you can request the binary from a CDN:
34
35
 
35
36
  ```typescript
36
37
  import { createC2pa } from '@contentauth/c2pa-web';
@@ -42,9 +43,11 @@ const c2pa = await createC2pa({
42
43
  });
43
44
  ```
44
45
 
45
- #### With an inlined WASM binary (convenience)
46
+ ### Using an inline Wasm binary
47
+
48
+ Where it is not possible or convenient to request a separate resource over the network, use the `@contentauth/c2pa-web/inline` package, which has the Wasm binary encoded as a base64 string in the JavaScript file.
46
49
 
47
- In environments where it is not possible or not convenient to request a separate resource over the network, the "inline" SDK can be used. The WASM binary is encoded as a base64 string and included in the JavaScript file, so no (additional) network request is necessary. However, this adds _significant_ size to the JavaScript bundle, and cannot take advantage of the higher-performance
50
+ Using this package does not require an additional network request. However, it adds _significant_ size to the JavaScript bundle, and cannot take advantage of the higher-performance
48
51
  [`WebAssembly.compileStreaming()`](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/compileStreaming_static) API.
49
52
 
50
53
  ```typescript
@@ -53,7 +56,11 @@ import { createC2pa } from '@contentauth/c2pa-web/inline';
53
56
  const c2pa = await createC2pa();
54
57
  ```
55
58
 
56
- ### Use
59
+ ## Using the library
60
+
61
+ See also the [API reference documentation](https://contentauth.github.io/c2pa-js/modules/_contentauth_c2pa-web.html).
62
+
63
+ ### Reading C2PA manifests
57
64
 
58
65
  Fetch an image and provide it to the `Reader`:
59
66
 
@@ -73,17 +80,164 @@ console.log(manifestStore);
73
80
  await reader.free();
74
81
  ```
75
82
 
76
- ## Api reference
83
+ ### Building C2PA manifests with ingredients
84
+
85
+ Use the `Builder` API to create C2PA manifests and add ingredients (source assets) to document the provenance chain.
86
+
87
+ #### Setting builder intent
88
+
89
+ The builder intent describes the type of operation being performed on the asset. This influences how the manifest is structured and what assertions are automatically added. Use one of these intents:
90
+ - `create`: Indicates the asset is a new digital creation, a DigitalSourceType is required. The Manifest must not have have a parent ingredient. A `c2pa.created` action will be added if not provided.
91
+ - `edit`: Indicates the asset is an edit of a pre-existing parent asset. The Manifest must have a parent ingredient. A parent ingredient will be generated from the source stream if not otherwise provided. A `c2pa.opened action will be tied to the parent ingredient.
92
+ - `update`: A restricted version of `edit` for non-editorial changes. There must be only one ingredient, as a parent. No changes can be made to the hashed content of the parent. There are additional restrictions on the types of changes that can be made.
93
+
94
+ ```typescript
95
+ const builder = await c2pa.builder.new();
96
+
97
+ await builder.setIntent({
98
+ create: 'http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia',
99
+ });
100
+
101
+ await builder.setIntent('edit');
102
+
103
+ await builder.setIntent('update');
104
+ ```
105
+
106
+ The `create` intent accepts a `DigitalSourceType` that describes the origin of the asset. Common values include:
107
+
108
+ - `'http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia'` - AI-generated content
109
+ - `'http://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture'` - Digital camera capture
110
+ - `'http://cv.iptc.org/newscodes/digitalsourcetype/composite'` - Composite of multiple sources
111
+
112
+ For a complete list of digital source types, see the [C2PA specification](https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_digital_source_type) and [IPTC digital source type vocabulary](https://cv.iptc.org/newscodes/digitalsourcetype).
113
+
114
+ For more details on builder intents, see the [c2pa-rs Builder documentation](https://docs.rs/c2pa/latest/c2pa/struct.Builder.html).
115
+
116
+ #### Adding ingredients from blobs
117
+
118
+ When you have access to the ingredient asset, use `addIngredientFromBlob` to include both the metadata and the asset data:
119
+
120
+ ```typescript
121
+ // Fetch or load the ingredient asset
122
+ const ingredientResponse = await fetch('path/to/source-image.jpg');
123
+ const ingredientBlob = await ingredientResponse.blob();
124
+
125
+ // Create a builder
126
+ const builder = await c2pa.builder.new();
127
+
128
+ // Add the ingredient with its blob
129
+ await builder.addIngredientFromBlob(
130
+ {
131
+ title: 'source-image.jpg',
132
+ format: 'image/jpeg',
133
+ instance_id: 'ingredient-123',
134
+ relationship: 'parentOf',
135
+ },
136
+ 'image/jpeg', // Format
137
+ ingredientBlob // The actual asset bytes
138
+ );
139
+
140
+ const definition = await builder.getDefinition();
141
+ console.log(definition.ingredients); // Contains the ingredient with embedded data
142
+
143
+ await builder.free();
144
+ ```
145
+
146
+ #### Adding multiple ingredients
147
+
148
+ You can add multiple ingredients to document complex provenance chains:
149
+
150
+ ```typescript
151
+ const builder = await c2pa.builder.new();
152
+
153
+ // Fetch ingredient assets
154
+ const background = await fetch('background.jpg').then((r) => r.blob());
155
+ const overlay = await fetch('overlay.png').then((r) => r.blob());
156
+
157
+ // Add first ingredient
158
+ await builder.addIngredientFromBlob(
159
+ {
160
+ title: 'background.jpg',
161
+ format: 'image/jpeg',
162
+ instance_id: 'background-001',
163
+ relationship: 'componentOf',
164
+ },
165
+ 'image/jpeg',
166
+ background
167
+ );
168
+
169
+ // Add second ingredient
170
+ await builder.addIngredientFromBlob(
171
+ {
172
+ title: 'overlay.png',
173
+ format: 'image/png',
174
+ instance_id: 'overlay-002',
175
+ relationship: 'componentOf',
176
+ },
177
+ 'image/png',
178
+ overlay
179
+ );
180
+
181
+ const definition = await builder.getDefinition();
182
+ console.log(definition.ingredients.length); // 2
183
+
184
+ await builder.free();
185
+ ```
186
+
187
+ #### Creating and reusing builder archives
188
+
189
+ Use a builder archive to save a builder's state (including ingredients) and reuse it later:
190
+
191
+ ```typescript
192
+ // Create a builder with ingredients
193
+ const builder = await c2pa.builder.new();
194
+
195
+ const ingredientBlob = await fetch('source.jpg').then((r) => r.blob());
196
+ await builder.addIngredientFromBlob(
197
+ {
198
+ title: 'source.jpg',
199
+ format: 'image/jpeg',
200
+ instance_id: 'source-123',
201
+ },
202
+ 'image/jpeg',
203
+ ingredientBlob
204
+ );
205
+
206
+ // Save as an archive
207
+ const archive = await builder.toArchive();
208
+ await builder.free();
209
+
210
+ // Later, recreate the builder from the archive
211
+ const restoredBuilder = await c2pa.builder.fromArchive(new Blob([archive]));
212
+
213
+ // The ingredients are preserved
214
+ const definition = await restoredBuilder.getDefinition();
215
+ console.log(definition.ingredients); // Contains the ingredient
216
+
217
+ await restoredBuilder.free();
218
+ ```
219
+
220
+ #### Ingredient properties
221
+
222
+ The `Ingredient` type supports a number of properties, including:
223
+
224
+ - `title`: Human-readable title for the ingredient.
225
+ - `format`: MIME type of the ingredient asset (e.g., `'image/jpeg'`).
226
+ - `instance_id`: Unique identifier for this specific instance.
227
+ - `document_id` (optional): Identifier for the source document.
228
+ - `relationship` (optional): Relationship to the parent asset (`'parentOf'`, `'componentOf'`, etc.)
229
+ - `thumbnail` (optional): Thumbnail reference for the ingredient.
230
+ - `validation_status` (optional): Validation results if the ingredient has C2PA data.
77
231
 
78
- API docs are available [here](https://contentauth.github.io/c2pa-js/modules/_contentauth_c2pa-web.html).
232
+ For the full list, see the [API reference](https://contentauth.github.io/c2pa-js/interfaces/_contentauth_c2pa-web.index.Ingredient.html).
79
233
 
80
- ## Development
234
+ ## Library development
81
235
 
82
- ### Prerequsities
236
+ ### Prerequisites
83
237
 
84
- Ensure the repo-wide prerequisites [NX](https://nx.dev/getting-started/intro) and [pnpm](https://pnpm.io/) are installed.
238
+ Ensure the repo-wide prerequisites ([Node.js](https://nodejs.org/) v22+, [NX](https://nx.dev/getting-started/intro), and [pnpm](https://pnpm.io/)) are installed. See the [top-level README](https://github.com/contentauth/c2pa-js#prerequisites) for details.
85
239
 
86
- [`c2pa-wasm`'s prerequisites](https://github.com/contentauth/c2pa-js-v2/tree/main/packages/c2pa-wasm) must also be installed.
240
+ [`c2pa-wasm`'s prerequisites](https://github.com/contentauth/c2pa-js/tree/main/packages/c2pa-wasm#prerequisites) must also be installed.
87
241
 
88
242
  ### Building
89
243
 
@@ -95,10 +249,10 @@ nx build c2pa-web
95
249
 
96
250
  ### Testing
97
251
 
98
- This library relies on [Vitest](https://vitest.dev/) to run its tests in a headless browser. Before the tests can be run, the test browser binaries must be installed:
252
+ This library relies on [Vitest](https://vitest.dev/) to run its tests in a headless browser. Before the tests can be run, the test browser binaries must be installed. Run the following from the `packages/c2pa-web` directory (rather than from the root directory, to ensure that the correct binaries are installed):
99
253
 
100
254
  ```sh
101
- pnpx playwright install
255
+ pnpm exec playwright install
102
256
  ```
103
257
 
104
258
  To run the tests:
@@ -0,0 +1,365 @@
1
+ import { channel as I, transfer as M } from "highgain";
2
+ import { merge as z } from "ts-deepmerge";
3
+ const { createTx: O, rx: H } = I(), { createTx: X, rx: N } = I("worker"), T = '(function(){"use strict";class h{static __wrap(e){e=e>>>0;const t=Object.create(h.prototype);return t.__wbg_ptr=e,O.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,O.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw b(t[0])}addIngredient(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmbuilder_addIngredient(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}addIngredientFromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,i=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u,a=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n);if(a[1])throw b(a[0])}addResourceFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}static fromArchive(e,t){var n=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw b(c[1]);return h.__wrap(c[0])}static fromJson(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;var c=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw b(s[1]);return h.__wrap(s[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}static new(e){var t=g(e)?0:f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;const _=o.wasmbuilder_new(t,n);if(_[2])throw b(_[1]);return h.__wrap(_[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw b(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setRemoteUrl(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}sign(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,n)}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}}Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);class v{static __wrap(e){e=e>>>0;const t=Object.create(v.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=y(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}static fromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;var i=g(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;var s=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u;return o.wasmreader_fromBlobFragment(c,i,t,n,s,a)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}resourceToBytes(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,n);if(_[2])throw b(_[1]);return b(_[0])}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function C(r){const e=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,n=o.loadSettings(e,t);if(n[1])throw b(n[0])}function V(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(e,t){return Error(y(e,t))},__wbg_Number_04624de7d0e8332d:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,g(_)?BigInt(0):_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(e,t){const n=j(t),_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_47fa6863be6f2f25:function(e,t){return e in t},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(e,t){return e==t},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,g(_)?0:_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_string_get_72fb696202c56729:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(e,t){throw new Error(y(e,t))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(e){e._wbg_cb_unref()},__wbg_abort_2f0584e03e8e3950:function(e){e.abort()},__wbg_abort_d549b92d3c665de1:function(e,t){e.abort(t)},__wbg_append_a992ccc37aa62dc4:function(){return d(function(e,t,n,_,c){e.append(y(t,n),y(_,c))},arguments)},__wbg_arrayBuffer_bb54076166006c39:function(){return d(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_3417f266f4bf562a:function(e){return e.byteLength},__wbg_call_389efe28435a9388:function(){return d(function(e,t){return e.call(t)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return d(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearTimeout_42d9ccd50822fd3a:function(e){return clearTimeout(e)},__wbg_crypto_86f2631e91b51511:function(e){return e.crypto},__wbg_done_57b39ecd9addfe81:function(e){return e.done},__wbg_entries_58c7934c745daac7:function(e){return Object.entries(e)},__wbg_error_7534b8e9a36f1ab4:function(e,t){let n,_;try{n=e,_=t,console.error(y(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_6bbc32f991730587:function(e){return fetch(e)},__wbg_fetch_afb6a4b6cacf876d:function(e,t){return e.fetch(t)},__wbg_from_bddd64e7d5ff6941:function(e){return Array.from(e)},__wbg_getRandomValues_1c61fac11405ffdc:function(){return d(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_9c5c1b115e142bb8:function(){return d(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_b3f15fcbfabb0f8b:function(){return d(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(e){return e.getTime()},__wbg_get_9b94d73e6221f75c:function(e,t){return e[t>>>0]},__wbg_get_b3ed3ad4be2bc8ac:function(){return d(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_with_ref_key_1dc361bd10053bfe:function(e,t){return e[t]},__wbg_has_d4e53238966c12b6:function(){return d(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_59a2938db9f80985:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_53af74335dec57f4:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_0094681e3519d6ec:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_ee1d54d79ae41977:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_d314bb98fcf08331:function(e){return Array.isArray(e)},__wbg_isSafeInteger_bfbc7332a9768d2a:function(e){return Number.isSafeInteger(e)},__wbg_iterator_6ff6560ca1568e55:function(){return Symbol.iterator},__wbg_length_32ed9a279acd054c:function(e){return e.length},__wbg_length_35a7bace40f36eac:function(e){return e.length},__wbg_msCrypto_d562bbe83e0d4b91:function(e){return e.msCrypto},__wbg_new_0_73afc35eb544e539:function(){return new Date},__wbg_new_361308b2356cecd0:function(){return new Object},__wbg_new_3eb36ae241fe6f44:function(){return new Array},__wbg_new_64284bd487f9d239:function(){return d(function(){return new Headers},arguments)},__wbg_new_72b49615380db768:function(e,t){return new Error(y(e,t))},__wbg_new_8a6f238a6ece86ea:function(){return new Error},__wbg_new_b5d9e2fb389fef91:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const a=n.a;n.a=0;try{return $(a,n.b,i,s)}finally{n.a=a}};return new Promise(_)}finally{n.a=n.b=0}},__wbg_new_b949e7f56150a5d1:function(){return d(function(){return new AbortController},arguments)},__wbg_new_c27f68f047724fa3:function(){return d(function(){return new FileReaderSync},arguments)},__wbg_new_dca287b076112a51:function(){return new Map},__wbg_new_dd2b680c8bf6ae29:function(e){return new Uint8Array(e)},__wbg_new_from_slice_a3d2629dc1826784:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_no_args_1c7c842f08d00ebb:function(e,t){return new Function(y(e,t))},__wbg_new_with_length_a2c39cbe88fd8ff1:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_a61cbc6bdef21614:function(){return d(function(e,t,n){return new Request(y(e,t),n)},arguments)},__wbg_next_3482f54c49e8af19:function(){return d(function(e){return e.next()},arguments)},__wbg_next_418f80d8f5303233:function(e){return e.next},__wbg_node_e1f24f89a7336c2e:function(e){return e.node},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_process_3975fd6c72f520aa:function(e){return e.process},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(e){return e.queueMicrotask},__wbg_queueMicrotask_5bb536982f78a56f:function(e){queueMicrotask(e)},__wbg_randomFillSync_f8c153b79f285817:function(){return d(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_8b36975ef3917d9b:function(){return d(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b74f47fc2d022fd6:function(){return d(function(){return module.require},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(e){return Promise.resolve(e)},__wbg_setTimeout_4ec014681668a581:function(e,t){return setTimeout(e,t)},__wbg_set_1eb0999cf5d27fc8:function(e,t,n){return e.set(t,n)},__wbg_set_3f1d0b984ed272ed:function(e,t,n){e[t]=n},__wbg_set_body_9a7e00afe3cfe244:function(e,t){e.body=t},__wbg_set_cache_315a3ed773a41543:function(e,t){e.cache=J[t]},__wbg_set_cc56eefd2dd91957:function(e,t,n){e.set(A(t,n))},__wbg_set_credentials_c4a58d2e05ef24fb:function(e,t){e.credentials=H[t]},__wbg_set_f43e577aea94465b:function(e,t,n){e[t>>>0]=n},__wbg_set_headers_cfc5f4b2c1f20549:function(e,t){e.headers=t},__wbg_set_method_c3e20375f5ae7fac:function(e,t,n){e.method=y(t,n)},__wbg_set_mode_b13642c312648202:function(e,t){e.mode=X[t]},__wbg_set_signal_f2d3f8599248896d:function(e,t){e.signal=t},__wbg_signal_d1285ecab4ebc5ad:function(e){return e.signal},__wbg_size_e05d31cc6049815f:function(e){return e.size},__wbg_slice_a4d15492574b99a1:function(){return d(function(e,t,n){return e.slice(t,n)},arguments)},__wbg_stack_0ed75d68575b0f3c:function(e,t){const n=t.stack,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){const e=typeof global>"u"?null:global;return g(e)?0:B(e)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:B(e)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){const e=typeof self>"u"?null:self;return g(e)?0:B(e)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){const e=typeof window>"u"?null:window;return g(e)?0:B(e)},__wbg_status_89d7e803db911ee7:function(e){return e.status},__wbg_stringify_8d1cc6ff383e8bae:function(){return d(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_a96e1fef17ed23cb:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_0d9fe2c7b1857d32:function(e,t,n){return e.then(t,n)},__wbg_then_b9e7b3b5f1a9e1b5:function(e,t){return e.then(t)},__wbg_url_c484c26b1fbf5126:function(e,t){const n=t.url,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_670bef5709ccda33:function(e){return e.valueOf()},__wbg_value_0546255b415e96c1:function(e){return e.value},__wbg_versions_4e31226f5e8dc909:function(e){return e.versions},__wbg_wasmreader_new:function(e){return v.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return z(e,t,o.wasm_bindgen__closure__destroy__h6c572eed28725b35,G)},__wbindgen_cast_0000000000000002:function(e,t){return z(e,t,o.wasm_bindgen__closure__destroy__hdc14e87eb7e60d10,P)},__wbindgen_cast_0000000000000003:function(e){return e},__wbindgen_cast_0000000000000004:function(e){return e},__wbindgen_cast_0000000000000005:function(e,t){return A(e,t)},__wbindgen_cast_0000000000000006:function(e,t){return y(e,t)},__wbindgen_cast_0000000000000007:function(e){return BigInt.asUintN(64,e)},__wbindgen_cast_0000000000000008:function(e,t){var n=A(e,t).slice();return o.__wbindgen_free(e,t*1,1),n},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function G(r,e){o.wasm_bindgen__convert__closures_____invoke__h6d7af91d7cf01ed3(r,e)}function P(r,e,t){o.wasm_bindgen__convert__closures_____invoke__ha319c5c448ef8efe(r,e,t)}function $(r,e,t,n){o.wasm_bindgen__convert__closures_____invoke__h1ab8f2c4d39167e4(r,e,t,n)}const J=["default","no-store","reload","no-cache","force-cache","only-if-cached"],H=["omit","same-origin","include"],X=["same-origin","no-cors","cors","navigate"],O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r>>>0,1)),k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r>>>0,1));function B(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>r.dtor(r.a,r.b));function j(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let c="[";_>0&&(c+=j(r[0]));for(let i=1;i<_;i++)c+=", "+j(r[i]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:n}function A(r,e){return r=r>>>0,R().subarray(r/1,r/1+e)}let F=null;function m(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==o.memory.buffer)&&(F=new DataView(o.memory.buffer)),F}function y(r,e){return r=r>>>0,K(r,e)}let M=null;function R(){return(M===null||M.byteLength===0)&&(M=new Uint8Array(o.memory.buffer)),M}function d(r,e){try{return r.apply(this,e)}catch(t){const n=B(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function z(r,e,t,n){const _={a:r,b:e,cnt:1,dtor:t},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return n(s,_.b,...i)}finally{_.a=s,c._wbg_cb_unref()}};return c._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,N.unregister(_))},N.register(c,_,_),c}function f(r,e,t){if(t===void 0){const s=T.encode(r),a=e(s.length,1)>>>0;return R().subarray(a,a+s.length).set(s),u=s.length,a}let n=r.length,_=e(n,1)>>>0;const c=R();let i=0;for(;i<n;i++){const s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){i!==0&&(r=r.slice(i)),_=t(_,n,n=i+r.length*3,1)>>>0;const s=R().subarray(_+i,_+n),a=T.encodeInto(r,s);i+=a.written,_=t(_,n,i,1)>>>0}return u=i,_}function b(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});E.decode();const Y=2146435072;let x=0;function K(r,e){return x+=e,x>=Y&&(E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),E.decode(),x=e),E.decode(R().subarray(r,r+e))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(r,e){const t=T.encode(r);return e.set(t),{read:r.length,written:t.length}});let u=0,o;function Q(r,e){return o=r.exports,F=null,M=null,o.__wbindgen_start(),o}function Z(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=V();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Q(t)}function D(){let r=0;const e=new Map;return{add(t){const n=r++;return e.set(n,t),n},get(t){const n=e.get(t);if(!n)throw new Error("Attempted to use an object that has been freed");return n},remove(t){return e.delete(t)}}}const L=Symbol("transfer");function I(r,e){return{type:L,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function U(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===L)}function q(r="default"){return{createTx(e){const t=new Map,n=e??self;return n.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==r)return;const{id:i,result:s,error:a}=c,w=t.get(i);w&&(a?w.reject(a):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=ee(),a=[],w=[];return i.forEach(S=>{U(S)?(a.push(S.value),w.push(...S.transfer)):a.push(S)}),n.postMessage({method:c,args:a,id:s,channelName:r},{transfer:w}),new Promise((S,re)=>{t.set(s,{resolve:S,reject:re})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:i,args:s,id:a}=c;try{const w=await e[i](...s);U(w)?n.postMessage({result:w.value,id:a,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:a,channelName:r})}catch(w){n.postMessage({error:w,id:a,channelName:r})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=q(),{createTx:ne}=q("worker"),p=D(),l=D(),W=ne();te({async initWorker(r,e){Z({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return p.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return p.add(_)},reader_activeLabel(r){return p.get(r).activeLabel()??null},reader_manifestStore(r){return p.get(r).manifestStore()},reader_activeManifest(r){return p.get(r).activeManifest()},reader_json(r){return p.get(r).json()},reader_resourceToBytes(r,e){const n=p.get(r).resourceToBytes(e);return I(n,n.buffer)},reader_free(r){p.get(r).free(),p.remove(r)},builder_new(r){const e=h.new(r);return l.add(e)},builder_fromJson(r,e){const t=h.fromJson(r,e);return l.add(t)},builder_fromArchive(r,e){const t=h.fromArchive(r,e);return l.add(t)},builder_setIntent(r,e){l.get(r).setIntent(e)},builder_addAction(r,e){l.get(r).addAction(e)},builder_setRemoteUrl(r,e){l.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){l.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){l.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){l.get(r).addIngredient(e)},builder_addIngredientFromBlob(r,e,t,n){l.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){l.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return l.get(r).getDefinition()},builder_toArchive(r){const t=l.get(r).toArchive();return I(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await l.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,I(s,s.buffer),t.reserveSize)},n,_);return I(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=l.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async a=>await W.sign(e,I(a,a.buffer),t.reserveSize)},n,_);return I({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){l.get(r).free(),l.remove(r)}})})();\n', m = typeof self < "u" && self.Blob && new Blob([T], { type: "text/javascript;charset=utf-8" });
4
+ function U(e) {
5
+ let t;
6
+ try {
7
+ if (t = m && (self.URL || self.webkitURL).createObjectURL(m), !t) throw "";
8
+ const _ = new Worker(t, {
9
+ name: e == null ? void 0 : e.name
10
+ });
11
+ return _.addEventListener("error", () => {
12
+ (self.URL || self.webkitURL).revokeObjectURL(t);
13
+ }), _;
14
+ } catch {
15
+ return new Worker(
16
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(T),
17
+ {
18
+ name: e == null ? void 0 : e.name
19
+ }
20
+ );
21
+ } finally {
22
+ t && (self.URL || self.webkitURL).revokeObjectURL(t);
23
+ }
24
+ }
25
+ async function L(e) {
26
+ const { wasm: t, settingsString: _ } = e;
27
+ let r = 0;
28
+ const n = new U(), o = O(n), i = /* @__PURE__ */ new Map();
29
+ N(
30
+ {
31
+ sign: async (c, s, j) => {
32
+ const l = i.get(c);
33
+ if (i.delete(c), !l)
34
+ throw new Error("No signer registered for request");
35
+ const w = await l(s, j);
36
+ return M(w, w.buffer);
37
+ }
38
+ },
39
+ n
40
+ );
41
+ function a(c) {
42
+ const s = r++;
43
+ return i.set(s, c), s;
44
+ }
45
+ return await o.initWorker(t, _), {
46
+ tx: o,
47
+ registerSignReceiver: a,
48
+ terminate: () => n.terminate()
49
+ };
50
+ }
51
+ class y extends Error {
52
+ constructor(t) {
53
+ super(
54
+ `The provided asset was too large. Size: ${t} bytes. Maximum: ${d}.`
55
+ ), this.name = "AssetTooLargeError";
56
+ }
57
+ }
58
+ class p extends Error {
59
+ constructor(t) {
60
+ super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
61
+ }
62
+ }
63
+ const k = [
64
+ "jpg",
65
+ "video/mp4",
66
+ "image/heif",
67
+ "video/x-msvideo",
68
+ "pdf",
69
+ "image/png",
70
+ "application/c2pa",
71
+ "video/quicktime",
72
+ "video/avi",
73
+ "image/gif",
74
+ "application/xml",
75
+ "text/xml",
76
+ "application/xhtml+xml",
77
+ "tiff",
78
+ "audio/wave",
79
+ "mp4",
80
+ "image/avif",
81
+ "image/dng",
82
+ "png",
83
+ "dng",
84
+ "image/svg+xml",
85
+ "image/heic",
86
+ "application/mp4",
87
+ "image/x-nikon-nef",
88
+ "video/msvideo",
89
+ "tif",
90
+ "wav",
91
+ "xml",
92
+ "audio/vnd.wave",
93
+ "xhtml",
94
+ "gif",
95
+ "application/x-troff-msvideo",
96
+ "webp",
97
+ "heic",
98
+ "application/pdf",
99
+ "audio/mpeg",
100
+ "application/x-c2pa-manifest-store",
101
+ "jpeg",
102
+ "image/x-adobe-dng",
103
+ "audio/wav",
104
+ "mp3",
105
+ "mov",
106
+ "image/tiff",
107
+ "audio/mp4",
108
+ "application/svg+xml",
109
+ "arw",
110
+ "c2pa",
111
+ "svg",
112
+ "avi",
113
+ "audio/x-wav",
114
+ "m4a",
115
+ "image/x-sony-arw",
116
+ "image/jpeg",
117
+ "avif",
118
+ "image/webp",
119
+ "nef",
120
+ "heif"
121
+ ];
122
+ function h(e) {
123
+ return k.includes(e);
124
+ }
125
+ const D = {
126
+ builder: {
127
+ generateC2paArchive: !0
128
+ }
129
+ };
130
+ async function u(e) {
131
+ const t = z(D, e), _ = [];
132
+ return t.trust && _.push(v(t.trust)), t.cawgTrust && _.push(v(t.cawgTrust)), await Promise.all(_), JSON.stringify(E(t));
133
+ }
134
+ function E(e) {
135
+ return Object.entries(e).reduce(
136
+ (_, [r, n]) => (_[W(r)] = typeof n == "object" ? E(n) : n, _),
137
+ {}
138
+ );
139
+ }
140
+ function W(e) {
141
+ return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
142
+ }
143
+ async function v(e) {
144
+ try {
145
+ const t = Object.entries(e).map(async ([_, r]) => {
146
+ if (Array.isArray(r)) {
147
+ const n = r.map(async (a) => {
148
+ const c = await S(a);
149
+ if (A(_) && !R(c))
150
+ throw new Error(`Error parsing PEM file at: ${a}`);
151
+ return c;
152
+ }), i = (await Promise.all(n)).join("");
153
+ e[_] = i;
154
+ } else if (r && J(r)) {
155
+ const n = await S(r);
156
+ if (A(_) && !R(n))
157
+ throw new Error(`Error parsing PEM file at: ${r}`);
158
+ e[_] = n;
159
+ } else
160
+ return r;
161
+ });
162
+ await Promise.all(t);
163
+ } catch (t) {
164
+ throw new Error("Failed to resolve trust settings.", { cause: t });
165
+ }
166
+ }
167
+ const A = (e) => ["userAnchors", "trustAnchors"].includes(e), R = (e) => e.includes("-----BEGIN CERTIFICATE-----"), J = (e) => e.startsWith("http");
168
+ async function S(e) {
169
+ return await (await fetch(e)).text();
170
+ }
171
+ const d = 10 ** 9;
172
+ function C(e) {
173
+ const { tx: t } = e, _ = new FinalizationRegistry(async (r) => {
174
+ await t.reader_free(r);
175
+ });
176
+ return {
177
+ async fromBlob(r, n, o) {
178
+ if (!h(r))
179
+ throw new p(r);
180
+ if (n.size > d)
181
+ throw new y(n.size);
182
+ try {
183
+ const i = o && await u(o), a = await t.reader_fromBlob(r, n, i), c = F(e, a, () => {
184
+ _.unregister(c);
185
+ });
186
+ return _.register(c, a, c), c;
187
+ } catch (i) {
188
+ return B(i);
189
+ }
190
+ },
191
+ async fromBlobFragment(r, n, o, i) {
192
+ if (!h(r))
193
+ throw new p(r);
194
+ if (n.size > d)
195
+ throw new y(n.size);
196
+ try {
197
+ const a = i && await u(i), c = await t.reader_fromBlobFragment(
198
+ r,
199
+ n,
200
+ o,
201
+ a
202
+ ), s = F(e, c, () => {
203
+ _.unregister(s);
204
+ });
205
+ return _.register(s, c, s), s;
206
+ } catch (a) {
207
+ return B(a);
208
+ }
209
+ }
210
+ };
211
+ }
212
+ function B(e) {
213
+ if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
214
+ return null;
215
+ throw e;
216
+ }
217
+ function F(e, t, _) {
218
+ const { tx: r } = e;
219
+ return {
220
+ async activeLabel() {
221
+ return await r.reader_activeLabel(t);
222
+ },
223
+ async manifestStore() {
224
+ return await r.reader_manifestStore(t);
225
+ },
226
+ async activeManifest() {
227
+ return await r.reader_activeManifest(t);
228
+ },
229
+ async json() {
230
+ const n = await r.reader_json(t);
231
+ return JSON.parse(n);
232
+ },
233
+ async resourceToBytes(n) {
234
+ return await r.reader_resourceToBytes(t, n);
235
+ },
236
+ async free() {
237
+ _(), await r.reader_free(t);
238
+ }
239
+ };
240
+ }
241
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e >>> 0, 1));
242
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e >>> 0, 1));
243
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e >>> 0, 1));
244
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => e.dtor(e.a, e.b));
245
+ let P = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
246
+ P.decode();
247
+ const f = new TextEncoder();
248
+ "encodeInto" in f || (f.encodeInto = function(e, t) {
249
+ const _ = f.encode(e);
250
+ return t.set(_), {
251
+ read: e.length,
252
+ written: _.length
253
+ };
254
+ });
255
+ let g;
256
+ const q = "sha512-/BfYF29Di+PDrCOWfBXKdkAlYy5+vZbDIW0Z8+oeWW8DUm6mKN9XV030vz7HKDEQK6v6xzkiHrc+/pBf5lS1bA==";
257
+ async function x(e) {
258
+ const { alg: t } = e;
259
+ return {
260
+ reserveSize: await e.reserveSize(),
261
+ alg: t
262
+ };
263
+ }
264
+ function $(e) {
265
+ const { tx: t } = e, _ = new FinalizationRegistry((r) => {
266
+ t.builder_free(r);
267
+ });
268
+ return {
269
+ async new(r) {
270
+ const n = r && await u(r), o = await t.builder_new(n), i = b(e, o, () => {
271
+ _.unregister(i);
272
+ });
273
+ return _.register(i, o, i), i;
274
+ },
275
+ async fromDefinition(r, n) {
276
+ const o = JSON.stringify(r), i = n && await u(n), a = await t.builder_fromJson(o, i), c = b(e, a, () => {
277
+ _.unregister(c);
278
+ });
279
+ return _.register(c, a, c), c;
280
+ },
281
+ async fromArchive(r, n) {
282
+ const o = n && await u(n), i = await t.builder_fromArchive(r, o), a = b(e, i, () => {
283
+ _.unregister(a);
284
+ });
285
+ return _.register(a, i, a), a;
286
+ }
287
+ };
288
+ }
289
+ function b(e, t, _) {
290
+ const { tx: r } = e;
291
+ return {
292
+ async setIntent(n) {
293
+ await r.builder_setIntent(t, n);
294
+ },
295
+ async addAction(n) {
296
+ await r.builder_addAction(t, n);
297
+ },
298
+ async setRemoteUrl(n) {
299
+ await r.builder_setRemoteUrl(t, n);
300
+ },
301
+ async setNoEmbed(n) {
302
+ await r.builder_setNoEmbed(t, n);
303
+ },
304
+ async setThumbnailFromBlob(n, o) {
305
+ await r.builder_setThumbnailFromBlob(t, n, o);
306
+ },
307
+ async addIngredient(n) {
308
+ const o = JSON.stringify(n);
309
+ await r.builder_addIngredient(t, o);
310
+ },
311
+ async addIngredientFromBlob(n, o, i) {
312
+ const a = JSON.stringify(n);
313
+ await r.builder_addIngredientFromBlob(t, a, o, i);
314
+ },
315
+ async addResourceFromBlob(n, o) {
316
+ await r.builder_addResourceFromBlob(t, n, o);
317
+ },
318
+ async getDefinition() {
319
+ return await r.builder_getDefinition(t);
320
+ },
321
+ async toArchive() {
322
+ return await r.builder_toArchive(t);
323
+ },
324
+ async sign(n, o, i) {
325
+ const a = await x(n), c = e.registerSignReceiver(n.sign);
326
+ return await r.builder_sign(
327
+ t,
328
+ c,
329
+ a,
330
+ o,
331
+ i
332
+ );
333
+ },
334
+ async signAndGetManifestBytes(n, o, i) {
335
+ const a = await x(n), c = e.registerSignReceiver(n.sign);
336
+ return await r.builder_signAndGetManifestBytes(
337
+ t,
338
+ c,
339
+ a,
340
+ o,
341
+ i
342
+ );
343
+ },
344
+ async free() {
345
+ _(), await r.builder_free(t);
346
+ }
347
+ };
348
+ }
349
+ async function Z(e) {
350
+ const { wasmSrc: t, settings: _ } = e, r = typeof t == "string" ? await G(t) : t, n = _ ? await u(_) : void 0, o = await L({ wasm: r, settingsString: n });
351
+ return {
352
+ reader: C(o),
353
+ builder: $(o),
354
+ dispose: o.terminate
355
+ };
356
+ }
357
+ async function G(e) {
358
+ const t = await fetch(e, { integrity: q });
359
+ return await WebAssembly.compileStreaming(t);
360
+ }
361
+ export {
362
+ k as R,
363
+ Z as c,
364
+ h as i
365
+ };
package/dist/common.d.ts CHANGED
@@ -11,6 +11,6 @@ export type { Reader, ReaderFactory } from './lib/reader.js';
11
11
  export type { Builder, BuilderFactory, ManifestAndAssetBytes, } from './lib/builder.js';
12
12
  export type { Signer, SigningAlg } from './lib/signer.js';
13
13
  export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS, } from './lib/supportedFormats.js';
14
- export type { SettingsContext, Settings, VerifySettings, TrustSettings, BuilderSettings, BuilderThumbnailSettings, CawgTrustSettings, } from './lib/settings.js';
14
+ export type { Settings, VerifySettings, TrustSettings, BuilderSettings, BuilderThumbnailSettings, CawgTrustSettings, } from './lib/settings.js';
15
15
  export type * from '@contentauth/c2pa-types';
16
16
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,YAAY,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,eAAe,EACf,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,mBAAmB,yBAAyB,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,YAAY,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,mBAAmB,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as r, c as R, i as o } from "./c2pa-CUB9X4uN.js";
1
+ import { R as r, c as R, i as o } from "./c2pa-CDISz-AM.js";
2
2
  export {
3
3
  r as READER_SUPPORTED_FORMATS,
4
4
  R as createC2pa,