@contentauth/c2pa-web 0.4.1 → 0.5.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.
- package/dist/c2pa-ebBVH9UY.js +330 -0
- package/dist/index.js +1 -1
- package/dist/inline.js +3 -3
- package/dist/lib/builder.d.ts +39 -5
- package/dist/lib/builder.d.ts.map +1 -1
- package/dist/lib/reader.d.ts +6 -8
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/lib/settings.d.ts +12 -2
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/signer.d.ts +1 -1
- package/dist/lib/signer.d.ts.map +1 -1
- package/dist/lib/worker/rpc.d.ts +17 -6
- package/dist/lib/worker/rpc.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +6 -4
- package/dist/c2pa-CECNIBtF.js +0 -305
|
@@ -0,0 +1,330 @@
|
|
|
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) {
|
|
5
|
+
let n;
|
|
6
|
+
try {
|
|
7
|
+
if (n = l && (self.URL || self.webkitURL).createObjectURL(l), !n) throw "";
|
|
8
|
+
const o = new Worker(n, {
|
|
9
|
+
name: e == null ? void 0 : e.name
|
|
10
|
+
});
|
|
11
|
+
return o.addEventListener("error", () => {
|
|
12
|
+
(self.URL || self.webkitURL).revokeObjectURL(n);
|
|
13
|
+
}), o;
|
|
14
|
+
} catch {
|
|
15
|
+
return new Worker(
|
|
16
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(B),
|
|
17
|
+
{
|
|
18
|
+
name: e == null ? void 0 : e.name
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
} finally {
|
|
22
|
+
n && (self.URL || self.webkitURL).revokeObjectURL(n);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function E(e) {
|
|
26
|
+
const { wasm: n, settingsString: o } = e;
|
|
27
|
+
let r = 0;
|
|
28
|
+
const t = new j(), _ = T(t), i = /* @__PURE__ */ new Map();
|
|
29
|
+
M(
|
|
30
|
+
{
|
|
31
|
+
sign: async (c, s, F) => {
|
|
32
|
+
const w = i.get(c);
|
|
33
|
+
if (i.delete(c), !w)
|
|
34
|
+
throw new Error("No signer registered for request");
|
|
35
|
+
const d = await w(s, F);
|
|
36
|
+
return x(d, d.buffer);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
t
|
|
40
|
+
);
|
|
41
|
+
function a(c) {
|
|
42
|
+
const s = r++;
|
|
43
|
+
return i.set(s, c), s;
|
|
44
|
+
}
|
|
45
|
+
return await _.initWorker(n, o), {
|
|
46
|
+
tx: _,
|
|
47
|
+
registerSignReceiver: a,
|
|
48
|
+
terminate: () => t.terminate()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
class m extends Error {
|
|
52
|
+
constructor(n) {
|
|
53
|
+
super(
|
|
54
|
+
`The provided asset was too large. Size: ${n} bytes. Maximum: ${f}.`
|
|
55
|
+
), this.name = "AssetTooLargeError";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class y extends Error {
|
|
59
|
+
constructor(n) {
|
|
60
|
+
super(`Unsupported format: ${n}.`), this.name = "UnsupportedFormatError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const z = [
|
|
64
|
+
"jpg",
|
|
65
|
+
"video/mp4",
|
|
66
|
+
"image/heif",
|
|
67
|
+
"video/x-msvideo",
|
|
68
|
+
"pdf",
|
|
69
|
+
"image/png",
|
|
70
|
+
"application/c2pa",
|
|
71
|
+
"video/quicktime",
|
|
72
|
+
"video/avi",
|
|
73
|
+
"image/gif",
|
|
74
|
+
"application/xml",
|
|
75
|
+
"text/xml",
|
|
76
|
+
"application/xhtml+xml",
|
|
77
|
+
"tiff",
|
|
78
|
+
"audio/wave",
|
|
79
|
+
"mp4",
|
|
80
|
+
"image/avif",
|
|
81
|
+
"image/dng",
|
|
82
|
+
"png",
|
|
83
|
+
"dng",
|
|
84
|
+
"image/svg+xml",
|
|
85
|
+
"image/heic",
|
|
86
|
+
"application/mp4",
|
|
87
|
+
"image/x-nikon-nef",
|
|
88
|
+
"video/msvideo",
|
|
89
|
+
"tif",
|
|
90
|
+
"wav",
|
|
91
|
+
"xml",
|
|
92
|
+
"audio/vnd.wave",
|
|
93
|
+
"xhtml",
|
|
94
|
+
"gif",
|
|
95
|
+
"application/x-troff-msvideo",
|
|
96
|
+
"webp",
|
|
97
|
+
"heic",
|
|
98
|
+
"application/pdf",
|
|
99
|
+
"audio/mpeg",
|
|
100
|
+
"application/x-c2pa-manifest-store",
|
|
101
|
+
"jpeg",
|
|
102
|
+
"image/x-adobe-dng",
|
|
103
|
+
"audio/wav",
|
|
104
|
+
"mp3",
|
|
105
|
+
"mov",
|
|
106
|
+
"image/tiff",
|
|
107
|
+
"audio/mp4",
|
|
108
|
+
"application/svg+xml",
|
|
109
|
+
"arw",
|
|
110
|
+
"c2pa",
|
|
111
|
+
"svg",
|
|
112
|
+
"avi",
|
|
113
|
+
"audio/x-wav",
|
|
114
|
+
"m4a",
|
|
115
|
+
"image/x-sony-arw",
|
|
116
|
+
"image/jpeg",
|
|
117
|
+
"avif",
|
|
118
|
+
"image/webp",
|
|
119
|
+
"nef",
|
|
120
|
+
"heif"
|
|
121
|
+
];
|
|
122
|
+
function p(e) {
|
|
123
|
+
return z.includes(e);
|
|
124
|
+
}
|
|
125
|
+
const f = 10 ** 9;
|
|
126
|
+
function L(e) {
|
|
127
|
+
const { tx: n } = e, o = new FinalizationRegistry(async (r) => {
|
|
128
|
+
await n.reader_free(r);
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
async fromBlob(r, t) {
|
|
132
|
+
if (!p(r))
|
|
133
|
+
throw new y(r);
|
|
134
|
+
if (t.size > f)
|
|
135
|
+
throw new m(t.size);
|
|
136
|
+
try {
|
|
137
|
+
const _ = await n.reader_fromBlob(r, t), i = v(e, _, () => {
|
|
138
|
+
o.unregister(i);
|
|
139
|
+
});
|
|
140
|
+
return o.register(i, _, i), i;
|
|
141
|
+
} catch (_) {
|
|
142
|
+
return h(_);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
async fromBlobFragment(r, t, _) {
|
|
146
|
+
if (!p(r))
|
|
147
|
+
throw new y(r);
|
|
148
|
+
if (t.size > f)
|
|
149
|
+
throw new m(t.size);
|
|
150
|
+
try {
|
|
151
|
+
const i = await n.reader_fromBlobFragment(
|
|
152
|
+
r,
|
|
153
|
+
t,
|
|
154
|
+
_
|
|
155
|
+
), a = v(e, i, () => {
|
|
156
|
+
o.unregister(a);
|
|
157
|
+
});
|
|
158
|
+
return o.register(a, i, a), a;
|
|
159
|
+
} catch (i) {
|
|
160
|
+
return h(i);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function h(e) {
|
|
166
|
+
if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
|
|
167
|
+
return null;
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
function v(e, n, o) {
|
|
171
|
+
const { tx: r } = e;
|
|
172
|
+
return {
|
|
173
|
+
async activeLabel() {
|
|
174
|
+
return await r.reader_activeLabel(n);
|
|
175
|
+
},
|
|
176
|
+
async manifestStore() {
|
|
177
|
+
return await r.reader_manifestStore(n);
|
|
178
|
+
},
|
|
179
|
+
async activeManifest() {
|
|
180
|
+
return await r.reader_activeManifest(n);
|
|
181
|
+
},
|
|
182
|
+
async json() {
|
|
183
|
+
const t = await r.reader_json(n);
|
|
184
|
+
return JSON.parse(t);
|
|
185
|
+
},
|
|
186
|
+
async resourceToBytes(t) {
|
|
187
|
+
return await r.reader_resourceToBytes(n, t);
|
|
188
|
+
},
|
|
189
|
+
async free() {
|
|
190
|
+
o(), await r.reader_free(n);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
let g, N = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
|
195
|
+
N.decode();
|
|
196
|
+
const b = new TextEncoder();
|
|
197
|
+
"encodeInto" in b || (b.encodeInto = function(e, n) {
|
|
198
|
+
const o = b.encode(e);
|
|
199
|
+
return n.set(o), {
|
|
200
|
+
read: e.length,
|
|
201
|
+
written: o.length
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => e.dtor(e.a, e.b));
|
|
205
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e >>> 0, 1));
|
|
206
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e >>> 0, 1));
|
|
207
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e >>> 0, 1));
|
|
208
|
+
const U = "sha512-0Bft1wLozl93+XmqnNddxgbrBhvF/jz1S1VLEXcAqfygqW7AZ4nrrpSR2I0YqD9+dBNlIgzMULACLQFfxfZlGA==", O = {
|
|
209
|
+
builder: {
|
|
210
|
+
generateC2paArchive: !0
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
function k(e) {
|
|
214
|
+
const n = I(O, e);
|
|
215
|
+
return JSON.stringify(S(n));
|
|
216
|
+
}
|
|
217
|
+
function S(e) {
|
|
218
|
+
return Object.entries(e).reduce(
|
|
219
|
+
(o, [r, t]) => (o[q(r)] = typeof t == "object" ? S(t) : t, o),
|
|
220
|
+
{}
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
function q(e) {
|
|
224
|
+
return e.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
|
|
225
|
+
}
|
|
226
|
+
async function A(e) {
|
|
227
|
+
const { alg: n } = e;
|
|
228
|
+
return {
|
|
229
|
+
reserveSize: await e.reserveSize(),
|
|
230
|
+
alg: n
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function D(e) {
|
|
234
|
+
const { tx: n } = e, o = new FinalizationRegistry((r) => {
|
|
235
|
+
n.builder_free(r);
|
|
236
|
+
});
|
|
237
|
+
return {
|
|
238
|
+
async new() {
|
|
239
|
+
const r = await n.builder_new(), t = u(e, r, () => {
|
|
240
|
+
o.unregister(t);
|
|
241
|
+
});
|
|
242
|
+
return o.register(t, r, t), t;
|
|
243
|
+
},
|
|
244
|
+
async fromDefinition(r) {
|
|
245
|
+
const t = JSON.stringify(r), _ = await n.builder_fromJson(t), i = u(e, _, () => {
|
|
246
|
+
o.unregister(i);
|
|
247
|
+
});
|
|
248
|
+
return o.register(i, _, i), i;
|
|
249
|
+
},
|
|
250
|
+
async fromArchive(r) {
|
|
251
|
+
const t = await n.builder_fromArchive(r), _ = u(e, t, () => {
|
|
252
|
+
o.unregister(_);
|
|
253
|
+
});
|
|
254
|
+
return o.register(_, t, _), _;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function u(e, n, o) {
|
|
259
|
+
const { tx: r } = e;
|
|
260
|
+
return {
|
|
261
|
+
async setIntent(t) {
|
|
262
|
+
await r.builder_setIntent(n, t);
|
|
263
|
+
},
|
|
264
|
+
async addAction(t) {
|
|
265
|
+
await r.builder_addAction(n, t);
|
|
266
|
+
},
|
|
267
|
+
async setRemoteUrl(t) {
|
|
268
|
+
await r.builder_setRemoteUrl(n, t);
|
|
269
|
+
},
|
|
270
|
+
async setNoEmbed(t) {
|
|
271
|
+
await r.builder_setNoEmbed(n, t);
|
|
272
|
+
},
|
|
273
|
+
async setThumbnailFromBlob(t, _) {
|
|
274
|
+
await r.builder_setThumbnailFromBlob(n, t, _);
|
|
275
|
+
},
|
|
276
|
+
async addIngredientFromBlob(t, _, i) {
|
|
277
|
+
const a = JSON.stringify(t);
|
|
278
|
+
await r.builder_addIngredientFromBlob(n, a, _, i);
|
|
279
|
+
},
|
|
280
|
+
async addResourceFromBlob(t, _) {
|
|
281
|
+
await r.builder_addResourceFromBlob(n, t, _);
|
|
282
|
+
},
|
|
283
|
+
async getDefinition() {
|
|
284
|
+
return await r.builder_getDefinition(n);
|
|
285
|
+
},
|
|
286
|
+
async toArchive() {
|
|
287
|
+
return await r.builder_toArchive(n);
|
|
288
|
+
},
|
|
289
|
+
async sign(t, _, i) {
|
|
290
|
+
const a = await A(t), c = e.registerSignReceiver(t.sign);
|
|
291
|
+
return await r.builder_sign(
|
|
292
|
+
n,
|
|
293
|
+
c,
|
|
294
|
+
a,
|
|
295
|
+
_,
|
|
296
|
+
i
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
async signAndGetManifestBytes(t, _, i) {
|
|
300
|
+
const a = await A(t), c = e.registerSignReceiver(t.sign);
|
|
301
|
+
return await r.builder_signAndGetManifestBytes(
|
|
302
|
+
n,
|
|
303
|
+
c,
|
|
304
|
+
a,
|
|
305
|
+
_,
|
|
306
|
+
i
|
|
307
|
+
);
|
|
308
|
+
},
|
|
309
|
+
async free() {
|
|
310
|
+
o(), await r.builder_free(n);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
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 });
|
|
316
|
+
return {
|
|
317
|
+
reader: L(_),
|
|
318
|
+
builder: D(_),
|
|
319
|
+
dispose: _.terminate
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async function W(e) {
|
|
323
|
+
const n = await fetch(e, { integrity: U });
|
|
324
|
+
return await WebAssembly.compileStreaming(n);
|
|
325
|
+
}
|
|
326
|
+
export {
|
|
327
|
+
z as R,
|
|
328
|
+
P as c,
|
|
329
|
+
p as i
|
|
330
|
+
};
|
package/dist/index.js
CHANGED