@contentauth/c2pa-web 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,26 @@
1
- var $ = (r, e) => () => (e || r((e = { exports: {} }).exports, e), e.exports);
2
- var fe = $((ge, C) => {
3
- class h {
1
+ var Q = (r, e) => () => (e || r((e = { exports: {} }).exports, e), e.exports);
2
+ var Ae = Q((Fe, Y) => {
3
+ class p {
4
4
  static __wrap(e) {
5
- const t = Object.create(h.prototype);
6
- return t.__wbg_ptr = e, z.register(t, t.__wbg_ptr, t), t;
5
+ const t = Object.create(p.prototype);
6
+ return t.__wbg_ptr = e, J.register(t, t.__wbg_ptr, t), t;
7
7
  }
8
8
  __destroy_into_raw() {
9
9
  const e = this.__wbg_ptr;
10
- return this.__wbg_ptr = 0, z.unregister(this), e;
10
+ return this.__wbg_ptr = 0, J.unregister(this), e;
11
11
  }
12
12
  free() {
13
13
  const e = this.__destroy_into_raw();
14
- o.__wbg_wasmbuilder_free(e, 0);
14
+ _.__wbg_wasmbuilder_free(e, 0);
15
15
  }
16
16
  /**
17
17
  * Add an action to the manifest's `Actions` assertion.
18
18
  * @param {any} action
19
19
  */
20
20
  addAction(e) {
21
- const t = o.wasmbuilder_addAction(this.__wbg_ptr, e);
21
+ const t = _.wasmbuilder_addAction(this.__wbg_ptr, e);
22
22
  if (t[1])
23
- throw d(t[0]);
23
+ throw u(t[0]);
24
24
  }
25
25
  /**
26
26
  * Add an assertion to the manifest under `label` with the given `data`.
@@ -28,9 +28,9 @@ var fe = $((ge, C) => {
28
28
  * @param {any} data
29
29
  */
30
30
  addAssertion(e, t) {
31
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_addAssertion(this.__wbg_ptr, n, _, t);
32
- if (c[1])
33
- throw d(c[0]);
31
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_addAssertion(this.__wbg_ptr, n, o, t);
32
+ if (i[1])
33
+ throw u(i[0]);
34
34
  }
35
35
  /**
36
36
  * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
@@ -45,8 +45,8 @@ var fe = $((ge, C) => {
45
45
  * @returns {Promise<void>}
46
46
  */
47
47
  addIngredientFromBlob(e, t, n) {
48
- const _ = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a, s = b(t, o.__wbindgen_malloc, o.__wbindgen_realloc), i = a;
49
- return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr, _, c, s, i, n);
48
+ const o = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a, c = d(t, _.__wbindgen_malloc, _.__wbindgen_realloc), s = a;
49
+ return _.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr, o, i, c, s, n);
50
50
  }
51
51
  /**
52
52
  * Add an ingredient to the manifest from a JSON ingredient definition without a blob
@@ -56,9 +56,9 @@ var fe = $((ge, C) => {
56
56
  * @param {string} json
57
57
  */
58
58
  addIngredient(e) {
59
- const t = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), n = a, _ = o.wasmbuilder_addIngredient(this.__wbg_ptr, t, n);
60
- if (_[1])
61
- throw d(_[0]);
59
+ const t = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), n = a, o = _.wasmbuilder_addIngredient(this.__wbg_ptr, t, n);
60
+ if (o[1])
61
+ throw u(o[0]);
62
62
  }
63
63
  /**
64
64
  * Add a redaction for a JUMBF URI with the given reason.
@@ -69,9 +69,9 @@ var fe = $((ge, C) => {
69
69
  * @param {any} reason
70
70
  */
71
71
  addRedaction(e, t) {
72
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_addRedaction(this.__wbg_ptr, n, _, t);
73
- if (c[1])
74
- throw d(c[0]);
72
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_addRedaction(this.__wbg_ptr, n, o, t);
73
+ if (i[1])
74
+ throw u(i[0]);
75
75
  }
76
76
  /**
77
77
  * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
@@ -79,9 +79,9 @@ var fe = $((ge, C) => {
79
79
  * @param {Blob} blob
80
80
  */
81
81
  addResourceFromBlob(e, t) {
82
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr, n, _, t);
83
- if (c[1])
84
- throw d(c[0]);
82
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_addResourceFromBlob(this.__wbg_ptr, n, o, t);
83
+ if (i[1])
84
+ throw u(i[0]);
85
85
  }
86
86
  /**
87
87
  * Retains actions and ingredients together in one step, per
@@ -96,9 +96,9 @@ var fe = $((ge, C) => {
96
96
  * @param {Uint32Array} ingredient_indices
97
97
  */
98
98
  filterActionsAndIngredientsAt(e, t) {
99
- const n = E(e, o.__wbindgen_malloc), _ = a, c = E(t, o.__wbindgen_malloc), s = a, i = o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr, n, _, c, s);
100
- if (i[1])
101
- throw d(i[0]);
99
+ const n = W(e, _.__wbindgen_malloc), o = a, i = W(t, _.__wbindgen_malloc), c = a, s = _.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr, n, o, i, c);
100
+ if (s[1])
101
+ throw u(s[0]);
102
102
  }
103
103
  /**
104
104
  * Retains only the actions at the given 0-based indices into the actions currently returned
@@ -118,9 +118,9 @@ var fe = $((ge, C) => {
118
118
  * @param {Uint32Array} indices
119
119
  */
120
120
  filterActionsAt(e) {
121
- const t = E(e, o.__wbindgen_malloc), n = a, _ = o.wasmbuilder_filterActionsAt(this.__wbg_ptr, t, n);
122
- if (_[1])
123
- throw d(_[0]);
121
+ const t = W(e, _.__wbindgen_malloc), n = a, o = _.wasmbuilder_filterActionsAt(this.__wbg_ptr, t, n);
122
+ if (o[1])
123
+ throw u(o[0]);
124
124
  }
125
125
  /**
126
126
  * Retains ingredients, rescuing an otherwise-orphaned ingredient when its 0-based index into
@@ -132,9 +132,22 @@ var fe = $((ge, C) => {
132
132
  * @param {Uint32Array} indices
133
133
  */
134
134
  filterIngredientsAt(e) {
135
- const t = E(e, o.__wbindgen_malloc), n = a, _ = o.wasmbuilder_filterIngredientsAt(this.__wbg_ptr, t, n);
136
- if (_[1])
137
- throw d(_[0]);
135
+ const t = W(e, _.__wbindgen_malloc), n = a, o = _.wasmbuilder_filterIngredientsAt(this.__wbg_ptr, t, n);
136
+ if (o[1])
137
+ throw u(o[0]);
138
+ }
139
+ /**
140
+ * Creates a builder from an archive sharing the handle's settings.
141
+ * @param {Blob} archive
142
+ * @param {WasmContext} context
143
+ * @returns {WasmBuilder}
144
+ */
145
+ static fromArchiveWithContext(e, t) {
146
+ C(t, M);
147
+ const n = _.wasmbuilder_fromArchiveWithContext(e, t.__wbg_ptr);
148
+ if (n[2])
149
+ throw u(n[1]);
150
+ return p.__wrap(n[0]);
138
151
  }
139
152
  /**
140
153
  * Attempts to create a new `WasmBuilder` from a builder archive.
@@ -144,11 +157,25 @@ var fe = $((ge, C) => {
144
157
  * @returns {WasmBuilder}
145
158
  */
