@contentauth/c2pa-web 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -7
- package/dist/common.d.ts +14 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -38
- package/dist/inline.d.ts +20 -0
- package/dist/inline.d.ts.map +1 -0
- package/dist/inline.js +26 -0
- package/dist/lib/c2pa.d.ts +0 -13
- package/dist/lib/c2pa.d.ts.map +1 -1
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -12,14 +12,55 @@ npm install @contentauth/c2pa-web
|
|
|
12
12
|
|
|
13
13
|
## Quickstart
|
|
14
14
|
|
|
15
|
+
### Importing
|
|
16
|
+
|
|
17
|
+
Due to [specific requirements](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running) around handling WASM modules, there are two methods of importing the library. One optimizes for performance, the other for convenience.
|
|
18
|
+
|
|
19
|
+
#### With a separate WASM binary (performance)
|
|
20
|
+
|
|
21
|
+
The recommended method of using the library requires that the WASM binary be hosted separately, to be fetched over the network at runtime.
|
|
22
|
+
|
|
23
|
+
With Vite:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { createC2pa } from '@contentauth/c2pa-web';
|
|
27
|
+
|
|
28
|
+
import wasmSrc from '@contentauth/c2pa-web/resources/c2pa.wasm?url';
|
|
29
|
+
|
|
30
|
+
const c2pa = createC2pa({ wasmSrc });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use a solution appropriate to your tooling. Alternatively, the binary can be requested from a CDN:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { createC2pa } from '@contentauth/c2pa-web';
|
|
37
|
+
|
|
38
|
+
// Ensure that [PACKAGE VERSION] matches the currently-installed version of @contentauth/c2pa-web.
|
|
39
|
+
const c2pa = await createC2pa({
|
|
40
|
+
wasmSrc:
|
|
41
|
+
'https://cdn.jsdelivr.net/npm/@contentauth/c2pa-web@[PACKAGE VERSION]/dist/resources/c2pa_bg.wasm',
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### With an inlined WASM binary (convenience)
|
|
46
|
+
|
|
47
|
+
In environments where it is not possible or not convenient to request a separate resource over the network, the "inline" SDK can be used. The WASM binary is encoded as a base64 string and included in the JavaScript file, so no (additional) network request is necessary. However, this adds _significant_ size to the JavaScript bundle, and cannot take advantage of the higher-performance
|
|
48
|
+
[`WebAssembly.compileStreaming()`](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/compileStreaming_static) API.
|
|
49
|
+
|
|
15
50
|
```typescript
|
|
16
|
-
import { createC2pa } from
|
|
51
|
+
import { createC2pa } from '@contentauth/c2pa-web/inline';
|
|
52
|
+
|
|
53
|
+
const c2pa = await createC2pa();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Use
|
|
17
57
|
|
|
18
|
-
|
|
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";
|
|
58
|
+
Fetch an image and provide it to the `Reader`:
|
|
21
59
|
|
|
22
|
-
|
|
60
|
+
```typescript
|
|
61
|
+
const response = await fetch(
|
|
62
|
+
'https://spec.c2pa.org/public-testfiles/image/jpeg/adobe-20220124-C.jpg'
|
|
63
|
+
);
|
|
23
64
|
const blob = await response.blob();
|
|
24
65
|
|
|
25
66
|
const reader = await c2pa.reader.fromBlob(blob.type, blob);
|
|
@@ -29,17 +70,22 @@ const manifestStore = await reader.manifestStore();
|
|
|
29
70
|
console.log(manifestStore);
|
|
30
71
|
```
|
|
31
72
|
|
|
73
|
+
## Api reference
|
|
74
|
+
|
|
75
|
+
API docs are available [here](https://contentauth.github.io/c2pa-js/modules/_contentauth_c2pa-web.html).
|
|
76
|
+
|
|
32
77
|
## Development
|
|
33
78
|
|
|
34
|
-
### Prerequsities
|
|
79
|
+
### Prerequsities
|
|
35
80
|
|
|
36
|
-
Ensure the repo-wide prerequisites [NX](https://nx.dev/getting-started/intro) and [pnpm](https://pnpm.io/) are installed.
|
|
81
|
+
Ensure the repo-wide prerequisites [NX](https://nx.dev/getting-started/intro) and [pnpm](https://pnpm.io/) are installed.
|
|
37
82
|
|
|
38
83
|
[`c2pa-wasm`'s prerequisites](https://github.com/contentauth/c2pa-js-v2/tree/main/packages/c2pa-wasm) must also be installed.
|
|
39
84
|
|
|
40
85
|
### Building
|
|
41
86
|
|
|
42
87
|
To build the library:
|
|
88
|
+
|
|
43
89
|
```sh
|
|
44
90
|
nx build c2pa-web
|
|
45
91
|
```
|
|
@@ -47,11 +93,13 @@ nx build c2pa-web
|
|
|
47
93
|
### Testing
|
|
48
94
|
|
|
49
95
|
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:
|
|
96
|
+
|
|
50
97
|
```sh
|
|
51
98
|
pnpx playwright install
|
|
52
99
|
```
|
|
53
100
|
|
|
54
101
|
To run the tests:
|
|
102
|
+
|
|
55
103
|
```
|
|
56
104
|
nx test c2pa-web
|
|
57
105
|
```
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
export type * from './lib/c2pa.js';
|
|
10
|
+
export type { Reader, ReaderFactory } from './lib/reader.js';
|
|
11
|
+
export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS, } from './lib/supportedFormats.js';
|
|
12
|
+
export type { Settings, VerifySettings, TrustSettings, } from './lib/settings.js';
|
|
13
|
+
export type * from '@contentauth/c2pa-types';
|
|
14
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,GACd,MAAM,mBAAmB,CAAC;AAG3B,mBAAmB,yBAAyB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,19 @@
|
|
|
6
6
|
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
7
|
* it.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new instance of c2pa-web by setting up a web worker and preparing a WASM binary.
|
|
11
|
+
*
|
|
12
|
+
* @param config - SDK configuration object.
|
|
13
|
+
* @returns An object providing access to factory methods for creating new reader objects.
|
|
14
|
+
*
|
|
15
|
+
* @example Creating a new SDK instance and reader:
|
|
16
|
+
* ```
|
|
17
|
+
* const c2pa = await createC2pa({ wasmSrc: 'url/hosting/wasm/binary' });
|
|
18
|
+
*
|
|
19
|
+
* const reader = await c2pa.reader.fromBlob(imageBlob.type, imageBlob);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export { createC2pa } from './lib/c2pa.js';
|
|
23
|
+
export * from './common.js';
|
|
14
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,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" });
|
|
1
|
+
const d = '(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__h577ba7b6b2bd3a5a(t,e)}function W(t,e,n){o.closure1454_externref_shim(t,e,n)}function U(t,e,n,r){o.closure2443_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_wrapper10792=function(e,n,r){return B(e,n,1450,v)},t.wbg.__wbindgen_closure_wrapper10802=function(e,n,r){return B(e,n,1453,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', s = typeof self < "u" && self.Blob && new Blob([d], { type: "text/javascript;charset=utf-8" });
|
|
2
2
|
function v(e) {
|
|
3
3
|
let t;
|
|
4
4
|
try {
|
|
5
|
-
if (t =
|
|
5
|
+
if (t = s && (self.URL || self.webkitURL).createObjectURL(s), !t) throw "";
|
|
6
6
|
const n = new Worker(t, {
|
|
7
7
|
name: e == null ? void 0 : e.name
|
|
8
8
|
});
|
|
@@ -11,7 +11,7 @@ function v(e) {
|
|
|
11
11
|
}), n;
|
|
12
12
|
} catch {
|
|
13
13
|
return new Worker(
|
|
14
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
14
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(d),
|
|
15
15
|
{
|
|
16
16
|
name: e == null ? void 0 : e.name
|
|
17
17
|
}
|
|
@@ -31,10 +31,10 @@ function T(e, t) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
async function S(e) {
|
|
34
|
-
const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((a,
|
|
34
|
+
const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((a, y) => {
|
|
35
35
|
T(r, {
|
|
36
|
-
onSuccess: (
|
|
37
|
-
onError: (
|
|
36
|
+
onSuccess: (i) => a(i),
|
|
37
|
+
onError: (i) => y(i)
|
|
38
38
|
});
|
|
39
39
|
const { method: p, args: h, transfer: x } = _;
|
|
40
40
|
r.postMessage({ method: p, args: h }, x ?? []);
|
|
@@ -44,14 +44,14 @@ async function S(e) {
|
|
|
44
44
|
terminate: () => r.terminate()
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
class
|
|
47
|
+
class f extends Error {
|
|
48
48
|
constructor(t) {
|
|
49
49
|
super(
|
|
50
|
-
`The provided asset was too large. Size: ${t} bytes. Maximum: ${
|
|
50
|
+
`The provided asset was too large. Size: ${t} bytes. Maximum: ${u}.`
|
|
51
51
|
), this.name = "AssetTooLargeError";
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class b extends Error {
|
|
55
55
|
constructor(t) {
|
|
56
56
|
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
57
57
|
}
|
|
@@ -115,44 +115,44 @@ const E = [
|
|
|
115
115
|
"nef",
|
|
116
116
|
"heif"
|
|
117
117
|
];
|
|
118
|
-
function
|
|
118
|
+
function g(e) {
|
|
119
119
|
return E.includes(e);
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const u = 10 ** 9;
|
|
122
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 (!
|
|
129
|
-
throw new
|
|
130
|
-
if (r.size >
|
|
131
|
-
throw new
|
|
128
|
+
if (!g(n))
|
|
129
|
+
throw new b(n);
|
|
130
|
+
if (r.size > u)
|
|
131
|
+
throw new f(r.size);
|
|
132
132
|
const o = await e.execute({
|
|
133
133
|
method: "reader_fromBlob",
|
|
134
134
|
args: [n, r]
|
|
135
|
-
}), _ =
|
|
135
|
+
}), _ = w(e, o, () => {
|
|
136
136
|
t.unregister(_);
|
|
137
137
|
});
|
|
138
|
-
return t.register(
|
|
138
|
+
return t.register(_, o, _), _;
|
|
139
139
|
},
|
|
140
140
|
async fromBlobFragment(n, r, o) {
|
|
141
|
-
if (!
|
|
142
|
-
throw new
|
|
143
|
-
if (r.size >
|
|
144
|
-
throw new
|
|
141
|
+
if (!g(n))
|
|
142
|
+
throw new b(n);
|
|
143
|
+
if (r.size > u)
|
|
144
|
+
throw new f(r.size);
|
|
145
145
|
const _ = await e.execute({
|
|
146
146
|
method: "reader_fromBlobFragment",
|
|
147
147
|
args: [n, r, o]
|
|
148
|
-
}), a =
|
|
148
|
+
}), a = w(e, _, () => {
|
|
149
149
|
t.unregister(a);
|
|
150
150
|
});
|
|
151
|
-
return t.register(
|
|
151
|
+
return t.register(a, _, a), a;
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function w(e, t, n) {
|
|
156
156
|
return {
|
|
157
157
|
async activeLabel() {
|
|
158
158
|
return await e.execute({
|
|
@@ -187,44 +187,44 @@ function d(e, t, n) {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
let
|
|
190
|
+
let l, R = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
|
|
191
191
|
throw Error("TextDecoder not available");
|
|
192
192
|
} };
|
|
193
193
|
typeof TextDecoder < "u" && R.decode();
|
|
194
|
-
const
|
|
194
|
+
const c = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
|
|
195
195
|
throw Error("TextEncoder not available");
|
|
196
196
|
} };
|
|
197
|
-
|
|
197
|
+
c.encodeInto;
|
|
198
198
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => {
|
|
199
|
-
|
|
199
|
+
l.__wbindgen_export_6.get(e.dtor)(e.a, e.b);
|
|
200
200
|
});
|
|
201
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) =>
|
|
202
|
-
const A = "sha512-
|
|
201
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => l.__wbg_wasmreader_free(e >>> 0, 1));
|
|
202
|
+
const A = "sha512-44unTbzB+7yjRi6ipBWyto89C4FzIn+bcq1wqi+qIw1Xmnyg9NFvdcl2AHIGaWG/0jJycDTV3j4MgcB3V458PA==";
|
|
203
203
|
function B(e) {
|
|
204
|
-
return JSON.stringify(
|
|
204
|
+
return JSON.stringify(m(e));
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function m(e) {
|
|
207
207
|
return Object.entries(e).reduce(
|
|
208
|
-
(n, [r, o]) => (n[M(r)] = typeof o == "object" ?
|
|
208
|
+
(n, [r, o]) => (n[M(r)] = typeof o == "object" ? m(o) : o, n),
|
|
209
209
|
{}
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
function M(e) {
|
|
213
213
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
214
214
|
}
|
|
215
|
-
async function
|
|
216
|
-
const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await
|
|
215
|
+
async function L(e) {
|
|
216
|
+
const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await F(t) : t, o = n ? B(n) : void 0, _ = await S({ wasm: r, settingsString: o });
|
|
217
217
|
return {
|
|
218
218
|
reader: j(_),
|
|
219
219
|
dispose: _.terminate
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
async function
|
|
222
|
+
async function F(e) {
|
|
223
223
|
const t = await fetch(e, { integrity: A });
|
|
224
224
|
return await WebAssembly.compileStreaming(t);
|
|
225
225
|
}
|
|
226
226
|
export {
|
|
227
227
|
E as READER_SUPPORTED_FORMATS,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
L as createC2pa,
|
|
229
|
+
g as isSupportedReaderFormat
|
|
230
230
|
};
|
package/dist/inline.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Config } from './lib/c2pa.js';
|
|
2
|
+
export type InlineConfig = Omit<Config, 'wasmSrc'>;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new instance of c2pa-web by setting up a web worker and preparing a WASM binary.
|
|
5
|
+
*
|
|
6
|
+
* This is the "inline" version which compiles the WASM binary from an inlined, base64-encoded string.
|
|
7
|
+
*
|
|
8
|
+
* @param config - SDK configuration object.
|
|
9
|
+
* @returns An object providing access to factory methods for creating new reader objects.
|
|
10
|
+
*
|
|
11
|
+
* @example Creating a new SDK instance and reader:
|
|
12
|
+
* ```
|
|
13
|
+
* const c2pa = await createC2pa();
|
|
14
|
+
*
|
|
15
|
+
* const reader = await c2pa.reader.fromBlob(imageBlob.type, imageBlob);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function createC2pa(config?: InlineConfig): Promise<import('./common.js').C2paSdk>;
|
|
19
|
+
export * from './common.js';
|
|
20
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../src/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAgC,MAAM,EAAE,MAAM,eAAe,CAAC;AAGrE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,0CAOrD;AAED,cAAc,aAAa,CAAC"}
|