@contentauth/c2pa-web 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +51 -5
  2. package/dist/index.d.ts +3 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +59 -49
  5. package/dist/lib/c2pa.d.ts +7 -2
  6. package/dist/lib/c2pa.d.ts.map +1 -1
  7. package/dist/lib/reader.d.ts +38 -3
  8. package/dist/lib/reader.d.ts.map +1 -1
  9. package/dist/lib/settings.d.ts +27 -3
  10. package/dist/lib/settings.d.ts.map +1 -1
  11. package/dist/lib/worker.d.ts +3 -1
  12. package/dist/lib/worker.d.ts.map +1 -1
  13. package/dist/resources/c2pa_bg.wasm +0 -0
  14. package/package.json +11 -4
  15. package/CHANGELOG.md +0 -26
  16. package/eslint.config.mjs +0 -30
  17. package/project.json +0 -7
  18. package/src/index.ts +0 -15
  19. package/src/lib/c2pa.spec.ts +0 -166
  20. package/src/lib/c2pa.ts +0 -65
  21. package/src/lib/error.ts +0 -26
  22. package/src/lib/reader.ts +0 -150
  23. package/src/lib/settings.ts +0 -52
  24. package/src/lib/supportedFormats.ts +0 -72
  25. package/src/lib/worker/setupWorker.ts +0 -53
  26. package/src/lib/worker/workerManager.ts +0 -64
  27. package/src/lib/worker/workerObjectMap.ts +0 -35
  28. package/src/lib/worker/workerResponse.ts +0 -50
  29. package/src/lib/worker.ts +0 -77
  30. package/test/fixtures/assets/C_with_CAWG_data.jpg +0 -0
  31. package/test/fixtures/assets/C_with_CAWG_data.json +0 -144
  32. package/test/fixtures/assets/C_with_CAWG_data_thumbnail.jpg +0 -0
  33. package/test/fixtures/assets/C_with_CAWG_data_trusted.json +0 -149
  34. package/test/fixtures/assets/C_with_CAWG_data_untrusted.json +0 -157
  35. package/test/fixtures/assets/dash1.m4s +0 -0
  36. package/test/fixtures/assets/dashinit.json +0 -184
  37. package/test/fixtures/assets/dashinit.mp4 +0 -0
  38. package/test/fixtures/assets/no_alg.jpg +0 -0
  39. package/test/fixtures/trust/anchor-correct.pem +0 -15
  40. package/test/fixtures/trust/anchor-incorrect.pem +0 -16
  41. package/tsconfig.json +0 -13
  42. package/tsconfig.lib.json +0 -29
  43. package/tsconfig.spec.json +0 -36
  44. package/vite.config.ts +0 -91