146
159
  static fromArchive(e, t) {
147
- var n = w(t) ? 0 : b(t, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a;
148
- const c = o.wasmbuilder_fromArchive(e, n, _);
149
- if (c[2])
150
- throw d(c[1]);
151
- return h.__wrap(c[0]);
160
+ var n = w(t) ? 0 : d(t, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a;
161
+ const i = _.wasmbuilder_fromArchive(e, n, o);
162
+ if (i[2])
163
+ throw u(i[1]);
164
+ return p.__wrap(i[0]);
165
+ }
166
+ /**
167
+ * Creates a builder from manifest JSON sharing the handle's settings.
168
+ * @param {string} json
169
+ * @param {WasmContext} context
170
+ * @returns {WasmBuilder}
171
+ */
172
+ static fromJsonWithContext(e, t) {
173
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a;
174
+ C(t, M);
175
+ const i = _.wasmbuilder_fromJsonWithContext(n, o, t.__wbg_ptr);
176
+ if (i[2])
177
+ throw u(i[1]);
178
+ return p.__wrap(i[0]);
152
179
  }
153
180
  /**
154
181
  * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
@@ -158,22 +185,34 @@ var fe = $((ge, C) => {
158
185
  * @returns {WasmBuilder}
159
186
  */
160
187
  static fromJson(e, t) {
161
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a;
162
- var c = w(t) ? 0 : b(t, o.__wbindgen_malloc, o.__wbindgen_realloc), s = a;
163
- const i = o.wasmbuilder_fromJson(n, _, c, s);
164
- if (i[2])
165
- throw d(i[1]);
166
- return h.__wrap(i[0]);
188
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a;
189
+ var i = w(t) ? 0 : d(t, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
190
+ const s = _.wasmbuilder_fromJson(n, o, i, c);
191
+ if (s[2])
192
+ throw u(s[1]);
193
+ return p.__wrap(s[0]);
167
194
  }
168
195
  /**
169
196
  * Get the current manifest definition.
170
197
  * @returns {string}
171
198
  */
172
199
  getDefinition() {
173
- const e = o.wasmbuilder_getDefinition(this.__wbg_ptr);
200
+ const e = _.wasmbuilder_getDefinition(this.__wbg_ptr);
174
201
  if (e[2])
175
- throw d(e[1]);
176
- return d(e[0]);
202
+ throw u(e[1]);
203
+ return u(e[0]);
204
+ }
205
+ /**
206
+ * Creates a builder sharing the handle's settings, with independent manifest state.
207
+ * @param {WasmContext} context
208
+ * @returns {WasmBuilder}
209
+ */
210
+ static newWithContext(e) {
211
+ C(e, M);
212
+ const t = _.wasmbuilder_newWithContext(e.__wbg_ptr);
213
+ if (t[2])
214
+ throw u(t[1]);
215
+ return p.__wrap(t[0]);
177
216
  }
178
217
  /**
179
218
  * Creates a new `WasmBuilder` with a minimal manifest definition.
@@ -182,27 +221,27 @@ var fe = $((ge, C) => {
182
221
  * @returns {WasmBuilder}
183
222
  */
184
223
  static new(e) {
185
- var t = w(e) ? 0 : b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), n = a;
186
- const _ = o.wasmbuilder_new(t, n);
187
- if (_[2])
188
- throw d(_[1]);
189
- return h.__wrap(_[0]);
224
+ var t = w(e) ? 0 : d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), n = a;
225
+ const o = _.wasmbuilder_new(t, n);
226
+ if (o[2])
227
+ throw u(o[1]);
228
+ return p.__wrap(o[0]);
190
229
  }
191
230
  /**
192
231
  * Sets the builder "intent."
193
232
  * @param {any} json_intent
194
233
  */
195
234
  setIntent(e) {
196
- const t = o.wasmbuilder_setIntent(this.__wbg_ptr, e);
235
+ const t = _.wasmbuilder_setIntent(this.__wbg_ptr, e);
197
236
  if (t[1])
198
- throw d(t[0]);
237
+ throw u(t[0]);
199
238
  }
200
239
  /**
201
240
  * Sets the state of the no_embed flag.
202
241
  * @param {boolean} no_embed
203
242
  */
204
243
  setNoEmbed(e) {
205
- o.wasmbuilder_setNoEmbed(this.__wbg_ptr, e);
244
+ _.wasmbuilder_setNoEmbed(this.__wbg_ptr, e);
206
245
  }
207
246
  /**
208
247
  * Sets the remote_url for a remote manifest.
@@ -212,8 +251,8 @@ var fe = $((ge, C) => {
212
251
  * @param {string} url
213
252
  */
214
253
  setRemoteUrl(e) {
215
- const t = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), n = a;
216
- o.wasmbuilder_setRemoteUrl(this.__wbg_ptr, t, n);
254
+ const t = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), n = a;
255
+ _.wasmbuilder_setRemoteUrl(this.__wbg_ptr, t, n);
217
256
  }
218
257
  /**
219
258
  * Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
@@ -221,9 +260,9 @@ var fe = $((ge, C) => {
221
260
  * @param {Blob} blob
222
261
  */
223
262
  setThumbnailFromBlob(e, t) {
224
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr, n, _, t);
225
- if (c[1])
226
- throw d(c[0]);
263
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr, n, o, t);
264
+ if (i[1])
265
+ throw u(i[0]);
227
266
  }
228
267
  /**
229
268
  * Sign an asset using the provided SignerDefinition, format, and source Blob.
@@ -236,9 +275,9 @@ var fe = $((ge, C) => {
236
275
  * @param {Blob} source
237
276
  * @returns {Promise<any>}
238
277
  */
239
- signAndGetManifestBytes(e, t, n, _) {
240
- const c = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), s = a;
241
- return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr, e, t, c, s, _);
278
+ signAndGetManifestBytes(e, t, n, o) {
279
+ const i = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
280
+ return _.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr, e, t, i, c, o);
242
281
  }
243
282
  /**
244
283
  * Sign an asset using the provided SignerDefinition, format, and source Blob.
@@ -252,19 +291,19 @@ var fe = $((ge, C) => {
252
291
  * @param {Blob} source
253
292
  * @returns {Promise<Uint8Array>}
254
293
  */
255
- sign(e, t, n, _) {
256
- const c = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), s = a;
257
- return o.wasmbuilder_sign(this.__wbg_ptr, e, t, c, s, _);
294
+ sign(e, t, n, o) {
295
+ const i = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
296
+ return _.wasmbuilder_sign(this.__wbg_ptr, e, t, i, c, o);
258
297
  }
259
298
  /**
260
299
  * "Save" a builder to an archive.
261
300
  * @returns {Uint8Array}
262
301
  */
263
302
  toArchive() {
264
- const e = o.wasmbuilder_toArchive(this.__wbg_ptr);
303
+ const e = _.wasmbuilder_toArchive(this.__wbg_ptr);
265
304
  if (e[2])
266
- throw d(e[1]);
267
- return d(e[0]);
305
+ throw u(e[1]);
306
+ return u(e[0]);
268
307
  }
269
308
  /**
270
309
  * Replaces the actions in the `c2pa.actions`/`c2pa.actions.v2` assertions with
@@ -291,9 +330,9 @@ var fe = $((ge, C) => {
291
330
  * @param {any} action_groups
292
331
  */
293
332
  updateActionsAt(e) {
294
- const t = o.wasmbuilder_updateActionsAt(this.__wbg_ptr, e);
333
+ const t = _.wasmbuilder_updateActionsAt(this.__wbg_ptr, e);
295
334
  if (t[1])
296
- throw d(t[0]);
335
+ throw u(t[0]);
297
336
  }
298
337
  /**
299
338
  * Replaces the data of every assertion with an exact matching label, in positional order.
@@ -302,9 +341,9 @@ var fe = $((ge, C) => {
302
341
  * @param {any} data
303
342
  */
304
343
  updateAssertionsAt(e, t) {
305
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_updateAssertionsAt(this.__wbg_ptr, n, _, t);
306
- if (c[1])
307
- throw d(c[0]);
344
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_updateAssertionsAt(this.__wbg_ptr, n, o, t);
345
+ if (i[1])
346
+ throw u(i[0]);
308
347
  }
309
348
  /**
310
349
  * Updates a (known) property in the manifest definition.
@@ -312,43 +351,65 @@ var fe = $((ge, C) => {
312
351
  * @param {any} value
313
352
  */
314
353
  updateManifestProperty(e, t) {
315
- const n = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), _ = a, c = o.wasmbuilder_updateManifestProperty(this.__wbg_ptr, n, _, t);
316
- if (c[1])
317
- throw d(c[0]);
354
+ const n = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), o = a, i = _.wasmbuilder_updateManifestProperty(this.__wbg_ptr, n, o, t);
355
+ if (i[1])
356
+ throw u(i[0]);
318
357
  }
319
358
  }
