let o;function l(n){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,n),e}function u(n,e){try{return n.apply(this,e)}catch(t){const r=l(t);o.__wbindgen_exn_store(r)}}const T=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&T.decode();let h=null;function m(){return(h===null||h.byteLength===0)&&(h=new Uint8Array(o.memory.buffer)),h}function w(n,e){return n=n>>>0,T.decode(m().subarray(n,n+e))}function b(n){return n==null}function R(n,e){return n=n>>>0,m().subarray(n/1,n/1+e)}let s=0;const S=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},D=typeof S.encodeInto=="function"?function(n,e){return S.encodeInto(n,e)}:function(n,e){const t=S.encode(n);return e.set(t),{read:n.length,written:t.length}};function f(n,e,t){if(t===void 0){const a=S.encode(n),g=e(a.length,1)>>>0;return m().subarray(g,g+a.length).set(a),s=a.length,g}let r=n.length,c=e(r,1)>>>0;const i=m();let _=0;for(;_127)break;i[c+_]=a}if(_!==r){_!==0&&(n=n.slice(_)),c=t(c,r,r=_+n.length*3,1)>>>0;const a=m().subarray(c+_,c+r),g=D(n,a);_+=g.written,c=t(c,r,_,1)>>>0}return s=_,c}let d=null;function p(){return(d===null||d.buffer.detached===!0||d.buffer.detached===void 0&&d.buffer!==o.memory.buffer)&&(d=new DataView(o.memory.buffer)),d}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>{o.__wbindgen_export_5.get(n.dtor)(n.a,n.b)});function k(n,e,t,r){const c={a:n,b:e,cnt:1,dtor:t},i=(..._)=>{c.cnt++;const a=c.a;c.a=0;try{return r(a,c.b,..._)}finally{--c.cnt===0?(o.__wbindgen_export_5.get(c.dtor)(a,c.b),O.unregister(c)):c.a=a}};return i.original=c,O.register(i,c,c),i}function A(n){const e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){const c=n.description;return c==null?"Symbol":`Symbol(${c})`}if(e=="function"){const c=n.name;return typeof c=="string"&&c.length>0?`Function(${c})`:"Function"}if(Array.isArray(n)){const c=n.length;let i="[";c>0&&(i+=A(n[0]));for(let _=1;_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.stack}`:r}function B(){o.init_rhai_env()}function y(n){const e=o.__wbindgen_export_2.get(n);return o.__externref_table_dealloc(n),e}function N(n){const e=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),t=s,r=o.run_rhai(e,t);if(r[2])throw y(r[1]);return y(r[0])}function v(n,e){const t=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=s,c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=s;return o.create_keyspace(t,r,c,i)}function V(n,e){const t=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=s,c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=s;return o.init_session(t,r,c,i)}function C(){o.lock_session()}function $(){const n=o.current_keypair_metadata();if(n[2])throw y(n[1]);return y(n[0])}function z(){const n=o.current_keypair_public_key();if(n[2])throw y(n[1]);return y(n[0])}function P(){return o.is_unlocked()!==0}function J(n){const e=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),t=s,r=o.select_keypair(e,t);if(r[1])throw y(r[0])}function G(){return o.list_keypairs()}function H(n,e){var t=b(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=s,c=b(e)?0:f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=s;return o.add_keypair(t,r,c,i)}function x(n,e){const t=e(n.length*1,1)>>>0;return m().set(n,t/1),s=n.length,t}function K(n){const e=x(n,o.__wbindgen_malloc),t=s;return o.sign(e,t)}function Q(n,e){const t=x(n,o.__wbindgen_malloc),r=s,c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=s;return o.verify(t,r,c,i)}function X(n){const e=x(n,o.__wbindgen_malloc),t=s;return o.encrypt_data(e,t)}function Y(n){const e=x(n,o.__wbindgen_malloc),t=s;return o.decrypt_data(e,t)}function W(n,e,t){o.closure100_externref_shim(n,e,t)}function M(n,e,t){o.closure143_externref_shim(n,e,t)}function E(n,e,t){o.closure223_externref_shim(n,e,t)}function F(n,e,t,r){o.closure1882_externref_shim(n,e,t,r)}const q=["readonly","readwrite","versionchange","readwriteflush","cleanup"];async function L(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function j(){const n={};return n.wbg={},n.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},n.wbg.__wbg_call_672a4d21634d4a24=function(){return u(function(e,t){return e.call(t)},arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return u(function(e,t,r){return e.call(t,r)},arguments)},n.wbg.__wbg_createObjectStore_d2f9e1016f4d81b9=function(){return u(function(e,t,r,c){return e.createObjectStore(w(t,r),c)},arguments)},n.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},n.wbg.__wbg_error_524f506f44df1645=function(e){console.error(e)},n.wbg.__wbg_error_ff4ddaabdfc5dbb3=function(){return u(function(e){const t=e.error;return b(t)?0:l(t)},arguments)},n.wbg.__wbg_getRandomValues_3c9c0d586e575a16=function(){return u(function(e,t){globalThis.crypto.getRandomValues(R(e,t))},arguments)},n.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return u(function(e,t){e.getRandomValues(t)},arguments)},n.wbg.__wbg_getTime_46267b1c24877e30=function(e){return e.getTime()},n.wbg.__wbg_get_4f73335ab78445db=function(e,t,r){const c=t[r>>>0];var i=b(c)?0:f(c,o.__wbindgen_malloc,o.__wbindgen_realloc),_=s;p().setInt32(e+4*1,_,!0),p().setInt32(e+4*0,i,!0)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return u(function(e,t){return Reflect.get(e,t)},arguments)},n.wbg.__wbg_get_8da03f81f6a1111e=function(){return u(function(e,t){return e.get(t)},arguments)},n.wbg.__wbg_instanceof_IdbDatabase_a3ef009ca00059f9=function(e){let t;try{t=e instanceof IDBDatabase}catch{t=!1}return t},n.wbg.__wbg_instanceof_IdbFactory_12eaba3366f4302f=function(e){let t;try{t=e instanceof IDBFactory}catch{t=!1}return t},n.wbg.__wbg_instanceof_IdbOpenDbRequest_a3416e156c9db893=function(e){let t;try{t=e instanceof IDBOpenDBRequest}catch{t=!1}return t},n.wbg.__wbg_instanceof_IdbRequest_4813c3f207666aa4=function(e){let t;try{t=e instanceof IDBRequest}catch{t=!1}return t},n.wbg.__wbg_length_52b6c4580c5ec934=function(e){return e.length},n.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},n.wbg.__wbg_new0_f788a2397c7ca929=function(){return new Date},n.wbg.__wbg_new_23a2665fac83c611=function(e,t){try{var r={a:e,b:t},c=(_,a)=>{const g=r.a;r.a=0;try{return F(g,r.b,_,a)}finally{r.a=g}};return new Promise(c)}finally{r.a=r.b=0}},n.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},n.wbg.__wbg_new_78feb108b6472713=function(){return new Array},n.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,t){return new Function(w(e,t))},n.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,t,r){return new Uint8Array(e,t>>>0,r>>>0)},n.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},n.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},n.wbg.__wbg_now_d18023d54d4e5500=function(e){return e.now()},n.wbg.__wbg_objectStoreNames_9bb1ab04a7012aaf=function(e){return e.objectStoreNames},n.wbg.__wbg_objectStore_21878d46d25b64b6=function(){return u(function(e,t,r){return e.objectStore(w(t,r))},arguments)},n.wbg.__wbg_open_88b1390d99a7c691=function(){return u(function(e,t,r){return e.open(w(t,r))},arguments)},n.wbg.__wbg_open_e0c0b2993eb596e1=function(){return u(function(e,t,r,c){return e.open(w(t,r),c>>>0)},arguments)},n.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},n.wbg.__wbg_push_737cfc8c1432c2c6=function(e,t){return e.push(t)},n.wbg.__wbg_put_066faa31a6a88f5b=function(){return u(function(e,t,r){return e.put(t,r)},arguments)},n.wbg.__wbg_put_9ef5363941008835=function(){return u(function(e,t){return e.put(t)},arguments)},n.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},n.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},n.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return u(function(e,t){e.randomFillSync(t)},arguments)},n.wbg.__wbg_require_60cc747a6bc5215a=function(){return u(function(){return module.require},arguments)},n.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},n.wbg.__wbg_result_f29afabdf2c05826=function(){return u(function(e){return e.result},arguments)},n.wbg.__wbg_set_65595bdd868b3009=function(e,t,r){e.set(t,r>>>0)},n.wbg.__wbg_setonerror_d7e3056cc6e56085=function(e,t){e.onerror=t},n.wbg.__wbg_setonsuccess_afa464ee777a396d=function(e,t){e.onsuccess=t},n.wbg.__wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f=function(e,t){e.onupgradeneeded=t},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e=typeof global>"u"?null:global;return b(e)?0:l(e)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e=typeof globalThis>"u"?null:globalThis;return b(e)?0:l(e)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e=typeof self>"u"?null:self;return b(e)?0:l(e)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e=typeof window>"u"?null:window;return b(e)?0:l(e)},n.wbg.__wbg_subarray_aa9065fa9dc5df96=function(e,t,r){return e.subarray(t>>>0,r>>>0)},n.wbg.__wbg_target_0a62d9d79a2a1ede=function(e){const t=e.target;return b(t)?0:l(t)},n.wbg.__wbg_then_44b73946d2fb3e7d=function(e,t){return e.then(t)},n.wbg.__wbg_transaction_d6d07c3c9963c49e=function(){return u(function(e,t,r){return e.transaction(t,q[r])},arguments)},n.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},n.wbg.__wbindgen_cb_drop=function(e){const t=e.original;return t.cnt--==1?(t.a=0,!0):!1},n.wbg.__wbindgen_closure_wrapper312=function(e,t,r){return k(e,t,101,W)},n.wbg.__wbindgen_closure_wrapper533=function(e,t,r){return k(e,t,144,M)},n.wbg.__wbindgen_closure_wrapper844=function(e,t,r){return k(e,t,224,E)},n.wbg.__wbindgen_debug_string=function(e,t){const r=A(t),c=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),i=s;p().setInt32(e+4*1,i,!0),p().setInt32(e+4*0,c,!0)},n.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_export_2,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.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},n.wbg.__wbindgen_is_null=function(e){return e===null},n.wbg.__wbindgen_is_object=function(e){const t=e;return typeof t=="object"&&t!==null},n.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},n.wbg.__wbindgen_is_undefined=function(e){return e===void 0},n.wbg.__wbindgen_json_parse=function(e,t){return JSON.parse(w(e,t))},n.wbg.__wbindgen_json_serialize=function(e,t){const r=t,c=JSON.stringify(r===void 0?null:r),i=f(c,o.__wbindgen_malloc,o.__wbindgen_realloc),_=s;p().setInt32(e+4*1,_,!0),p().setInt32(e+4*0,i,!0)},n.wbg.__wbindgen_memory=function(){return o.memory},n.wbg.__wbindgen_string_new=function(e,t){return w(e,t)},n.wbg.__wbindgen_throw=function(e,t){throw new Error(w(e,t))},n}function I(n,e){return o=n.exports,U.__wbindgen_wasm_module=e,d=null,h=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=j();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));const t=new WebAssembly.Instance(n,e);return I(t,n)}async function U(n){if(o!==void 0)return o;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof n>"u"&&(n=new URL("/wasm/wasm_app_bg.wasm",self.location));const e=j();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:t,module:r}=await L(await n,e);return I(t,r)}export{H as add_keypair,v as create_keyspace,$ as current_keypair_metadata,z as current_keypair_public_key,Y as decrypt_data,U as default,X as encrypt_data,Z as initSync,B as init_rhai_env,V as init_session,P as is_unlocked,G as list_keypairs,C as lock_session,N as run_rhai,J as select_keypair,K as sign,Q as verify};