@contentauth/c2pa-web 0.9.0 → 0.10.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-D84Gj1B6.js +387 -0
- package/dist/c2pa-oJwJnvn8.js +941 -0
- package/dist/index.js +1 -1
- package/dist/inline.js +2 -2
- package/dist/lib/c2pa.d.ts +9 -0
- package/dist/lib/c2pa.d.ts.map +1 -1
- package/dist/lib/worker/workerManager.d.ts +11 -0
- package/dist/lib/worker/workerManager.d.ts.map +1 -1
- package/dist/worker.js +163 -0
- package/package.json +7 -3
- package/dist/c2pa-Cy_f_Zk_.js +0 -395
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { b as M, w as O, d as N } from "./c2pa-oJwJnvn8.js";
|
|
2
|
+
import { transfer as U } from "highgain";
|
|
3
|
+
import { merge as m } from "ts-deepmerge";
|
|
4
|
+
const T = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.prototype);return t.__wbg_ptr=e,x.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,x.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 d(t[0])}addIngredient(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmbuilder_addIngredient(this.__wbg_ptr,t,n);if(_[1])throw d(_[0])}addIngredientFromBlob(e,t,n){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,i=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n)}addRedaction(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addRedaction(this.__wbg_ptr,n,_,t);if(c[1])throw d(c[0])}addResourceFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw d(c[0])}static fromArchive(e,t){var n=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw d(c[1]);return p.__wrap(c[0])}static fromJson(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;var c=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw d(s[1]);return p.__wrap(s[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}static new(e){var t=g(e)?0:b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;const _=o.wasmbuilder_new(t,n);if(_[2])throw d(_[1]);return p.__wrap(_[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw d(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setRemoteUrl(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw d(c[0])}sign(e,t,n){const _=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,n)}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}}Symbol.dispose&&(p.prototype[Symbol.dispose]=p.prototype.free);class v{static __wrap(e){const t=Object.create(v.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_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=y(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}crJson(){let e,t;try{const n=o.wasmreader_crJson(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t,n){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;var i=g(n)?0:b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;var s=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u;return o.wasmreader_fromBlobFragment(c,i,t,n,s,a)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}resourceToBytes(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,n);if(_[2])throw d(_[1]);return d(_[0])}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function C(r){const e=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,n=o.loadSettings(e,t);if(n[1])throw d(n[0])}function J(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,t){return Error(y(e,t))},__wbg_Number_6b506e6536831eaa:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,g(_)?BigInt(0):_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=j(t),_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,t){return e==t},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,g(_)?0:_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,t){throw new Error(y(e,t))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){e._wbg_cb_unref()},__wbg_abort_2ec46222bf378517:function(e){e.abort()},__wbg_abort_b29d719932441c95:function(e,t){e.abort(t)},__wbg_append_e1746995edcb0170:function(){return f(function(e,t,n,_,c){e.append(y(t,n),y(_,c))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return f(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_2c6dc3b4b85d3547:function(e){return e.byteLength},__wbg_call_8a89609d89f6608a:function(){return f(function(e,t){return e.call(t)},arguments)},__wbg_call_9c758de292015997:function(){return f(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearTimeout_6b8d9a38b9263d65:function(e){return clearTimeout(e)},__wbg_crypto_38df2bab126b63dc:function(e){return e.crypto},__wbg_done_60cf307fcc680536:function(e){return e.done},__wbg_entries_04b37a02507f1713:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(y(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_344c8d3849002659:function(e,t){return e.fetch(t)},__wbg_fetch_9dad4fe911207b37:function(e){return fetch(e)},__wbg_from_d300fe49deab18f5:function(e){return Array.from(e)},__wbg_getRandomValues_3f44b700395062e5:function(){return f(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_8aa3112c6615eef6:function(){return f(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return f(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_00b3f7db575e4ef5:function(e){return e.getTime()},__wbg_get_1f8f054ddbaa7db2:function(){return f(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,t){return e[t>>>0]},__wbg_get_de6a0f7d4d18a304:function(){return f(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_has_73740b27f436fed3:function(){return f(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_0feb63d2d374b44a:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_9fc06d9a951bcee6:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_d0db99486956c8e8:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(e)},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(e)},__wbg_iterator_8732428d309e270e:function(){return Symbol.iterator},__wbg_length_4a591ecaa01354d9:function(e){return e.length},__wbg_length_66f1a4b2e9026940:function(e){return e.length},__wbg_msCrypto_bd5a034af96bcba6:function(e){return e.msCrypto},__wbg_new_0_445c13a750296eb6:function(){return new Date},__wbg_new_0d09705104e164af:function(){return f(function(){return new AbortController},arguments)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_578aeef4b6b94378:function(e){return new Uint8Array(e)},__wbg_new_622fc80556be2e26:function(){return new Map},__wbg_new_a1b9f645bba64f0f:function(){return f(function(){return new FileReaderSync},arguments)},__wbg_new_ce1ab61c1c2b300d:function(){return new Object},__wbg_new_d90091b82fdf5b91:function(){return new Array},__wbg_new_e436d06bc8e77460:function(){return f(function(){return new Headers},arguments)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_typed_bf31d18f92484486:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const a=n.a;n.a=0;try{return P(a,n.b,i,s)}finally{n.a=a}};return new Promise(_)}finally{n.a=0}},__wbg_new_with_length_36a4998e27b014c5:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return f(function(e,t,n){return new Request(y(e,t),n)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){return e.next},__wbg_next_eb8ca7351fa27906:function(){return f(function(e){return e.next()},arguments)},__wbg_node_84ea875411254db1:function(e){return e.node},__wbg_now_190933fa139cc119:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){return e.process},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(e)},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){return e.queueMicrotask},__wbg_randomFillSync_6c25eac9869eb53c:function(){return f(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_f1b8da05559618d9:function(){return f(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return f(function(){return module.require},arguments)},__wbg_resolve_25a7e548d5881dca:function(e){return Promise.resolve(e)},__wbg_setTimeout_f757f00851f76c42:function(e,t){return setTimeout(e,t)},__wbg_set_29c99a8aac1c01e5:function(e,t,n){e.set(A(t,n))},__wbg_set_52b1e1eb5bed906a:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_body_36614c7e61546809:function(e,t){e.body=t},__wbg_set_cache_488ea16c11cbf20d:function(e,t){e.cache=$[t]},__wbg_set_credentials_fa9c491a27c4bdf0:function(e,t){e.credentials=H[t]},__wbg_set_dca99999bba88a9a:function(e,t,n){e[t>>>0]=n},__wbg_set_headers_7c1e39ece7826bec:function(e,t){e.headers=t},__wbg_set_method_7a6811dec7a4feff:function(e,t,n){e.method=y(t,n)},__wbg_set_mode_c90e3667002857d4:function(e,t){e.mode=X[t]},__wbg_set_signal_d9da62b3f215c821:function(e,t){e.signal=t},__wbg_signal_e03304a84df9ed09:function(e){return e.signal},__wbg_size_9970092b88b1094c:function(e){return e.size},__wbg_slice_02bb778501725738:function(){return f(function(e,t,n){return e.slice(t,n)},arguments)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){const e=typeof global>"u"?null:global;return g(e)?0:S(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:S(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return g(e)?0:S(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return g(e)?0:S(e)},__wbg_status_00549d55b78d949e:function(e){return e.status},__wbg_stringify_8286df6dcc591521:function(){return f(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_4aa221f6a4f5ab22:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_18f476d590e58992:function(e,t,n){return e.then(t,n)},__wbg_then_ac7b025999b52837:function(e,t){return e.then(t)},__wbg_url_6808f1c468f2d0cd:function(e,t){const n=t.url,_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_41ae57308c1f031c:function(e){return e.valueOf()},__wbg_value_f3625092ee4b37f4:function(e){return e.value},__wbg_versions_276b2795b1c6a219:function(e){return e.versions},__wbg_wasmreader_new:function(e){return v.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return z(e,t,G)},__wbindgen_cast_0000000000000002:function(e,t){return z(e,t,V)},__wbindgen_cast_0000000000000003:function(e){return e},__wbindgen_cast_0000000000000004:function(e){return e},__wbindgen_cast_0000000000000005:function(e,t){return A(e,t)},__wbindgen_cast_0000000000000006:function(e,t){return y(e,t)},__wbindgen_cast_0000000000000007:function(e){return BigInt.asUintN(64,e)},__wbindgen_cast_0000000000000008:function(e,t){var n=A(e,t).slice();return o.__wbindgen_free(e,t*1,1),n},__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)}}}}function V(r,e){o.wasm_bindgen__convert__closures_____invoke__h9ad77c532ffa5b9e(r,e)}function G(r,e,t){const n=o.wasm_bindgen__convert__closures_____invoke__hf2acc361175a8d00(r,e,t);if(n[1])throw d(n[0])}function P(r,e,t,n){o.wasm_bindgen__convert__closures_____invoke__h53f6302d12a3bd57(r,e,t,n)}const $=["default","no-store","reload","no-cache","force-cache","only-if-cached"],H=["omit","same-origin","include"],X=["same-origin","no-cors","cors","navigate"],x=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r,1)),k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r,1));function S(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbindgen_destroy_closure(r.a,r.b));function j(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let c="[";_>0&&(c+=j(r[0]));for(let i=1;i<_;i++)c+=", "+j(r[i]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:n}function A(r,e){return r=r>>>0,M().subarray(r/1,r/1+e)}let F=null;function m(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==o.memory.buffer)&&(F=new DataView(o.memory.buffer)),F}function y(r,e){return K(r>>>0,e)}let B=null;function M(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(o.memory.buffer)),B}function f(r,e){try{return r.apply(this,e)}catch(t){const n=S(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function z(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const i=n.a;n.a=0;try{return t(i,n.b,...c)}finally{n.a=i,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,N.unregister(n))},N.register(_,n,n),_}function b(r,e,t){if(t===void 0){const s=T.encode(r),a=e(s.length,1)>>>0;return M().subarray(a,a+s.length).set(s),u=s.length,a}let n=r.length,_=e(n,1)>>>0;const c=M();let i=0;for(;i<n;i++){const s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){i!==0&&(r=r.slice(i)),_=t(_,n,n=i+r.length*3,1)>>>0;const s=M().subarray(_+i,_+n),a=T.encodeInto(r,s);i+=a.written,_=t(_,n,i,1)>>>0}return u=i,_}function d(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});E.decode();const Y=2146435072;let O=0;function K(r,e){return O+=e,O>=Y&&(E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),E.decode(),O=e),E.decode(M().subarray(r,r+e))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(r,e){const t=T.encode(r);return e.set(t),{read:r.length,written:t.length}});let u=0,o;function Q(r,e){return o=r.exports,F=null,B=null,o.__wbindgen_start(),o}function Z(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=J();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Q(t)}function D(){let r=0;const e=new Map;return{add(t){const n=r++;return e.set(n,t),n},get(t){const n=e.get(t);if(!n)throw new Error("Attempted to use an object that has been freed");return n},remove(t){return e.delete(t)}}}const L=Symbol("transfer");function I(r,e){return{type:L,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function U(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===L)}function q(r="default"){return{createTx(e){const t=new Map,n=e??self;return n.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==r)return;const{id:i,result:s,error:a}=c,w=t.get(i);w&&(a?w.reject(a):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=ee(),a=[],w=[];return i.forEach(R=>{U(R)?(a.push(R.value),w.push(...R.transfer)):a.push(R)}),n.postMessage({method:c,args:a,id:s,channelName:r},{transfer:w}),new Promise((R,_e)=>{t.set(s,{resolve:R,reject:_e})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:i,args:s,id:a}=c;try{const w=await e[i](...s);U(w)?n.postMessage({result:w.value,id:a,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:a,channelName:r})}catch(w){n.postMessage({error:w,id:a,channelName:r})}})}}}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"),h=D(),l=D(),W=ne();te(re({async initWorker(r,e){Z({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return h.add(_)},reader_activeLabel(r){return h.get(r).activeLabel()??null},reader_manifestStore(r){return h.get(r).manifestStore()},reader_activeManifest(r){return h.get(r).activeManifest()},reader_json(r){return h.get(r).json()},reader_crJson(r){return h.get(r).crJson()},reader_resourceToBytes(r,e){const n=h.get(r).resourceToBytes(e);return I(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return l.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return l.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return l.add(t)},builder_setIntent(r,e){l.get(r).setIntent(e)},builder_addAction(r,e){l.get(r).addAction(e)},builder_addRedaction(r,e,t){l.get(r).addRedaction(e,t)},builder_setRemoteUrl(r,e){l.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){l.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){l.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){l.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await l.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){l.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return l.get(r).getDefinition()},builder_toArchive(r){const t=l.get(r).toArchive();return I(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await l.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,I(s,s.buffer),t.reserveSize)},n,_);return I(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=l.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async a=>await W.sign(e,I(a,a.buffer),t.reserveSize)},n,_);return I({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){l.get(r).free(),l.remove(r)}}));function re(r){const e={};for(const[t,n]of Object.entries(r))e[t]=async(..._)=>{try{return await n(..._)}catch(c){throw typeof c=="string"?new Error(c):c}};return e}})();\n', y = typeof self < "u" && self.Blob && new Blob([T], { type: "text/javascript;charset=utf-8" });
|
|
5
|
+
function L(n) {
|
|
6
|
+
let e;
|
|
7
|
+
try {
|
|
8
|
+
if (e = y && (self.URL || self.webkitURL).createObjectURL(y), !e) throw "";
|
|
9
|
+
const _ = new Worker(e, {
|
|
10
|
+
name: n == null ? void 0 : n.name
|
|
11
|
+
});
|
|
12
|
+
return _.addEventListener("error", () => {
|
|
13
|
+
(self.URL || self.webkitURL).revokeObjectURL(e);
|
|
14
|
+
}), _;
|
|
15
|
+
} catch {
|
|
16
|
+
return new Worker(
|
|
17
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(T),
|
|
18
|
+
{
|
|
19
|
+
name: n == null ? void 0 : n.name
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
} finally {
|
|
23
|
+
e && (self.URL || self.webkitURL).revokeObjectURL(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function k(n) {
|
|
27
|
+
if (n.protocol !== "https:")
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Worker source URL must use https, but got ${n.protocol}`
|
|
30
|
+
);
|
|
31
|
+
return n.toString();
|
|
32
|
+
}
|
|
33
|
+
async function z(n) {
|
|
34
|
+
const { wasm: e, settingsString: _, workerSrc: r } = n;
|
|
35
|
+
let t = 0;
|
|
36
|
+
const o = r ? new Worker(k(r)) : new L(), i = M(o), a = /* @__PURE__ */ new Map();
|
|
37
|
+
O(
|
|
38
|
+
{
|
|
39
|
+
sign: async (c, u, f) => {
|
|
40
|
+
const l = a.get(c);
|
|
41
|
+
if (a.delete(c), !l)
|
|
42
|
+
throw new Error("No signer registered for request");
|
|
43
|
+
const w = await l(u, f);
|
|
44
|
+
return U(w, w.buffer);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
o
|
|
48
|
+
);
|
|
49
|
+
function s(c) {
|
|
50
|
+
const u = t++;
|
|
51
|
+
return a.set(u, c), u;
|
|
52
|
+
}
|
|
53
|
+
return await i.initWorker(e, _), {
|
|
54
|
+
tx: i,
|
|
55
|
+
registerSignReceiver: s,
|
|
56
|
+
terminate: () => o.terminate()
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
class h extends Error {
|
|
60
|
+
constructor(e) {
|
|
61
|
+
super(
|
|
62
|
+
`The provided asset was too large. Size: ${e} bytes. Maximum: ${g}.`
|
|
63
|
+
), this.name = "AssetTooLargeError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class p extends Error {
|
|
67
|
+
constructor(e) {
|
|
68
|
+
super(`Unsupported format: ${e}.`), this.name = "UnsupportedFormatError";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const J = [
|
|
72
|
+
"jpg",
|
|
73
|
+
"video/mp4",
|
|
74
|
+
"image/heif",
|
|
75
|
+
"video/x-msvideo",
|
|
76
|
+
"pdf",
|
|
77
|
+
"image/png",
|
|
78
|
+
"application/c2pa",
|
|
79
|
+
"video/quicktime",
|
|
80
|
+
"video/avi",
|
|
81
|
+
"image/gif",
|
|
82
|
+
"application/xml",
|
|
83
|
+
"text/xml",
|
|
84
|
+
"application/xhtml+xml",
|
|
85
|
+
"tiff",
|
|
86
|
+
"audio/wave",
|
|
87
|
+
"mp4",
|
|
88
|
+
"image/avif",
|
|
89
|
+
"image/dng",
|
|
90
|
+
"png",
|
|
91
|
+
"dng",
|
|
92
|
+
"image/svg+xml",
|
|
93
|
+
"image/heic",
|
|
94
|
+
"application/mp4",
|
|
95
|
+
"image/x-nikon-nef",
|
|
96
|
+
"video/msvideo",
|
|
97
|
+
"tif",
|
|
98
|
+
"wav",
|
|
99
|
+
"xml",
|
|
100
|
+
"audio/vnd.wave",
|
|
101
|
+
"xhtml",
|
|
102
|
+
"gif",
|
|
103
|
+
"application/x-troff-msvideo",
|
|
104
|
+
"webp",
|
|
105
|
+
"heic",
|
|
106
|
+
"application/pdf",
|
|
107
|
+
"audio/mpeg",
|
|
108
|
+
"application/x-c2pa-manifest-store",
|
|
109
|
+
"jpeg",
|
|
110
|
+
"image/x-adobe-dng",
|
|
111
|
+
"audio/wav",
|
|
112
|
+
"mp3",
|
|
113
|
+
"mov",
|
|
114
|
+
"image/tiff",
|
|
115
|
+
"audio/mp4",
|
|
116
|
+
"application/svg+xml",
|
|
117
|
+
"arw",
|
|
118
|
+
"c2pa",
|
|
119
|
+
"svg",
|
|
120
|
+
"avi",
|
|
121
|
+
"audio/x-wav",
|
|
122
|
+
"m4a",
|
|
123
|
+
"image/x-sony-arw",
|
|
124
|
+
"image/jpeg",
|
|
125
|
+
"avif",
|
|
126
|
+
"image/webp",
|
|
127
|
+
"nef",
|
|
128
|
+
"heif"
|
|
129
|
+
];
|
|
130
|
+
function v(n) {
|
|
131
|
+
return J.includes(n);
|
|
132
|
+
}
|
|
133
|
+
const $ = {
|
|
134
|
+
userAnchors: !0,
|
|
135
|
+
trustAnchors: !0,
|
|
136
|
+
trustConfig: !0,
|
|
137
|
+
allowedList: !0
|
|
138
|
+
}, W = Object.keys($), C = {
|
|
139
|
+
builder: {
|
|
140
|
+
generateC2paArchive: !0
|
|
141
|
+
}
|
|
142
|
+
}, S = 1 * 1024 * 1024;
|
|
143
|
+
async function b(n, e) {
|
|
144
|
+
const _ = e ? m(n ?? {}, e) : n;
|
|
145
|
+
if (!_)
|
|
146
|
+
return;
|
|
147
|
+
const r = m(C, _), t = [];
|
|
148
|
+
return r.trust && t.push(A(r.trust)), r.cawgTrust && t.push(A(r.cawgTrust)), await Promise.all(t), JSON.stringify(j(r));
|
|
149
|
+
}
|
|
150
|
+
function j(n) {
|
|
151
|
+
return Object.entries(n).reduce(
|
|
152
|
+
(_, [r, t]) => (_[P(r)] = typeof t == "object" && t !== null ? j(t) : t, _),
|
|
153
|
+
{}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function P(n) {
|
|
157
|
+
return n.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
|
|
158
|
+
}
|
|
159
|
+
async function A(n) {
|
|
160
|
+
try {
|
|
161
|
+
const e = Object.entries(n).filter(([_]) => W.includes(_)).map(async ([_, r]) => {
|
|
162
|
+
if (r && typeof r == "object" && Array.isArray(r)) {
|
|
163
|
+
const t = r.map(async (a) => {
|
|
164
|
+
if (typeof a != "string")
|
|
165
|
+
throw new Error("Expected a string value for array item");
|
|
166
|
+
const s = await E(a);
|
|
167
|
+
if (R(_) && !B(s))
|
|
168
|
+
throw new Error(`Error parsing PEM file at: ${a}`);
|
|
169
|
+
return s;
|
|
170
|
+
}), i = (await Promise.all(t)).join("");
|
|
171
|
+
n[_] = i;
|
|
172
|
+
} else if (r && typeof r == "string" && D(r)) {
|
|
173
|
+
const t = await E(r);
|
|
174
|
+
if (R(_) && !B(t))
|
|
175
|
+
throw new Error(`Error parsing PEM file at: ${r}`);
|
|
176
|
+
n[_] = t;
|
|
177
|
+
} else
|
|
178
|
+
return r;
|
|
179
|
+
});
|
|
180
|
+
await Promise.all(e);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
const _ = e instanceof Error ? e.message : String(e);
|
|
183
|
+
throw new Error(`Failed to resolve trust settings. ${_}`, { cause: e });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const R = (n) => ["userAnchors", "trustAnchors"].includes(n), B = (n) => n.includes("-----BEGIN CERTIFICATE-----"), D = (n) => n.startsWith("http");
|
|
187
|
+
async function E(n) {
|
|
188
|
+
let e;
|
|
189
|
+
try {
|
|
190
|
+
e = await fetch(n);
|
|
191
|
+
} catch (r) {
|
|
192
|
+
const t = r instanceof Error ? r.message : String(r);
|
|
193
|
+
throw new Error(`Network error fetching ${n}: ${t}`, { cause: r });
|
|
194
|
+
}
|
|
195
|
+
if (!e.ok)
|
|
196
|
+
throw new Error(`Failed to fetch ${n}: ${e.status} ${e.statusText}`);
|
|
197
|
+
const _ = await e.text();
|
|
198
|
+
if (_.length > S)
|
|
199
|
+
throw new Error(`Response from ${n} is too large. Max size is ${S} bytes.`);
|
|
200
|
+
return _;
|
|
201
|
+
}
|
|
202
|
+
const g = 10 ** 9;
|
|
203
|
+
function q(n, e) {
|
|
204
|
+
const { tx: _ } = n, r = e, t = new FinalizationRegistry(async (o) => {
|
|
205
|
+
await _.reader_free(o);
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
async fromBlob(o, i, a) {
|
|
209
|
+
if (!v(o))
|
|
210
|
+
throw new p(o);
|
|
211
|
+
if (i.size > g)
|
|
212
|
+
throw new h(i.size);
|
|
213
|
+
try {
|
|
214
|
+
const s = await b(r, a), c = await _.reader_fromBlob(o, i, s), u = F(n, c, () => {
|
|
215
|
+
t.unregister(u);
|
|
216
|
+
});
|
|
217
|
+
return t.register(u, c, u), u;
|
|
218
|
+
} catch (s) {
|
|
219
|
+
return I(s);
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
async fromBlobFragment(o, i, a, s) {
|
|
223
|
+
if (!v(o))
|
|
224
|
+
throw new p(o);
|
|
225
|
+
if (i.size > g)
|
|
226
|
+
throw new h(i.size);
|
|
227
|
+
try {
|
|
228
|
+
const c = await b(r, s), u = await _.reader_fromBlobFragment(
|
|
229
|
+
o,
|
|
230
|
+
i,
|
|
231
|
+
a,
|
|
232
|
+
c
|
|
233
|
+
), f = F(n, u, () => {
|
|
234
|
+
t.unregister(f);
|
|
235
|
+
});
|
|
236
|
+
return t.register(f, u, f), f;
|
|
237
|
+
} catch (c) {
|
|
238
|
+
return I(c);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function I(n) {
|
|
244
|
+
if (n instanceof Error && n.message === "C2pa(JumbfNotFound)")
|
|
245
|
+
return null;
|
|
246
|
+
throw n;
|
|
247
|
+
}
|
|
248
|
+
function F(n, e, _) {
|
|
249
|
+
const { tx: r } = n;
|
|
250
|
+
return {
|
|
251
|
+
async activeLabel() {
|
|
252
|
+
return await r.reader_activeLabel(e);
|
|
253
|
+
},
|
|
254
|
+
async manifestStore() {
|
|
255
|
+
return await r.reader_manifestStore(e);
|
|
256
|
+
},
|
|
257
|
+
async activeManifest() {
|
|
258
|
+
return await r.reader_activeManifest(e);
|
|
259
|
+
},
|
|
260
|
+
async json() {
|
|
261
|
+
const t = await r.reader_json(e);
|
|
262
|
+
return JSON.parse(t);
|
|
263
|
+
},
|
|
264
|
+
async crJson() {
|
|
265
|
+
const t = await r.reader_crJson(e);
|
|
266
|
+
return JSON.parse(t);
|
|
267
|
+
},
|
|
268
|
+
async resourceToBytes(t) {
|
|
269
|
+
return await r.reader_resourceToBytes(e, t);
|
|
270
|
+
},
|
|
271
|
+
async free() {
|
|
272
|
+
_(), await r.reader_free(e);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
async function x(n) {
|
|
277
|
+
const { alg: e } = n;
|
|
278
|
+
return {
|
|
279
|
+
reserveSize: await n.reserveSize(),
|
|
280
|
+
alg: e
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function G(n, e) {
|
|
284
|
+
const _ = e, { tx: r } = n, t = new FinalizationRegistry((o) => {
|
|
285
|
+
r.builder_free(o);
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
async new(o) {
|
|
289
|
+
const i = await b(_, o), a = await r.builder_new(i), s = d(n, a, () => {
|
|
290
|
+
t.unregister(s);
|
|
291
|
+
});
|
|
292
|
+
return t.register(s, a, s), s;
|
|
293
|
+
},
|
|
294
|
+
async fromDefinition(o, i) {
|
|
295
|
+
const a = JSON.stringify(o), s = await b(_, i), c = await r.builder_fromJson(a, s), u = d(n, c, () => {
|
|
296
|
+
t.unregister(u);
|
|
297
|
+
});
|
|
298
|
+
return t.register(u, c, u), u;
|
|
299
|
+
},
|
|
300
|
+
async fromArchive(o, i) {
|
|
301
|
+
const a = await b(_, i), s = await r.builder_fromArchive(o, a), c = d(n, s, () => {
|
|
302
|
+
t.unregister(c);
|
|
303
|
+
});
|
|
304
|
+
return t.register(c, s, c), c;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function d(n, e, _) {
|
|
309
|
+
const { tx: r } = n;
|
|
310
|
+
return {
|
|
311
|
+
async setIntent(t) {
|
|
312
|
+
await r.builder_setIntent(e, t);
|
|
313
|
+
},
|
|
314
|
+
async addAction(t) {
|
|
315
|
+
await r.builder_addAction(e, t);
|
|
316
|
+
},
|
|
317
|
+
async addRedaction(t, o) {
|
|
318
|
+
await r.builder_addRedaction(e, t, o);
|
|
319
|
+
},
|
|
320
|
+
async setRemoteUrl(t) {
|
|
321
|
+
await r.builder_setRemoteUrl(e, t);
|
|
322
|
+
},
|
|
323
|
+
async setNoEmbed(t) {
|
|
324
|
+
await r.builder_setNoEmbed(e, t);
|
|
325
|
+
},
|
|
326
|
+
async setThumbnailFromBlob(t, o) {
|
|
327
|
+
await r.builder_setThumbnailFromBlob(e, t, o);
|
|
328
|
+
},
|
|
329
|
+
async addIngredient(t) {
|
|
330
|
+
const o = JSON.stringify(t);
|
|
331
|
+
await r.builder_addIngredient(e, o);
|
|
332
|
+
},
|
|
333
|
+
async addIngredientFromBlob(t, o, i) {
|
|
334
|
+
const a = JSON.stringify(t);
|
|
335
|
+
await r.builder_addIngredientFromBlob(e, a, o, i);
|
|
336
|
+
},
|
|
337
|
+
async addResourceFromBlob(t, o) {
|
|
338
|
+
await r.builder_addResourceFromBlob(e, t, o);
|
|
339
|
+
},
|
|
340
|
+
async getDefinition() {
|
|
341
|
+
return await r.builder_getDefinition(e);
|
|
342
|
+
},
|
|
343
|
+
async toArchive() {
|
|
344
|
+
return await r.builder_toArchive(e);
|
|
345
|
+
},
|
|
346
|
+
async sign(t, o, i) {
|
|
347
|
+
const a = await x(t), s = n.registerSignReceiver(t.sign);
|
|
348
|
+
return await r.builder_sign(
|
|
349
|
+
e,
|
|
350
|
+
s,
|
|
351
|
+
a,
|
|
352
|
+
o,
|
|
353
|
+
i
|
|
354
|
+
);
|
|
355
|
+
},
|
|
356
|
+
async signAndGetManifestBytes(t, o, i) {
|
|
357
|
+
const a = await x(t), s = n.registerSignReceiver(t.sign);
|
|
358
|
+
return await r.builder_signAndGetManifestBytes(
|
|
359
|
+
e,
|
|
360
|
+
s,
|
|
361
|
+
a,
|
|
362
|
+
o,
|
|
363
|
+
i
|
|
364
|
+
);
|
|
365
|
+
},
|
|
366
|
+
async free() {
|
|
367
|
+
_(), await r.builder_free(e);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
async function Z(n) {
|
|
372
|
+
const { wasmSrc: e, workerSrc: _, settings: r } = n, t = typeof e == "string" ? await V(e) : e, o = await b(r, void 0), i = await z({ wasm: t, workerSrc: _, settingsString: o });
|
|
373
|
+
return {
|
|
374
|
+
reader: q(i, r),
|
|
375
|
+
builder: G(i, r),
|
|
376
|
+
dispose: i.terminate
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
async function V(n) {
|
|
380
|
+
const e = await fetch(n, { integrity: N });
|
|
381
|
+
return await WebAssembly.compileStreaming(e);
|
|
382
|
+
}
|
|
383
|
+
export {
|
|
384
|
+
J as R,
|
|
385
|
+
Z as c,
|
|
386
|
+
v as i
|
|
387
|
+
};
|