320
- Symbol.dispose && (h.prototype[Symbol.dispose] = h.prototype.free);
359
+ Symbol.dispose && (p.prototype[Symbol.dispose] = p.prototype.free);
321
360
  class M {
361
+ __destroy_into_raw() {
362
+ const e = this.__wbg_ptr;
363
+ return this.__wbg_ptr = 0, D.unregister(this), e;
364
+ }
365
+ free() {
366
+ const e = this.__destroy_into_raw();
367
+ _.__wbg_wasmcontext_free(e, 0);
368
+ }
369
+ /**
370
+ * Parses settings once. Omit the JSON argument to use default settings.
371
+ * @param {string | null} [context_json]
372
+ */
373
+ constructor(e) {
374
+ var t = w(e) ? 0 : d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), n = a;
375
+ const o = _.wasmcontext_new(t, n);
376
+ if (o[2])
377
+ throw u(o[1]);
378
+ return this.__wbg_ptr = o[0], D.register(this, this.__wbg_ptr, this), this;
379
+ }
380
+ }
381
+ Symbol.dispose && (M.prototype[Symbol.dispose] = M.prototype.free);
382
+ class I {
322
383
  static __wrap(e) {
323
- const t = Object.create(M.prototype);
324
- return t.__wbg_ptr = e, N.register(t, t.__wbg_ptr, t), t;
384
+ const t = Object.create(I.prototype);
385
+ return t.__wbg_ptr = e, L.register(t, t.__wbg_ptr, t), t;
325
386
  }
326
387
  __destroy_into_raw() {
327
388
  const e = this.__wbg_ptr;
328
- return this.__wbg_ptr = 0, N.unregister(this), e;
389
+ return this.__wbg_ptr = 0, L.unregister(this), e;
329
390
  }
330
391
  free() {
331
392
  const e = this.__destroy_into_raw();
332
- o.__wbg_wasmreader_free(e, 0);
393
+ _.__wbg_wasmreader_free(e, 0);
333
394
  }
334
395
  /**
335
396
  * Returns the label of the asset's active manifest.
336
397
  * @returns {string | undefined}
337
398
  */
338
399
  activeLabel() {
339
- const e = o.wasmreader_activeLabel(this.__wbg_ptr);
400
+ const e = _.wasmreader_activeLabel(this.__wbg_ptr);
340
401
  let t;
341
- return e[0] !== 0 && (t = p(e[0], e[1]), o.__wbindgen_free(e[0], e[1] * 1, 1)), t;
402
+ return e[0] !== 0 && (t = y(e[0], e[1]), _.__wbindgen_free(e[0], e[1] * 1, 1)), t;
342
403
  }
343
404
  /**
344
405
  * Returns the asset's active manifest.
345
406
  * @returns {any}
346
407
  */
347
408
  activeManifest() {
348
- const e = o.wasmreader_activeManifest(this.__wbg_ptr);
409
+ const e = _.wasmreader_activeManifest(this.__wbg_ptr);
349
410
  if (e[2])
350
- throw d(e[1]);
351
- return d(e[0]);
411
+ throw u(e[1]);
412
+ return u(e[0]);
352
413
  }
353
414
  /**
354
415
  * Returns the asset's manifest store as crJSON.
@@ -357,12 +418,25 @@ var fe = $((ge, C) => {
357
418
  crJson() {
358
419
  let e, t;
359
420
  try {
360
- const n = o.wasmreader_crJson(this.__wbg_ptr);
361
- return e = n[0], t = n[1], p(n[0], n[1]);
421
+ const n = _.wasmreader_crJson(this.__wbg_ptr);
422
+ return e = n[0], t = n[1], y(n[0], n[1]);
362
423
  } finally {
363
- o.__wbindgen_free(e, t, 1);
424
+ _.__wbindgen_free(e, t, 1);
364
425
  }
365
426
  }
427
+ /**
428
+ * Creates a fragment reader sharing the handle's settings.
429
+ * The handle can be freed immediately, even while the returned Promise is pending.
430
+ * @param {string} format
431
+ * @param {Blob} init
432
+ * @param {Blob} fragment
433
+ * @param {WasmContext} context
434
+ * @returns {Promise<WasmReader>}
435
+ */
436
+ static fromBlobFragmentWithContext(e, t, n, o) {
437
+ const i = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
438
+ return C(o, M), _.wasmreader_fromBlobFragmentWithContext(i, c, t, n, o.__wbg_ptr);
439
+ }
366
440
  /**
367
441
  * Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
368
442
  * Optionally accepts a context JSON string to configure the reader.
@@ -372,10 +446,22 @@ var fe = $((ge, C) => {
372
446
  * @param {string | null} [context_json]
373
447
  * @returns {Promise<WasmReader>}
374
448
  */
375
- static fromBlobFragment(e, t, n, _) {
376
- const c = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), s = a;
377
- var i = w(_) ? 0 : b(_, o.__wbindgen_malloc, o.__wbindgen_realloc), u = a;
378
- return o.wasmreader_fromBlobFragment(c, s, t, n, i, u);
449
+ static fromBlobFragment(e, t, n, o) {
450
+ const i = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
451
+ var s = w(o) ? 0 : d(o, _.__wbindgen_malloc, _.__wbindgen_realloc), f = a;
452
+ return _.wasmreader_fromBlobFragment(i, c, t, n, s, f);
453
+ }
454
+ /**
455
+ * Creates a reader sharing the handle's settings.
456
+ * The handle can be freed immediately, even while the returned Promise is pending.
457
+ * @param {string} format
458
+ * @param {Blob} blob
459
+ * @param {WasmContext} context
460
+ * @returns {Promise<WasmReader>}
461
+ */
462
+ static fromBlobWithContext(e, t, n) {
463
+ const o = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
464
+ return C(n, M), _.wasmreader_fromBlobWithContext(o, i, t, n.__wbg_ptr);
379
465
  }
380
466
  /**
381
467
  * Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
@@ -386,9 +472,9 @@ var fe = $((ge, C) => {
386
472
  * @returns {Promise<WasmReader>}
387
473
  */
388
474
  static fromBlob(e, t, n) {
389
- const _ = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a;
390
- var s = w(n) ? 0 : b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), i = a;
391
- return o.wasmreader_fromBlob(_, c, t, s, i);
475
+ const o = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
476
+ var c = w(n) ? 0 : d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), s = a;
477
+ return _.wasmreader_fromBlob(o, i, t, c, s);
392
478
  }
393
479
  /**
394
480
  * Attempts to create a new `WasmReader` from an asset format and the asset's raw bytes.
@@ -405,9 +491,9 @@ var fe = $((ge, C) => {
405
491
  * @returns {Promise<WasmReader>}
406
492
  */
407
493
  static fromBytes(e, t, n) {
408
- const _ = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a, s = re(t, o.__wbindgen_malloc), i = a;
409
- var u = w(n) ? 0 : b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), g = a;
410
- return o.wasmreader_fromBytes(_, c, s, i, u, g);
494
+ const o = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a, c = se(t, _.__wbindgen_malloc), s = a;
495
+ var f = w(n) ? 0 : d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), g = a;
496
+ return _.wasmreader_fromBytes(o, i, c, s, f, g);
411
497
  }
412
498
  /**
413
499
  * Returns a JSON representation of the asset's manifest store.
@@ -416,10 +502,10 @@ var fe = $((ge, C) => {
416
502
  json() {
417
503
  let e, t;
418
504
  try {
419
- const n = o.wasmreader_json(this.__wbg_ptr);
420
- return e = n[0], t = n[1], p(n[0], n[1]);
505
+ const n = _.wasmreader_json(this.__wbg_ptr);
506
+ return e = n[0], t = n[1], y(n[0], n[1]);
421
507
  } finally {
422
- o.__wbindgen_free(e, t, 1);
508
+ _.__wbindgen_free(e, t, 1);
423
509
  }
424
510
  }
425
511
  /**
@@ -427,10 +513,10 @@ var fe = $((ge, C) => {
427
513
  * @returns {any}
428
514
  */
429
515
  manifestStore() {
430
- const e = o.wasmreader_manifestStore(this.__wbg_ptr);
516
+ const e = _.wasmreader_manifestStore(this.__wbg_ptr);
431
517
  if (e[2])
432
- throw d(e[1]);
433
- return d(e[0]);
518
+ throw u(e[1]);
519
+ return u(e[0]);
434
520
  }
435
521
  /**
436
522
  * Accepts a URI reference to a binary object in the resource store and returns a `js_sys::Uint8Array` containing the resource's bytes.
@@ -438,46 +524,46 @@ var fe = $((ge, C) => {
438
524
  * @returns {Uint8Array}
439
525
  */
440
526
  resourceToBytes(e) {
441
- const t = b(e, o.__wbindgen_malloc, o.__wbindgen_realloc), n = a, _ = o.wasmreader_resourceToBytes(this.__wbg_ptr, t, n);
442
- if (_[2])
443
- throw d(_[1]);
444
- return d(_[0]);
527
+ const t = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), n = a, o = _.wasmreader_resourceToBytes(this.__wbg_ptr, t, n);
528
+ if (o[2])
529
+ throw u(o[1]);
530
+ return u(o[0]);
445
531
  }
