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AAI,QAAQ,uBAItB,MADA,EAAG,MAAM,iBACH,IAAI,QAAQ,EAAc,mBAAmB,OAAO,EAAO,EAAI,IACzE,QACI,MAAM,IAAI,QAAQ,sBAAsB,KAChD,EAEJ,SAAS,gBAAgB,EAAI,GACzB,IACI,OAAO,GACX,CACA,MAAO,GACH,GAAI,aAAa,QACb,MAAM,EAKV,GADA,EAAG,MAAM,gBACL,aAAa,YAAY,cAA8B,gBAAd,EAAE,QAA2B,CACtE,MAAM,EAAQ,IAAI,QAAQ,oCAAoC,KAE9D,MADA,EAAM,MAAQ,EAAE,MACV,CACV,CAEI,MAAM,CAEd,CACJ,CACA,MAAM,aAAe,CAAC,EAAI,EAAe,EAAM,EAAQ,KACnD,MAAM,EAAM,EAAG,MAAM,SAAS,EAAS,MACvC,OAAO,gBAAgB,GAAI,KACvB,MAAO,EAAO,GAAU,EAAG,MAAM,kBAAkB,EAAM,EAAK,GAE9D,OADA,eAAe,EAAQ,EAAI,GACpB,CAAK,GACd,EAEA,WAAa,CAAC,EAAI,EAAe,IAC5B,gBAAgB,GAAI,KACvB,MAAO,EAAO,GAAU,EAAG,MAAM,oBAAoB,EAAO,MAE5D,OADA,eAAe,EAAQ,EAAI,GACpB,IAAI,QAAQ,EAAO,EAAI,EAAc,IAMpD,MAAM,gBAAgB,MAIlB,WAAA,CAAY,GACR,MAAM,EACV,EAMJ,MAAM,qBAAqB,QAIvB,WAAA,CAAY,GACR,MAAM,qBAAuB,EACjC,EAGJ,QAAQ,QAAU,QAClB,QAAQ,aAAe,aACvB,QAAQ,QAAU,QAClB,QAAQ,OAAS","file":"/npm/ruby-head-wasm-wasi@2.3.0/dist/index.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ruby-head-wasm-wasi@2.3.0/dist/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","console.warn(`\u001b[33mDEPRECATED(ruby-head-wasm-wasi): \"index.cjs.js\" will be moved to \"@ruby/wasm-wasi\" in the next major release.\nPlease replace your \\`require('ruby-head-wasm-wasi/dist/index.cjs.js');\\` with \\`require('@ruby/wasm-wasi/dist/index.cjs.js');\\`\u001b[0m`);\n\n'use strict';\n\nlet DATA_VIEW = new DataView(new ArrayBuffer());\n\nfunction data_view(mem) {\n  if (DATA_VIEW.buffer !== mem.buffer) DATA_VIEW = new DataView(mem.buffer);\n  return DATA_VIEW;\n}\n\nfunction to_uint32(val) {\n  return val >>> 0;\n}\nconst UTF8_DECODER = new TextDecoder('utf-8');\n\nconst UTF8_ENCODER = new TextEncoder('utf-8');\n\nfunction utf8_encode(s, realloc, memory) {\n  if (typeof s !== 'string') throw new TypeError('expected a string');\n  \n  if (s.length === 0) {\n    UTF8_ENCODED_LEN = 0;\n    return 1;\n  }\n  \n  let alloc_len = 0;\n  let ptr = 0;\n  let writtenTotal = 0;\n  while (s.length > 0) {\n    ptr = realloc(ptr, alloc_len, 1, alloc_len + s.length);\n    alloc_len += s.length;\n    const { read, written } = UTF8_ENCODER.encodeInto(\n    s,\n    new Uint8Array(memory.buffer, ptr + writtenTotal, alloc_len - writtenTotal),\n    );\n    writtenTotal += written;\n    s = s.slice(read);\n  }\n  if (alloc_len > writtenTotal)\n  ptr = realloc(ptr, alloc_len, 1, writtenTotal);\n  UTF8_ENCODED_LEN = writtenTotal;\n  return ptr;\n}\nlet UTF8_ENCODED_LEN = 0;\n\nclass Slab {\n  constructor() {\n    this.list = [];\n    this.head = 0;\n  }\n  \n  insert(val) {\n    if (this.head >= this.list.length) {\n      this.list.push({\n        next: this.list.length + 1,\n        val: undefined,\n      });\n    }\n    const ret = this.head;\n    const slot = this.list[ret];\n    this.head = slot.next;\n    slot.next = -1;\n    slot.val = val;\n    return ret;\n  }\n  \n  get(idx) {\n    if (idx >= this.list.length)\n    throw new RangeError('handle index not valid');\n    const slot = this.list[idx];\n    if (slot.next === -1)\n    return slot.val;\n    throw new RangeError('handle index not valid');\n  }\n  \n  remove(idx) {\n    const ret = this.get(idx); // validate the slot\n    const slot = this.list[idx];\n    slot.val = undefined;\n    slot.next = this.head;\n    this.head = idx;\n    return ret;\n  }\n}\n\nfunction throw_invalid_bool() {\n  throw new RangeError(\"invalid variant discriminant for bool\");\n}\n\nclass RbAbiGuest {\n  constructor() {\n    this._resource0_slab = new Slab();\n    this._resource1_slab = new Slab();\n  }\n  addToImports(imports) {\n    if (!(\"canonical_abi\" in imports)) imports[\"canonical_abi\"] = {};\n    \n    imports.canonical_abi['resource_drop_rb-iseq'] = i => {\n      this._resource0_slab.remove(i).drop();\n    };\n    imports.canonical_abi['resource_clone_rb-iseq'] = i => {\n      const obj = this._resource0_slab.get(i);\n      return this._resource0_slab.insert(obj.clone())\n    };\n    imports.canonical_abi['resource_get_rb-iseq'] = i => {\n      return this._resource0_slab.get(i)._wasm_val;\n    };\n    imports.canonical_abi['resource_new_rb-iseq'] = i => {\n      this._registry0;\n      return this._resource0_slab.insert(new RbIseq(i, this));\n    };\n    \n    imports.canonical_abi['resource_drop_rb-abi-value'] = i => {\n      this._resource1_slab.remove(i).drop();\n    };\n    imports.canonical_abi['resource_clone_rb-abi-value'] = i => {\n      const obj = this._resource1_slab.get(i);\n      return this._resource1_slab.insert(obj.clone())\n    };\n    imports.canonical_abi['resource_get_rb-abi-value'] = i => {\n      return this._resource1_slab.get(i)._wasm_val;\n    };\n    imports.canonical_abi['resource_new_rb-abi-value'] = i => {\n      this._registry1;\n      return this._resource1_slab.insert(new RbAbiValue(i, this));\n    };\n  }\n  \n  async instantiate(module, imports) {\n    imports = imports || {};\n    this.addToImports(imports);\n    \n    if (module instanceof WebAssembly.Instance) {\n      this.instance = module;\n    } else if (module instanceof WebAssembly.Module) {\n      this.instance = await WebAssembly.instantiate(module, imports);\n    } else if (module instanceof ArrayBuffer || module instanceof Uint8Array) {\n      const { instance } = await WebAssembly.instantiate(module, imports);\n      this.instance = instance;\n    } else {\n      const { instance } = await WebAssembly.instantiateStreaming(module, imports);\n      this.instance = instance;\n    }\n    this._exports = this.instance.exports;\n    this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-iseq']);\n    this._registry1 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);\n  }\n  rubyShowVersion() {\n    this._exports['ruby-show-version: func() -> ()']();\n  }\n  rubyInit() {\n    this._exports['ruby-init: func() -> ()']();\n  }\n  rubySysinit(arg0) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const vec1 = arg0;\n    const len1 = vec1.length;\n    const result1 = realloc(0, 0, 4, len1 * 8);\n    for (let i = 0; i < vec1.length; i++) {\n      const e = vec1[i];\n      const base = result1 + i * 8;\n      const ptr0 = utf8_encode(e, realloc, memory);\n      const len0 = UTF8_ENCODED_LEN;\n      data_view(memory).setInt32(base + 4, len0, true);\n      data_view(memory).setInt32(base + 0, ptr0, true);\n    }\n    this._exports['ruby-sysinit: func(args: list<string>) -> ()'](result1, len1);\n  }\n  rubyOptions(arg0) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const vec1 = arg0;\n    const len1 = vec1.length;\n    const result1 = realloc(0, 0, 4, len1 * 8);\n    for (let i = 0; i < vec1.length; i++) {\n      const e = vec1[i];\n      const base = result1 + i * 8;\n      const ptr0 = utf8_encode(e, realloc, memory);\n      const len0 = UTF8_ENCODED_LEN;\n      data_view(memory).setInt32(base + 4, len0, true);\n      data_view(memory).setInt32(base + 0, ptr0, true);\n    }\n    const ret = this._exports['ruby-options: func(args: list<string>) -> handle<rb-iseq>'](result1, len1);\n    return this._resource0_slab.remove(ret);\n  }\n  rubyScript(arg0) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const ptr0 = utf8_encode(arg0, realloc, memory);\n    const len0 = UTF8_ENCODED_LEN;\n    this._exports['ruby-script: func(name: string) -> ()'](ptr0, len0);\n  }\n  rubyInitLoadpath() {\n    this._exports['ruby-init-loadpath: func() -> ()']();\n  }\n  rbEvalStringProtect(arg0) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const ptr0 = utf8_encode(arg0, realloc, memory);\n    const len0 = UTF8_ENCODED_LEN;\n    const ret = this._exports['rb-eval-string-protect: func(str: string) -> tuple<handle<rb-abi-value>, s32>'](ptr0, len0);\n    return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];\n  }\n  rbFuncallvProtect(arg0, arg1, arg2) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const obj0 = arg0;\n    if (!(obj0 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');\n    const vec2 = arg2;\n    const len2 = vec2.length;\n    const result2 = realloc(0, 0, 4, len2 * 4);\n    for (let i = 0; i < vec2.length; i++) {\n      const e = vec2[i];\n      const base = result2 + i * 4;\n      const obj1 = e;\n      if (!(obj1 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');\n      data_view(memory).setInt32(base + 0, this._resource1_slab.insert(obj1.clone()), true);\n    }\n    const ret = this._exports['rb-funcallv-protect: func(recv: handle<rb-abi-value>, mid: u32, args: list<handle<rb-abi-value>>) -> tuple<handle<rb-abi-value>, s32>'](this._resource1_slab.insert(obj0.clone()), to_uint32(arg1), result2, len2);\n    return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];\n  }\n  rbIntern(arg0) {\n    const memory = this._exports.memory;\n    const realloc = this._exports[\"cabi_realloc\"];\n    const ptr0 = utf8_encode(arg0, realloc, memory);\n    const len0 = UTF8_ENCODED_LEN;\n    const ret = this._exports['rb-intern: func(name: string) -> u32'](ptr0, len0);\n    return ret >>> 0;\n  }\n  rbErrinfo() {\n    const ret = this._exports['rb-errinfo: func() -> handle<rb-abi-value>']();\n    return this._resource1_slab.remove(ret);\n  }\n  rbClearErrinfo() {\n    this._exports['rb-clear-errinfo: func() -> ()']();\n  }\n  rstringPtr(arg0) {\n    const memory = this._exports.memory;\n    const obj0 = arg0;\n    if (!(obj0 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');\n    const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource1_slab.insert(obj0.clone()));\n    const ptr1 = data_view(memory).getInt32(ret + 0, true);\n    const len1 = data_view(memory).getInt32(ret + 4, true);\n    const result1 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr1, len1));\n    this._exports[\"cabi_post_rstring-ptr\"](ret);\n    return result1;\n  }\n  rbVmBugreport() {\n    this._exports['rb-vm-bugreport: func() -> ()']();\n  }\n  rbGcEnable() {\n    const ret = this._exports['rb-gc-enable: func() -> bool']();\n    const bool0 = ret;\n    return bool0 == 0 ? false : (bool0 == 1 ? true : throw_invalid_bool());\n  }\n  rbGcDisable() {\n    const ret = this._exports['rb-gc-disable: func() -> bool']();\n    const bool0 = ret;\n    return bool0 == 0 ? false : (bool0 == 1 ? true : throw_invalid_bool());\n  }\n  rbSetShouldProhibitRewind(arg0) {\n    const ret = this._exports['rb-set-should-prohibit-rewind: func(new-value: bool) -> bool'](arg0 ? 1 : 0);\n    const bool0 = ret;\n    return bool0 == 0 ? false : (bool0 == 1 ? true : throw_invalid_bool());\n  }\n}\n\nclass RbIseq {\n  constructor(wasm_val, obj) {\n    this._wasm_val = wasm_val;\n    this._obj = obj;\n    this._refcnt = 1;\n    obj._registry0.register(this, wasm_val, this);\n  }\n  \n  clone() {\n    this._refcnt += 1;\n    return this;\n  }\n  \n  drop() {\n    this._refcnt -= 1;\n    if (this._refcnt !== 0)\n    return;\n    this._obj._registry0.unregister(this);\n    const dtor = this._obj._exports['canonical_abi_drop_rb-iseq'];\n    const wasm_val = this._wasm_val;\n    delete this._obj;\n    delete this._refcnt;\n    delete this._wasm_val;\n    dtor(wasm_val);\n  }\n}\n\nclass RbAbiValue {\n  constructor(wasm_val, obj) {\n    this._wasm_val = wasm_val;\n    this._obj = obj;\n    this._refcnt = 1;\n    obj._registry1.register(this, wasm_val, this);\n  }\n  \n  clone() {\n    this._refcnt += 1;\n    return this;\n  }\n  \n  drop() {\n    this._refcnt -= 1;\n    if (this._refcnt !== 0)\n    return;\n    this._obj._registry1.unregister(this);\n    const dtor = this._obj._exports['canonical_abi_drop_rb-abi-value'];\n    const wasm_val = this._wasm_val;\n    delete this._obj;\n    delete this._refcnt;\n    delete this._wasm_val;\n    dtor(wasm_val);\n  }\n}\n\nfunction addRbJsAbiHostToImports(imports, obj, get_export) {\n  if (!(\"rb-js-abi-host\" in imports)) imports[\"rb-js-abi-host\"] = {};\n  imports[\"rb-js-abi-host\"][\"eval-js: func(code: string) -> variant { success(handle<js-abi-value>), failure(handle<js-abi-value>) }\"] = function(arg0, arg1, arg2) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg0;\n    const len0 = arg1;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.evalJs(result0);\n    const variant1 = ret0;\n    switch (variant1.tag) {\n      case \"success\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg2 + 0, 0, true);\n        data_view(memory).setInt32(arg2 + 4, resources0.insert(e), true);\n        break;\n      }\n      case \"failure\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg2 + 0, 1, true);\n        data_view(memory).setInt32(arg2 + 4, resources0.insert(e), true);\n        break;\n      }\n      default:\n      throw new RangeError(\"invalid variant specified for JsAbiResult\");\n    }\n  };\n  imports[\"rb-js-abi-host\"][\"is-js: func(value: handle<js-abi-value>) -> bool\"] = function(arg0) {\n    const ret0 = obj.isJs(resources0.get(arg0));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"instance-of: func(value: handle<js-abi-value>, klass: handle<js-abi-value>) -> bool\"] = function(arg0, arg1) {\n    const ret0 = obj.instanceOf(resources0.get(arg0), resources0.get(arg1));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"global-this: func() -> handle<js-abi-value>\"] = function() {\n    const ret0 = obj.globalThis();\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"int-to-js-number: func(value: s32) -> handle<js-abi-value>\"] = function(arg0) {\n    const ret0 = obj.intToJsNumber(arg0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"float-to-js-number: func(value: float64) -> handle<js-abi-value>\"] = function(arg0) {\n    const ret0 = obj.floatToJsNumber(arg0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"string-to-js-string: func(value: string) -> handle<js-abi-value>\"] = function(arg0, arg1) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg0;\n    const len0 = arg1;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.stringToJsString(result0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"bool-to-js-bool: func(value: bool) -> handle<js-abi-value>\"] = function(arg0) {\n    const bool0 = arg0;\n    const ret0 = obj.boolToJsBool(bool0 == 0 ? false : (bool0 == 1 ? true : throw_invalid_bool()));\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"proc-to-js-function: func(value: u32) -> handle<js-abi-value>\"] = function(arg0) {\n    const ret0 = obj.procToJsFunction(arg0 >>> 0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"rb-object-to-js-rb-value: func(raw-rb-abi-value: u32) -> handle<js-abi-value>\"] = function(arg0) {\n    const ret0 = obj.rbObjectToJsRbValue(arg0 >>> 0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"js-value-to-string: func(value: handle<js-abi-value>) -> string\"] = function(arg0, arg1) {\n    const memory = get_export(\"memory\");\n    const realloc = get_export(\"cabi_realloc\");\n    const ret0 = obj.jsValueToString(resources0.get(arg0));\n    const ptr0 = utf8_encode(ret0, realloc, memory);\n    const len0 = UTF8_ENCODED_LEN;\n    data_view(memory).setInt32(arg1 + 4, len0, true);\n    data_view(memory).setInt32(arg1 + 0, ptr0, true);\n  };\n  imports[\"rb-js-abi-host\"][\"js-value-to-integer: func(value: handle<js-abi-value>) -> variant { f64(float64), bignum(string) }\"] = function(arg0, arg1) {\n    const memory = get_export(\"memory\");\n    const realloc = get_export(\"cabi_realloc\");\n    const ret0 = obj.jsValueToInteger(resources0.get(arg0));\n    const variant1 = ret0;\n    switch (variant1.tag) {\n      case \"f64\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg1 + 0, 0, true);\n        data_view(memory).setFloat64(arg1 + 8, +e, true);\n        break;\n      }\n      case \"bignum\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg1 + 0, 1, true);\n        const ptr0 = utf8_encode(e, realloc, memory);\n        const len0 = UTF8_ENCODED_LEN;\n        data_view(memory).setInt32(arg1 + 12, len0, true);\n        data_view(memory).setInt32(arg1 + 8, ptr0, true);\n        break;\n      }\n      default:\n      throw new RangeError(\"invalid variant specified for RawInteger\");\n    }\n  };\n  imports[\"rb-js-abi-host\"][\"export-js-value-to-host: func(value: handle<js-abi-value>) -> ()\"] = function(arg0) {\n    obj.exportJsValueToHost(resources0.get(arg0));\n  };\n  imports[\"rb-js-abi-host\"][\"import-js-value-from-host: func() -> handle<js-abi-value>\"] = function() {\n    const ret0 = obj.importJsValueFromHost();\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"js-value-typeof: func(value: handle<js-abi-value>) -> string\"] = function(arg0, arg1) {\n    const memory = get_export(\"memory\");\n    const realloc = get_export(\"cabi_realloc\");\n    const ret0 = obj.jsValueTypeof(resources0.get(arg0));\n    const ptr0 = utf8_encode(ret0, realloc, memory);\n    const len0 = UTF8_ENCODED_LEN;\n    data_view(memory).setInt32(arg1 + 4, len0, true);\n    data_view(memory).setInt32(arg1 + 0, ptr0, true);\n  };\n  imports[\"rb-js-abi-host\"][\"js-value-equal: func(lhs: handle<js-abi-value>, rhs: handle<js-abi-value>) -> bool\"] = function(arg0, arg1) {\n    const ret0 = obj.jsValueEqual(resources0.get(arg0), resources0.get(arg1));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"js-value-strictly-equal: func(lhs: handle<js-abi-value>, rhs: handle<js-abi-value>) -> bool\"] = function(arg0, arg1) {\n    const ret0 = obj.jsValueStrictlyEqual(resources0.get(arg0), resources0.get(arg1));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-apply: func(target: handle<js-abi-value>, this-argument: handle<js-abi-value>, arguments: list<handle<js-abi-value>>) -> variant { success(handle<js-abi-value>), failure(handle<js-abi-value>) }\"] = function(arg0, arg1, arg2, arg3, arg4) {\n    const memory = get_export(\"memory\");\n    const len0 = arg3;\n    const base0 = arg2;\n    const result0 = [];\n    for (let i = 0; i < len0; i++) {\n      const base = base0 + i * 4;\n      result0.push(resources0.get(data_view(memory).getInt32(base + 0, true)));\n    }\n    const ret0 = obj.reflectApply(resources0.get(arg0), resources0.get(arg1), result0);\n    const variant1 = ret0;\n    switch (variant1.tag) {\n      case \"success\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg4 + 0, 0, true);\n        data_view(memory).setInt32(arg4 + 4, resources0.insert(e), true);\n        break;\n      }\n      case \"failure\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg4 + 0, 1, true);\n        data_view(memory).setInt32(arg4 + 4, resources0.insert(e), true);\n        break;\n      }\n      default:\n      throw new RangeError(\"invalid variant specified for JsAbiResult\");\n    }\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-construct: func(target: handle<js-abi-value>, arguments: list<handle<js-abi-value>>) -> handle<js-abi-value>\"] = function(arg0, arg1, arg2) {\n    const memory = get_export(\"memory\");\n    const len0 = arg2;\n    const base0 = arg1;\n    const result0 = [];\n    for (let i = 0; i < len0; i++) {\n      const base = base0 + i * 4;\n      result0.push(resources0.get(data_view(memory).getInt32(base + 0, true)));\n    }\n    const ret0 = obj.reflectConstruct(resources0.get(arg0), result0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-delete-property: func(target: handle<js-abi-value>, property-key: string) -> bool\"] = function(arg0, arg1, arg2) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg1;\n    const len0 = arg2;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.reflectDeleteProperty(resources0.get(arg0), result0);\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-get: func(target: handle<js-abi-value>, property-key: string) -> variant { success(handle<js-abi-value>), failure(handle<js-abi-value>) }\"] = function(arg0, arg1, arg2, arg3) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg1;\n    const len0 = arg2;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.reflectGet(resources0.get(arg0), result0);\n    const variant1 = ret0;\n    switch (variant1.tag) {\n      case \"success\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg3 + 0, 0, true);\n        data_view(memory).setInt32(arg3 + 4, resources0.insert(e), true);\n        break;\n      }\n      case \"failure\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg3 + 0, 1, true);\n        data_view(memory).setInt32(arg3 + 4, resources0.insert(e), true);\n        break;\n      }\n      default:\n      throw new RangeError(\"invalid variant specified for JsAbiResult\");\n    }\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-get-own-property-descriptor: func(target: handle<js-abi-value>, property-key: string) -> handle<js-abi-value>\"] = function(arg0, arg1, arg2) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg1;\n    const len0 = arg2;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.reflectGetOwnPropertyDescriptor(resources0.get(arg0), result0);\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-get-prototype-of: func(target: handle<js-abi-value>) -> handle<js-abi-value>\"] = function(arg0) {\n    const ret0 = obj.reflectGetPrototypeOf(resources0.get(arg0));\n    return resources0.insert(ret0);\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-has: func(target: handle<js-abi-value>, property-key: string) -> bool\"] = function(arg0, arg1, arg2) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg1;\n    const len0 = arg2;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.reflectHas(resources0.get(arg0), result0);\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-is-extensible: func(target: handle<js-abi-value>) -> bool\"] = function(arg0) {\n    const ret0 = obj.reflectIsExtensible(resources0.get(arg0));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-own-keys: func(target: handle<js-abi-value>) -> list<handle<js-abi-value>>\"] = function(arg0, arg1) {\n    const memory = get_export(\"memory\");\n    const realloc = get_export(\"cabi_realloc\");\n    const ret0 = obj.reflectOwnKeys(resources0.get(arg0));\n    const vec0 = ret0;\n    const len0 = vec0.length;\n    const result0 = realloc(0, 0, 4, len0 * 4);\n    for (let i = 0; i < vec0.length; i++) {\n      const e = vec0[i];\n      const base = result0 + i * 4;\n      data_view(memory).setInt32(base + 0, resources0.insert(e), true);\n    }\n    data_view(memory).setInt32(arg1 + 4, len0, true);\n    data_view(memory).setInt32(arg1 + 0, result0, true);\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-prevent-extensions: func(target: handle<js-abi-value>) -> bool\"] = function(arg0) {\n    const ret0 = obj.reflectPreventExtensions(resources0.get(arg0));\n    return ret0 ? 1 : 0;\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-set: func(target: handle<js-abi-value>, property-key: string, value: handle<js-abi-value>) -> variant { success(handle<js-abi-value>), failure(handle<js-abi-value>) }\"] = function(arg0, arg1, arg2, arg3, arg4) {\n    const memory = get_export(\"memory\");\n    const ptr0 = arg1;\n    const len0 = arg2;\n    const result0 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr0, len0));\n    const ret0 = obj.reflectSet(resources0.get(arg0), result0, resources0.get(arg3));\n    const variant1 = ret0;\n    switch (variant1.tag) {\n      case \"success\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg4 + 0, 0, true);\n        data_view(memory).setInt32(arg4 + 4, resources0.insert(e), true);\n        break;\n      }\n      case \"failure\": {\n        const e = variant1.val;\n        data_view(memory).setInt8(arg4 + 0, 1, true);\n        data_view(memory).setInt32(arg4 + 4, resources0.insert(e), true);\n        break;\n      }\n      default:\n      throw new RangeError(\"invalid variant specified for JsAbiResult\");\n    }\n  };\n  imports[\"rb-js-abi-host\"][\"reflect-set-prototype-of: func(target: handle<js-abi-value>, prototype: handle<js-abi-value>) -> bool\"] = function(arg0, arg1) {\n    const ret0 = obj.reflectSetPrototypeOf(resources0.get(arg0), resources0.get(arg1));\n    return ret0 ? 1 : 0;\n  };\n  if (!(\"canonical_abi\" in imports)) imports[\"canonical_abi\"] = {};\n  \n  const resources0 = new Slab();\n  imports.canonical_abi[\"resource_drop_js-abi-value\"] = (i) => {\n    const val = resources0.remove(i);\n    if (obj.dropJsAbiValue)\n    obj.dropJsAbiValue(val);\n  };\n}\n\n/**\n * A Ruby VM instance\n *\n * @example\n *\n * const wasi = new WASI();\n * const vm = new RubyVM();\n * const imports = {\n *   wasi_snapshot_preview1: wasi.wasiImport,\n * };\n *\n * vm.addToImports(imports);\n *\n * const instance = await WebAssembly.instantiate(rubyModule, imports);\n * await vm.setInstance(instance);\n * wasi.initialize(instance);\n * vm.initialize();\n *\n */\nclass RubyVM {\n    constructor() {\n        this.instance = null;\n        this.interfaceState = {\n            hasJSFrameAfterRbFrame: false,\n        };\n        // Wrap exported functions from Ruby VM to prohibit nested VM operation\n        // if the call stack has sandwitched JS frames like JS -> Ruby -> JS -> Ruby.\n        const proxyExports = (exports) => {\n            const excludedMethods = [\n                \"addToImports\",\n                \"instantiate\",\n                \"rbSetShouldProhibitRewind\",\n                \"rbGcDisable\",\n                \"rbGcEnable\",\n            ];\n            const excluded = [\"constructor\"].concat(excludedMethods);\n            // wrap all methods in RbAbi.RbAbiGuest class\n            for (const key of Object.getOwnPropertyNames(RbAbiGuest.prototype)) {\n                if (excluded.includes(key)) {\n                    continue;\n                }\n                const value = exports[key];\n                if (typeof value === \"function\") {\n                    exports[key] = (...args) => {\n                        const isNestedVMCall = this.interfaceState.hasJSFrameAfterRbFrame;\n                        if (isNestedVMCall) {\n                            const oldShouldProhibitRewind = this.guest.rbSetShouldProhibitRewind(true);\n                            const oldIsDisabledGc = this.guest.rbGcDisable();\n                            const result = Reflect.apply(value, exports, args);\n                            this.guest.rbSetShouldProhibitRewind(oldShouldProhibitRewind);\n                            if (!oldIsDisabledGc) {\n                                this.guest.rbGcEnable();\n                            }\n                            return result;\n                        }\n                        else {\n                            return Reflect.apply(value, exports, args);\n                        }\n                    };\n                }\n            }\n            return exports;\n        };\n        this.guest = proxyExports(new RbAbiGuest());\n        this.transport = new JsValueTransport();\n        this.exceptionFormatter = new RbExceptionFormatter();\n    }\n    /**\n     * Initialize the Ruby VM with the given command line arguments\n     * @param args The command line arguments to pass to Ruby. Must be\n     * an array of strings starting with the Ruby program name.\n     */\n    initialize(args = [\"ruby.wasm\", \"--disable-gems\", \"-EUTF-8\", \"-e_=0\"]) {\n        const c_args = args.map((arg) => arg + \"\\0\");\n        this.guest.rubyInit();\n        this.guest.rubySysinit(c_args);\n        this.guest.rubyOptions(c_args);\n    }\n    /**\n     * Set a given instance to interact JavaScript and Ruby's\n     * WebAssembly instance. This method must be called before calling\n     * Ruby API.\n     *\n     * @param instance The WebAssembly instance to interact with. Must\n     * be instantiated from a Ruby built with JS extension, and built\n     * with Reactor ABI instead of command line.\n     */\n    async setInstance(instance) {\n        this.instance = instance;\n        await this.guest.instantiate(instance);\n    }\n    /**\n     * Add intrinsic import entries, which is necessary to interact JavaScript\n     * and Ruby's WebAssembly instance.\n     * @param imports The import object to add to the WebAssembly instance\n     */\n    addToImports(imports) {\n        this.guest.addToImports(imports);\n        function wrapTry(f) {\n            return (...args) => {\n                try {\n                    return { tag: \"success\", val: f(...args) };\n                }\n                catch (e) {\n                    if (e instanceof RbFatalError) {\n                        // RbFatalError should not be caught by Ruby because it Ruby VM\n                        // can be already in an inconsistent state.\n                        throw e;\n                    }\n                    return { tag: \"failure\", val: e };\n                }\n            };\n        }\n        imports[\"rb-js-abi-host\"] = {\n            rb_wasm_throw_prohibit_rewind_exception: (messagePtr, messageLen) => {\n                const memory = this.instance.exports.memory;\n                const str = new TextDecoder().decode(new Uint8Array(memory.buffer, messagePtr, messageLen));\n                throw new RbFatalError(\"Ruby APIs that may rewind the VM stack are prohibited under nested VM operation \" +\n                    `(${str})\\n` +\n                    \"Nested VM operation means that the call stack has sandwitched JS frames like JS -> Ruby -> JS -> Ruby \" +\n                    \"caused by something like `window.rubyVM.eval(\\\"JS.global[:rubyVM].eval('Fiber.yield')\\\")`\\n\" +\n                    \"\\n\" +\n                    \"Please check your call stack and make sure that you are **not** doing any of the following inside the nested Ruby frame:\\n\" +\n                    \"  1. Switching fibers (e.g. Fiber#resume, Fiber.yield, and Fiber#transfer)\\n\" +\n                    \"     Note that `evalAsync` JS API switches fibers internally\\n\" +\n                    \"  2. Raising uncaught exceptions\\n\" +\n                    \"     Please catch all exceptions inside the nested operation\\n\" +\n                    \"  3. Calling Continuation APIs\\n\");\n            },\n        };\n        // NOTE: The GC may collect objects that are still referenced by Wasm\n        // locals because Asyncify cannot scan the Wasm stack above the JS frame.\n        // So we need to keep track whether the JS frame is sandwitched by Ruby\n        // frames or not, and prohibit nested VM operation if it is.\n        const proxyImports = (imports) => {\n            for (const [key, value] of Object.entries(imports)) {\n                if (typeof value === \"function\") {\n                    imports[key] = (...args) => {\n                        const oldValue = this.interfaceState.hasJSFrameAfterRbFrame;\n                        this.interfaceState.hasJSFrameAfterRbFrame = true;\n                        const result = Reflect.apply(value, imports, args);\n                        this.interfaceState.hasJSFrameAfterRbFrame = oldValue;\n                        return result;\n                    };\n                }\n            }\n            return imports;\n        };\n        addRbJsAbiHostToImports(imports, proxyImports({\n            evalJs: wrapTry((code) => {\n                return Function(code)();\n            }),\n            isJs: (value) => {\n                // Just for compatibility with the old JS API\n                return true;\n            },\n            globalThis: () => {\n                if (typeof globalThis !== \"undefined\") {\n                    return globalThis;\n                }\n                else if (typeof global !== \"undefined\") {\n                    return global;\n                }\n                else if (typeof window !== \"undefined\") {\n                    return window;\n                }\n                throw new Error(\"unable to locate global object\");\n            },\n            intToJsNumber: (value) => {\n                return value;\n            },\n            floatToJsNumber: (value) => {\n                return value;\n            },\n            stringToJsString: (value) => {\n                return value;\n            },\n            boolToJsBool: (value) => {\n                return value;\n            },\n            procToJsFunction: (rawRbAbiValue) => {\n                const rbValue = this.rbValueOfPointer(rawRbAbiValue);\n                return (...args) => {\n                    rbValue.call(\"call\", ...args.map((arg) => this.wrap(arg)));\n                };\n            },\n            rbObjectToJsRbValue: (rawRbAbiValue) => {\n                return this.rbValueOfPointer(rawRbAbiValue);\n            },\n            jsValueToString: (value) => {\n                // According to the [spec](https://tc39.es/ecma262/multipage/text-processing.html#sec-string-constructor-string-value)\n                // `String(value)` always returns a string.\n                return String(value);\n            },\n            jsValueToInteger(value) {\n                if (typeof value === \"number\") {\n                    return { tag: \"f64\", val: value };\n                }\n                else if (typeof value === \"bigint\") {\n                    return { tag: \"bignum\", val: BigInt(value).toString(10) + \"\\0\" };\n                }\n                else if (typeof value === \"string\") {\n                    return { tag: \"bignum\", val: value + \"\\0\" };\n                }\n                else if (typeof value === \"undefined\") {\n                    return { tag: \"f64\", val: 0 };\n                }\n                else {\n                    return { tag: \"f64\", val: Number(value) };\n                }\n            },\n            exportJsValueToHost: (value) => {\n                // See `JsValueExporter` for the reason why we need to do this\n                this.transport.takeJsValue(value);\n            },\n            importJsValueFromHost: () => {\n                return this.transport.consumeJsValue();\n            },\n            instanceOf: (value, klass) => {\n                if (typeof klass === \"function\") {\n                    return value instanceof klass;\n                }\n                else {\n                    return false;\n                }\n            },\n            jsValueTypeof(value) {\n                return typeof value;\n            },\n            jsValueEqual(lhs, rhs) {\n                return lhs == rhs;\n            },\n            jsValueStrictlyEqual(lhs, rhs) {\n                return lhs === rhs;\n            },\n            reflectApply: wrapTry((target, thisArgument, args) => {\n                return Reflect.apply(target, thisArgument, args);\n            }),\n            reflectConstruct: function (target, args) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectDeleteProperty: function (target, propertyKey) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectGet: wrapTry((target, propertyKey) => {\n                return target[propertyKey];\n            }),\n            reflectGetOwnPropertyDescriptor: function (target, propertyKey) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectGetPrototypeOf: function (target) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectHas: function (target, propertyKey) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectIsExtensible: function (target) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectOwnKeys: function (target) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectPreventExtensions: function (target) {\n                throw new Error(\"Function not implemented.\");\n            },\n            reflectSet: wrapTry((target, propertyKey, value) => {\n                return Reflect.set(target, propertyKey, value);\n            }),\n            reflectSetPrototypeOf: function (target, prototype) {\n                throw new Error(\"Function not implemented.\");\n            },\n        }), (name) => {\n            return this.instance.exports[name];\n        });\n    }\n    /**\n     * Print the Ruby version to stdout\n     */\n    printVersion() {\n        this.guest.rubyShowVersion();\n    }\n    /**\n     * Runs a string of Ruby code from JavaScript\n     * @param code The Ruby code to run\n     * @returns the result of the last expression\n     *\n     * @example\n     * vm.eval(\"puts 'hello world'\");\n     * const result = vm.eval(\"1 + 2\");\n     * console.log(result.toString()); // 3\n     *\n     */\n    eval(code) {\n        return evalRbCode(this, this.privateObject(), code);\n    }\n    /**\n     * Runs a string of Ruby code with top-level `JS::Object#await`\n     * Returns a promise that resolves when execution completes.\n     * @param code The Ruby code to run\n     * @returns a promise that resolves to the result of the last expression\n     *\n     * @example\n     * const text = await vm.evalAsync(`\n     *   require 'js'\n     *   response = JS.global.fetch('https://example.com').await\n     *   response.text.await\n     * `);\n     * console.log(text.toString()); // <html>...</html>\n     */\n    evalAsync(code) {\n        const JS = this.eval(\"require 'js'; JS\");\n        return new Promise((resolve, reject) => {\n            JS.call(\"__eval_async_rb\", this.wrap(code), this.wrap({\n                resolve,\n                reject: (error) => {\n                    reject(new RbError(this.exceptionFormatter.format(error, this, this.privateObject())));\n                },\n            }));\n        });\n    }\n    /**\n     * Wrap a JavaScript value into a Ruby JS::Object\n     * @param value The value to convert to RbValue\n     * @returns the RbValue object representing the given JS value\n     *\n     * @example\n     * const hash = vm.eval(`Hash.new`)\n     * hash.call(\"store\", vm.eval(`\"key1\"`), vm.wrap(new Object()));\n     */\n    wrap(value) {\n        return this.transport.importJsValue(value, this);\n    }\n    privateObject() {\n        return {\n            transport: this.transport,\n            exceptionFormatter: this.exceptionFormatter,\n        };\n    }\n    rbValueOfPointer(pointer) {\n        const abiValue = new RbAbiValue(pointer, this.guest);\n        return new RbValue(abiValue, this, this.privateObject());\n    }\n}\n/**\n * Export a JS value held by the Ruby VM to the JS environment.\n * This is implemented in a dirty way since wit cannot reference resources\n * defined in other interfaces.\n * In our case, we can't express `function(v: rb-abi-value) -> js-abi-value`\n * because `rb-js-abi-host.wit`, that defines `js-abi-value`, is implemented\n * by embedder side (JS) but `rb-abi-guest.wit`, that defines `rb-abi-value`\n * is implemented by guest side (Wasm).\n *\n * This class is a helper to export by:\n * 1. Call `function __export_to_js(v: rb-abi-value)` defined in guest from embedder side.\n * 2. Call `function takeJsValue(v: js-abi-value)` defined in embedder from guest side with\n *    underlying JS value of given `rb-abi-value`.\n * 3. Then `takeJsValue` implementation escapes the given JS value to the `_takenJsValues`\n *    stored in embedder side.\n * 4. Finally, embedder side can take `_takenJsValues`.\n *\n * Note that `exportJsValue` is not reentrant.\n *\n * @private\n */\nclass JsValueTransport {\n    constructor() {\n        this._takenJsValue = null;\n    }\n    takeJsValue(value) {\n        this._takenJsValue = value;\n    }\n    consumeJsValue() {\n        return this._takenJsValue;\n    }\n    exportJsValue(value) {\n        value.call(\"__export_to_js\");\n        return this._takenJsValue;\n    }\n    importJsValue(value, vm) {\n        this._takenJsValue = value;\n        return vm.eval('require \"js\"; JS::Object').call(\"__import_from_js\");\n    }\n}\n/**\n * A RbValue is an object that represents a value in Ruby\n */\nclass RbValue {\n    /**\n     * @hideconstructor\n     */\n    constructor(inner, vm, privateObject) {\n        this.inner = inner;\n        this.vm = vm;\n        this.privateObject = privateObject;\n    }\n    /**\n     * Call a given method with given arguments\n     *\n     * @param callee name of the Ruby method to call\n     * @param args arguments to pass to the method. Must be an array of RbValue\n     *\n     * @example\n     * const ary = vm.eval(\"[1, 2, 3]\");\n     * ary.call(\"push\", 4);\n     * console.log(ary.call(\"sample\").toString());\n     *\n     */\n    call(callee, ...args) {\n        const innerArgs = args.map((arg) => arg.inner);\n        return new RbValue(callRbMethod(this.vm, this.privateObject, this.inner, callee, innerArgs), this.vm, this.privateObject);\n    }\n    /**\n     * @see {@link https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive}\n     * @param hint Preferred type of the result primitive value. `\"number\"`, `\"string\"`, or `\"default\"`.\n     */\n    [Symbol.toPrimitive](hint) {\n        if (hint === \"string\" || hint === \"default\") {\n            return this.toString();\n        }\n        else if (hint === \"number\") {\n            return null;\n        }\n        return null;\n    }\n    /**\n     * Returns a string representation of the value by calling `to_s`\n     */\n    toString() {\n        const rbString = callRbMethod(this.vm, this.privateObject, this.inner, \"to_s\", []);\n        return this.vm.guest.rstringPtr(rbString);\n    }\n    /**\n     * Returns a JavaScript object representation of the value\n     * by calling `to_js`.\n     *\n     * Returns null if the value is not convertible to a JavaScript object.\n     */\n    toJS() {\n        const JS = this.vm.eval(\"JS\");\n        const jsValue = JS.call(\"try_convert\", this);\n        if (jsValue.call(\"nil?\").toString() === \"true\") {\n            return null;\n        }\n        return this.privateObject.transport.exportJsValue(jsValue);\n    }\n}\nvar ruby_tag_type;\n(function (ruby_tag_type) {\n    ruby_tag_type[ruby_tag_type[\"None\"] = 0] = \"None\";\n    ruby_tag_type[ruby_tag_type[\"Return\"] = 1] = \"Return\";\n    ruby_tag_type[ruby_tag_type[\"Break\"] = 2] = \"Break\";\n    ruby_tag_type[ruby_tag_type[\"Next\"] = 3] = \"Next\";\n    ruby_tag_type[ruby_tag_type[\"Retry\"] = 4] = \"Retry\";\n    ruby_tag_type[ruby_tag_type[\"Redo\"] = 5] = \"Redo\";\n    ruby_tag_type[ruby_tag_type[\"Raise\"] = 6] = \"Raise\";\n    ruby_tag_type[ruby_tag_type[\"Throw\"] = 7] = \"Throw\";\n    ruby_tag_type[ruby_tag_type[\"Fatal\"] = 8] = \"Fatal\";\n    ruby_tag_type[ruby_tag_type[\"Mask\"] = 15] = \"Mask\";\n})(ruby_tag_type || (ruby_tag_type = {}));\nclass RbExceptionFormatter {\n    constructor() {\n        this.literalsCache = null;\n    }\n    format(error, vm, privateObject) {\n        const [zeroLiteral, oneLiteral, newLineLiteral] = (() => {\n            if (this.literalsCache == null) {\n                const zeroOneNewLine = [\n                    evalRbCode(vm, privateObject, \"0\"),\n                    evalRbCode(vm, privateObject, \"1\"),\n                    evalRbCode(vm, privateObject, `\"\\n\"`),\n                ];\n                this.literalsCache = zeroOneNewLine;\n                return zeroOneNewLine;\n            }\n            else {\n                return this.literalsCache;\n            }\n        })();\n        const backtrace = error.call(\"backtrace\");\n        if (backtrace.call(\"nil?\").toString() === \"true\") {\n            return this.formatString(error.call(\"class\").toString(), error.toString());\n        }\n        const firstLine = backtrace.call(\"at\", zeroLiteral);\n        const restLines = backtrace\n            .call(\"drop\", oneLiteral)\n            .call(\"join\", newLineLiteral);\n        return this.formatString(error.call(\"class\").toString(), error.toString(), [\n            firstLine.toString(),\n            restLines.toString(),\n        ]);\n    }\n    formatString(klass, message, backtrace) {\n        if (backtrace) {\n            return `${backtrace[0]}: ${message} (${klass})\\n${backtrace[1]}`;\n        }\n        else {\n            return `${klass}: ${message}`;\n        }\n    }\n}\nconst checkStatusTag = (rawTag, vm, privateObject) => {\n    switch (rawTag & ruby_tag_type.Mask) {\n        case ruby_tag_type.None:\n            break;\n        case ruby_tag_type.Return:\n            throw new RbError(\"unexpected return\");\n        case ruby_tag_type.Next:\n            throw new RbError(\"unexpected next\");\n        case ruby_tag_type.Break:\n            throw new RbError(\"unexpected break\");\n        case ruby_tag_type.Redo:\n            throw new RbError(\"unexpected redo\");\n        case ruby_tag_type.Retry:\n            throw new RbError(\"retry outside of rescue clause\");\n        case ruby_tag_type.Throw:\n            throw new RbError(\"unexpected throw\");\n        case ruby_tag_type.Raise:\n        case ruby_tag_type.Fatal:\n            const error = new RbValue(vm.guest.rbErrinfo(), vm, privateObject);\n            if (error.call(\"nil?\").toString() === \"true\") {\n                throw new RbError(\"no exception object\");\n            }\n            // clear errinfo if got exception due to no rb_jump_tag\n            vm.guest.rbClearErrinfo();\n            throw new RbError(privateObject.exceptionFormatter.format(error, vm, privateObject));\n        default:\n            throw new RbError(`unknown error tag: ${rawTag}`);\n    }\n};\nfunction wrapRbOperation(vm, body) {\n    try {\n        return body();\n    }\n    catch (e) {\n        if (e instanceof RbError) {\n            throw e;\n        }\n        // All JS exceptions triggered by Ruby code are translated to Ruby exceptions,\n        // so non-RbError exceptions are unexpected.\n        vm.guest.rbVmBugreport();\n        if (e instanceof WebAssembly.RuntimeError && e.message === \"unreachable\") {\n            const error = new RbError(`Something went wrong in Ruby VM: ${e}`);\n            error.stack = e.stack;\n            throw error;\n        }\n        else {\n            throw e;\n        }\n    }\n}\nconst callRbMethod = (vm, privateObject, recv, callee, args) => {\n    const mid = vm.guest.rbIntern(callee + \"\\0\");\n    return wrapRbOperation(vm, () => {\n        const [value, status] = vm.guest.rbFuncallvProtect(recv, mid, args);\n        checkStatusTag(status, vm, privateObject);\n        return value;\n    });\n};\nconst evalRbCode = (vm, privateObject, code) => {\n    return wrapRbOperation(vm, () => {\n        const [value, status] = vm.guest.rbEvalStringProtect(code + \"\\0\");\n        checkStatusTag(status, vm, privateObject);\n        return new RbValue(value, vm, privateObject);\n    });\n};\n/**\n * Error class thrown by Ruby execution\n */\nclass RbError extends Error {\n    /**\n     * @hideconstructor\n     */\n    constructor(message) {\n        super(message);\n    }\n}\n/**\n * Error class thrown by Ruby execution when it is not possible to recover.\n * This is usually caused when Ruby VM is in an inconsistent state.\n */\nclass RbFatalError extends RbError {\n    /**\n     * @hideconstructor\n     */\n    constructor(message) {\n        super(\"Ruby Fatal Error: \" + message);\n    }\n}\n\nexports.RbError = RbError;\nexports.RbFatalError = RbFatalError;\nexports.RbValue = RbValue;\nexports.RubyVM = RubyVM;\n"]}