@contentauth/c2pa-web 0.5.0 → 0.5.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.
@@ -1,19 +1,19 @@
1
- import { channel as R, transfer as x } from "highgain";
2
- import { merge as I } from "ts-deepmerge";
3
- const { createTx: T, rx: G } = R(), { createTx: $, rx: M } = R("worker"), B = '(function(){"use strict";let o,S=null;function M(){return(S===null||S.byteLength===0)&&(S=new Uint8Array(o.memory.buffer)),S}let j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});j.decode();const C=2146435072;let x=0;function V(n,e){return x+=e,x>=C&&(j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),j.decode(),x=e),j.decode(M().subarray(n,n+e))}function l(n,e){return n=n>>>0,V(n,e)}function y(n){return n==null}let A=null;function m(){return(A===null||A.buffer.detached===!0||A.buffer.detached===void 0&&A.buffer!==o.memory.buffer)&&(A=new DataView(o.memory.buffer)),A}function E(n){const e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){const _=n.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=n.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(n)){const _=n.length;let c="[";_>0&&(c+=E(n[0]));for(let s=1;s<_;s++)c+=", "+E(n[s]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(n));let r;if(t&&t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}let u=0;const R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(n,e){const t=R.encode(n);return e.set(t),{read:n.length,written:t.length}});function d(n,e,t){if(t===void 0){const i=R.encode(n),b=e(i.length,1)>>>0;return M().subarray(b,b+i.length).set(i),u=i.length,b}let r=n.length,_=e(r,1)>>>0;const c=M();let s=0;for(;s<r;s++){const i=n.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==r){s!==0&&(n=n.slice(s)),_=t(_,r,r=s+n.length*3,1)>>>0;const i=M().subarray(_+s,_+r),b=R.encodeInto(n,i);s+=b.written,_=t(_,r,s,1)>>>0}return u=s,_}function T(n){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,n),e}function f(n,e){try{return n.apply(this,e)}catch(t){const r=T(t);o.__wbindgen_exn_store(r)}}function F(n,e){return n=n>>>0,M().subarray(n/1,n/1+e)}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>n.dtor(n.a,n.b));function N(n,e,t,r){const _={a:n,b:e,cnt:1,dtor:t},c=(...s)=>{_.cnt++;const i=_.a;_.a=0;try{return r(i,_.b,...s)}finally{_.a=i,c._wbg_cb_unref()}};return c._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,O.unregister(_))},O.register(c,_,_),c}function a(n){const e=o.__wbindgen_externrefs.get(n);return o.__externref_table_dealloc(n),e}function G(n){const e=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,r=o.loadSettings(e,t);if(r[1])throw a(r[0])}function P(n,e){o.wasm_bindgen__convert__closures_____invoke__hbb73f02d9cb5eeb0(n,e)}function $(n,e,t){o.wasm_bindgen__convert__closures_____invoke__hedbe22ff1e6181ec(n,e,t)}function J(n,e,t,r){o.wasm_bindgen__convert__closures_____invoke__h1fd2c9ff95892b8d(n,e,t,r)}const H=["default","no-store","reload","no-cache","force-cache","only-if-cached"],X=["omit","same-origin","include"],Y=["same-origin","no-cors","cors","navigate"],k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>o.__wbg_wasmbuilder_free(n>>>0,1));class h{static __wrap(e){e=e>>>0;const t=Object.create(h.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw a(t[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw a(t[0])}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}static fromArchive(e){const t=o.wasmbuilder_fromArchive(e);if(t[2])throw a(t[1]);return h.__wrap(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}setRemoteUrl(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,r)}addResourceFromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,_,t);if(c[1])throw a(c[0])}setThumbnailFromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,_,t);if(c[1])throw a(c[0])}addIngredientFromBlob(e,t,r){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,s=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u,b=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,r);if(b[1])throw a(b[0])}signAndGetManifestBytes(e,t,r){const _=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,r)}static new(){const e=o.wasmbuilder_new();if(e[2])throw a(e[1]);return h.__wrap(e[0])}sign(e,t,r){const _=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,r)}static fromJson(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmbuilder_fromJson(t,r);if(_[2])throw a(_[1]);return h.__wrap(_[0])}}Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>o.__wbg_wasmreader_free(n>>>0,1));class v{static __wrap(e){e=e>>>0;const t=Object.create(v.prototype);return t.__wbg_ptr=e,z.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=l(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}resourceToBytes(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,r);if(_[2])throw a(_[1]);return a(_[0])}static fromBlobFragment(e,t,r){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmreader_fromBlobFragment(_,c,t,r)}json(){let e,t;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],t=r[1],l(r[0],r[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;return o.wasmreader_fromBlob(r,_,t)}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>o.__wbg_wasmsigner_free(n>>>0,1));function K(){const n={};return n.wbg={},n.wbg.__wbg_Error_e83987f665cf5504=function(e,t){return Error(l(e,t))},n.wbg.__wbg_Number_bb48ca12f395cd08=function(e){return Number(e)},n.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd=function(e,t){const r=t,_=typeof r=="bigint"?r:void 0;m().setBigInt64(e+8,y(_)?BigInt(0):_,!0),m().setInt32(e+0,!y(_),!0)},n.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68=function(e){const t=e,r=typeof t=="boolean"?t:void 0;return y(r)?16777215:r?1:0},n.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763=function(e,t){const r=E(t),_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f=function(e,t){return e in t},n.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b=function(e){return typeof e=="bigint"},n.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377=function(e){return typeof e=="function"},n.wbg.__wbg___wbindgen_is_object_c818261d21f283a4=function(e){const t=e;return typeof t=="object"&&t!==null},n.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd=function(e){return typeof e=="string"},n.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478=function(e){return e===void 0},n.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50=function(e,t){return e===t},n.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147=function(e,t){return e==t},n.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d=function(e,t){const r=t,_=typeof r=="number"?r:void 0;m().setFloat64(e+8,y(_)?0:_,!0),m().setInt32(e+0,!y(_),!0)},n.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b=function(e,t){const r=t,_=typeof r=="string"?r:void 0;var c=y(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,c,!0)},n.wbg.__wbg___wbindgen_throw_b855445ff6a94295=function(e,t){throw new Error(l(e,t))},n.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9=function(e){e._wbg_cb_unref()},n.wbg.__wbg_abort_28ad55c5825b004d=function(e,t){e.abort(t)},n.wbg.__wbg_abort_e7eb059f72f9ed0c=function(e){e.abort()},n.wbg.__wbg_append_b577eb3a177bc0fa=function(){return f(function(e,t,r,_,c){e.append(l(t,r),l(_,c))},arguments)},n.wbg.__wbg_arrayBuffer_b375eccb84b4ddf3=function(){return f(function(e){return e.arrayBuffer()},arguments)},n.wbg.__wbg_byteLength_bcd42e4025299788=function(e){return e.byteLength},n.wbg.__wbg_call_525440f72fbfc0ea=function(){return f(function(e,t,r){return e.call(t,r)},arguments)},n.wbg.__wbg_call_e762c39fa8ea36bf=function(){return f(function(e,t){return e.call(t)},arguments)},n.wbg.__wbg_clearTimeout_7a42b49784aea641=function(e){return clearTimeout(e)},n.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},n.wbg.__wbg_done_2042aa2670fb1db1=function(e){return e.done},n.wbg.__wbg_entries_e171b586f8f6bdbf=function(e){return Object.entries(e)},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,t){let r,_;try{r=e,_=t,console.error(l(e,t))}finally{o.__wbindgen_free(r,_,1)}},n.wbg.__wbg_fetch_74a3e84ebd2c9a0e=function(e){return fetch(e)},n.wbg.__wbg_fetch_f8ba0e29a9d6de0d=function(e,t){return e.fetch(t)},n.wbg.__wbg_from_a4ad7cbddd0d7135=function(e){return Array.from(e)},n.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return f(function(e,t){globalThis.crypto.getRandomValues(F(e,t))},arguments)},n.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return f(function(e,t){e.getRandomValues(t)},arguments)},n.wbg.__wbg_getTime_14776bfb48a1bff9=function(e){return e.getTime()},n.wbg.__wbg_get_7bed016f185add81=function(e,t){return e[t>>>0]},n.wbg.__wbg_get_efcb449f58ec27c2=function(){return f(function(e,t){return Reflect.get(e,t)},arguments)},n.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(e,t){return e[t]},n.wbg.__wbg_has_787fafc980c3ccdb=function(){return f(function(e,t){return Reflect.has(e,t)},arguments)},n.wbg.__wbg_headers_b87d7eaba61c3278=function(e){return e.headers},n.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38=function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7=function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},n.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef=function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},n.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c=function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},n.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98=function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_isArray_96e0af9891d0945d=function(e){return Array.isArray(e)},n.wbg.__wbg_isSafeInteger_d216eda7911dde36=function(e){return Number.isSafeInteger(e)},n.wbg.__wbg_iterator_e5822695327a3c39=function(){return Symbol.iterator},n.wbg.__wbg_length_69bca3cb64fc8748=function(e){return e.length},n.wbg.__wbg_length_cdd215e10d9dd507=function(e){return e.length},n.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},n.wbg.__wbg_new_0_f9740686d739025c=function(){return new Date},n.wbg.__wbg_new_0d96c0bf6ceac0b0=function(){return f(function(){return new FileReaderSync},arguments)},n.wbg.__wbg_new_1acc0b6eea89d040=function(){return new Object},n.wbg.__wbg_new_2531773dac38ebb3=function(){return f(function(){return new AbortController},arguments)},n.wbg.__wbg_new_3c3d849046688a66=function(e,t){try{var r={a:e,b:t},_=(s,i)=>{const b=r.a;r.a=0;try{return J(b,r.b,s,i)}finally{r.a=b}};return new Promise(_)}finally{r.a=r.b=0}},n.wbg.__wbg_new_5a79be3ab53b8aa5=function(e){return new Uint8Array(e)},n.wbg.__wbg_new_68651c719dcda04e=function(){return new Map},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_new_9edf9838a2def39c=function(){return f(function(){return new Headers},arguments)},n.wbg.__wbg_new_a7442b4b19c1a356=function(e,t){return new Error(l(e,t))},n.wbg.__wbg_new_e17d9f43105b08be=function(){return new Array},n.wbg.__wbg_new_from_slice_92f4d78ca282a2d2=function(e,t){return new Uint8Array(F(e,t))},n.wbg.__wbg_new_no_args_ee98eee5275000a4=function(e,t){return new Function(l(e,t))},n.wbg.__wbg_new_with_length_01aa0dc35aa13543=function(e){return new Uint8Array(e>>>0)},n.wbg.__wbg_new_with_str_and_init_0ae7728b6ec367b1=function(){return f(function(e,t,r){return new Request(l(e,t),r)},arguments)},n.wbg.__wbg_next_020810e0ae8ebcb0=function(){return f(function(e){return e.next()},arguments)},n.wbg.__wbg_next_2c826fe5dfec6b6a=function(e){return e.next},n.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},n.wbg.__wbg_now_793306c526e2e3b6=function(){return Date.now()},n.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},n.wbg.__wbg_prototypesetcall_2a6620b6922694b2=function(e,t,r){Uint8Array.prototype.set.call(F(e,t),r)},n.wbg.__wbg_queueMicrotask_34d692c25c47d05b=function(e){return e.queueMicrotask},n.wbg.__wbg_queueMicrotask_9d76cacb20c84d58=function(e){queueMicrotask(e)},n.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return f(function(e,t){e.randomFillSync(t)},arguments)},n.wbg.__wbg_readAsArrayBuffer_36927e3348e676c3=function(){return f(function(e,t){return e.readAsArrayBuffer(t)},arguments)},n.wbg.__wbg_require_60cc747a6bc5215a=function(){return f(function(){return module.require},arguments)},n.wbg.__wbg_resolve_caf97c30b83f7053=function(e){return Promise.resolve(e)},n.wbg.__wbg_setTimeout_7bb3429662ab1e70=function(e,t){return setTimeout(e,t)},n.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,r){e[t]=r},n.wbg.__wbg_set_907fb406c34a251d=function(e,t,r){return e.set(t,r)},n.wbg.__wbg_set_9e6516df7b7d0f19=function(e,t,r){e.set(F(t,r))},n.wbg.__wbg_set_body_3c365989753d61f4=function(e,t){e.body=t},n.wbg.__wbg_set_c213c871859d6500=function(e,t,r){e[t>>>0]=r},n.wbg.__wbg_set_cache_2f9deb19b92b81e3=function(e,t){e.cache=H[t]},n.wbg.__wbg_set_credentials_f621cd2d85c0c228=function(e,t){e.credentials=X[t]},n.wbg.__wbg_set_headers_6926da238cd32ee4=function(e,t){e.headers=t},n.wbg.__wbg_set_method_c02d8cbbe204ac2d=function(e,t,r){e.method=l(t,r)},n.wbg.__wbg_set_mode_52ef73cfa79639cb=function(e,t){e.mode=Y[t]},n.wbg.__wbg_set_signal_dda2cf7ccb6bee0f=function(e,t){e.signal=t},n.wbg.__wbg_signal_4db5aa055bf9eb9a=function(e){return e.signal},n.wbg.__wbg_size_0a5a003dbf5dfee8=function(e){return e.size},n.wbg.__wbg_slice_4947c0e051116da5=function(){return f(function(e,t,r){return e.slice(t,r)},arguments)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,t){const r=t.stack,_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e=function(){const e=typeof global>"u"?null:global;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac=function(){const e=typeof globalThis>"u"?null:globalThis;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b=function(){const e=typeof self>"u"?null:self;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2=function(){const e=typeof window>"u"?null:window;return y(e)?0:T(e)},n.wbg.__wbg_status_de7eed5a7a5bfd5d=function(e){return e.status},n.wbg.__wbg_stringify_b5fb28f6465d9c3e=function(){return f(function(e){return JSON.stringify(e)},arguments)},n.wbg.__wbg_subarray_480600f3d6a9f26c=function(e,t,r){return e.subarray(t>>>0,r>>>0)},n.wbg.__wbg_then_4f46f6544e6b4a28=function(e,t){return e.then(t)},n.wbg.__wbg_then_70d05cf780a18d77=function(e,t,r){return e.then(t,r)},n.wbg.__wbg_url_b36d2a5008eb056f=function(e,t){const r=t.url,_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg_valueOf_e1f2752ef9caddb2=function(e){return e.valueOf()},n.wbg.__wbg_value_692627309814bb8c=function(e){return e.value},n.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},n.wbg.__wbg_wasmreader_new=function(e){return v.__wrap(e)},n.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,t){return l(e,t)},n.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,t){return BigInt.asUintN(64,e)|t<<BigInt(64)},n.wbg.__wbindgen_cast_3f8afe4d69afce15=function(e,t){return N(e,t,o.wasm_bindgen__closure__destroy__h4e2af4dd32e0f9a7,$)},n.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},n.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,t){var r=F(e,t).slice();return o.__wbindgen_free(e,t*1,1),r},n.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},n.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,t){return F(e,t)},n.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},n.wbg.__wbindgen_cast_eea71553507a2f52=function(e,t){return N(e,t,o.wasm_bindgen__closure__destroy__h3685db4568587cc8,P)},n.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},n}function Q(n,e){return o=n.exports,A=null,S=null,o.__wbindgen_start(),o}function Z(n){if(o!==void 0)return o;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=K();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));const t=new WebAssembly.Instance(n,e);return Q(t)}function D(){let n=0;const e=new Map;return{add(t){const r=n++;return e.set(r,t),r},get(t){const r=e.get(t);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(t){return e.delete(t)}}}const L=Symbol("transfer");function B(n,e){return{type:L,value:n,transfer:e?Array.isArray(e)?e:[e]:[n]}}function U(n){return!!(n&&typeof n=="object"&&Reflect.get(n,"type")===L)}function q(n="default"){return{createTx(e){const t=new Map,r=e??self;return r.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==n)return;const{id:s,result:i,error:b}=c,w=t.get(s);w&&(b?w.reject(b):w.resolve(i),t.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=ee(),b=[],w=[];return s.forEach(I=>{U(I)?(b.push(I.value),w.push(...I.transfer)):b.push(I)}),r.postMessage({method:c,args:b,id:i,channelName:n},{transfer:w}),new Promise((I,re)=>{t.set(i,{resolve:I,reject:re})})}}})},rx(e,t){const r=t??self;r.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==n)return;const{method:s,args:i,id:b}=c;try{const w=await e[s](...i);U(w)?r.postMessage({result:w.value,id:b,channelName:n},{transfer:w.transfer}):r.postMessage({result:w,id:b,channelName:n})}catch(w){r.postMessage({error:w,id:b,channelName:n})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=q(),{createTx:ne}=q("worker"),p=D(),g=D(),W=ne();te({async initWorker(n,e){Z({module:n}),e&&G(e)},async reader_fromBlob(n,e){const t=await v.fromBlob(n,e);return p.add(t)},async reader_fromBlobFragment(n,e,t){const r=await v.fromBlobFragment(n,e,t);return p.add(r)},reader_activeLabel(n){return p.get(n).activeLabel()??null},reader_manifestStore(n){return p.get(n).manifestStore()},reader_activeManifest(n){return p.get(n).activeManifest()},reader_json(n){return p.get(n).json()},reader_resourceToBytes(n,e){const r=p.get(n).resourceToBytes(e);return B(r,r.buffer)},reader_free(n){p.get(n).free(),p.remove(n)},builder_new(){const n=h.new();return g.add(n)},builder_fromJson(n){const e=h.fromJson(n);return g.add(e)},builder_fromArchive(n){const e=h.fromArchive(n);return g.add(e)},builder_setIntent(n,e){g.get(n).setIntent(e)},builder_addAction(n,e){g.get(n).addAction(e)},builder_setRemoteUrl(n,e){g.get(n).setRemoteUrl(e)},builder_setNoEmbed(n,e){g.get(n).setNoEmbed(e)},builder_setThumbnailFromBlob(n,e,t){g.get(n).setThumbnailFromBlob(e,t)},builder_addIngredientFromBlob(n,e,t,r){g.get(n).addIngredientFromBlob(e,t,r)},builder_addResourceFromBlob(n,e,t){g.get(n).addResourceFromBlob(e,t)},builder_getDefinition(n){return g.get(n).getDefinition()},builder_toArchive(n){const t=g.get(n).toArchive();return B(t,t.buffer)},async builder_sign(n,e,t,r,_){const s=await g.get(n).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async i=>await W.sign(e,B(i,i.buffer),t.reserveSize)},r,_);return B(s,s.buffer)},async builder_signAndGetManifestBytes(n,e,t,r,_){const c=g.get(n),{manifest:s,asset:i}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async b=>await W.sign(e,B(b,b.buffer),t.reserveSize)},r,_);return B({manifest:s,asset:i},[s.buffer,i.buffer])},builder_free(n){g.get(n).free(),g.remove(n)}})})();\n', l = typeof self < "u" && self.Blob && new Blob([B], { type: "text/javascript;charset=utf-8" });
4
- function j(e) {
1
+ import { channel as F, transfer as E } from "highgain";
2
+ import { merge as j } from "ts-deepmerge";
3
+ const { createTx: M, rx: V } = F(), { createTx: Z, rx: z } = F("worker"), x = '(function(){"use strict";let o,S=null;function M(){return(S===null||S.byteLength===0)&&(S=new Uint8Array(o.memory.buffer)),S}let j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});j.decode();const C=2146435072;let x=0;function V(n,e){return x+=e,x>=C&&(j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),j.decode(),x=e),j.decode(M().subarray(n,n+e))}function l(n,e){return n=n>>>0,V(n,e)}function y(n){return n==null}let A=null;function m(){return(A===null||A.buffer.detached===!0||A.buffer.detached===void 0&&A.buffer!==o.memory.buffer)&&(A=new DataView(o.memory.buffer)),A}function E(n){const e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){const _=n.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=n.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(n)){const _=n.length;let c="[";_>0&&(c+=E(n[0]));for(let s=1;s<_;s++)c+=", "+E(n[s]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(n));let r;if(t&&t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}let u=0;const R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(n,e){const t=R.encode(n);return e.set(t),{read:n.length,written:t.length}});function d(n,e,t){if(t===void 0){const i=R.encode(n),b=e(i.length,1)>>>0;return M().subarray(b,b+i.length).set(i),u=i.length,b}let r=n.length,_=e(r,1)>>>0;const c=M();let s=0;for(;s<r;s++){const i=n.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==r){s!==0&&(n=n.slice(s)),_=t(_,r,r=s+n.length*3,1)>>>0;const i=M().subarray(_+s,_+r),b=R.encodeInto(n,i);s+=b.written,_=t(_,r,s,1)>>>0}return u=s,_}function T(n){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,n),e}function f(n,e){try{return n.apply(this,e)}catch(t){const r=T(t);o.__wbindgen_exn_store(r)}}function F(n,e){return n=n>>>0,M().subarray(n/1,n/1+e)}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>n.dtor(n.a,n.b));function N(n,e,t,r){const _={a:n,b:e,cnt:1,dtor:t},c=(...s)=>{_.cnt++;const i=_.a;_.a=0;try{return r(i,_.b,...s)}finally{_.a=i,c._wbg_cb_unref()}};return c._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,O.unregister(_))},O.register(c,_,_),c}function a(n){const e=o.__wbindgen_externrefs.get(n);return o.__externref_table_dealloc(n),e}function G(n){const e=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,r=o.loadSettings(e,t);if(r[1])throw a(r[0])}function P(n,e){o.wasm_bindgen__convert__closures_____invoke__hbb73f02d9cb5eeb0(n,e)}function $(n,e,t){o.wasm_bindgen__convert__closures_____invoke__hedbe22ff1e6181ec(n,e,t)}function J(n,e,t,r){o.wasm_bindgen__convert__closures_____invoke__h1fd2c9ff95892b8d(n,e,t,r)}const H=["default","no-store","reload","no-cache","force-cache","only-if-cached"],X=["omit","same-origin","include"],Y=["same-origin","no-cors","cors","navigate"],k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>o.__wbg_wasmbuilder_free(n>>>0,1));class h{static __wrap(e){e=e>>>0;const t=Object.create(h.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw a(t[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw a(t[0])}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}static fromArchive(e){const t=o.wasmbuilder_fromArchive(e);if(t[2])throw a(t[1]);return h.__wrap(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}setRemoteUrl(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,r)}addResourceFromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,_,t);if(c[1])throw a(c[0])}setThumbnailFromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,_,t);if(c[1])throw a(c[0])}addIngredientFromBlob(e,t,r){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,s=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u,b=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,r);if(b[1])throw a(b[0])}signAndGetManifestBytes(e,t,r){const _=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,r)}static new(){const e=o.wasmbuilder_new();if(e[2])throw a(e[1]);return h.__wrap(e[0])}sign(e,t,r){const _=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,r)}static fromJson(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmbuilder_fromJson(t,r);if(_[2])throw a(_[1]);return h.__wrap(_[0])}}Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>o.__wbg_wasmreader_free(n>>>0,1));class v{static __wrap(e){e=e>>>0;const t=Object.create(v.prototype);return t.__wbg_ptr=e,z.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=l(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}resourceToBytes(e){const t=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,r);if(_[2])throw a(_[1]);return a(_[0])}static fromBlobFragment(e,t,r){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmreader_fromBlobFragment(_,c,t,r)}json(){let e,t;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],t=r[1],l(r[0],r[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t){const r=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;return o.wasmreader_fromBlob(r,_,t)}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>o.__wbg_wasmsigner_free(n>>>0,1));function K(){const n={};return n.wbg={},n.wbg.__wbg_Error_e83987f665cf5504=function(e,t){return Error(l(e,t))},n.wbg.__wbg_Number_bb48ca12f395cd08=function(e){return Number(e)},n.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd=function(e,t){const r=t,_=typeof r=="bigint"?r:void 0;m().setBigInt64(e+8,y(_)?BigInt(0):_,!0),m().setInt32(e+0,!y(_),!0)},n.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68=function(e){const t=e,r=typeof t=="boolean"?t:void 0;return y(r)?16777215:r?1:0},n.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763=function(e,t){const r=E(t),_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f=function(e,t){return e in t},n.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b=function(e){return typeof e=="bigint"},n.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377=function(e){return typeof e=="function"},n.wbg.__wbg___wbindgen_is_object_c818261d21f283a4=function(e){const t=e;return typeof t=="object"&&t!==null},n.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd=function(e){return typeof e=="string"},n.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478=function(e){return e===void 0},n.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50=function(e,t){return e===t},n.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147=function(e,t){return e==t},n.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d=function(e,t){const r=t,_=typeof r=="number"?r:void 0;m().setFloat64(e+8,y(_)?0:_,!0),m().setInt32(e+0,!y(_),!0)},n.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b=function(e,t){const r=t,_=typeof r=="string"?r:void 0;var c=y(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,c,!0)},n.wbg.__wbg___wbindgen_throw_b855445ff6a94295=function(e,t){throw new Error(l(e,t))},n.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9=function(e){e._wbg_cb_unref()},n.wbg.__wbg_abort_28ad55c5825b004d=function(e,t){e.abort(t)},n.wbg.__wbg_abort_e7eb059f72f9ed0c=function(e){e.abort()},n.wbg.__wbg_append_b577eb3a177bc0fa=function(){return f(function(e,t,r,_,c){e.append(l(t,r),l(_,c))},arguments)},n.wbg.__wbg_arrayBuffer_b375eccb84b4ddf3=function(){return f(function(e){return e.arrayBuffer()},arguments)},n.wbg.__wbg_byteLength_bcd42e4025299788=function(e){return e.byteLength},n.wbg.__wbg_call_525440f72fbfc0ea=function(){return f(function(e,t,r){return e.call(t,r)},arguments)},n.wbg.__wbg_call_e762c39fa8ea36bf=function(){return f(function(e,t){return e.call(t)},arguments)},n.wbg.__wbg_clearTimeout_7a42b49784aea641=function(e){return clearTimeout(e)},n.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},n.wbg.__wbg_done_2042aa2670fb1db1=function(e){return e.done},n.wbg.__wbg_entries_e171b586f8f6bdbf=function(e){return Object.entries(e)},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,t){let r,_;try{r=e,_=t,console.error(l(e,t))}finally{o.__wbindgen_free(r,_,1)}},n.wbg.__wbg_fetch_74a3e84ebd2c9a0e=function(e){return fetch(e)},n.wbg.__wbg_fetch_f8ba0e29a9d6de0d=function(e,t){return e.fetch(t)},n.wbg.__wbg_from_a4ad7cbddd0d7135=function(e){return Array.from(e)},n.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return f(function(e,t){globalThis.crypto.getRandomValues(F(e,t))},arguments)},n.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return f(function(e,t){e.getRandomValues(t)},arguments)},n.wbg.__wbg_getTime_14776bfb48a1bff9=function(e){return e.getTime()},n.wbg.__wbg_get_7bed016f185add81=function(e,t){return e[t>>>0]},n.wbg.__wbg_get_efcb449f58ec27c2=function(){return f(function(e,t){return Reflect.get(e,t)},arguments)},n.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(e,t){return e[t]},n.wbg.__wbg_has_787fafc980c3ccdb=function(){return f(function(e,t){return Reflect.has(e,t)},arguments)},n.wbg.__wbg_headers_b87d7eaba61c3278=function(e){return e.headers},n.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38=function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7=function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},n.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef=function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},n.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c=function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},n.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98=function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_isArray_96e0af9891d0945d=function(e){return Array.isArray(e)},n.wbg.__wbg_isSafeInteger_d216eda7911dde36=function(e){return Number.isSafeInteger(e)},n.wbg.__wbg_iterator_e5822695327a3c39=function(){return Symbol.iterator},n.wbg.__wbg_length_69bca3cb64fc8748=function(e){return e.length},n.wbg.__wbg_length_cdd215e10d9dd507=function(e){return e.length},n.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},n.wbg.__wbg_new_0_f9740686d739025c=function(){return new Date},n.wbg.__wbg_new_0d96c0bf6ceac0b0=function(){return f(function(){return new FileReaderSync},arguments)},n.wbg.__wbg_new_1acc0b6eea89d040=function(){return new Object},n.wbg.__wbg_new_2531773dac38ebb3=function(){return f(function(){return new AbortController},arguments)},n.wbg.__wbg_new_3c3d849046688a66=function(e,t){try{var r={a:e,b:t},_=(s,i)=>{const b=r.a;r.a=0;try{return J(b,r.b,s,i)}finally{r.a=b}};return new Promise(_)}finally{r.a=r.b=0}},n.wbg.__wbg_new_5a79be3ab53b8aa5=function(e){return new Uint8Array(e)},n.wbg.__wbg_new_68651c719dcda04e=function(){return new Map},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_new_9edf9838a2def39c=function(){return f(function(){return new Headers},arguments)},n.wbg.__wbg_new_a7442b4b19c1a356=function(e,t){return new Error(l(e,t))},n.wbg.__wbg_new_e17d9f43105b08be=function(){return new Array},n.wbg.__wbg_new_from_slice_92f4d78ca282a2d2=function(e,t){return new Uint8Array(F(e,t))},n.wbg.__wbg_new_no_args_ee98eee5275000a4=function(e,t){return new Function(l(e,t))},n.wbg.__wbg_new_with_length_01aa0dc35aa13543=function(e){return new Uint8Array(e>>>0)},n.wbg.__wbg_new_with_str_and_init_0ae7728b6ec367b1=function(){return f(function(e,t,r){return new Request(l(e,t),r)},arguments)},n.wbg.__wbg_next_020810e0ae8ebcb0=function(){return f(function(e){return e.next()},arguments)},n.wbg.__wbg_next_2c826fe5dfec6b6a=function(e){return e.next},n.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},n.wbg.__wbg_now_793306c526e2e3b6=function(){return Date.now()},n.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},n.wbg.__wbg_prototypesetcall_2a6620b6922694b2=function(e,t,r){Uint8Array.prototype.set.call(F(e,t),r)},n.wbg.__wbg_queueMicrotask_34d692c25c47d05b=function(e){return e.queueMicrotask},n.wbg.__wbg_queueMicrotask_9d76cacb20c84d58=function(e){queueMicrotask(e)},n.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return f(function(e,t){e.randomFillSync(t)},arguments)},n.wbg.__wbg_readAsArrayBuffer_36927e3348e676c3=function(){return f(function(e,t){return e.readAsArrayBuffer(t)},arguments)},n.wbg.__wbg_require_60cc747a6bc5215a=function(){return f(function(){return module.require},arguments)},n.wbg.__wbg_resolve_caf97c30b83f7053=function(e){return Promise.resolve(e)},n.wbg.__wbg_setTimeout_7bb3429662ab1e70=function(e,t){return setTimeout(e,t)},n.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,r){e[t]=r},n.wbg.__wbg_set_907fb406c34a251d=function(e,t,r){return e.set(t,r)},n.wbg.__wbg_set_9e6516df7b7d0f19=function(e,t,r){e.set(F(t,r))},n.wbg.__wbg_set_body_3c365989753d61f4=function(e,t){e.body=t},n.wbg.__wbg_set_c213c871859d6500=function(e,t,r){e[t>>>0]=r},n.wbg.__wbg_set_cache_2f9deb19b92b81e3=function(e,t){e.cache=H[t]},n.wbg.__wbg_set_credentials_f621cd2d85c0c228=function(e,t){e.credentials=X[t]},n.wbg.__wbg_set_headers_6926da238cd32ee4=function(e,t){e.headers=t},n.wbg.__wbg_set_method_c02d8cbbe204ac2d=function(e,t,r){e.method=l(t,r)},n.wbg.__wbg_set_mode_52ef73cfa79639cb=function(e,t){e.mode=Y[t]},n.wbg.__wbg_set_signal_dda2cf7ccb6bee0f=function(e,t){e.signal=t},n.wbg.__wbg_signal_4db5aa055bf9eb9a=function(e){return e.signal},n.wbg.__wbg_size_0a5a003dbf5dfee8=function(e){return e.size},n.wbg.__wbg_slice_4947c0e051116da5=function(){return f(function(e,t,r){return e.slice(t,r)},arguments)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,t){const r=t.stack,_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e=function(){const e=typeof global>"u"?null:global;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac=function(){const e=typeof globalThis>"u"?null:globalThis;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b=function(){const e=typeof self>"u"?null:self;return y(e)?0:T(e)},n.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2=function(){const e=typeof window>"u"?null:window;return y(e)?0:T(e)},n.wbg.__wbg_status_de7eed5a7a5bfd5d=function(e){return e.status},n.wbg.__wbg_stringify_b5fb28f6465d9c3e=function(){return f(function(e){return JSON.stringify(e)},arguments)},n.wbg.__wbg_subarray_480600f3d6a9f26c=function(e,t,r){return e.subarray(t>>>0,r>>>0)},n.wbg.__wbg_then_4f46f6544e6b4a28=function(e,t){return e.then(t)},n.wbg.__wbg_then_70d05cf780a18d77=function(e,t,r){return e.then(t,r)},n.wbg.__wbg_url_b36d2a5008eb056f=function(e,t){const r=t.url,_=d(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},n.wbg.__wbg_valueOf_e1f2752ef9caddb2=function(e){return e.valueOf()},n.wbg.__wbg_value_692627309814bb8c=function(e){return e.value},n.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},n.wbg.__wbg_wasmreader_new=function(e){return v.__wrap(e)},n.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,t){return l(e,t)},n.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,t){return BigInt.asUintN(64,e)|t<<BigInt(64)},n.wbg.__wbindgen_cast_3f8afe4d69afce15=function(e,t){return N(e,t,o.wasm_bindgen__closure__destroy__h4e2af4dd32e0f9a7,$)},n.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},n.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,t){var r=F(e,t).slice();return o.__wbindgen_free(e,t*1,1),r},n.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},n.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,t){return F(e,t)},n.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},n.wbg.__wbindgen_cast_eea71553507a2f52=function(e,t){return N(e,t,o.wasm_bindgen__closure__destroy__h3685db4568587cc8,P)},n.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},n}function Q(n,e){return o=n.exports,A=null,S=null,o.__wbindgen_start(),o}function Z(n){if(o!==void 0)return o;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=K();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));const t=new WebAssembly.Instance(n,e);return Q(t)}function D(){let n=0;const e=new Map;return{add(t){const r=n++;return e.set(r,t),r},get(t){const r=e.get(t);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(t){return e.delete(t)}}}const L=Symbol("transfer");function B(n,e){return{type:L,value:n,transfer:e?Array.isArray(e)?e:[e]:[n]}}function U(n){return!!(n&&typeof n=="object"&&Reflect.get(n,"type")===L)}function q(n="default"){return{createTx(e){const t=new Map,r=e??self;return r.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==n)return;const{id:s,result:i,error:b}=c,w=t.get(s);w&&(b?w.reject(b):w.resolve(i),t.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=ee(),b=[],w=[];return s.forEach(I=>{U(I)?(b.push(I.value),w.push(...I.transfer)):b.push(I)}),r.postMessage({method:c,args:b,id:i,channelName:n},{transfer:w}),new Promise((I,re)=>{t.set(i,{resolve:I,reject:re})})}}})},rx(e,t){const r=t??self;r.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==n)return;const{method:s,args:i,id:b}=c;try{const w=await e[s](...i);U(w)?r.postMessage({result:w.value,id:b,channelName:n},{transfer:w.transfer}):r.postMessage({result:w,id:b,channelName:n})}catch(w){r.postMessage({error:w,id:b,channelName:n})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=q(),{createTx:ne}=q("worker"),p=D(),g=D(),W=ne();te({async initWorker(n,e){Z({module:n}),e&&G(e)},async reader_fromBlob(n,e){const t=await v.fromBlob(n,e);return p.add(t)},async reader_fromBlobFragment(n,e,t){const r=await v.fromBlobFragment(n,e,t);return p.add(r)},reader_activeLabel(n){return p.get(n).activeLabel()??null},reader_manifestStore(n){return p.get(n).manifestStore()},reader_activeManifest(n){return p.get(n).activeManifest()},reader_json(n){return p.get(n).json()},reader_resourceToBytes(n,e){const r=p.get(n).resourceToBytes(e);return B(r,r.buffer)},reader_free(n){p.get(n).free(),p.remove(n)},builder_new(){const n=h.new();return g.add(n)},builder_fromJson(n){const e=h.fromJson(n);return g.add(e)},builder_fromArchive(n){const e=h.fromArchive(n);return g.add(e)},builder_setIntent(n,e){g.get(n).setIntent(e)},builder_addAction(n,e){g.get(n).addAction(e)},builder_setRemoteUrl(n,e){g.get(n).setRemoteUrl(e)},builder_setNoEmbed(n,e){g.get(n).setNoEmbed(e)},builder_setThumbnailFromBlob(n,e,t){g.get(n).setThumbnailFromBlob(e,t)},builder_addIngredientFromBlob(n,e,t,r){g.get(n).addIngredientFromBlob(e,t,r)},builder_addResourceFromBlob(n,e,t){g.get(n).addResourceFromBlob(e,t)},builder_getDefinition(n){return g.get(n).getDefinition()},builder_toArchive(n){const t=g.get(n).toArchive();return B(t,t.buffer)},async builder_sign(n,e,t,r,_){const s=await g.get(n).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async i=>await W.sign(e,B(i,i.buffer),t.reserveSize)},r,_);return B(s,s.buffer)},async builder_signAndGetManifestBytes(n,e,t,r,_){const c=g.get(n),{manifest:s,asset:i}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async b=>await W.sign(e,B(b,b.buffer),t.reserveSize)},r,_);return B({manifest:s,asset:i},[s.buffer,i.buffer])},builder_free(n){g.get(n).free(),g.remove(n)}})})();\n', l = typeof self < "u" && self.Blob && new Blob([x], { type: "text/javascript;charset=utf-8" });
4
+ function N(e) {
5
5
  let n;
6
6
  try {
7
7
  if (n = l && (self.URL || self.webkitURL).createObjectURL(l), !n) throw "";
8
- const o = new Worker(n, {
8
+ const _ = new Worker(n, {
9
9
  name: e == null ? void 0 : e.name
10
10
  });
11
- return o.addEventListener("error", () => {
11
+ return _.addEventListener("error", () => {
12
12
  (self.URL || self.webkitURL).revokeObjectURL(n);
13
- }), o;
13
+ }), _;
14
14
  } catch {
15
15
  return new Worker(
16
- "data:text/javascript;charset=utf-8," + encodeURIComponent(B),
16
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(x),
17
17
  {
18
18
  name: e == null ? void 0 : e.name
19
19
  }
@@ -22,28 +22,28 @@ function j(e) {
22
22
  n && (self.URL || self.webkitURL).revokeObjectURL(n);
23
23
  }
24
24
  }
25
- async function E(e) {
26
- const { wasm: n, settingsString: o } = e;
25
+ async function O(e) {
26
+ const { wasm: n, settingsString: _ } = e;
27
27
  let r = 0;
28
- const t = new j(), _ = T(t), i = /* @__PURE__ */ new Map();
29
- M(
28
+ const t = new N(), o = M(t), i = /* @__PURE__ */ new Map();
29
+ z(
30
30
  {
31
- sign: async (c, s, F) => {
32
- const w = i.get(c);
33
- if (i.delete(c), !w)
31
+ sign: async (s, c, T) => {
32
+ const w = i.get(s);
33
+ if (i.delete(s), !w)
34
34
  throw new Error("No signer registered for request");
35
- const d = await w(s, F);
36
- return x(d, d.buffer);
35
+ const d = await w(c, T);
36
+ return E(d, d.buffer);
37
37
  }
38
38
  },
39
39
  t
40
40
  );
41
- function a(c) {
42
- const s = r++;
43
- return i.set(s, c), s;
41
+ function a(s) {
42
+ const c = r++;
43
+ return i.set(c, s), c;
44
44
  }
45
- return await _.initWorker(n, o), {
46
- tx: _,
45
+ return await o.initWorker(n, _), {
46
+ tx: o,
47
47
  registerSignReceiver: a,
48
48
  terminate: () => t.terminate()
49
49
  };
@@ -60,7 +60,7 @@ class y extends Error {
60
60
  super(`Unsupported format: ${n}.`), this.name = "UnsupportedFormatError";
61
61
  }
62
62
  }
63
- const z = [
63
+ const U = [
64
64
  "jpg",
65
65
  "video/mp4",
66
66
  "image/heif",
@@ -120,11 +120,11 @@ const z = [
120
120
  "heif"
121
121
  ];
122
122
  function p(e) {
123
- return z.includes(e);
123
+ return U.includes(e);
124
124
  }
125
125
  const f = 10 ** 9;
126
126
  function L(e) {
127
- const { tx: n } = e, o = new FinalizationRegistry(async (r) => {
127
+ const { tx: n } = e, _ = new FinalizationRegistry(async (r) => {
128
128
  await n.reader_free(r);
129
129
  });
130
130
  return {
@@ -134,15 +134,15 @@ function L(e) {
134
134
  if (t.size > f)
135
135
  throw new m(t.size);
136
136
  try {
137
- const _ = await n.reader_fromBlob(r, t), i = v(e, _, () => {
138
- o.unregister(i);
137
+ const o = await n.reader_fromBlob(r, t), i = v(e, o, () => {
138
+ _.unregister(i);
139
139
  });
140
- return o.register(i, _, i), i;
141
- } catch (_) {
142
- return h(_);
140
+ return _.register(i, o, i), i;
141
+ } catch (o) {
142
+ return h(o);
143
143
  }
144
144
  },
145
- async fromBlobFragment(r, t, _) {
145
+ async fromBlobFragment(r, t, o) {
146
146
  if (!p(r))
147
147
  throw new y(r);
148
148
  if (t.size > f)
@@ -151,11 +151,11 @@ function L(e) {
151
151
  const i = await n.reader_fromBlobFragment(
152
152
  r,
153
153
  t,
154
- _
154
+ o
155
155
  ), a = v(e, i, () => {
156
- o.unregister(a);
156
+ _.unregister(a);
157
157
  });
158
- return o.register(a, i, a), a;
158
+ return _.register(a, i, a), a;
159
159
  } catch (i) {
160
160
  return h(i);
161
161
  }
@@ -167,7 +167,7 @@ function h(e) {
167
167
  return null;
168
168
  throw e;
169
169
  }
170
- function v(e, n, o) {
170
+ function v(e, n, _) {
171
171
  const { tx: r } = e;
172
172
  return {
173
173
  async activeLabel() {
@@ -187,75 +187,100 @@ function v(e, n, o) {
187
187
  return await r.reader_resourceToBytes(n, t);
188
188
  },
189
189
  async free() {
190
- o(), await r.reader_free(n);
190
+ _(), await r.reader_free(n);
191
191
  }
192
192
  };
193
193
  }
194
- let g, N = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
195
- N.decode();
194
+ let g, k = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
195
+ k.decode();
196
196
  const b = new TextEncoder();
197
197
  "encodeInto" in b || (b.encodeInto = function(e, n) {
198
- const o = b.encode(e);
199
- return n.set(o), {
198
+ const _ = b.encode(e);
199
+ return n.set(_), {
200
200
  read: e.length,
201
- written: o.length
201
+ written: _.length
202
202
  };
203
203
  });
204
204
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => e.dtor(e.a, e.b));
205
205
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e >>> 0, 1));
206
206
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e >>> 0, 1));
207
207
  typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e >>> 0, 1));
208
- const U = "sha512-0Bft1wLozl93+XmqnNddxgbrBhvF/jz1S1VLEXcAqfygqW7AZ4nrrpSR2I0YqD9+dBNlIgzMULACLQFfxfZlGA==", O = {
208
+ const D = "sha512-BgNa7gSOC/bbT/nj29wwZ2H/2J6ZAai0H1nnTqptiGmHp2Yi0H/2JzgJgt752C83SDNhe8TUDb/+Cnu+uPoPcw==", C = {
209
209
  builder: {
210
210
  generateC2paArchive: !0
211
211
  }
212
212
  };
213
- function k(e) {
214
- const n = I(O, e);
215
- return JSON.stringify(S(n));
213
+ async function W(e) {
214
+ const n = j(C, e), _ = [];
215
+ return n.trust && _.push(A(n.trust)), n.cawgTrust && _.push(A(n.cawgTrust)), await Promise.all(_), JSON.stringify(I(n));
216
216
  }
217
- function S(e) {
217
+ function I(e) {
218
218
  return Object.entries(e).reduce(
219
- (o, [r, t]) => (o[q(r)] = typeof t == "object" ? S(t) : t, o),
219
+ (_, [r, t]) => (_[P(r)] = typeof t == "object" ? I(t) : t, _),
220
220
  {}
221
221
  );
222
222
  }
223
- function q(e) {
223
+ function P(e) {
224
224
  return e.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
225
225
  }
226
226
  async function A(e) {
227
+ try {
228
+ const n = Object.entries(e).map(async ([_, r]) => {
229
+ if (Array.isArray(r)) {
230
+ const t = r.map(async (a) => {
231
+ const c = await (await fetch(a)).text();
232
+ if (R(_) && !S(c))
233
+ throw new Error(`Error parsing PEM file at: ${a}`);
234
+ return c;
235
+ }), i = (await Promise.all(t)).join("");
236
+ e[_] = i;
237
+ } else if (r && q(r)) {
238
+ const o = await (await fetch(r)).text();
239
+ if (R(_) && !S(o))
240
+ throw new Error(`Error parsing PEM file at: ${r}`);
241
+ e[_] = o;
242
+ } else
243
+ return r;
244
+ });
245
+ await Promise.all(n);
246
+ } catch (n) {
247
+ throw new Error("Failed to resolve trust settings.", { cause: n });
248
+ }
249
+ }
250
+ const R = (e) => ["userAnchors", "trustAnchors"].includes(e), S = (e) => e.includes("-----BEGIN CERTIFICATE-----"), q = (e) => e.startsWith("http");
251
+ async function B(e) {
227
252
  const { alg: n } = e;
228
253
  return {
229
254
  reserveSize: await e.reserveSize(),
230
255
  alg: n
231
256
  };
232
257
  }
233
- function D(e) {
234
- const { tx: n } = e, o = new FinalizationRegistry((r) => {
258
+ function J(e) {
259
+ const { tx: n } = e, _ = new FinalizationRegistry((r) => {
235
260
  n.builder_free(r);
236
261
  });
237
262
  return {
238
263
  async new() {
239
264
  const r = await n.builder_new(), t = u(e, r, () => {
240
- o.unregister(t);
265
+ _.unregister(t);
241
266
  });
242
- return o.register(t, r, t), t;
267
+ return _.register(t, r, t), t;
243
268
  },
244
269
  async fromDefinition(r) {
245
- const t = JSON.stringify(r), _ = await n.builder_fromJson(t), i = u(e, _, () => {
246
- o.unregister(i);
270
+ const t = JSON.stringify(r), o = await n.builder_fromJson(t), i = u(e, o, () => {
271
+ _.unregister(i);
247
272
  });
248
- return o.register(i, _, i), i;
273
+ return _.register(i, o, i), i;
249
274
  },
250
275
  async fromArchive(r) {
251
- const t = await n.builder_fromArchive(r), _ = u(e, t, () => {
252
- o.unregister(_);
276
+ const t = await n.builder_fromArchive(r), o = u(e, t, () => {
277
+ _.unregister(o);
253
278
  });
254
- return o.register(_, t, _), _;
279
+ return _.register(o, t, o), o;
255
280
  }
256
281
  };
257
282
  }
258
- function u(e, n, o) {
283
+ function u(e, n, _) {
259
284
  const { tx: r } = e;
260
285
  return {
261
286
  async setIntent(t) {
@@ -270,15 +295,15 @@ function u(e, n, o) {
270
295
  async setNoEmbed(t) {
271
296
  await r.builder_setNoEmbed(n, t);
272
297
  },
273
- async setThumbnailFromBlob(t, _) {
274
- await r.builder_setThumbnailFromBlob(n, t, _);
298
+ async setThumbnailFromBlob(t, o) {
299
+ await r.builder_setThumbnailFromBlob(n, t, o);
275
300
  },
276
- async addIngredientFromBlob(t, _, i) {
301
+ async addIngredientFromBlob(t, o, i) {
277
302
  const a = JSON.stringify(t);
278
- await r.builder_addIngredientFromBlob(n, a, _, i);
303
+ await r.builder_addIngredientFromBlob(n, a, o, i);
279
304
  },
280
- async addResourceFromBlob(t, _) {
281
- await r.builder_addResourceFromBlob(n, t, _);
305
+ async addResourceFromBlob(t, o) {
306
+ await r.builder_addResourceFromBlob(n, t, o);
282
307
  },
283
308
  async getDefinition() {
284
309
  return await r.builder_getDefinition(n);
@@ -286,45 +311,45 @@ function u(e, n, o) {
286
311
  async toArchive() {
287
312
  return await r.builder_toArchive(n);
288
313
  },
289
- async sign(t, _, i) {
290
- const a = await A(t), c = e.registerSignReceiver(t.sign);
314
+ async sign(t, o, i) {
315
+ const a = await B(t), s = e.registerSignReceiver(t.sign);
291
316
  return await r.builder_sign(
292
317
  n,
293
- c,
318
+ s,
294
319
  a,
295
- _,
320
+ o,
296
321
  i
297
322
  );
298
323
  },
299
- async signAndGetManifestBytes(t, _, i) {
300
- const a = await A(t), c = e.registerSignReceiver(t.sign);
324
+ async signAndGetManifestBytes(t, o, i) {
325
+ const a = await B(t), s = e.registerSignReceiver(t.sign);
301
326
  return await r.builder_signAndGetManifestBytes(
302
327
  n,
303
- c,
328
+ s,
304
329
  a,
305
- _,
330
+ o,
306
331
  i
307
332
  );
308
333
  },
309
334
  async free() {
310
- o(), await r.builder_free(n);
335
+ _(), await r.builder_free(n);
311
336
  }
312
337
  };
313
338
  }
314
- async function P(e) {
315
- const { wasmSrc: n, settings: o } = e, r = typeof n == "string" ? await W(n) : n, t = o ? k(o) : void 0, _ = await E({ wasm: r, settingsString: t });
339
+ async function X(e) {
340
+ const { wasmSrc: n, settings: _ } = e, r = typeof n == "string" ? await $(n) : n, t = _ ? await W(_) : void 0, o = await O({ wasm: r, settingsString: t });
316
341
  return {
317
- reader: L(_),
318
- builder: D(_),
319
- dispose: _.terminate
342
+ reader: L(o),
343
+ builder: J(o),
344
+ dispose: o.terminate
320
345
  };
321
346
  }
322
- async function W(e) {
323
- const n = await fetch(e, { integrity: U });
347
+ async function $(e) {
348
+ const n = await fetch(e, { integrity: D });
324
349
  return await WebAssembly.compileStreaming(n);
325
350
  }
326
351
  export {
327
- z as R,
328
- P as c,
352
+ U as R,
353
+ X as c,
329
354
  p as i
330
355
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as r, c as R, i as o } from "./c2pa-ebBVH9UY.js";
1
+ import { R as r, c as R, i as o } from "./c2pa-BgMc2N9M.js";
2
2
  export {
3
3
  r as READER_SUPPORTED_FORMATS,
4
4
  R as createC2pa,