446
532
  }
447
- Symbol.dispose && (M.prototype[Symbol.dispose] = M.prototype.free);
448
- function H(r) {
449
- const e = o.encodeSignerPayload(r);
533
+ Symbol.dispose && (I.prototype[Symbol.dispose] = I.prototype.free);
534
+ function Z(r) {
535
+ const e = _.encodeSignerPayload(r);
450
536
  if (e[3])
451
- throw d(e[2]);
537
+ throw u(e[2]);
452
538
  var t = A(e[0], e[1]).slice();
453
- return o.__wbindgen_free(e[0], e[1] * 1, 1), t;
539
+ return _.__wbindgen_free(e[0], e[1] * 1, 1), t;
454
540
  }
455
- function X() {
541
+ function ee() {
456
542
  return {
457
543
  __proto__: null,
458
544
  "./c2pa_bg.js": {
459
545
  __proto__: null,
460
546
  __wbg_Error_30c8987f7c2ed4e2: function(e, t) {
461
- return Error(p(e, t));
547
+ return Error(y(e, t));
462
548
  },
463
549
  __wbg_Number_14af1003b8dd5ead: function(e) {
464
550
  return Number(e);
465
551
  },
466
552
  __wbg_String_8564e559799eccda: function(e, t) {
467
- const n = String(t), _ = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a;
468
- m().setInt32(e + 4, c, !0), m().setInt32(e + 0, _, !0);
553
+ const n = String(t), o = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
554
+ m().setInt32(e + 4, i, !0), m().setInt32(e + 0, o, !0);
469
555
  },
470
556
  __wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(e, t) {
471
- const n = t, _ = typeof n == "bigint" ? n : void 0;
472
- m().setBigInt64(e + 8, w(_) ? BigInt(0) : _, !0), m().setInt32(e + 0, !w(_), !0);
557
+ const n = t, o = typeof n == "bigint" ? n : void 0;
558
+ m().setBigInt64(e + 8, w(o) ? BigInt(0) : o, !0), m().setInt32(e + 0, !w(o), !0);
473
559
  },
474
560
  __wbg___wbindgen_boolean_get_5b446f51afd21013: function(e) {
475
561
  const t = e, n = typeof t == "boolean" ? t : void 0;
476
562
  return w(n) ? 16777215 : n ? 1 : 0;
477
563
  },
478
564
  __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(e, t) {
479
- const n = x(t), _ = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a;
480
- m().setInt32(e + 4, c, !0), m().setInt32(e + 0, _, !0);
565
+ const n = k(t), o = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
566
+ m().setInt32(e + 4, i, !0), m().setInt32(e + 0, o, !0);
481
567
  },
482
568
  __wbg___wbindgen_in_92f62ee1427d9e49: function(e, t) {
483
569
  return e in t;
@@ -508,16 +594,16 @@ var fe = $((ge, C) => {
508
594
  return e == t;
509
595
  },
510
596
  __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(e, t) {
511
- const n = t, _ = typeof n == "number" ? n : void 0;
512
- m().setFloat64(e + 8, w(_) ? 0 : _, !0), m().setInt32(e + 0, !w(_), !0);
597
+ const n = t, o = typeof n == "number" ? n : void 0;
598
+ m().setFloat64(e + 8, w(o) ? 0 : o, !0), m().setInt32(e + 0, !w(o), !0);
513
599
  },
514
600
  __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(e, t) {
515
- const n = t, _ = typeof n == "string" ? n : void 0;
516
- var c = w(_) ? 0 : b(_, o.__wbindgen_malloc, o.__wbindgen_realloc), s = a;
517
- m().setInt32(e + 4, s, !0), m().setInt32(e + 0, c, !0);
601
+ const n = t, o = typeof n == "string" ? n : void 0;
602
+ var i = w(o) ? 0 : d(o, _.__wbindgen_malloc, _.__wbindgen_realloc), c = a;
603
+ m().setInt32(e + 4, c, !0), m().setInt32(e + 0, i, !0);
518
604
  },
519
605
  __wbg___wbindgen_throw_41e9ee4f547fc59a: function(e, t) {
520
- throw new Error(p(e, t));
606
+ throw new Error(y(e, t));
521
607
  },
522
608
  __wbg__wbg_cb_unref_dcc1a90847f04c41: function(e) {
523
609
  e._wbg_cb_unref();
@@ -529,8 +615,8 @@ var fe = $((ge, C) => {
529
615
  e.abort();
530
616
  },
531
617
  __wbg_append_1938ed58fb5613b8: function() {
532
- return l(function(e, t, n, _, c) {
533
- e.append(p(t, n), p(_, c));
618
+ return l(function(e, t, n, o, i) {
619
+ e.append(y(t, n), y(o, i));
534
620
  }, arguments);
535
621
  },
536
622
  __wbg_arrayBuffer_f07be74819944ea2: function() {
@@ -564,11 +650,11 @@ var fe = $((ge, C) => {
564
650
  return Object.entries(e);
565
651
  },
566
652
  __wbg_error_757e9472f8410341: function(e, t) {
567
- let n, _;
653
+ let n, o;
568
654
  try {
569
- n = e, _ = t, console.error(p(e, t));
655
+ n = e, o = t, console.error(y(e, t));
570
656
  } finally {
571
- o.__wbindgen_free(n, _, 1);
657
+ _.__wbindgen_free(n, o, 1);
572
658
  }
573
659
  },
574
660
  __wbg_fetch_9dad4fe911207b37: function(e) {
@@ -731,16 +817,16 @@ var fe = $((ge, C) => {
731
817
  },
732
818
  __wbg_new_typed_b01cb72a8af741a3: function(e, t) {
733
819
  try {
734
- var n = { a: e, b: t }, _ = (s, i) => {
735
- const u = n.a;
820
+ var n = { a: e, b: t }, o = (c, s) => {
821
+ const f = n.a;
736
822
  n.a = 0;
737
823
  try {
738
- return Q(u, n.b, s, i);
824
+ return re(f, n.b, c, s);
739
825
  } finally {
740
- n.a = u;
826
+ n.a = f;
741
827
  }
742
828
  };
743
- return new Promise(_);
829
+ return new Promise(o);
744
830
  } finally {
745
831
  n.a = 0;
746
832
  }
@@ -750,7 +836,7 @@ var fe = $((ge, C) => {
750
836
  },
751
837
  __wbg_new_with_str_and_init_4618dee4e950224f: function() {
752
838
  return l(function(e, t, n) {
753
- return new Request(p(e, t), n);
839
+ return new Request(y(e, t), n);
754
840
  }, arguments);
755
841
  },
756
842
  __wbg_next_33784799010f1bbe: function(e) {
@@ -797,7 +883,7 @@ var fe = $((ge, C) => {
797
883
  },
798
884
  __wbg_require_b4edbdcf3e2a1ef0: function() {
799
885
  return l(function() {
800
- return C.require;
886
+ return Y.require;
801
887
  }, arguments);
802
888
  },
803
889
  __wbg_resolve_0076e10020304ede: function(e) {
@@ -822,19 +908,19 @@ var fe = $((ge, C) => {
822
908
  e.body = t;
823
909
  },
824
910
  __wbg_set_cache_7507c4cc5938ccc7: function(e, t) {
825
- e.cache = Z[t];
911
+ e.cache = _e[t];
826
912
  },
827
913
  __wbg_set_credentials_e0dcce31ca532b7d: function(e, t) {
828
- e.credentials = ee[t];
914
+ e.credentials = oe[t];
829
915
  },
830
916
  __wbg_set_headers_40ad33dcf016613f: function(e, t) {
831
917
  e.headers = t;
832
918
  },
833
919
  __wbg_set_method_dcb32343247ec427: function(e, t, n) {
834
- e.method = p(t, n);
920
+ e.method = y(t, n);
835
921
  },
836
922
  __wbg_set_mode_74e772635acb96ec: function(e, t) {
837
- e.mode = te[t];
923
+ e.mode = ie[t];
838
924
  },
839
925
  __wbg_set_signal_2dbd377604627f26: function(e, t) {
840
926
  e.signal = t;
@@ -851,24 +937,24 @@ var fe = $((ge, C) => {
851
937
  }, arguments);
852
938
  },
853
939
  __wbg_stack_3b0d974bbf31e44f: function(e, t) {
854
- const n = t.stack, _ = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a;
855
- m().setInt32(e + 4, c, !0), m().setInt32(e + 0, _, !0);
940
+ const n = t.stack, o = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
941
+ m().setInt32(e + 4, i, !0), m().setInt32(e + 0, o, !0);
856
942
  },
857
943
  __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
858
944
  const e = typeof global > "u" ? null : global;
859
- return w(e) ? 0 : R(e);
945
+ return w(e) ? 0 : x(e);
860
946
  },
861
947
  __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
862
948
  const e = typeof globalThis > "u" ? null : globalThis;
863
- return w(e) ? 0 : R(e);
949
+ return w(e) ? 0 : x(e);
864
950
  },
865
951
  __wbg_static_accessor_SELF_0b583911f537483a: function() {
866
952
  const e = typeof self > "u" ? null : self;
867
- return w(e) ? 0 : R(e);
953
+ return w(e) ? 0 : x(e);
868
954
  },
869
955
  __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
870
956
  const e = typeof window > "u" ? null : window;
871
- return w(e) ? 0 : R(e);
957
+ return w(e) ? 0 : x(e);
872
958
  },
873
959
  __wbg_status_ce0a98d3c57125f3: function(e) {
874
960
  return e.status;
@@ -888,8 +974,8 @@ var fe = $((ge, C) => {
888
974
  return e.then(t);
889
975
  },
890
976
  __wbg_url_8e28edeab4cd6bed: function(e, t) {
891
- const n = t.url, _ = b(n, o.__wbindgen_malloc, o.__wbindgen_realloc), c = a;
892
- m().setInt32(e + 4, c, !0), m().setInt32(e + 0, _, !0);
977
+ const n = t.url, o = d(n, _.__wbindgen_malloc, _.__wbindgen_realloc), i = a;
978
+ m().setInt32(e + 4, i, !0), m().setInt32(e + 0, o, !0);
893
979
  },
894
980
  __wbg_valueOf_6abcff09c8156bb6: function(e) {
895
981
  return e.valueOf();
@@ -901,13 +987,13 @@ var fe = $((ge, C) => {
901
987
  return e.versions;
902
988
  },
903
989
  __wbg_wasmreader_new: function(e) {
904
- return M.__wrap(e);
990
+ return I.__wrap(e);
905
991
  },
906
992
  __wbindgen_generic_0000000000000001: function(e, t) {
907
- return L(e, t, K);
993
+ return P(e, t, ne);
908
994
  },
909
995
  __wbindgen_generic_0000000000000002: function(e, t) {
910
- return L(e, t, Y);
996
+ return P(e, t, te);
911
997
  },
912
998
  __wbindgen_generic_0000000000000003: function(e) {
913
999
  return e;
@@ -919,67 +1005,73 @@ var fe = $((ge, C) => {
919
1005
  return A(e, t);
920
1006
  },
921
1007
  __wbindgen_generic_0000000000000006: function(e, t) {
922
- return p(e, t);
1008
+ return y(e, t);
923
1009
  },
924
1010
  __wbindgen_generic_0000000000000007: function(e) {
925
1011
  return BigInt.asUintN(64, e);
926
1012
  },
927
1013
  __wbindgen_generic_0000000000000008: function(e, t) {
928
1014
  var n = A(e, t).slice();
929
- return o.__wbindgen_free(e, t * 1, 1), n;
1015
+ return _.__wbindgen_free(e, t * 1, 1), n;
930
1016
  },
931
1017
  __wbindgen_init_externref_table: function() {
932
- const e = o.__wbindgen_externrefs, t = e.grow(4);
1018
+ const e = _.__wbindgen_externrefs, t = e.grow(4);
933
1019
  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);
934
1020
  }
935
1021
  }
936
1022
  };
937
1023
  }
938
- function Y(r, e) {
939
- o.wasm_bindgen_255200e6d97c625a___convert__closures_____invoke_______true_(r, e);
1024
+ function te(r, e) {
1025
+ _.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_(r, e);
940
1026
  }
941
- function K(r, e, t) {
942
- const n = o.wasm_bindgen_255200e6d97c625a___convert__closures_____invoke___wasm_bindgen_255200e6d97c625a___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_255200e6d97c625a___JsError___true_(r, e, t);
1027
+ function ne(r, e, t) {
1028
+ const n = _.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_(r, e, t);
943
1029
  if (n[1])
944
- throw d(n[0]);
1030
+ throw u(n[0]);
945
1031
  }
946
- function Q(r, e, t, n) {
947
- o.wasm_bindgen_255200e6d97c625a___convert__closures_____invoke___js_sys_bd80bcec31efc073___Function_fn_wasm_bindgen_255200e6d97c625a___JsValue_____wasm_bindgen_255200e6d97c625a___sys__Undefined___js_sys_bd80bcec31efc073___Function_fn_wasm_bindgen_255200e6d97c625a___JsValue_____wasm_bindgen_255200e6d97c625a___sys__Undefined_______true_(r, e, t, n);
1032
+ function re(r, e, t, n) {
1033
+ _.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_(r, e, t, n);
948
1034
  }
949
- const Z = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"], ee = ["omit", "same-origin", "include"], te = ["same-origin", "no-cors", "cors", "navigate"], z = typeof FinalizationRegistry > "u" ? { register: () => {
1035
+ const _e = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"], oe = ["omit", "same-origin", "include"], ie = ["same-origin", "no-cors", "cors", "navigate"], J = typeof FinalizationRegistry > "u" ? { register: () => {
950
1036
  }, unregister: () => {
951
- } } : new FinalizationRegistry((r) => o.__wbg_wasmbuilder_free(r, 1)), N = typeof FinalizationRegistry > "u" ? { register: () => {
1037
+ } } : new FinalizationRegistry((r) => _.__wbg_wasmbuilder_free(r, 1)), D = typeof FinalizationRegistry > "u" ? { register: () => {
952
1038
  }, unregister: () => {
953
- } } : new FinalizationRegistry((r) => o.__wbg_wasmreader_free(r, 1));
954
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((r) => o.__wbg_wasmsigner_free(r, 1));
955
- function R(r) {
956
- const e = o.__externref_table_alloc();
957
- return o.__wbindgen_externrefs.set(e, r), e;
958
- }
959
- const J = typeof FinalizationRegistry > "u" ? { register: () => {
1039
+ } } : new FinalizationRegistry((r) => _.__wbg_wasmcontext_free(r, 1)), L = typeof FinalizationRegistry > "u" ? { register: () => {
960
1040
  }, unregister: () => {
961
- } } : new FinalizationRegistry((r) => o.__wbindgen_destroy_closure(r.a, r.b));
1041
+ } } : new FinalizationRegistry((r) => _.__wbg_wasmreader_free(r, 1));
1042
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((r) => _.__wbg_wasmsigner_free(r, 1));
962
1043
  function x(r) {
1044
+ const e = _.__externref_table_alloc();
1045
+ return _.__wbindgen_externrefs.set(e, r), e;
1046
+ }
1047
+ function C(r, e) {
1048
+ if (!(r instanceof e))
1049
+ throw new Error(`expected instance of ${e.name}`);
1050
+ }
1051
+ const V = typeof FinalizationRegistry > "u" ? { register: () => {
1052
+ }, unregister: () => {
1053
+ } } : new FinalizationRegistry((r) => _.__wbindgen_destroy_closure(r.a, r.b));
1054
+ function k(r) {
963
1055
  const e = typeof r;
964
1056
  if (e == "number" || e == "boolean" || r == null)
965
1057
  return `${r}`;
966
1058
  if (e == "string")
967
1059
  return `"${r}"`;
968
1060
  if (e == "symbol") {
969
- const _ = r.description;
970
- return _ == null ? "Symbol" : `Symbol(${_})`;
1061
+ const o = r.description;
1062
+ return o == null ? "Symbol" : `Symbol(${o})`;
971
1063
  }
972
1064
  if (e == "function") {
973
- const _ = r.name;
974
- return typeof _ == "string" && _.length > 0 ? `Function(${_})` : "Function";
1065
+ const o = r.name;
1066
+ return typeof o == "string" && o.length > 0 ? `Function(${o})` : "Function";
975
1067
  }
976
1068
  if (Array.isArray(r)) {
977
- const _ = r.length;
978
- let c = "[";
979
- _ > 0 && (c += x(r[0]));
980
- for (let s = 1; s < _; s++)
981
- c += ", " + x(r[s]);
982
- return c += "]", c;
1069
+ const o = r.length;
1070
+ let i = "[";
1071
+ o > 0 && (i += k(r[0]));
1072
+ for (let c = 1; c < o; c++)
1073
+ i += ", " + k(r[c]);
1074
+ return i += "]", i;
983
1075
  }
984
1076
  const t = /\[object ([^\]]+)\]/.exec(toString.call(r));
985
1077
  let n;
@@ -997,109 +1089,109 @@ var fe = $((ge, C) => {
997
1089
  ${r.stack}` : n;
998
1090
  }
999
1091
  function A(r, e) {
1000
- return r = r >>> 0, S().subarray(r / 1, r / 1 + e);
1092
+ return r = r >>> 0, R().subarray(r / 1, r / 1 + e);
1001
1093
  }
1002
- let F = null;
1094
+ let S = null;
1003
1095
  function m() {
1004
- return (F === null || F.buffer.detached === !0 || F.buffer.detached === void 0 && F.buffer !== o.memory.buffer) && (F = new DataView(o.memory.buffer)), F;
1096
+ return (S === null || S.buffer.detached === !0 || S.buffer.detached === void 0 && S.buffer !== _.memory.buffer) && (S = new DataView(_.memory.buffer)), S;
1005
1097
  }
1006
- function p(r, e) {
1007
- return oe(r >>> 0, e);
1098
+ function y(r, e) {
1099
+ return ue(r >>> 0, e);
1008
1100
  }
1009
- let B = null;
1010
- function ne() {
1011
- return (B === null || B.byteLength === 0) && (B = new Uint32Array(o.memory.buffer)), B;
1101
+ let j = null;
1102
+ function ce() {
1103
+ return (j === null || j.byteLength === 0) && (j = new Uint32Array(_.memory.buffer)), j;
1012
1104
  }
1013
- let T = null;
1014
- function S() {
1015
- return (T === null || T.byteLength === 0) && (T = new Uint8Array(o.memory.buffer)), T;
1105
+ let E = null;
1106
+ function R() {
1107
+ return (E === null || E.byteLength === 0) && (E = new Uint8Array(_.memory.buffer)), E;
1016
1108
  }
1017
1109
  function l(r, e) {
1018
1110
  try {
1019
1111
  return r.apply(this, e);
1020
1112
  } catch (t) {
1021
- const n = R(t);
1022
- o.__wbindgen_exn_store(n);
1113
+ const n = x(t);
1114
+ _.__wbindgen_exn_store(n);
1023
1115
  }
1024
1116
  }
1025
1117
  function w(r) {
1026
1118
  return r == null;
1027
1119
  }
1028
- function L(r, e, t) {
1029
- const n = { a: r, b: e, cnt: 1 }, _ = (...c) => {
1120
+ function P(r, e, t) {
1121
+ const n = { a: r, b: e, cnt: 1 }, o = (...i) => {
1030
1122
  n.cnt++;
1031
- const s = n.a;
1123
+ const c = n.a;
1032
1124
  n.a = 0;
1033
1125
  try {
1034
- return t(s, n.b, ...c);
1126
+ return t(c, n.b, ...i);
1035
1127
  } finally {
1036
- n.a = s, _._wbg_cb_unref();
1128
+ n.a = c, o._wbg_cb_unref();
1037
1129
  }
1038
1130
  };
1039
- return _._wbg_cb_unref = () => {
1040
- --n.cnt === 0 && (o.__wbindgen_destroy_closure(n.a, n.b), n.a = 0, J.unregister(n));
1041
- }, J.register(_, n, n), _;
1131
+ return o._wbg_cb_unref = () => {
1132
+ --n.cnt === 0 && (_.__wbindgen_destroy_closure(n.a, n.b), n.a = 0, V.unregister(n));
1133
+ }, V.register(o, n, n), o;
1042
1134
  }
1043
- function E(r, e) {
1135
+ function W(r, e) {
1044
1136
  const t = e(r.length * 4, 4) >>> 0;
1045
- return ne().set(r, t / 4), a = r.length, t;
1137
+ return ce().set(r, t / 4), a = r.length, t;
1046
1138
  }
1047
- function re(r, e) {
1139
+ function se(r, e) {
1048
1140
  const t = e(r.length * 1, 1) >>> 0;
1049
- return S().set(r, t / 1), a = r.length, t;
1141
+ return R().set(r, t / 1), a = r.length, t;
1050
1142
  }
1051
- function b(r, e, t) {
1143
+ function d(r, e, t) {
1052
1144
  if (t === void 0) {
1053
- const i = j.encode(r), u = e(i.length, 1) >>> 0;
1054
- return S().subarray(u, u + i.length).set(i), a = i.length, u;
1145
+ const s = O.encode(r), f = e(s.length, 1) >>> 0;
1146
+ return R().subarray(f, f + s.length).set(s), a = s.length, f;
1055
1147
  }
1056
- let n = r.length, _ = e(n, 1) >>> 0;
1057
- const c = S();
1058
- let s = 0;
1059
- for (; s < n; s++) {
1060
- const i = r.charCodeAt(s);
1061
- if (i > 127) break;
1062
- c[_ + s] = i;
1148
+ let n = r.length, o = e(n, 1) >>> 0;
1149
+ const i = R();
1150
+ let c = 0;
1151
+ for (; c < n; c++) {
1152
+ const s = r.charCodeAt(c);
1153
+ if (s > 127) break;
1154
+ i[o + c] = s;
1063
1155
  }
1064
- if (s !== n) {
1065
- s !== 0 && (r = r.slice(s)), _ = t(_, n, n = s + r.length * 3, 1) >>> 0;
1066
- const i = S().subarray(_ + s, _ + n), u = j.encodeInto(r, i);
1067
- s += u.written, _ = t(_, n, s, 1) >>> 0;
1156
+ if (c !== n) {
1157
+ c !== 0 && (r = r.slice(c)), o = t(o, n, n = c + r.length * 3, 1) >>> 0;
1158
+ const s = R().subarray(o + c, o + n), f = O.encodeInto(r, s);
1159
+ c += f.written, o = t(o, n, c, 1) >>> 0;
1068
1160
  }
1069
- return a = s, _;
1161
+ return a = c, o;
1070
1162
  }
1071
- function d(r) {
1072
- const e = o.__wbindgen_externrefs.get(r);
1073
- return o.__externref_table_dealloc(r), e;
1163
+ function u(r) {
1164
+ const e = _.__wbindgen_externrefs.get(r);
1165
+ return _.__externref_table_dealloc(r), e;
1074
1166
  }
1075
- let O = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1076
- O.decode();
1077
- const _e = 2146435072;
1078
- let U = 0;
1079
- function oe(r, e) {
1080
- return U += e, U >= _e && (O = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), O.decode(), U = e), O.decode(S().subarray(r, r + e));
1167
+ let z = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1168
+ z.decode();
1169
+ const ae = 2146435072;
1170
+ let N = 0;
1171
+ function ue(r, e) {
1172
+ return N += e, N >= ae && (z = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), z.decode(), N = e), z.decode(R().subarray(r, r + e));
1081
1173
  }
1082
- const j = new TextEncoder();
1083
- "encodeInto" in j || (j.encodeInto = function(r, e) {
1084
- const t = j.encode(r);
1174
+ const O = new TextEncoder();
1175
+ "encodeInto" in O || (O.encodeInto = function(r, e) {
1176
+ const t = O.encode(r);
1085
1177
  return e.set(t), {
1086
1178
  read: r.length,
1087
1179
  written: t.length
1088
1180
  };
1089
1181
  });
1090
- let a = 0, o;
1091
- function ce(r, e) {
1092
- return o = r.exports, F = null, B = null, T = null, o.__wbindgen_start(), o;
1182
+ let a = 0, _;
1183
+ function de(r, e) {
1184
+ return _ = r.exports, S = null, j = null, E = null, _.__wbindgen_start(), _;
1093
1185
  }
1094
- function se(r) {
1095
- if (o !== void 0) return o;
1186
+ function fe(r) {
1187
+ if (_ !== void 0) return _;
1096
1188
  r !== void 0 && (Object.getPrototypeOf(r) === Object.prototype ? { module: r } = r : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
1097
- const e = X();
1189
+ const e = ee();
1098
1190
  r instanceof WebAssembly.Module || (r = new WebAssembly.Module(r));
1099
1191
  const t = new WebAssembly.Instance(r, e);
1100
- return ce(t);
1192
+ return de(t);
1101
1193
  }
1102
- function P() {
1194
+ function $() {
1103
1195
  let r = 0;
1104
1196
  const e = /* @__PURE__ */ new Map();
1105
1197
  return {
@@ -1118,40 +1210,40 @@ ${r.stack}` : n;
1118
1210
  }
1119
1211
  };
1120
1212
  }
1121
- const W = Symbol("transfer");
1122
- function I(r, e) {
1213
+ const H = Symbol("transfer");
1214
+ function F(r, e) {
1123
1215
  return {
1124
- type: W,
1216
+ type: H,
1125
1217
  value: r,
1126
1218
  transfer: e ? Array.isArray(e) ? e : [e] : [r]
1127
1219
  };
1128
1220
  }
1129
- function V(r) {
1130
- return !!(r && typeof r == "object" && Reflect.get(r, "type") === W);
1221
+ function q(r) {
1222
+ return !!(r && typeof r == "object" && Reflect.get(r, "type") === H);
1131
1223
  }
1132
- function q(r = "default") {
1224
+ function X(r = "default") {
1133
1225
  return {
1134
1226
  createTx(e) {
1135
1227
  const t = /* @__PURE__ */ new Map(), n = e ?? self;
1136
- return n.addEventListener("message", (_) => {
1137
- const { data: c } = _;
1138
- if (c.channelName !== r)
1228
+ return n.addEventListener("message", (o) => {
1229
+ const { data: i } = o;
1230
+ if (i.channelName !== r)
1139
1231
  return;
1140
- const { id: s, result: i, error: u } = c, g = t.get(s);
1141
- g && (u ? g.reject(u) : g.resolve(i), t.delete(s));
1232
+ const { id: c, result: s, error: f } = i, g = t.get(c);
1233
+ g && (f ? g.reject(f) : g.resolve(s), t.delete(c));
1142
1234
  }), new Proxy(
1143
1235
  {},
1144
1236
  {
1145
- get(_, c) {
1146
- return (...s) => {
1147
- const i = ie(), u = [], g = [];
1148
- return s.forEach((v) => {
1149
- V(v) ? (u.push(v.value), g.push(...v.transfer)) : u.push(v);
1237
+ get(o, i) {
1238
+ return (...c) => {
1239
+ const s = be(), f = [], g = [];
1240
+ return c.forEach((v) => {
1241
+ q(v) ? (f.push(v.value), g.push(...v.transfer)) : f.push(v);
1150
1242
  }), n.postMessage(
1151
- { method: c, args: u, id: i, channelName: r },
1243
+ { method: i, args: f, id: s, channelName: r },
1152
1244
  { transfer: g }
1153
- ), new Promise((v, G) => {
1154
- t.set(i, { resolve: v, reject: G });
1245
+ ), new Promise((v, K) => {
1246
+ t.set(s, { resolve: v, reject: K });
1155
1247
  });
1156
1248
  };
1157
1249
  }
@@ -1160,218 +1252,258 @@ ${r.stack}` : n;
1160
1252
  },
1161
1253
  rx(e, t) {
1162
1254
  const n = t ?? self;
1163
- n.addEventListener("message", async (_) => {
1164
- const { data: c } = _;
1165
- if (c.channelName !== r)
1255
+ n.addEventListener("message", async (o) => {
1256
+ const { data: i } = o;
1257
+ if (i.channelName !== r)
1166
1258
  return;
1167
- const { method: s, args: i, id: u } = c;
1259
+ const { method: c, args: s, id: f } = i;
1168
1260
  try {
1169
- const g = await e[s](...i);
1170
- V(g) ? n.postMessage(
1171
- { result: g.value, id: u, channelName: r },
1261
+ const g = await e[c](...s);
1262
+ q(g) ? n.postMessage(
1263
+ { result: g.value, id: f, channelName: r },
1172
1264
  { transfer: g.transfer }
1173
- ) : n.postMessage({ result: g, id: u, channelName: r });
1265
+ ) : n.postMessage({ result: g, id: f, channelName: r });
1174
1266
  } catch (g) {
1175
- n.postMessage({ error: g, id: u, channelName: r });
1267
+ n.postMessage({ error: g, id: f, channelName: r });
1176
1268
  }
1177
1269
  });
1178
1270
  }
1179
1271
  };
1180
1272
  }
1181
- function ie() {
1273
+ function be() {
1182
1274
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
1183
1275
  }
1184
- const { rx: ae } = q(), { createTx: ue } = q("worker");
1185
- function de(r) {
1276
+ const le = 16, ge = "context-missing", { rx: we } = X(), { createTx: me } = X("worker");
1277
+ function pe(r) {
1186
1278
  if (!(r != null && r.manifests))
1187
1279
  return r;
1188
1280
  const e = r.manifests, t = Object.assign(/* @__PURE__ */ Object.create(null), e), n = Object.getPrototypeOf(e);
1189
1281
  return n !== null && n !== Object.prototype && (t.__proto__ = n), r.manifests = t, r;
1190
1282
  }
1191
- const y = P(), f = P(), k = ue();
1192
- function D(r) {
1283
+ const h = $(), b = $(), B = /* @__PURE__ */ new Map(), U = me();
1284
+ function ye(r) {
1285
+ const e = B.get(r.id);
1286
+ if (e !== void 0)
1287
+ return e;
1288
+ if (r.json !== void 0) {
1289
+ const t = new M(r.json);
1290
+ if (B.size === le) {
1291
+ const n = B.entries().next().value;
1292
+ if (n !== void 0) {
1293
+ const [o, i] = n;
1294
+ i.free(), B.delete(o);
1295
+ }
1296
+ }
1297
+ return B.set(r.id, t), t;
1298
+ }
1299
+ }
1300
+ async function T(r, e) {
1301
+ const t = ye(r);
1302
+ if (t === void 0)
1303
+ return ge;
1304
+ try {
1305
+ return await e(t);
1306
+ } finally {
1307
+ r.json !== void 0 && await U.context_registered(r.id);
1308
+ }
1309
+ }
1310
+ function G(r) {
1193
1311
  return r.map((e) => ({
1194
1312
  sigType: e.sigType,
1195
1313
  reserveSize: e.reserveSize,
1196
1314
  referencedAssertions: e.referencedAssertions,
1197
1315
  roles: e.roles,
1198
1316
  sign: async (t) => {
1199
- const n = t.referencedAssertions.map((c) => c.hash.buffer);
1200
- return await k.cawgSign(e.requestId, I(t, n));
1317
+ const n = t.referencedAssertions.map((i) => i.hash.buffer);
1318
+ return await U.cawgSign(e.requestId, F(t, n));
1201
1319
  }
1202
1320
  }));
1203
1321
  }
1204
- ae(
1205
- be({
1322
+ we(
1323
+ he({
1206
1324
  async initWorker(r) {
1207
- se({ module: r });
1325
+ fe({ module: r });
1208
1326
  },
1209
1327
  encodeSignerPayload(r) {
1210
- const e = H(r);
1211
- return I(e, e.buffer);
1328
+ const e = Z(r);
1329
+ return F(e, e.buffer);
1212
1330
  },
1213
1331
  async reader_fromBlob(r, e, t) {
1214
- const n = await M.fromBlob(r, e, t);
1215
- return y.add(n);
1332
+ return T(
1333
+ t,
1334
+ async (n) => h.add(
1335
+ await I.fromBlobWithContext(r, e, n)
1336
+ )
1337
+ );
1216
1338
  },
1217
1339
  async reader_fromBlobFragment(r, e, t, n) {
1218
- const _ = await M.fromBlobFragment(
1219
- r,
1220
- e,
1221
- t,
1222
- n
1340
+ return T(
1341
+ n,
1342
+ async (o) => h.add(
1343
+ await I.fromBlobFragmentWithContext(
1344
+ r,
1345
+ e,
1346
+ t,
1347
+ o
1348
+ )
1349
+ )
1223
1350
  );
1224
- return y.add(_);
1225
1351
  },
1226
1352
  reader_activeLabel(r) {
1227
- return y.get(r).activeLabel() ?? null;
1353
+ return h.get(r).activeLabel() ?? null;
1228
1354
  },
1229
1355
  reader_manifestStore(r) {
1230
- const e = y.get(r);
1231
- return de(e.manifestStore());
1356
+ const e = h.get(r);
1357
+ return pe(e.manifestStore());
1232
1358
  },
1233
1359
  reader_activeManifest(r) {
1234
- return y.get(r).activeManifest();
1360
+ return h.get(r).activeManifest();
1235
1361
  },
1236
1362
  reader_json(r) {
1237
- return y.get(r).json();
1363
+ return h.get(r).json();
1238
1364
  },
1239
1365
  reader_crJson(r) {
1240
- return y.get(r).crJson();
1366
+ return h.get(r).crJson();
1241
1367
  },
1242
1368
  reader_resourceToBytes(r, e) {
1243
- const n = y.get(r).resourceToBytes(e);
1244
- return I(n, n.buffer);
1369
+ const n = h.get(r).resourceToBytes(e);
1370
+ return F(n, n.buffer);
1245
1371
  },
1246
1372
  reader_free(r) {
1247
- y.get(r).free(), y.remove(r);
1373
+ h.get(r).free(), h.remove(r);
1248
1374
  },
1249
- builder_new(r) {
1250
- const e = h.new(r);
1251
- return f.add(e);
1375
+ async builder_new(r) {
1376
+ return T(
1377
+ r,
1378
+ (e) => b.add(p.newWithContext(e))
1379
+ );
1252
1380
  },
1253
- builder_fromJson(r, e) {
1254
- const t = h.fromJson(r, e);
1255
- return f.add(t);
1381
+ async builder_fromJson(r, e) {
1382
+ return T(
1383
+ e,
1384
+ (t) => b.add(p.fromJsonWithContext(r, t))
1385
+ );
1256
1386
  },
1257
- builder_fromArchive(r, e) {
1258
- const t = h.fromArchive(r, e);
1259
- return f.add(t);
1387
+ async builder_fromArchive(r, e) {
1388
+ return T(
1389
+ e,
1390
+ (t) => b.add(p.fromArchiveWithContext(r, t))
1391
+ );
1260
1392
  },
1261
1393
  builder_setIntent(r, e) {
1262
- f.get(r).setIntent(e);
1394
+ b.get(r).setIntent(e);
1263
1395
  },
1264
1396
  builder_addAction(r, e) {
1265
- f.get(r).addAction(e);
1397
+ b.get(r).addAction(e);
1266
1398
  },
1267
1399
  builder_addAssertion(r, e, t) {
1268
- f.get(r).addAssertion(e, t);
1400
+ b.get(r).addAssertion(e, t);
1269
1401
  },
1270
1402
  builder_updateAssertionsAt(r, e, t) {
1271
- f.get(r).updateAssertionsAt(e, t);
1403
+ b.get(r).updateAssertionsAt(e, t);
1272
1404
  },
1273
1405
  builder_addRedaction(r, e, t) {
1274
- f.get(r).addRedaction(e, t);
1406
+ b.get(r).addRedaction(e, t);
1275
1407
  },
1276
1408
  builder_filterActionsAt(r, e) {
1277
- f.get(r).filterActionsAt(Uint32Array.from(e));
1409
+ b.get(r).filterActionsAt(Uint32Array.from(e));
1278
1410
  },
1279
1411
  builder_updateActionsAt(r, e) {
1280
- f.get(r).updateActionsAt(e);
1412
+ b.get(r).updateActionsAt(e);
1281
1413
  },
1282
1414
  builder_filterIngredientsAt(r, e) {
1283
- f.get(r).filterIngredientsAt(Uint32Array.from(e));
1415
+ b.get(r).filterIngredientsAt(Uint32Array.from(e));
1284
1416
  },
1285
1417
  builder_filterActionsAndIngredientsAt(r, e, t) {
1286
- f.get(r).filterActionsAndIngredientsAt(
1418
+ b.get(r).filterActionsAndIngredientsAt(
1287
1419
  Uint32Array.from(e),
1288
1420
  Uint32Array.from(t)
1289
1421
  );
1290
1422
  },
1291
1423
  builder_setRemoteUrl(r, e) {
1292
- f.get(r).setRemoteUrl(e);
1424
+ b.get(r).setRemoteUrl(e);
1293
1425
  },
1294
1426
  builder_setNoEmbed(r, e) {
1295
- f.get(r).setNoEmbed(e);
1427
+ b.get(r).setNoEmbed(e);
1296
1428
  },
1297
1429
  builder_updateManifestProperty(r, e, t) {
1298
- f.get(r).updateManifestProperty(e, t);
1430
+ b.get(r).updateManifestProperty(e, t);
1299
1431
  },
1300
1432
  builder_setThumbnailFromBlob(r, e, t) {
1301
- f.get(r).setThumbnailFromBlob(e, t);
1433
+ b.get(r).setThumbnailFromBlob(e, t);
1302
1434
  },
1303
1435
  builder_addIngredient(r, e) {
1304
- f.get(r).addIngredient(e);
1436
+ b.get(r).addIngredient(e);
1305
1437
  },
1306
1438
  async builder_addIngredientFromBlob(r, e, t, n) {
1307
- await f.get(r).addIngredientFromBlob(e, t, n);
1439
+ await b.get(r).addIngredientFromBlob(e, t, n);
1308
1440
  },
1309
1441
  builder_addResourceFromBlob(r, e, t) {
1310
- f.get(r).addResourceFromBlob(e, t);
1442
+ b.get(r).addResourceFromBlob(e, t);
1311
1443
  },
1312
1444
  builder_getDefinition(r) {
1313
- return f.get(r).getDefinition();
1445
+ return b.get(r).getDefinition();
1314
1446
  },
1315
1447
  builder_toArchive(r) {
1316
- const t = f.get(r).toArchive();
1317
- return I(t, t.buffer);
1448
+ const t = b.get(r).toArchive();
1449
+ return F(t, t.buffer);
1318
1450
  },
1319
- async builder_sign(r, e, t, n, _, c) {
1320
- const i = await f.get(r).sign(
1451
+ async builder_sign(r, e, t, n, o, i) {
1452
+ const s = await b.get(r).sign(
1321
1453
  {
1322
1454
  reserveSize: t.reserveSize,
1323
1455
  alg: t.alg,
1324
- sign: async (u) => await k.sign(
1456
+ sign: async (f) => await U.sign(
1325
1457
  e,
1326
- I(u, u.buffer),
1458
+ F(f, f.buffer),
1327
1459
  t.reserveSize
1328
1460
  )
1329
1461
  },
1330
- D(n),
1331
- _,
1332
- c
1462
+ G(n),
1463
+ o,
1464
+ i
1333
1465
  );
1334
- return I(i, i.buffer);
1466
+ return F(s, s.buffer);
1335
1467
  },
1336
- async builder_signAndGetManifestBytes(r, e, t, n, _, c) {
1337
- const s = f.get(r), { manifest: i, asset: u } = await s.signAndGetManifestBytes(
1468
+ async builder_signAndGetManifestBytes(r, e, t, n, o, i) {
1469
+ const c = b.get(r), { manifest: s, asset: f } = await c.signAndGetManifestBytes(
1338
1470
  {
1339
1471
  reserveSize: t.reserveSize,
1340
1472
  alg: t.alg,
1341
- sign: async (g) => await k.sign(
1473
+ sign: async (g) => await U.sign(
1342
1474
  e,
1343
- I(g, g.buffer),
1475
+ F(g, g.buffer),
1344
1476
  t.reserveSize
1345
1477
  )
1346
1478
  },
1347
- D(n),
1348
- _,
1349
- c
1479
+ G(n),
1480
+ o,
1481
+ i
1350
1482
  );
1351
- return I(
1483
+ return F(
1352
1484
  {
1353
- manifest: i,
1354
- asset: u
1485
+ manifest: s,
1486
+ asset: f
1355
1487
  },
1356
- [i.buffer, u.buffer]
1488
+ [s.buffer, f.buffer]
1357
1489
  );
1358
1490
  },
1359
1491
  builder_free(r) {
1360
- f.get(r).free(), f.remove(r);
1492
+ b.get(r).free(), b.remove(r);
1361
1493
  }
1362
1494
  })
1363
1495
  );
1364
- function be(r) {
1496
+ function he(r) {
1365
1497
  const e = {};
1366
1498
  for (const [t, n] of Object.entries(r))
1367
- e[t] = async (..._) => {
1499
+ e[t] = async (...o) => {
1368
1500
  try {
1369
- return await n(..._);
1370
- } catch (c) {
1371
- throw typeof c == "string" ? new Error(c) : c;
1501
+ return await n(...o);
1502
+ } catch (i) {
1503
+ throw typeof i == "string" ? new Error(i) : i;
1372
1504
  }
1373
1505
  };
1374
1506
  return e;
1375
1507
  }
1376
1508
  });
1377
- export default fe();
1509
+ export default Ae();