import { Foo, jsthunk } from '../globals.js'; import * as __wbg_star0 from '../globals.js'; let wasm; const heap = new Array(32).fill(undefined); heap.push(undefined, null, true, false); function getObject(idx) { return heap[idx]; } let heap_next = heap.length; function dropObject(idx) { if (idx < 36) return; heap[idx] = heap_next; heap_next = idx; } function takeObject(idx) { const ret = getObject(idx); dropObject(idx); return ret; } let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); let cachegetUint8Memory0 = null; function getUint8Memory0() { if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachegetUint8Memory0; } function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8Memory0().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; } function handleError(f) { return function () { try { return f.apply(this, arguments); } catch (e) { wasm.__wbindgen_exn_store(addHeapObject(e)); } }; } /** * @param {number} n */ export function call_js_thunk_n_times(n) { wasm.call_js_thunk_n_times(n); } /** * @param {number} n * @param {number} a * @param {number} b */ export function call_js_add_n_times(n, a, b) { wasm.call_js_add_n_times(n, a, b); } /** */ export function thunk() { wasm.thunk(); } /** * @param {number} a * @param {number} b * @returns {number} */ export function add(a, b) { var ret = wasm.add(a, b); return ret; } /** * @param {number} n * @returns {number} */ export function fibonacci(n) { var ret = wasm.fibonacci(n); return ret; } /** * @returns {number} */ export function fibonacci_high() { var ret = wasm.fibonacci_high(); return ret; } let stack_pointer = 32; function addBorrowedObject(obj) { if (stack_pointer == 1) throw new Error('out of js stack'); heap[--stack_pointer] = obj; return stack_pointer; } /** * @param {number} n * @param {any} foo */ export function call_foo_bar_final_n_times(n, foo) { try { wasm.call_foo_bar_final_n_times(n, addBorrowedObject(foo)); } finally { heap[stack_pointer++] = undefined; } } /** * @param {number} n * @param {any} foo */ export function call_foo_bar_structural_n_times(n, foo) { try { wasm.call_foo_bar_structural_n_times(n, addBorrowedObject(foo)); } finally { heap[stack_pointer++] = undefined; } } /** * @param {number} n */ export function call_doesnt_throw_n_times(n) { wasm.call_doesnt_throw_n_times(n); } /** * @param {number} n */ export function call_doesnt_throw_with_catch_n_times(n) { wasm.call_doesnt_throw_with_catch_n_times(n); } function GetOwnOrInheritedPropertyDescriptor(obj, id) { while (obj) { let desc = Object.getOwnPropertyDescriptor(obj, id); if (desc) return desc; obj = Object.getPrototypeOf(obj); } return {}; } /** * @param {number} n * @param {any} element */ export function call_first_child_final_n_times(n, element) { try { wasm.call_first_child_final_n_times(n, addBorrowedObject(element)); } finally { heap[stack_pointer++] = undefined; } } /** * @param {number} n * @param {any} element */ export function call_first_child_structural_n_times(n, element) { try { wasm.call_first_child_structural_n_times(n, addBorrowedObject(element)); } finally { heap[stack_pointer++] = undefined; } } let cachegetUint32Memory0 = null; function getUint32Memory0() { if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) { cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer); } return cachegetUint32Memory0; } let WASM_VECTOR_LEN = 0; function passArrayJsValueToWasm0(array, malloc) { const ptr = malloc(array.length * 4); const mem = getUint32Memory0(); for (let i = 0; i < array.length; i++) { mem[ptr / 4 + i] = addHeapObject(array[i]); } WASM_VECTOR_LEN = array.length; return ptr; } /** * @param {number} n * @param {any[]} elements */ export function call_node_first_child_n_times(n, elements) { var ptr0 = passArrayJsValueToWasm0(elements, wasm.__wbindgen_malloc); var len0 = WASM_VECTOR_LEN; wasm.call_node_first_child_n_times(n, ptr0, len0); } /** * @param {number} n * @param {any[]} elements */ export function call_node_node_type_n_times(n, elements) { var ptr0 = passArrayJsValueToWasm0(elements, wasm.__wbindgen_malloc); var len0 = WASM_VECTOR_LEN; wasm.call_node_node_type_n_times(n, ptr0, len0); } /** * @param {number} n * @param {any[]} elements */ export function call_node_has_child_nodes_n_times(n, elements) { var ptr0 = passArrayJsValueToWasm0(elements, wasm.__wbindgen_malloc); var len0 = WASM_VECTOR_LEN; wasm.call_node_has_child_nodes_n_times(n, ptr0, len0); } /** * @param {Node} element */ export function count_node_types(element) { wasm.count_node_types(addHeapObject(element)); } let cachedTextEncoder = new TextEncoder('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); getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len); const mem = getUint8Memory0(); 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); const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; } WASM_VECTOR_LEN = offset; return ptr; } let cachegetInt32Memory0 = null; function getInt32Memory0() { if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachegetInt32Memory0; } /** * @param {string} s * @returns {string} */ export function str_roundtrip(s) { try { var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var len0 = WASM_VECTOR_LEN; wasm.str_roundtrip(8, ptr0, len0); var r0 = getInt32Memory0()[8 / 4 + 0]; var r1 = getInt32Memory0()[8 / 4 + 1]; return getStringFromWasm0(r0, r1); } finally { wasm.__wbindgen_free(r0, r1); } } function isLikeNone(x) { return x === undefined || x === null; } async function load(module, imports) { if (typeof Response === 'function' && module instanceof Response) { if (typeof WebAssembly.instantiateStreaming === 'function') { try { return await WebAssembly.instantiateStreaming(module, imports); } catch (e) { if (module.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", e); } else { throw e; } } } const bytes = await module.arrayBuffer(); return await WebAssembly.instantiate(bytes, imports); } else { const instance = await WebAssembly.instantiate(module, imports); if (instance instanceof WebAssembly.Instance) { return { instance, module }; } else { return instance; } } } async function init(input) { if (typeof input === 'undefined') { input = import.meta.url.replace(/\.js$/, '_bg.wasm'); } const imports = {}; imports.wbg = {}; imports.wbg.__wbg_bar_be39433b107f574c = function(arg0) { Foo.prototype.bar.call(getObject(arg0)); }; imports.wbg.__wbg_bar_ecb09d67d012d94e = function(arg0) { getObject(arg0).bar(); }; imports.wbg.__wbg_jsthunk_06330a0180a79545 = handleError(function() { jsthunk(); }); imports.wbg.__wbg_firstChild_a71694b74dc435f3 = function(arg0) { var ret = GetOwnOrInheritedPropertyDescriptor(Element.prototype, 'firstChild').get.call(getObject(arg0)); return addHeapObject(ret); }; imports.wbg.__wbindgen_object_drop_ref = function(arg0) { takeObject(arg0); }; imports.wbg.__wbg_firstChild_708a5ee860a65e50 = function(arg0) { var ret = getObject(arg0).firstChild; return addHeapObject(ret); }; imports.wbg.__wbg_nodeType_f7a0acdc5a8af0ba = function(arg0) { var ret = getObject(arg0).nodeType; return ret; }; imports.wbg.__wbg_firstChild_6331d78021333fbb = function(arg0) { var ret = getObject(arg0).firstChild; return isLikeNone(ret) ? 0 : addHeapObject(ret); }; imports.wbg.__wbg_nextSibling_706449ed0cb4c6f1 = function(arg0) { var ret = getObject(arg0).nextSibling; return isLikeNone(ret) ? 0 : addHeapObject(ret); }; imports.wbg.__wbg_hasChildNodes_a116232429ef947b = function(arg0) { var ret = getObject(arg0).hasChildNodes(); return ret; }; imports.wbg.__wbindgen_throw = function(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; imports.wbg.__wbindgen_rethrow = function(arg0) { throw takeObject(arg0); }; imports['../globals.js'] = __wbg_star0; if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { input = fetch(input); } const { instance, module } = await load(await input, imports); wasm = instance.exports; init.__wbindgen_wasm_module = module; return wasm; } export default init;