@contentauth/c2pa-web 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { channel as
|
|
2
|
-
const { createTx: S, rx: W } = v(), { createTx: q, rx: T } = v("worker"), x = '(function(){"use strict";let o,T=null;function x(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(o.memory.buffer)),T}let R=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&R.decode();const C=2146435072;let j=0;function V(t,e){return j+=e,j>=C&&(R=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},R.decode(),j=e),R.decode(x().subarray(t,t+e))}function w(t,e){return t=t>>>0,V(t,e)}function M(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function b(t,e){try{return t.apply(this,e)}catch(n){const r=M(n);o.__wbindgen_exn_store(r)}}function h(t,e){return t=t>>>0,x().subarray(t/1,t/1+e)}let u=0;const E=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},G=typeof E.encodeInto=="function"?function(t,e){return E.encodeInto(t,e)}:function(t,e){const n=E.encode(t);return e.set(n),{read:t.length,written:n.length}};function f(t,e,n){if(n===void 0){const i=E.encode(t),a=e(i.length,1)>>>0;return x().subarray(a,a+i.length).set(i),u=i.length,a}let r=t.length,_=e(r,1)>>>0;const c=x();let s=0;for(;s<r;s++){const i=t.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==r){s!==0&&(t=t.slice(s)),_=n(_,r,r=s+t.length*3,1)>>>0;const i=x().subarray(_+s,_+r),a=G(t,i);s+=a.written,_=n(_,r,s,1)>>>0}return u=s,_}let p=null;function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==o.memory.buffer)&&(p=new DataView(o.memory.buffer)),p}function F(t){return t==null}function I(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+=I(t[0]));for(let s=1;s<_;s++)c+=", "+I(t[s]);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}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function D(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...s)=>{_.cnt++;const i=_.a;_.a=0;try{return r(i,_.b,...s)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(i,_.b),O.unregister(_)):_.a=i}};return c.original=_,O.register(c,_,_),c}function g(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function P(t){const e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,r=o.loadSettings(e,n);if(r[1])throw g(r[0])}function $(t,e){o.wasm_bindgen__convert__closures_____invoke__h7416124e9fa3b9aa(t,e)}function J(t,e,n){o.closure1671_externref_shim(t,e,n)}function H(t,e,n,r){o.closure2624_externref_shim(t,e,n,r)}const X=["omit","same-origin","include"],Y=["same-origin","no-cors","cors","navigate"],N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmbuilder_free(t>>>0,1));class v{static __wrap(e){e=e>>>0;const n=Object.create(v.prototype);return n.__wbg_ptr=e,N.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}static fromJson(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmbuilder_fromJson(n,r);if(_[2])throw g(_[1]);return v.__wrap(_[0])}setRemoteUrl(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,n,r)}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setThumbnailFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}addIngredientFromBlob(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,s=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u,a=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,r);if(a[1])throw g(a[0])}addResourceFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}sign(e,n,r){const _=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,r)}signAndGetManifestBytes(e,n,r){const _=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,r)}}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class S{static __wrap(e){e=e>>>0;const n=Object.create(S.prototype);return n.__wbg_ptr=e,z.register(n,n.__wbg_ptr,n),n}__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)}static fromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmreader_fromBlobFragment(_,c,n,r)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=w(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 g(e[1]);return g(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],w(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw g(_[1]);return g(_[0])}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>o.__wbg_wasmsigner_free(t>>>0,1));function K(){const t={};return t.wbg={},t.wbg.__wbg_Error_1f3748b298f99708=function(e,n){return Error(w(e,n))},t.wbg.__wbg_Number_577a493fc95ea223=function(e){return Number(e)},t.wbg.__wbg_abort_6665281623826052=function(e){e.abort()},t.wbg.__wbg_abort_c11a5d245a242912=function(e,n){e.abort(n)},t.wbg.__wbg_append_3e86b0cd6215edd8=function(){return b(function(e,n,r,_,c){e.append(w(n,r),w(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_55e4a430671abfd8=function(){return b(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_1f897e9f3ed6b41d=function(e){return e.buffer},t.wbg.__wbg_byteLength_7029fecd0c136e6d=function(e){return e.byteLength},t.wbg.__wbg_call_2f8d426a20a307fe=function(){return b(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_f53f0647ceb9c567=function(){return b(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},t.wbg.__wbg_done_4a7743b6f942c9f3=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(w(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_9885d2e26ad251bb=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_237b1ad767238d8b=function(e){return Array.from(e)},t.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return b(function(e,n){globalThis.crypto.getRandomValues(h(e,n))},arguments)},t.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return b(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_getTime_5b1dd03bb6d4b784=function(e){return e.getTime()},t.wbg.__wbg_get_27b4bcbec57323ca=function(){return b(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_85abdd8aeb8edebf=function(){return b(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_177bc880a5823968=function(e){return e.headers},t.wbg.__wbg_instanceof_Promise_1147df2e75727145=function(e){let n;try{n=e instanceof Promise}catch{n=!1}return n},t.wbg.__wbg_instanceof_Response_0ab386c6818f788a=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_96378c3c9a17347c=function(){return Symbol.iterator},t.wbg.__wbg_length_904c0910ed998bf3=function(e){return e.length},t.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},t.wbg.__wbg_new0_85cc856927102294=function(){return new Date},t.wbg.__wbg_new_12588505388d0897=function(){return b(function(){return new Headers},arguments)},t.wbg.__wbg_new_1930cbb8d9ffc31b=function(){return new Object},t.wbg.__wbg_new_56407f99198feff7=function(){return new Map},t.wbg.__wbg_new_6a8b180049d9484e=function(){return b(function(){return new AbortController},arguments)},t.wbg.__wbg_new_7e574c906ccc59b1=function(){return b(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_9190433fb67ed635=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_97ddeb994a38bb69=function(e,n){return new Error(w(e,n))},t.wbg.__wbg_new_d5e3800b120e37e1=function(e,n){try{var r={a:e,b:n},_=(s,i)=>{const a=r.a;r.a=0;try{return H(a,r.b,s,i)}finally{r.a=a}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_e969dc3f68d25093=function(){return new Array},t.wbg.__wbg_newfromslice_d0d56929c6d9c842=function(e,n){return new Uint8Array(h(e,n))},t.wbg.__wbg_newnoargs_a81330f6e05d8aca=function(e,n){return new Function(w(e,n))},t.wbg.__wbg_newwithlength_ed0ee6c1edca86fc=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_e8e22e9851f3c2fe=function(){return b(function(e,n,r){return new Request(w(e,n),r)},arguments)},t.wbg.__wbg_next_2e6b37020ac5fe58=function(){return b(function(e){return e.next()},arguments)},t.wbg.__wbg_next_3de8f2669431a3ff=function(e){return e.next},t.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},t.wbg.__wbg_now_e3057dd824ca0191=function(){return Date.now()},t.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},t.wbg.__wbg_prototypesetcall_c5f74efd31aea86b=function(e,n,r){Uint8Array.prototype.set.call(h(e,n),r)},t.wbg.__wbg_queueMicrotask_bcc6e26d899696db=function(e){return e.queueMicrotask},t.wbg.__wbg_queueMicrotask_f24a794d09c42640=function(e){queueMicrotask(e)},t.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return b(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_readAsArrayBuffer_b45cdda102d3c0b2=function(){return b(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_require_60cc747a6bc5215a=function(){return b(function(){return module.require},arguments)},t.wbg.__wbg_resolve_5775c0ef9222f556=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_1d5fe1e3f51a48d8=function(e,n,r){e.set(h(n,r))},t.wbg.__wbg_set_31197016f65a6a19=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_d636a0463acf1dbc=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_setbody_e324371c31597f2a=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_55a9317ed2777533=function(e,n){e.credentials=X[n]},t.wbg.__wbg_setheaders_ac0b1e4890a949cd=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_9ce6e95af1ae0eaf=function(e,n,r){e.method=w(n,r)},t.wbg.__wbg_setmode_b89d1784e7e7f118=function(e,n){e.mode=Y[n]},t.wbg.__wbg_setsignal_e663c6d962763cd5=function(e,n){e.signal=n},t.wbg.__wbg_signal_bdb003fe19e53a13=function(e){return e.signal},t.wbg.__wbg_size_4181b899cbfa6483=function(e){return e.size},t.wbg.__wbg_slice_dc41c7f2c4886814=function(){return b(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_1f13249cc3acc96d=function(){const e=typeof global>"u"?null:global;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3=function(){const e=typeof globalThis>"u"?null:globalThis;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_SELF_6265471db3b3c228=function(){const e=typeof self>"u"?null:self;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_WINDOW_16fb482f8ec52863=function(){const e=typeof window>"u"?null:window;return F(e)?0:M(e)},t.wbg.__wbg_status_31874648c8651949=function(e){return e.status},t.wbg.__wbg_stringify_1f41b6198e0932e0=function(){return b(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_subarray_a219824899e59712=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_then_8d2fcccde5380a03=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_then_9cc266be2bf537b6=function(e,n){return e.then(n)},t.wbg.__wbg_url_d5273b9e10503471=function(e,n){const r=n.url,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_valueOf_94f1c9efbe2ba399=function(e){return e.valueOf()},t.wbg.__wbg_value_09d0b4eaab48b91d=function(e){return e.value},t.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},t.wbg.__wbg_wasmreader_new=function(e){return S.__wrap(e)},t.wbg.__wbg_wbindgencbdrop_a85ed476c6a370b9=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d=function(e,n){const r=I(n),_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_wbindgenisfunction_ea72b9d66a0e1705=function(e){return typeof e=="function"},t.wbg.__wbg_wbindgenisobject_dfe064a121d87553=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbg_wbindgenisstring_4b74e4111ba029e6=function(e){return typeof e=="string"},t.wbg.__wbg_wbindgenisundefined_71f08a6ade4354e7=function(e){return e===void 0},t.wbg.__wbg_wbindgenstringget_43fe05afe34b0cb1=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=F(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;y().setInt32(e+4,s,!0),y().setInt32(e+0,c,!0)},t.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf=function(e,n){throw new Error(w(e,n))},t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,n){return w(e,n)},t.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,n){return BigInt.asUintN(64,e)|n<<BigInt(64)},t.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,n){var r=h(e,n).slice();return o.__wbindgen_free(e,n*1,1),r},t.wbg.__wbindgen_cast_7920211b6bf3825e=function(e,n){return D(e,n,1660,J)},t.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},t.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,n){return h(e,n)},t.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},t.wbg.__wbindgen_cast_da253e46cc5a287c=function(e,n){return D(e,n,1653,$)},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}function Q(t,e){return o=t.exports,p=null,T=null,o.__wbindgen_start(),o}function Z(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=K();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return Q(n)}function L(){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 k=Symbol("transfer");function A(t,e){return{type:k,value:t,transfer:e?Array.isArray(e)?e:[e]:[t]}}function U(t){return!!(t&&typeof t=="object"&&Reflect.get(t,"type")===k)}function W(t="default"){return{createTx(e){const n=new Map,r=e??self;return r.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==t)return;const{id:s,result:i,error:a}=c,d=n.get(s);d&&(a?d.reject(a):d.resolve(i),n.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=ee(),a=[],d=[];return s.forEach(B=>{U(B)?(a.push(B.value),d.push(...B.transfer)):a.push(B)}),r.postMessage({method:c,args:a,id:i,channelName:t},{transfer:d}),new Promise((B,re)=>{n.set(i,{resolve:B,reject:re})})}}})},rx(e,n){const r=n??self;r.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==t)return;const{method:s,args:i,id:a}=c;try{const d=await e[s](...i);U(d)?r.postMessage({result:d.value,id:a,channelName:t},{transfer:d.transfer}):r.postMessage({result:d,id:a,channelName:t})}catch(d){r.postMessage({error:d,id:a,channelName:t})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=W(),{createTx:ne}=W("worker"),m=L(),l=L(),q=ne();te({async initWorker(t,e){Z(t),e&&P(e)},async reader_fromBlob(t,e){const n=await S.fromBlob(t,e);return m.add(n)},async reader_fromBlobFragment(t,e,n){const r=await S.fromBlobFragment(t,e,n);return m.add(r)},reader_activeLabel(t){return m.get(t).activeLabel()??null},reader_manifestStore(t){return m.get(t).manifestStore()},reader_activeManifest(t){return m.get(t).activeManifest()},reader_json(t){return m.get(t).json()},reader_resourceToBuffer(t,e){const r=m.get(t).resourceToBuffer(e);return A(r)},reader_free(t){m.get(t).free(),m.remove(t)},builder_fromJson(t){const e=v.fromJson(t);return l.add(e)},builder_setRemoteUrl(t,e){l.get(t).setRemoteUrl(e)},builder_setNoEmbed(t,e){l.get(t).setNoEmbed(e)},builder_setThumbnailFromBlob(t,e,n){l.get(t).setThumbnailFromBlob(e,n)},builder_addIngredientFromBlob(t,e,n,r){l.get(t).addIngredientFromBlob(e,n,r)},builder_addResourceFromBlob(t,e,n){l.get(t).addResourceFromBlob(e,n)},builder_getDefinition(t){return l.get(t).getDefinition()},async builder_sign(t,e,n,r,_){const s=await l.get(t).sign({reserveSize:n.reserveSize,alg:n.alg,sign:async i=>await q.sign(e,A(i,i.buffer),n.reserveSize)},r,_);return A(s,s.buffer)},async builder_signAndGetManifestBytes(t,e,n,r,_){const c=l.get(t),{manifest:s,asset:i}=await c.signAndGetManifestBytes({reserveSize:n.reserveSize,alg:n.alg,sign:async a=>await q.sign(e,A(a,a.buffer),n.reserveSize)},r,_);return A({manifest:s,asset:i},[s.buffer,i.buffer])},builder_free(t){l.get(t).free(),l.remove(t)}})})();\n', d = typeof self < "u" && self.Blob && new Blob([x], { type: "text/javascript;charset=utf-8" });
|
|
3
|
-
function
|
|
1
|
+
import { channel as x, transfer as S } from "highgain";
|
|
2
|
+
const { createTx: T, rx: q } = x(), { createTx: C, rx: E } = x("worker"), R = '(function(){"use strict";let o,T=null;function x(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(o.memory.buffer)),T}let R=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&R.decode();const C=2146435072;let j=0;function V(t,e){return j+=e,j>=C&&(R=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},R.decode(),j=e),R.decode(x().subarray(t,t+e))}function w(t,e){return t=t>>>0,V(t,e)}function M(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function b(t,e){try{return t.apply(this,e)}catch(n){const r=M(n);o.__wbindgen_exn_store(r)}}function h(t,e){return t=t>>>0,x().subarray(t/1,t/1+e)}let u=0;const E=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},G=typeof E.encodeInto=="function"?function(t,e){return E.encodeInto(t,e)}:function(t,e){const n=E.encode(t);return e.set(n),{read:t.length,written:n.length}};function f(t,e,n){if(n===void 0){const i=E.encode(t),a=e(i.length,1)>>>0;return x().subarray(a,a+i.length).set(i),u=i.length,a}let r=t.length,_=e(r,1)>>>0;const c=x();let s=0;for(;s<r;s++){const i=t.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==r){s!==0&&(t=t.slice(s)),_=n(_,r,r=s+t.length*3,1)>>>0;const i=x().subarray(_+s,_+r),a=G(t,i);s+=a.written,_=n(_,r,s,1)>>>0}return u=s,_}let p=null;function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==o.memory.buffer)&&(p=new DataView(o.memory.buffer)),p}function F(t){return t==null}function I(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+=I(t[0]));for(let s=1;s<_;s++)c+=", "+I(t[s]);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}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function D(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...s)=>{_.cnt++;const i=_.a;_.a=0;try{return r(i,_.b,...s)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(i,_.b),O.unregister(_)):_.a=i}};return c.original=_,O.register(c,_,_),c}function g(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function P(t){const e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,r=o.loadSettings(e,n);if(r[1])throw g(r[0])}function $(t,e){o.wasm_bindgen__convert__closures_____invoke__h7416124e9fa3b9aa(t,e)}function J(t,e,n){o.closure1671_externref_shim(t,e,n)}function H(t,e,n,r){o.closure2624_externref_shim(t,e,n,r)}const X=["omit","same-origin","include"],Y=["same-origin","no-cors","cors","navigate"],N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmbuilder_free(t>>>0,1));class v{static __wrap(e){e=e>>>0;const n=Object.create(v.prototype);return n.__wbg_ptr=e,N.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}static fromJson(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmbuilder_fromJson(n,r);if(_[2])throw g(_[1]);return v.__wrap(_[0])}setRemoteUrl(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,n,r)}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setThumbnailFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}addIngredientFromBlob(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,s=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u,a=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,r);if(a[1])throw g(a[0])}addResourceFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}sign(e,n,r){const _=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,r)}signAndGetManifestBytes(e,n,r){const _=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,r)}}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class S{static __wrap(e){e=e>>>0;const n=Object.create(S.prototype);return n.__wbg_ptr=e,z.register(n,n.__wbg_ptr,n),n}__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)}static fromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmreader_fromBlobFragment(_,c,n,r)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=w(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 g(e[1]);return g(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],w(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw g(_[1]);return g(_[0])}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>o.__wbg_wasmsigner_free(t>>>0,1));function K(){const t={};return t.wbg={},t.wbg.__wbg_Error_1f3748b298f99708=function(e,n){return Error(w(e,n))},t.wbg.__wbg_Number_577a493fc95ea223=function(e){return Number(e)},t.wbg.__wbg_abort_6665281623826052=function(e){e.abort()},t.wbg.__wbg_abort_c11a5d245a242912=function(e,n){e.abort(n)},t.wbg.__wbg_append_3e86b0cd6215edd8=function(){return b(function(e,n,r,_,c){e.append(w(n,r),w(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_55e4a430671abfd8=function(){return b(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_1f897e9f3ed6b41d=function(e){return e.buffer},t.wbg.__wbg_byteLength_7029fecd0c136e6d=function(e){return e.byteLength},t.wbg.__wbg_call_2f8d426a20a307fe=function(){return b(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_f53f0647ceb9c567=function(){return b(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},t.wbg.__wbg_done_4a7743b6f942c9f3=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(w(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_9885d2e26ad251bb=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_237b1ad767238d8b=function(e){return Array.from(e)},t.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return b(function(e,n){globalThis.crypto.getRandomValues(h(e,n))},arguments)},t.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return b(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_getTime_5b1dd03bb6d4b784=function(e){return e.getTime()},t.wbg.__wbg_get_27b4bcbec57323ca=function(){return b(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_85abdd8aeb8edebf=function(){return b(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_177bc880a5823968=function(e){return e.headers},t.wbg.__wbg_instanceof_Promise_1147df2e75727145=function(e){let n;try{n=e instanceof Promise}catch{n=!1}return n},t.wbg.__wbg_instanceof_Response_0ab386c6818f788a=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_96378c3c9a17347c=function(){return Symbol.iterator},t.wbg.__wbg_length_904c0910ed998bf3=function(e){return e.length},t.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},t.wbg.__wbg_new0_85cc856927102294=function(){return new Date},t.wbg.__wbg_new_12588505388d0897=function(){return b(function(){return new Headers},arguments)},t.wbg.__wbg_new_1930cbb8d9ffc31b=function(){return new Object},t.wbg.__wbg_new_56407f99198feff7=function(){return new Map},t.wbg.__wbg_new_6a8b180049d9484e=function(){return b(function(){return new AbortController},arguments)},t.wbg.__wbg_new_7e574c906ccc59b1=function(){return b(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_9190433fb67ed635=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_97ddeb994a38bb69=function(e,n){return new Error(w(e,n))},t.wbg.__wbg_new_d5e3800b120e37e1=function(e,n){try{var r={a:e,b:n},_=(s,i)=>{const a=r.a;r.a=0;try{return H(a,r.b,s,i)}finally{r.a=a}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_e969dc3f68d25093=function(){return new Array},t.wbg.__wbg_newfromslice_d0d56929c6d9c842=function(e,n){return new Uint8Array(h(e,n))},t.wbg.__wbg_newnoargs_a81330f6e05d8aca=function(e,n){return new Function(w(e,n))},t.wbg.__wbg_newwithlength_ed0ee6c1edca86fc=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_e8e22e9851f3c2fe=function(){return b(function(e,n,r){return new Request(w(e,n),r)},arguments)},t.wbg.__wbg_next_2e6b37020ac5fe58=function(){return b(function(e){return e.next()},arguments)},t.wbg.__wbg_next_3de8f2669431a3ff=function(e){return e.next},t.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},t.wbg.__wbg_now_e3057dd824ca0191=function(){return Date.now()},t.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},t.wbg.__wbg_prototypesetcall_c5f74efd31aea86b=function(e,n,r){Uint8Array.prototype.set.call(h(e,n),r)},t.wbg.__wbg_queueMicrotask_bcc6e26d899696db=function(e){return e.queueMicrotask},t.wbg.__wbg_queueMicrotask_f24a794d09c42640=function(e){queueMicrotask(e)},t.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return b(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_readAsArrayBuffer_b45cdda102d3c0b2=function(){return b(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_require_60cc747a6bc5215a=function(){return b(function(){return module.require},arguments)},t.wbg.__wbg_resolve_5775c0ef9222f556=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_1d5fe1e3f51a48d8=function(e,n,r){e.set(h(n,r))},t.wbg.__wbg_set_31197016f65a6a19=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_d636a0463acf1dbc=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_setbody_e324371c31597f2a=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_55a9317ed2777533=function(e,n){e.credentials=X[n]},t.wbg.__wbg_setheaders_ac0b1e4890a949cd=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_9ce6e95af1ae0eaf=function(e,n,r){e.method=w(n,r)},t.wbg.__wbg_setmode_b89d1784e7e7f118=function(e,n){e.mode=Y[n]},t.wbg.__wbg_setsignal_e663c6d962763cd5=function(e,n){e.signal=n},t.wbg.__wbg_signal_bdb003fe19e53a13=function(e){return e.signal},t.wbg.__wbg_size_4181b899cbfa6483=function(e){return e.size},t.wbg.__wbg_slice_dc41c7f2c4886814=function(){return b(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_1f13249cc3acc96d=function(){const e=typeof global>"u"?null:global;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3=function(){const e=typeof globalThis>"u"?null:globalThis;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_SELF_6265471db3b3c228=function(){const e=typeof self>"u"?null:self;return F(e)?0:M(e)},t.wbg.__wbg_static_accessor_WINDOW_16fb482f8ec52863=function(){const e=typeof window>"u"?null:window;return F(e)?0:M(e)},t.wbg.__wbg_status_31874648c8651949=function(e){return e.status},t.wbg.__wbg_stringify_1f41b6198e0932e0=function(){return b(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_subarray_a219824899e59712=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_then_8d2fcccde5380a03=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_then_9cc266be2bf537b6=function(e,n){return e.then(n)},t.wbg.__wbg_url_d5273b9e10503471=function(e,n){const r=n.url,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_valueOf_94f1c9efbe2ba399=function(e){return e.valueOf()},t.wbg.__wbg_value_09d0b4eaab48b91d=function(e){return e.value},t.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},t.wbg.__wbg_wasmreader_new=function(e){return S.__wrap(e)},t.wbg.__wbg_wbindgencbdrop_a85ed476c6a370b9=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d=function(e,n){const r=I(n),_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,_,!0)},t.wbg.__wbg_wbindgenisfunction_ea72b9d66a0e1705=function(e){return typeof e=="function"},t.wbg.__wbg_wbindgenisobject_dfe064a121d87553=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbg_wbindgenisstring_4b74e4111ba029e6=function(e){return typeof e=="string"},t.wbg.__wbg_wbindgenisundefined_71f08a6ade4354e7=function(e){return e===void 0},t.wbg.__wbg_wbindgenstringget_43fe05afe34b0cb1=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=F(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;y().setInt32(e+4,s,!0),y().setInt32(e+0,c,!0)},t.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf=function(e,n){throw new Error(w(e,n))},t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,n){return w(e,n)},t.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,n){return BigInt.asUintN(64,e)|n<<BigInt(64)},t.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,n){var r=h(e,n).slice();return o.__wbindgen_free(e,n*1,1),r},t.wbg.__wbindgen_cast_7920211b6bf3825e=function(e,n){return D(e,n,1660,J)},t.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},t.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,n){return h(e,n)},t.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},t.wbg.__wbindgen_cast_da253e46cc5a287c=function(e,n){return D(e,n,1653,$)},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}function Q(t,e){return o=t.exports,p=null,T=null,o.__wbindgen_start(),o}function Z(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=K();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return Q(n)}function L(){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 k=Symbol("transfer");function A(t,e){return{type:k,value:t,transfer:e?Array.isArray(e)?e:[e]:[t]}}function U(t){return!!(t&&typeof t=="object"&&Reflect.get(t,"type")===k)}function W(t="default"){return{createTx(e){const n=new Map,r=e??self;return r.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==t)return;const{id:s,result:i,error:a}=c,d=n.get(s);d&&(a?d.reject(a):d.resolve(i),n.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=ee(),a=[],d=[];return s.forEach(B=>{U(B)?(a.push(B.value),d.push(...B.transfer)):a.push(B)}),r.postMessage({method:c,args:a,id:i,channelName:t},{transfer:d}),new Promise((B,re)=>{n.set(i,{resolve:B,reject:re})})}}})},rx(e,n){const r=n??self;r.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==t)return;const{method:s,args:i,id:a}=c;try{const d=await e[s](...i);U(d)?r.postMessage({result:d.value,id:a,channelName:t},{transfer:d.transfer}):r.postMessage({result:d,id:a,channelName:t})}catch(d){r.postMessage({error:d,id:a,channelName:t})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=W(),{createTx:ne}=W("worker"),m=L(),l=L(),q=ne();te({async initWorker(t,e){Z(t),e&&P(e)},async reader_fromBlob(t,e){const n=await S.fromBlob(t,e);return m.add(n)},async reader_fromBlobFragment(t,e,n){const r=await S.fromBlobFragment(t,e,n);return m.add(r)},reader_activeLabel(t){return m.get(t).activeLabel()??null},reader_manifestStore(t){return m.get(t).manifestStore()},reader_activeManifest(t){return m.get(t).activeManifest()},reader_json(t){return m.get(t).json()},reader_resourceToBuffer(t,e){const r=m.get(t).resourceToBuffer(e);return A(r)},reader_free(t){m.get(t).free(),m.remove(t)},builder_fromJson(t){const e=v.fromJson(t);return l.add(e)},builder_setRemoteUrl(t,e){l.get(t).setRemoteUrl(e)},builder_setNoEmbed(t,e){l.get(t).setNoEmbed(e)},builder_setThumbnailFromBlob(t,e,n){l.get(t).setThumbnailFromBlob(e,n)},builder_addIngredientFromBlob(t,e,n,r){l.get(t).addIngredientFromBlob(e,n,r)},builder_addResourceFromBlob(t,e,n){l.get(t).addResourceFromBlob(e,n)},builder_getDefinition(t){return l.get(t).getDefinition()},async builder_sign(t,e,n,r,_){const s=await l.get(t).sign({reserveSize:n.reserveSize,alg:n.alg,sign:async i=>await q.sign(e,A(i,i.buffer),n.reserveSize)},r,_);return A(s,s.buffer)},async builder_signAndGetManifestBytes(t,e,n,r,_){const c=l.get(t),{manifest:s,asset:i}=await c.signAndGetManifestBytes({reserveSize:n.reserveSize,alg:n.alg,sign:async a=>await q.sign(e,A(a,a.buffer),n.reserveSize)},r,_);return A({manifest:s,asset:i},[s.buffer,i.buffer])},builder_free(t){l.get(t).free(),l.remove(t)}})})();\n', d = typeof self < "u" && self.Blob && new Blob([R], { type: "text/javascript;charset=utf-8" });
|
|
3
|
+
function A(e) {
|
|
4
4
|
let t;
|
|
5
5
|
try {
|
|
6
6
|
if (t = d && (self.URL || self.webkitURL).createObjectURL(d), !t) throw "";
|
|
@@ -12,7 +12,7 @@ function E(e) {
|
|
|
12
12
|
}), o;
|
|
13
13
|
} catch {
|
|
14
14
|
return new Worker(
|
|
15
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
15
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(R),
|
|
16
16
|
{
|
|
17
17
|
name: e == null ? void 0 : e.name
|
|
18
18
|
}
|
|
@@ -21,18 +21,18 @@ function E(e) {
|
|
|
21
21
|
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
async function
|
|
24
|
+
async function M(e) {
|
|
25
25
|
const { wasm: t, settingsString: o } = e;
|
|
26
26
|
let r = 0;
|
|
27
|
-
const n = new
|
|
28
|
-
|
|
27
|
+
const n = new A(), i = T(n), a = /* @__PURE__ */ new Map();
|
|
28
|
+
E(
|
|
29
29
|
{
|
|
30
|
-
sign: async (c, s,
|
|
30
|
+
sign: async (c, s, F) => {
|
|
31
31
|
const g = a.get(c);
|
|
32
32
|
if (a.delete(c), !g)
|
|
33
33
|
throw new Error("No signer registered for request");
|
|
34
|
-
const w = await g(s,
|
|
35
|
-
return
|
|
34
|
+
const w = await g(s, F);
|
|
35
|
+
return S(w, w.buffer);
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
n
|
|
@@ -59,7 +59,7 @@ class m extends Error {
|
|
|
59
59
|
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const j = [
|
|
63
63
|
"jpg",
|
|
64
64
|
"video/mp4",
|
|
65
65
|
"image/heif",
|
|
@@ -119,10 +119,10 @@ const M = [
|
|
|
119
119
|
"heif"
|
|
120
120
|
];
|
|
121
121
|
function y(e) {
|
|
122
|
-
return
|
|
122
|
+
return j.includes(e);
|
|
123
123
|
}
|
|
124
124
|
const f = 10 ** 9;
|
|
125
|
-
function
|
|
125
|
+
function z(e) {
|
|
126
126
|
const { tx: t } = e, o = new FinalizationRegistry(async (r) => {
|
|
127
127
|
await t.reader_free(r);
|
|
128
128
|
});
|
|
@@ -132,24 +132,41 @@ function j(e) {
|
|
|
132
132
|
throw new m(r);
|
|
133
133
|
if (n.size > f)
|
|
134
134
|
throw new l(n.size);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
try {
|
|
136
|
+
const i = await t.reader_fromBlob(r, n), a = h(e, i, () => {
|
|
137
|
+
o.unregister(a);
|
|
138
|
+
});
|
|
139
|
+
return o.register(a, i, a), a;
|
|
140
|
+
} catch (i) {
|
|
141
|
+
return p(i);
|
|
142
|
+
}
|
|
139
143
|
},
|
|
140
144
|
async fromBlobFragment(r, n, i) {
|
|
141
145
|
if (!y(r))
|
|
142
146
|
throw new m(r);
|
|
143
147
|
if (n.size > f)
|
|
144
148
|
throw new l(n.size);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
try {
|
|
150
|
+
const a = await t.reader_fromBlobFragment(
|
|
151
|
+
r,
|
|
152
|
+
n,
|
|
153
|
+
i
|
|
154
|
+
), _ = h(e, a, () => {
|
|
155
|
+
o.unregister(_);
|
|
156
|
+
});
|
|
157
|
+
return o.register(_, a, _), _;
|
|
158
|
+
} catch (a) {
|
|
159
|
+
return p(a);
|
|
160
|
+
}
|
|
149
161
|
}
|
|
150
162
|
};
|
|
151
163
|
}
|
|
152
|
-
function p(e
|
|
164
|
+
function p(e) {
|
|
165
|
+
if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
|
|
166
|
+
return null;
|
|
167
|
+
throw e;
|
|
168
|
+
}
|
|
169
|
+
function h(e, t, o) {
|
|
153
170
|
const { tx: r } = e;
|
|
154
171
|
return {
|
|
155
172
|
async activeLabel() {
|
|
@@ -189,20 +206,20 @@ typeof FinalizationRegistry > "u" || new FinalizationRegistry(
|
|
|
189
206
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmbuilder_free(e >>> 0, 1));
|
|
190
207
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmreader_free(e >>> 0, 1));
|
|
191
208
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmsigner_free(e >>> 0, 1));
|
|
192
|
-
const
|
|
209
|
+
const L = "sha512-oM4XbvmLifskSziUDz4mFfLTsirWPIPvUo6GO64ejfxS8lN/94+GL6rV8AmNzPx8rtV6kKSljRSQkeizqygMYQ==";
|
|
193
210
|
function O(e) {
|
|
194
|
-
return JSON.stringify(
|
|
211
|
+
return JSON.stringify(B(e));
|
|
195
212
|
}
|
|
196
|
-
function
|
|
213
|
+
function B(e) {
|
|
197
214
|
return Object.entries(e).reduce(
|
|
198
|
-
(o, [r, n]) => (o[
|
|
215
|
+
(o, [r, n]) => (o[N(r)] = typeof n == "object" ? B(n) : n, o),
|
|
199
216
|
{}
|
|
200
217
|
);
|
|
201
218
|
}
|
|
202
|
-
function
|
|
219
|
+
function N(e) {
|
|
203
220
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
204
221
|
}
|
|
205
|
-
async function
|
|
222
|
+
async function v(e) {
|
|
206
223
|
const { alg: t } = e;
|
|
207
224
|
return {
|
|
208
225
|
reserveSize: await e.reserveSize(),
|
|
@@ -215,14 +232,14 @@ function U(e) {
|
|
|
215
232
|
});
|
|
216
233
|
return {
|
|
217
234
|
async fromDefinition(r) {
|
|
218
|
-
const n = JSON.stringify(r), i = await t.builder_fromJson(n), a =
|
|
235
|
+
const n = JSON.stringify(r), i = await t.builder_fromJson(n), a = k(e, i, () => {
|
|
219
236
|
o.unregister(a);
|
|
220
237
|
});
|
|
221
238
|
return o.register(a, i, a), a;
|
|
222
239
|
}
|
|
223
240
|
};
|
|
224
241
|
}
|
|
225
|
-
function
|
|
242
|
+
function k(e, t, o) {
|
|
226
243
|
const { tx: r } = e;
|
|
227
244
|
return {
|
|
228
245
|
async setRemoteUrl(n) {
|
|
@@ -245,7 +262,7 @@ function N(e, t, o) {
|
|
|
245
262
|
return await r.builder_getDefinition(t);
|
|
246
263
|
},
|
|
247
264
|
async sign(n, i, a) {
|
|
248
|
-
const _ = await
|
|
265
|
+
const _ = await v(n), c = e.registerSignReceiver(n.sign);
|
|
249
266
|
return await r.builder_sign(
|
|
250
267
|
t,
|
|
251
268
|
c,
|
|
@@ -255,7 +272,7 @@ function N(e, t, o) {
|
|
|
255
272
|
);
|
|
256
273
|
},
|
|
257
274
|
async signAndGetManifestBytes(n, i, a) {
|
|
258
|
-
const _ = await
|
|
275
|
+
const _ = await v(n), c = e.registerSignReceiver(n.sign);
|
|
259
276
|
return await r.builder_signAndGetManifestBytes(
|
|
260
277
|
t,
|
|
261
278
|
c,
|
|
@@ -269,20 +286,20 @@ function N(e, t, o) {
|
|
|
269
286
|
}
|
|
270
287
|
};
|
|
271
288
|
}
|
|
272
|
-
async function
|
|
273
|
-
const { wasmSrc: t, settings: o } = e, r = typeof t == "string" ? await
|
|
289
|
+
async function J(e) {
|
|
290
|
+
const { wasmSrc: t, settings: o } = e, r = typeof t == "string" ? await D(t) : t, n = o ? O(o) : void 0, i = await M({ wasm: r, settingsString: n });
|
|
274
291
|
return {
|
|
275
|
-
reader:
|
|
292
|
+
reader: z(i),
|
|
276
293
|
builder: U(i),
|
|
277
294
|
dispose: i.terminate
|
|
278
295
|
};
|
|
279
296
|
}
|
|
280
|
-
async function
|
|
281
|
-
const t = await fetch(e, { integrity:
|
|
297
|
+
async function D(e) {
|
|
298
|
+
const t = await fetch(e, { integrity: L });
|
|
282
299
|
return await WebAssembly.compileStreaming(t);
|
|
283
300
|
}
|
|
284
301
|
export {
|
|
285
|
-
|
|
286
|
-
|
|
302
|
+
j as R,
|
|
303
|
+
J as c,
|
|
287
304
|
y as i
|
|
288
305
|
};
|
package/dist/index.js
CHANGED