let wasm; export function __wbg_set_wasm(val) { wasm = val; } const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); function getObject(idx) { return heap[idx]; } let heap_next = heap.length; function dropObject(idx) { if (idx < 132) return; heap[idx] = heap_next; heap_next = idx; } function takeObject(idx) { const ret = getObject(idx); dropObject(idx); return ret; } const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); let cachedUint8ArrayMemory0 = null; function getUint8ArrayMemory0() { if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } function addHeapObject(obj) { if (heap_next === heap.length) heap.push(heap.length + 1); const idx = heap_next; heap_next = heap[idx]; heap[idx] = obj; return idx; } const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(state => { wasm.__wbindgen_export_0.get(state.dtor)(state.a, state.b) }); function makeMutClosure(arg0, arg1, dtor, f) { const state = { a: arg0, b: arg1, cnt: 1, dtor }; const real = (...args) => { // First up with a closure we increment the internal reference // count. This ensures that the Rust closure environment won't // be deallocated while we're invoking it. state.cnt++; const a = state.a; state.a = 0; try { return f(a, state.b, ...args); } finally { if (--state.cnt === 0) { wasm.__wbindgen_export_0.get(state.dtor)(a, state.b); CLOSURE_DTORS.unregister(state); } else { state.a = a; } } }; real.original = state; CLOSURE_DTORS.register(real, state, state); return real; } function __wbg_adapter_16(arg0, arg1, arg2) { wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7eff1fc92a11aeed(arg0, arg1, addHeapObject(arg2)); } let WASM_VECTOR_LEN = 0; const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; let cachedTextEncoder = new lTextEncoder('utf-8'); const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { return cachedTextEncoder.encodeInto(arg, view); } : function (arg, view) { const buf = cachedTextEncoder.encode(arg); view.set(buf); return { read: arg.length, written: buf.length }; }); function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length, 1) >>> 0; getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len, 1) >>> 0; const mem = getUint8ArrayMemory0(); let offset = 0; for (; offset < len; offset++) { const code = arg.charCodeAt(offset); if (code > 0x7F) break; mem[ptr + offset] = code; } if (offset !== len) { if (offset !== 0) { arg = arg.slice(offset); } ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; ptr = realloc(ptr, len, offset, 1) >>> 0; } WASM_VECTOR_LEN = offset; return ptr; } /** * Calculates the Proof of Work for the given challenge * @param {string} challenge * @returns {Promise} */ export function pow_work_wasm(challenge) { const ptr0 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.pow_work_wasm(ptr0, len0); return takeObject(ret); } function handleError(f, args) { try { return f.apply(this, args); } catch (e) { wasm.__wbindgen_exn_store(addHeapObject(e)); } } function __wbg_adapter_28(arg0, arg1, arg2, arg3) { wasm.wasm_bindgen__convert__closures__invoke2_mut__h8d1a7fb8f096da29(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); } export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; export function __wbindgen_string_new(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); }; export function __wbg_queueMicrotask_48421b3cc9052b68(arg0) { const ret = getObject(arg0).queueMicrotask; return addHeapObject(ret); }; export function __wbindgen_is_function(arg0) { const ret = typeof(getObject(arg0)) === 'function'; return ret; }; export function __wbindgen_cb_drop(arg0) { const obj = takeObject(arg0).original; if (obj.cnt-- == 1) { obj.a = 0; return true; } const ret = false; return ret; }; export function __wbg_queueMicrotask_12a30234db4045d3(arg0) { queueMicrotask(getObject(arg0)); }; export function __wbg_self_3093d5d1f7bcb682() { return handleError(function () { const ret = self.self; return addHeapObject(ret); }, arguments) }; export function __wbg_window_3bcfc4d31bc012f8() { return handleError(function () { const ret = window.window; return addHeapObject(ret); }, arguments) }; export function __wbg_globalThis_86b222e13bdf32ed() { return handleError(function () { const ret = globalThis.globalThis; return addHeapObject(ret); }, arguments) }; export function __wbg_global_e5a3fe56f8be9485() { return handleError(function () { const ret = global.global; return addHeapObject(ret); }, arguments) }; export function __wbindgen_is_undefined(arg0) { const ret = getObject(arg0) === undefined; return ret; }; export function __wbg_newnoargs_76313bd6ff35d0f2(arg0, arg1) { const ret = new Function(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }; export function __wbg_call_1084a111329e68ce() { return handleError(function (arg0, arg1) { const ret = getObject(arg0).call(getObject(arg1)); return addHeapObject(ret); }, arguments) }; export function __wbindgen_object_clone_ref(arg0) { const ret = getObject(arg0); return addHeapObject(ret); }; export function __wbg_call_89af060b4e1523f2() { return handleError(function (arg0, arg1, arg2) { const ret = getObject(arg0).call(getObject(arg1), getObject(arg2)); return addHeapObject(ret); }, arguments) }; export function __wbg_new_b85e72ed1bfd57f9(arg0, arg1) { try { var state0 = {a: arg0, b: arg1}; var cb0 = (arg0, arg1) => { const a = state0.a; state0.a = 0; try { return __wbg_adapter_28(a, state0.b, arg0, arg1); } finally { state0.a = a; } }; const ret = new Promise(cb0); return addHeapObject(ret); } finally { state0.a = state0.b = 0; } }; export function __wbg_resolve_570458cb99d56a43(arg0) { const ret = Promise.resolve(getObject(arg0)); return addHeapObject(ret); }; export function __wbg_then_95e6edc0f89b73b1(arg0, arg1) { const ret = getObject(arg0).then(getObject(arg1)); return addHeapObject(ret); }; export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; export function __wbindgen_closure_wrapper36(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_16); return addHeapObject(ret); };