package/README.md CHANGED
@@ -1,11 +1,57 @@
1
1
  # c2pa-web
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ The SDK for interacting with [C2PA metadata](https://c2pa.org/) on the web.
4
4
 
5
- ## Building
5
+ As a guiding philosophy, `c2pa-web` attempts to adhere closely to the API paradigms established by [`c2pa-rs`](https://github.com/contentauth/c2pa-rs).
6
6
 
7
- Run `nx build c2pa-web` to build the library.
7
+ ## Installation
8
8
 
9
- ## Running unit tests
9
+ ```sh
10
+ npm install @contentauth/c2pa-web
11
+ ```
10
12
 
11
- Run `nx test c2pa-web` to execute the unit tests via [Vitest](https://vitest.dev/).
13
+ ## Quickstart
14
+
15
+ ```typescript
16
+ import { createC2pa } from "@contentauth/c2pa-web";
17
+
18
+ // Using vite's ?url query parameter - use a solution appropriate to your tooling.
19
+ // This resolves to a WASM binary that must be available for the library to fetch at runtime.
20
+ import wasmSrc from "@contentauth/c2pa-web/resources/c2pa.wasm?url";
21
+
22
+ const response = await fetch("https://spec.c2pa.org/public-testfiles/image/jpeg/adobe-20220124-C.jpg");
23
+ const blob = await response.blob();
24
+
25
+ const reader = await c2pa.reader.fromBlob(blob.type, blob);
26
+
27
+ const manifestStore = await reader.manifestStore();
28
+
29
+ console.log(manifestStore);
30
+ ```
31
+
32
+ ## Development
33
+
34
+ ### Prerequsities
35
+
36
+ Ensure the repo-wide prerequisites [NX](https://nx.dev/getting-started/intro) and [pnpm](https://pnpm.io/) are installed.
37
+
38
+ [`c2pa-wasm`'s prerequisites](https://github.com/contentauth/c2pa-js-v2/tree/main/packages/c2pa-wasm) must also be installed.
39
+
40
+ ### Building
41
+
42
+ To build the library:
43
+ ```sh
44
+ nx build c2pa-web
45
+ ```
46
+
47
+ ### Testing
48
+
49
+ 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:
50
+ ```sh
51
+ pnpx playwright install
52
+ ```
53
+
54
+ To run the tests:
55
+ ```
56
+ nx test c2pa-web
57
+ ```
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@
7
7
  * it.
8
8
  */
9
9
  export * from './lib/c2pa.js';
10
+ export type { Reader, ReaderFactory } from './lib/reader.js';
10
11
  export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS, } from './lib/supportedFormats.js';
11
- export { type Settings } from './lib/settings.js';
12
+ export type { Settings, VerifySettings, TrustSettings } from './lib/settings.js';
13
+ export type * from '@contentauth/c2pa-types';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAE9B,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGjF,mBAAmB,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const l = '(function(){"use strict";let o;const S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&S.decode();let m=null;function x(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(o.memory.buffer)),m}function a(t,e){return t=t>>>0,S.decode(x().subarray(t,t+e))}function y(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function u(t,e){try{return t.apply(this,e)}catch(n){const r=y(n);o.__wbindgen_exn_store(r)}}let f=0;const T=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},E=typeof T.encodeInto=="function"?function(t,e){return T.encodeInto(t,e)}:function(t,e){const n=T.encode(t);return e.set(n),{read:t.length,written:n.length}};function b(t,e,n){if(n===void 0){const s=T.encode(t),d=e(s.length,1)>>>0;return x().subarray(d,d+s.length).set(s),f=s.length,d}let r=t.length,_=e(r,1)>>>0;const c=x();let i=0;for(;i<r;i++){const s=t.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==r){i!==0&&(t=t.slice(i)),_=n(_,r,r=i+t.length*3,1)>>>0;const s=x().subarray(_+i,_+r),d=E(t,s);i+=d.written,_=n(_,r,i,1)>>>0}return f=i,_}let w=null;function g(){return(w===null||w.buffer.detached===!0||w.buffer.detached===void 0&&w.buffer!==o.memory.buffer)&&(w=new DataView(o.memory.buffer)),w}function p(t){return t==null}const A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function O(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return r(s,_.b,...i)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(s,_.b),A.unregister(_)):_.a=s}};return c.original=_,A.register(c,_,_),c}function j(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const _=t.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=t.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(t)){const _=t.length;let c="[";_>0&&(c+=j(t[0]));for(let i=1;i<_;i++)c+=", "+j(t[i]);return c+="]",c}const n=/\\[object ([^\\]]+)\\]/.exec(toString.call(t));let r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}function M(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function I(t){const e=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=f,r=o.loadSettings(e,n);if(r[1])throw M(r[0])}function k(t,e){o._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1953f27c342761b(t,e)}function R(t,e,n){o.closure1391_externref_shim(t,e,n)}function L(t,e,n,r){o.closure2380_externref_shim(t,e,n,r)}const W=["omit","same-origin","include"],D=["same-origin","no-cors","cors","navigate"],F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class h{static __wrap(e){e=e>>>0;const n=Object.create(h.prototype);return n.__wbg_ptr=e,F.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,F.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=f;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;return o.wasmreader_fromBlobFragment(_,c,n,r)}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],a(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=a(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),n}resourceToBuffer(e){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=f,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw M(_[1]);return M(_[0])}}function v(){const t={};return t.wbg={},t.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},t.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},t.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return u(function(e,n,r,_,c){e.append(a(n,r),a(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return u(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_09165b52af8c5237=function(e){return e.buffer},t.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},t.wbg.__wbg_byteLength_e674b853d9c77e1d=function(e){return e.byteLength},t.wbg.__wbg_call_672a4d21634d4a24=function(){return u(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return u(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(a(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return u(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_a5ea9117f258a0ec=function(){return u(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},t.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},t.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},t.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return u(function(){return new Headers},arguments)},t.wbg.__wbg_new_16004015965f986e=function(){return u(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const d=r.a;r.a=0;try{return L(d,r.b,i,s)}finally{r.a=d}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(a(e,n))},t.wbg.__wbg_new_e25e5aab09ff45db=function(){return u(function(){return new AbortController},arguments)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(a(e,n))},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return u(function(e,n,r){return new Request(a(e,n),r)},arguments)},t.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},t.wbg.__wbg_next_6574e1a8a62d1055=function(){return u(function(e){return e.next()},arguments)},t.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},t.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},t.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},t.wbg.__wbg_readAsArrayBuffer_560aeb9fce36c5c8=function(){return u(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_65595bdd868b3009=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=W[n]},t.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,r){e.method=a(n,r)},t.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=D[n]},t.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},t.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},t.wbg.__wbg_size_3808d41635a9c259=function(e){return e.size},t.wbg.__wbg_slice_bd4c84b64bdfe01f=function(){return u(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e=typeof global>"u"?null:global;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e=typeof globalThis>"u"?null:globalThis;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e=typeof self>"u"?null:self;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e=typeof window>"u"?null:window;return p(e)?0:y(e)},t.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},t.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return u(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},t.wbg.__wbg_then_48b406749878a531=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const r=n.url,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},t.wbg.__wbg_wasmreader_new=function(e){return h.__wrap(e)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_closure_wrapper9193=function(e,n,r){return O(e,n,1337,k)},t.wbg.__wbindgen_closure_wrapper9303=function(e,n,r){return O(e,n,1392,R)},t.wbg.__wbindgen_debug_string=function(e,n){const r=j(n),_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_memory=function(){return o.memory},t.wbg.__wbindgen_string_get=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=p(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=f;g().setInt32(e+4,i,!0),g().setInt32(e+0,c,!0)},t.wbg.__wbindgen_string_new=function(e,n){return a(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(a(e,n))},t}function z(t,e){return o=t.exports,w=null,m=null,o.__wbindgen_start(),o}function q(t){if(o!==void 0)return o;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=v();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return z(n)}function B(t,e){const n={type:"success",...t!==void 0?{payload:t}:{}};postMessage(n,e??[])}function C(t){postMessage({type:"error",error:t})}function U(t){onmessage=async e=>{try{const{args:n,method:r}=e.data,_=await t[r](...n);(_==null?void 0:_.data)!==void 0?B(_.data,_.transfer):B()}catch(n){C(n)}}}function $(){let t=0;const e=new Map;return{add(n){const r=t++;return e.set(r,n),r},get(n){const r=e.get(n);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(n){return e.delete(n)}}}const l=$();U({async initWorker(t,e){q(t),e&&I(e)},async reader_fromBlob(t,e){const n=await h.fromBlob(t,e);return{data:l.add(n)}},async reader_fromBlobFragment(t,e,n){const r=await h.fromBlobFragment(t,e,n);return{data:l.add(r)}},reader_json(t){return{data:l.get(t).json()}},reader_activeLabel(t){return{data:l.get(t).activeLabel()??null}},reader_resourceToBuffer(t,e){const r=l.get(t).resourceToBuffer(e);return{data:r,transfer:[r]}},reader_free(t){l.get(t).free(),l.remove(t)}})})();\n', f = typeof self < "u" && self.Blob && new Blob([l], { type: "text/javascript;charset=utf-8" });
1
+ const l = '(function(){"use strict";let o,y=null;function p(){return(y===null||y.byteLength===0)&&(y=new Uint8Array(o.memory.buffer)),y}let A=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&A.decode();const I=2146435072;let S=0;function D(t,e){return S+=e,S>=I&&(A=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},A.decode(),S=e),A.decode(p().subarray(t,t+e))}function b(t,e){return t=t>>>0,D(t,e)}function h(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function u(t,e){try{return t.apply(this,e)}catch(n){const r=h(n);o.__wbindgen_exn_store(r)}}function k(t,e){return t=t>>>0,p().subarray(t/1,t/1+e)}let a=0;const M=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},R=typeof M.encodeInto=="function"?function(t,e){return M.encodeInto(t,e)}:function(t,e){const n=M.encode(t);return e.set(n),{read:t.length,written:n.length}};function g(t,e,n){if(n===void 0){const s=M.encode(t),w=e(s.length,1)>>>0;return p().subarray(w,w+s.length).set(s),a=s.length,w}let r=t.length,_=e(r,1)>>>0;const c=p();let i=0;for(;i<r;i++){const s=t.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==r){i!==0&&(t=t.slice(i)),_=n(_,r,r=i+t.length*3,1)>>>0;const s=p().subarray(_+i,_+r),w=R(t,s);i+=w.written,_=n(_,r,i,1)>>>0}return a=i,_}let l=null;function d(){return(l===null||l.buffer.detached===!0||l.buffer.detached===void 0&&l.buffer!==o.memory.buffer)&&(l=new DataView(o.memory.buffer)),l}function x(t){return t==null}const j=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function B(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return r(s,_.b,...i)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(s,_.b),j.unregister(_)):_.a=s}};return c.original=_,j.register(c,_,_),c}function E(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const _=t.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=t.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(t)){const _=t.length;let c="[";_>0&&(c+=E(t[0]));for(let i=1;i<_;i++)c+=", "+E(t[i]);return c+="]",c}const n=/\\[object ([^\\]]+)\\]/.exec(toString.call(t));let r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}function m(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function L(t){const e=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,r=o.loadSettings(e,n);if(r[1])throw m(r[0])}function v(t,e){o.wasm_bindgen__convert__closures_____invoke__ha5b2289bd84e4451(t,e)}function W(t,e,n){o.closure1451_externref_shim(t,e,n)}function U(t,e,n,r){o.closure2451_externref_shim(t,e,n,r)}const z=["omit","same-origin","include"],q=["same-origin","no-cors","cors","navigate"],O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class T{static __wrap(e){e=e>>>0;const n=Object.create(T.prototype);return n.__wbg_ptr=e,O.register(n,n.__wbg_ptr,n),n}__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_wasmreader_free(e,0)}static fromBlob(e,n){const r=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;return o.wasmreader_fromBlobFragment(_,c,n,r)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=b(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),n}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw m(e[1]);return m(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw m(e[1]);return m(e[0])}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],b(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=a,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw m(_[1]);return m(_[0])}}function C(){const t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,n){return Error(b(e,n))},t.wbg.__wbg_abort_18ba44d46e13d7fe=function(e){e.abort()},t.wbg.__wbg_abort_4198a1129c47f21a=function(e,n){e.abort(n)},t.wbg.__wbg_append_0342728346e47425=function(){return u(function(e,n,r,_,c){e.append(b(n,r),b(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_d58b858456021d7f=function(){return u(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_a1a27a0dfa70165d=function(e){return e.buffer},t.wbg.__wbg_buffer_e495ba54cee589cc=function(e){return e.buffer},t.wbg.__wbg_byteLength_937f8a52f9697148=function(e){return e.byteLength},t.wbg.__wbg_call_f2db6205e5c51dc8=function(){return u(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_call_fbe8be8bf6436ce5=function(){return u(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_done_4d01f352bade43b7=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(b(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_a8e43a4e138dfc93=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_12ff8e47307bd4c7=function(e){return Array.from(e)},t.wbg.__wbg_getTime_2afe67905d873e92=function(e){return e.getTime()},t.wbg.__wbg_get_92470be87867c2e5=function(){return u(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_809e438ee9d787a7=function(){return u(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_0f0cbdc6290b6780=function(e){return e.headers},t.wbg.__wbg_instanceof_Response_e80ce8b7a2b968d2=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_4068add5b2aef7a6=function(){return Symbol.iterator},t.wbg.__wbg_length_ab6d22b5ead75c72=function(e){return e.length},t.wbg.__wbg_new0_97314565408dea38=function(){return new Date},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_new_186abcfdff244e42=function(){return u(function(){return new AbortController},arguments)},t.wbg.__wbg_new_476169e6d59f23ae=function(e,n){return new Error(b(e,n))},t.wbg.__wbg_new_4796e1cd2eb9ea6d=function(){return u(function(){return new Headers},arguments)},t.wbg.__wbg_new_58353953ad2097cc=function(){return new Array},t.wbg.__wbg_new_58fdb85a58696862=function(){return u(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_a979b4b45bd55c7f=function(){return new Map},t.wbg.__wbg_new_e30c39c06edaabf2=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const w=r.a;r.a=0;try{return U(w,r.b,i,s)}finally{r.a=w}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_e52b3efaaa774f96=function(e){return new Uint8Array(e)},t.wbg.__wbg_newfromslice_7c05ab1297cb2d88=function(e,n){return new Uint8Array(k(e,n))},t.wbg.__wbg_newnoargs_ff528e72d35de39a=function(e,n){return new Function(b(e,n))},t.wbg.__wbg_newwithbyteoffsetandlength_3b01ecda099177e8=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_newwithlength_08f872dc1e3ada2e=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_f8a9dbe009d6be37=function(){return u(function(e,n,r){return new Request(b(e,n),r)},arguments)},t.wbg.__wbg_next_8bb824d217961b5d=function(e){return e.next},t.wbg.__wbg_next_e2da48d8fff7439a=function(){return u(function(e){return e.next()},arguments)},t.wbg.__wbg_now_eb0821f3bd9f6529=function(){return Date.now()},t.wbg.__wbg_queueMicrotask_46c1df247678729f=function(e){queueMicrotask(e)},t.wbg.__wbg_queueMicrotask_8acf3ccb75ed8d11=function(e){return e.queueMicrotask},t.wbg.__wbg_readAsArrayBuffer_5af53619afa1b299=function(){return u(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_resolve_0dac8c580ffd4678=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_7422acbe992d64ab=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_set_d6bdfd275fb8a4ce=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_set_fe4e79d1ed3b0e9b=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_setbody_971ec015fc13d6b4=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_920d91fb5984c94a=function(e,n){e.credentials=z[n]},t.wbg.__wbg_setheaders_65a4eb4c0443ae61=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_8ce1be0b4d701b7c=function(e,n,r){e.method=b(n,r)},t.wbg.__wbg_setmode_bd35f026f55b6247=function(e,n){e.mode=q[n]},t.wbg.__wbg_setsignal_8e72abfe7ee03c97=function(e,n){e.signal=n},t.wbg.__wbg_signal_b96223519a041faa=function(e){return e.signal},t.wbg.__wbg_size_e2929e11261f04db=function(e){return e.size},t.wbg.__wbg_slice_efdd8b335ee00bd0=function(){return u(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;d().setInt32(e+4,c,!0),d().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_487c52c58d65314d=function(){const e=typeof global>"u"?null:global;return x(e)?0:h(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291=function(){const e=typeof globalThis>"u"?null:globalThis;return x(e)?0:h(e)},t.wbg.__wbg_static_accessor_SELF_78c9e3071b912620=function(){const e=typeof self>"u"?null:self;return x(e)?0:h(e)},t.wbg.__wbg_static_accessor_WINDOW_a093d21393777366=function(){const e=typeof window>"u"?null:window;return x(e)?0:h(e)},t.wbg.__wbg_status_a54682bbe52f9058=function(e){return e.status},t.wbg.__wbg_stringify_c242842b97f054cc=function(){return u(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_then_82ab9fb4080f1707=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_then_db882932c0c714c6=function(e,n){return e.then(n)},t.wbg.__wbg_url_e6ed869ea05b7a71=function(e,n){const r=n.url,_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;d().setInt32(e+4,c,!0),d().setInt32(e+0,_,!0)},t.wbg.__wbg_value_17b896954e14f896=function(e){return e.value},t.wbg.__wbg_wasmreader_new=function(e){return T.__wrap(e)},t.wbg.__wbindgen_as_number=function(e){return+e},t.wbg.__wbindgen_bigint_from_i64=function(e){return e},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_closure_wrapper10869=function(e,n,r){return B(e,n,1447,v)},t.wbg.__wbindgen_closure_wrapper10883=function(e,n,r){return B(e,n,1450,W)},t.wbg.__wbindgen_debug_string=function(e,n){const r=E(n),_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;d().setInt32(e+4,c,!0),d().setInt32(e+0,_,!0)},t.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_memory=function(){return o.memory},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_get=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=x(_)?0:g(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;d().setInt32(e+4,i,!0),d().setInt32(e+0,c,!0)},t.wbg.__wbindgen_string_new=function(e,n){return b(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(b(e,n))},t}function N(t,e){return o=t.exports,l=null,y=null,o.__wbindgen_start(),o}function $(t){if(o!==void 0)return o;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=C();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return N(n)}function F(t,e){const n={type:"success",...t!==void 0?{payload:t}:{}};postMessage(n,e??[])}function V(t){postMessage({type:"error",error:t})}function P(t){onmessage=async e=>{try{const{args:n,method:r}=e.data,_=await t[r](...n);(_==null?void 0:_.data)!==void 0?F(_.data,_.transfer):F()}catch(n){V(n)}}}function G(){let t=0;const e=new Map;return{add(n){const r=t++;return e.set(r,n),r},get(n){const r=e.get(n);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(n){return e.delete(n)}}}const f=G();P({async initWorker(t,e){$(t),e&&L(e)},async reader_fromBlob(t,e){const n=await T.fromBlob(t,e);return{data:f.add(n)}},async reader_fromBlobFragment(t,e,n){const r=await T.fromBlobFragment(t,e,n);return{data:f.add(r)}},reader_activeLabel(t){return{data:f.get(t).activeLabel()??null}},reader_manifestStore(t){return{data:f.get(t).manifestStore()}},reader_activeManifest(t){return{data:f.get(t).activeManifest()}},reader_json(t){return{data:f.get(t).json()}},reader_resourceToBuffer(t,e){const r=f.get(t).resourceToBuffer(e);return{data:r,transfer:[r]}},reader_free(t){f.get(t).free(),f.remove(t)}})})();\n', f = typeof self < "u" && self.Blob && new Blob([l], { type: "text/javascript;charset=utf-8" });
2
2
  function v(e) {
3
3
  let t;
4
4
  try {
@@ -30,11 +30,11 @@ function T(e, t) {
30
30
  t.onError(n.data);
31
31
  };
32
32
  }
33
- async function R(e) {
34
- const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((c, a) => {
33
+ async function S(e) {
34
+ const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((a, i) => {
35
35
  T(r, {
36
- onSuccess: (i) => c(i),
37
- onError: (i) => a(i)
36
+ onSuccess: (c) => a(c),
37
+ onError: (c) => i(c)
38
38
  });
39
39
  const { method: p, args: h, transfer: x } = _;
40
40
  r.postMessage({ method: p, args: h }, x ?? []);
@@ -44,19 +44,19 @@ async function R(e) {
44
44
  terminate: () => r.terminate()
45
45
  };
46
46
  }
47
- class g extends Error {
47
+ class b extends Error {
48
48
  constructor(t) {
49
49
  super(
50
- `The provided asset was too large. Size: ${t} bytes. Maximum: ${u}.`
50
+ `The provided asset was too large. Size: ${t} bytes. Maximum: ${s}.`
51
51
  ), this.name = "AssetTooLargeError";
52
52
  }
53
53
  }
54
- class b extends Error {
54
+ class g extends Error {
55
55
  constructor(t) {
56
56
  super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
57
57
  }
58
58
  }
59
- const S = [
59
+ const E = [
60
60
  "jpg",
61
61
  "video/mp4",
62
62
  "image/heif",
@@ -115,56 +115,67 @@ const S = [
115
115
  "nef",
116
116
  "heif"
117
117
  ];
118
- function d(e) {
119
- return S.includes(e);
118
+ function w(e) {
119
+ return E.includes(e);
120
120
  }
121
- const u = 10 ** 9;
122
- function E(e) {
121
+ const s = 10 ** 9;
122
+ function j(e) {
123
123
  const t = new FinalizationRegistry((n) => {
124
124
  e.execute({ method: "reader_free", args: [n] });
125
125
  });
126
126
  return {
127
127
  async fromBlob(n, r) {
128
- if (!d(n))
129
- throw new b(n);
130
- if (r.size > u)
131
- throw new g(r.size);
128
+ if (!w(n))
129
+ throw new g(n);
130
+ if (r.size > s)
131
+ throw new b(r.size);
132
132
  const o = await e.execute({
133
133
  method: "reader_fromBlob",
134
134
  args: [n, r]
135
- }), _ = Symbol(o), c = w(e, o, () => {
135
+ }), _ = Symbol(o), a = d(e, o, () => {
136
136
  t.unregister(_);
137
137
  });
138
- return t.register(c, o, _), c;
138
+ return t.register(a, o, _), a;
139
139
  },
140
140
  async fromBlobFragment(n, r, o) {
141
- if (!d(n))
142
- throw new b(n);
143
- if (r.size > u)
144
- throw new g(r.size);
141
+ if (!w(n))
142
+ throw new g(n);
143
+ if (r.size > s)
144
+ throw new b(r.size);
145
145
  const _ = await e.execute({
146
146
  method: "reader_fromBlobFragment",
147
147
  args: [n, r, o]
148
- }), c = Symbol(_), a = w(e, _, () => {
149
- t.unregister(c);
148
+ }), a = Symbol(_), i = d(e, _, () => {
149
+ t.unregister(a);
150
150
  });
151
- return t.register(a, _, c), a;
151
+ return t.register(i, _, a), i;
152
152
  }
153
153
  };
154
154
  }
155
- function w(e, t, n) {
155
+ function d(e, t, n) {
156
156
  return {
157
- // TODO: manifest type
158
- async manifestStore() {
159
- const r = await e.execute({ method: "reader_json", args: [t] });
160
- return JSON.parse(r);
161
- },
162
157
  async activeLabel() {
163
158
  return await e.execute({
164
159
  method: "reader_activeLabel",
165
160
  args: [t]
166
161
  });
167
162
  },
163
+ async manifestStore() {
164
+ return await e.execute({
165
+ method: "reader_manifestStore",
166
+ args: [t]
167
+ });
168
+ },
169
+ async activeManifest() {
170
+ return await e.execute({
171
+ method: "reader_activeManifest",
172
+ args: [t]
173
+ });
174
+ },
175
+ async json() {
176
+ const r = await e.execute({ method: "reader_json", args: [t] });
177
+ return JSON.parse(r);
178
+ },
168
179
  async resourceToBuffer(r) {
169
180
  return e.execute({
170
181
  method: "reader_resourceToBuffer",
@@ -176,45 +187,44 @@ function w(e, t, n) {
176
187
  }
177
188
  };
178
189
  }
179
- let m;
180
- const j = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
190
+ let m, R = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
181
191
  throw Error("TextDecoder not available");
182
192
  } };
183
- typeof TextDecoder < "u" && j.decode();
184
- const s = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
193
+ typeof TextDecoder < "u" && R.decode();
194
+ const u = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
185
195
  throw Error("TextEncoder not available");
186
196
  } };
187
- s.encodeInto;
197
+ u.encodeInto;
188
198
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => {
189
199
  m.__wbindgen_export_6.get(e.dtor)(e.a, e.b);
190
200
  });
191
201
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => m.__wbg_wasmreader_free(e >>> 0, 1));
192
- const B = "sha512-fQMTO3HLS7dtGFRg+QIUqpyyCX5XlwlaFKDhcsIycpdCmb9I5uKk4ATvKIkYyqLZxWdk63gmGEUB3/U4LyT3fQ==";
193
- function L(e) {
202
+ const A = "sha512-7w/e+kyxISej6Gt6cK/d939I2c82jl9nnydzcwjzuGtJbfA4Vvx3HQUf7dmmapRzvFXZxg5NrSU8tz4v7hBrhw==";
203
+ function B(e) {
194
204
  return JSON.stringify(y(e));
195
205
  }
196
206
  function y(e) {
197
207
  return Object.entries(e).reduce(
198
- (n, [r, o]) => (n[A(r)] = typeof o == "object" ? y(o) : o, n),
208
+ (n, [r, o]) => (n[M(r)] = typeof o == "object" ? y(o) : o, n),
199
209
  {}
200
210
  );
201
211
  }
202
- function A(e) {
212
+ function M(e) {
203
213
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
204
214
  }
205
- async function O(e) {
206
- const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await F(t) : t, o = n ? L(n) : void 0, _ = await R({ wasm: r, settingsString: o });
215
+ async function F(e) {
216
+ const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await L(t) : t, o = n ? B(n) : void 0, _ = await S({ wasm: r, settingsString: o });
207
217
  return {
208
- reader: E(_),
218
+ reader: j(_),
209
219
  dispose: _.terminate
210
220
  };
211
221
  }
212
- async function F(e) {
213
- const t = await fetch(e, { integrity: B });
222
+ async function L(e) {
223
+ const t = await fetch(e, { integrity: A });
214
224
  return await WebAssembly.compileStreaming(t);
215
225
  }
216
226
  export {
217
- S as READER_SUPPORTED_FORMATS,
218
- O as createC2pa,
219
- d as isSupportedReaderFormat
227
+ E as READER_SUPPORTED_FORMATS,
228
+ F as createC2pa,
229
+ w as isSupportedReaderFormat
220
230
  };
@@ -10,8 +10,14 @@ export interface Config {
10
10
  */
11
11
  settings?: Settings;
12
12
  }
13
- interface C2paSdk {
13
+ export interface C2paSdk {
14
+ /**
15
+ * Contains methods for creating Reader objects.
16
+ */
14
17
  reader: ReaderFactory;
18
+ /**
19
+ * Terminates the SDK's underlying web worker.
20
+ */
15
21
  dispose: () => void;
16
22
  }
17
23
  /**
@@ -28,5 +34,4 @@ interface C2paSdk {
28
34
  * ```
29
35
  */
30
36
  export declare function createC2pa(config: Config): Promise<C2paSdk>;
31
- export {};
32
37
  //# sourceMappingURL=c2pa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,UAAU,OAAO;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcjE"}
1
+ {"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcjE"}
@@ -1,5 +1,9 @@
1
+ import { Manifest, ManifestStore } from '@contentauth/c2pa-types';
1
2
  import { WorkerManager } from './worker/workerManager.js';
2
3
  export declare const MAX_SIZE_IN_BYTES: number;
4
+ /**
5
+ * A collection of functions that permit the creation of Reader objects from various sources.
6
+ */
3
7
  export interface ReaderFactory {
4
8
  /**
5
9
  * Create a Reader from an asset's format and a blob of its bytes.
@@ -11,20 +15,51 @@ export interface ReaderFactory {
11
15
  fromBlob: (format: string, blob: Blob) => Promise<Reader>;
12
16
  fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<Reader>;
13
17
  }
18
+ /**
19
+ * Exposes methods for reading C2PA data out of an asset.
20
+ *
21
+ * @example Getting an asset's active manifest:
22
+ * ```
23
+ * const reader = await c2pa.reader.fromBlob(blob.type, blob);
24
+ *
25
+ * const activeManifest = await reader.activeManfiest();
26
+ * ```
27
+ */
14
28
  export interface Reader {
29
+ /**
30
+ * @returns The label of the active manifest.
31
+ */
32
+ activeLabel: () => Promise<string | null>;
15
33
  /**
16
34
  * @returns The asset's full manifest store containing all its manifests, validation statuses, and the URI of the active manifest.
35
+ *
36
+ * NOTE: At the moment, the manifest store returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.
17
37
  */
18
- manifestStore: () => Promise<any>;
38
+ manifestStore: () => Promise<ManifestStore>;
19
39
  /**
20
- * @returns The label of the active manifest.
40
+ * @returns The asset's active manifest.
41
+ *
42
+ * NOTE: At the moment, the manifest returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.
21
43
  */
22
- activeLabel: () => Promise<string | null>;
44
+ activeManifest: () => Promise<Manifest>;
45
+ /**
46
+ * @returns The asset's full manifest store, including decoded CAWG data.
47
+ */
48
+ json: () => Promise<any>;
23
49
  /**
24
50
  * Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.
25
51
  *
26
52
  * @param uri URI of the binary object to resolve.
27
53
  * @returns An array buffer of the resource's bytes.
54
+ *
55
+ * @example Retrieving a thumbnail from the resource store:
56
+ * ```
57
+ * const reader = await c2pa.reader.fromBlob(blob.type, blob);
58
+ *
59
+ * const activeManifest = await reader.activeManifest();
60
+ *
61
+ * const thumbnailBuffer = await reader.resourceToBuffer(activeManifest.thumbnail!.identifier);
62
+ * ```
28
63
  */
29
64
  resourceToBuffer: (uri: string) => Promise<ArrayBuffer>;
30
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAElC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAExD;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAoDxE"}
1
+ {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAEzB;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAExD;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAoDxE"}
@@ -6,22 +6,46 @@
6
6
  * accordance with the terms of the Adobe license agreement accompanying
7
7
  * it.
8
8
  */
9
+ /**
10
+ * Settings used to configure the SDK's behavior.
11
+ */
9
12
  export interface Settings {
13
+ /**
14
+ * Trust configuration for C2PA claim validation.
15
+ */
10
16
  trust?: TrustSettings;
17
+ /**
18
+ * Trust configuration for CAWG identity valdation.
19
+ */
20
+ cawgTrust?: TrustSettings;
11
21
  verify?: VerifySettings;
12
22
  }
13
- interface TrustSettings {
23
+ export interface TrustSettings {
24
+ /**
25
+ * "User" trust anchors. Any asset validated off of this trust list will will have a "signingCredential.trusted" result with an explanation noting the trust source is a "User" anchor.
26
+ */
14
27
  userAnchors?: string;
28
+ /**
29
+ * "System" trust anchors. Any asset validated off of this trust list will will have a "signingCredential.trusted" result with an explanation noting the trust source is a "System" anchor.
30
+ */
15
31
  trustAnchors?: string;
32
+ /**
33
+ * Trust store
34
+ */
16
35
  trustConfig?: string;
36
+ /**
37
+ * End-entity certificates.
38
+ */
17
39
  allowedList?: string;
18
40
  }
19
- interface VerifySettings {
41
+ export interface VerifySettings {
42
+ /**
43
+ * Enable trust list validation.
44
+ */
20
45
  verifyTrust?: boolean;
21
46
  }
22
47
  /**
23
48
  * Converts a settings object to a JSON string of the structure expected by c2pa-rs.
24
49
  */
25
50
  export declare function settingsToWasmJson(settings: Settings): string;
26
- export {};
27
51
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,UAEpD"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,UAEpD"}
@@ -3,8 +3,10 @@ declare const workerFunctions: {
3
3
  initWorker(module: WebAssembly.Module, settings?: string): Promise<void>;
4
4
  reader_fromBlob(format: string, blob: Blob): Promise<WorkerResponse<number>>;
5
5
  reader_fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WorkerResponse<number>>;
6
- reader_json(readerId: number): WorkerResponse<string>;
7
6
  reader_activeLabel(readerId: number): WorkerResponse<string | null>;
7
+ reader_manifestStore(readerId: number): WorkerResponse<any>;
8
+ reader_activeManifest(readerId: number): WorkerResponse<any>;
9
+ reader_json(readerId: number): WorkerResponse<string>;
8
10
  reader_resourceToBuffer(readerId: number, uri: string): WorkerResponse<ArrayBuffer>;
9
11
  reader_free(readerId: number): void;
10
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,QAAA,MAAM,eAAe;uBACM,WAAW,CAAC,MAAM,aAAa,MAAM;4BAUpD,MAAM,QACR,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oCAOxB,MAAM,QACR,IAAI,YACA,IAAI,GACb,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;0BAOZ,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;iCAIxB,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;sCAKvD,MAAM,OACX,MAAM,GACV,cAAc,CAAC,WAAW,CAAC;0BAKR,MAAM;CAKH,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,eAAe,CAAC"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,QAAA,MAAM,eAAe;uBACM,WAAW,CAAC,MAAM,aAAa,MAAM;4BAUpD,MAAM,QACR,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oCAOxB,MAAM,QACR,IAAI,YACA,IAAI,GACb,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;iCAOL,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;mCAIpC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC;oCAI3B,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC;0BAItC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;sCAKzC,MAAM,OACX,MAAM,GACV,cAAc,CAAC,WAAW,CAAC;0BAKR,MAAM;CAKH,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,eAAe,CAAC"}
Binary file
package/package.json CHANGED
@@ -1,27 +1,34 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-web",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "module": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist/**/*"
10
+ ],
7
11
  "exports": {
8
12
  "./package.json": "./package.json",
9
13
  "./resources/c2pa.wasm": "./dist/resources/c2pa_bg.wasm",
10
14
  ".": {
11
- "development": "./src/index.ts",
12
15
  "types": "./dist/index.d.ts",
13
16
  "import": "./dist/index.js",
14
17
  "default": "./dist/index.js"
15
18
  }
16
19
  },
17
20
  "dependencies": {
18
- "@contentauth/c2pa-wasm": "0.1.1"
21
+ "@contentauth/c2pa-types": "0.2.1",
22
+ "@contentauth/c2pa-wasm": "0.2.1"
19
23
  },
20
24
  "devDependencies": {
21
25
  "@playwright/test": "^1.55.0",
22
26
  "@types/ssri": "^7.1.5",
23
27
  "@vitest/browser": "^3.2.4",
28
+ "typedoc": "^0.28.12",
24
29
  "rimraf": "^6.0.1"
25
30
  },
26
- "scripts": {}
31
+ "scripts": {
32
+ "build:docs": "typedoc src/index.ts"
33
+ }
27
34
  }
package/CHANGELOG.md DELETED
@@ -1,26 +0,0 @@
1
- # @contentauth/c2pa-web
2
-
3
- ## 0.1.2
4
-
5
- ### Patch Changes
6
-
7
- - eda667c: Added WASM binary to package.json exports
8
-
9
- ## 0.1.1
10
-
11
- ### Patch Changes
12
-
13
- - 3868d81: Fix broken dependencies
14
- - Updated dependencies [3868d81]
15
- - @contentauth/c2pa-wasm@0.1.1
16
-
17
- ## 0.1.0
18
-
19
- ### Minor Changes
20
-
21
- - e9a7614: Add minimal reader API
22
-
23
- ### Patch Changes
24
-
25
- - Updated dependencies [e9a7614]
26
- - @contentauth/c2pa-wasm@0.1.0
package/eslint.config.mjs DELETED
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright 2025 Adobe
3
- * All Rights Reserved.
4
- *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this file in
6
- * accordance with the terms of the Adobe license agreement accompanying
7
- * it.
8
- */
9
- import baseConfig from '../../eslint.config.mjs';
10
-
11
- export default [
12
- ...baseConfig,
13
- {
14
- files: ['**/*.json'],
15
- rules: {
16
- '@nx/dependency-checks': [
17
- 'error',
18
- {
19
- ignoredFiles: [
20
- '{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
21
- '{projectRoot}/vite.config.{js,ts,mjs,mts}',
22
- ],
23
- },
24
- ],
25
- },
26
- languageOptions: {
27
- parser: await import('jsonc-eslint-parser'),
28
- },
29
- },
30
- ];
package/project.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "name": "c2pa-web",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "tags": ["lib"],
5
- "projectType": "library",
6
- "sourceRoot": "packages/c2pa-web/src"
7
- }
package/src/index.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Copyright 2025 Adobe
3
- * All Rights Reserved.
4
- *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this file in
6
- * accordance with the terms of the Adobe license agreement accompanying
7
- * it.
8
- */
9
-
10
- export * from './lib/c2pa.js';
11
- export {
12
- isSupportedReaderFormat,
13
- READER_SUPPORTED_FORMATS,
14
- } from './lib/supportedFormats.js';
15
- export { type Settings } from './lib/settings.js';